From c35c020a81e406c3f6940d572fe984b4b2ce823d Mon Sep 17 00:00:00 2001 From: Guille Date: Fri, 17 May 2024 05:42:19 +0200 Subject: [PATCH] add new fields to results in meb and retrofit --- workflows/meb/module/module.js | 7 ++++--- workflows/retrofit/module/module.js | 16 ++++++++-------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/workflows/meb/module/module.js b/workflows/meb/module/module.js index a5dec0d..be74328 100644 --- a/workflows/meb/module/module.js +++ b/workflows/meb/module/module.js @@ -49,7 +49,7 @@ exports.run = async (application, param, tmp_path) => { var error = '' if (response.status == 200) { results = await response.json() - var meb_header = "BUILDING NAME" + var meb_header = "BUILDING NAME;TOTAL HEATING AREA;YEAR_OF_CONSTRUCTION;FUNCTION" meb_header = `${meb_header};YEARLY COOLING DEMAND;YEARLY HEATING DEMAND;MONTHLY COOLING DEMAND(JAN);MONTHLY COOLING DEMAND(FEB);MONTHLY COOLING DEMAND(MAR);MONTHLY COOLING DEMAND(APR);MONTHLY COOLING DEMAND(MAY);MONTHLY COOLING DEMAND(JUN);MONTHLY COOLING DEMAND(JUL);MONTHLY COOLING DEMAND(AUG);MONTHLY COOLING DEMAND(SEPT);MONTHLY COOLING DEMAND(OCT);MONTHLY COOLING DEMAND(NOV);MONTHLY COOLING DEMAND(DEC);MONTHLY HEATING DEMAND(JAN);MONTHLY HEATING DEMAND(FEB);MONTHLY HEATING DEMAND(MAR);MONTHLY HEATING DEMAND(APR);MONTHLY HEATING DEMAND(MAY);MONTHLY HEATING DEMAND(JUN);MONTHLY HEATING DEMAND(JUL);MONTHLY HEATING DEMAND(AUG);MONTHLY HEATING DEMAND(SEPT);MONTHLY HEATING DEMAND(OCT);MONTHLY HEATING DEMAND(NOV);MONTHLY HEATING DEMAND(DEC)` meb_header = `${meb_header};YEARLY COOLING PEAK LOAD;YEARLY HEATING PEAK LOAD;MONTHLY COOLING PEAK LOAD (JAN);MONTHLY COOLING PEAK LOAD (FEB);MONTHLY COOLING PEAK LOAD (MAR);MONTHLY COOLING PEAK LOAD (APR);MONTHLY COOLING PEAK LOAD (MAY);MONTHLY COOLING PEAK LOAD (JUN);MONTHLY COOLING PEAK LOAD (JUL);MONTHLY COOLING PEAK LOAD (AUG);MONTHLY COOLING PEAK LOAD (SEPT);MONTHLY COOLING PEAK LOAD (OCT);MONTHLY COOLING PEAK LOAD (NOV);MONTHLY COOLING PEAK LOAD (DEC);MONTHLY HEATING PEAK LOAD (JAN);MONTHLY HEATING PEAK LOAD (FEB);MONTHLY HEATING PEAK LOAD (MAR);MONTHLY HEATING PEAK LOAD (APR);MONTHLY HEATING PEAK LOAD (MAY);MONTHLY HEATING PEAK LOAD (JUN);MONTHLY HEATING PEAK LOAD (JUL);MONTHLY HEATING PEAK LOAD (AUG);MONTHLY HEATING PEAK LOAD (SEPT);MONTHLY HEATING PEAK LOAD (OCT);MONTHLY HEATING PEAK LOAD (NOV);MONTHLY HEATING PEAK LOAD (DEC)` meb_header = `${meb_header};YEARLY LIGHTING PEAK LOAD;MONTHLY LIGHTING PEAK LOAD(JAN);MONTHLY LIGHTING PEAK LOAD(FEB);MONTHLY LIGHTING PEAK LOAD(MAR);MONTHLY LIGHTING PEAK LOAD(APR);MONTHLY LIGHTING PEAK LOAD(MAY);MONTHLY LIGHTING PEAK LOAD(JUN);MONTHLY LIGHTING PEAK LOAD(JUL);MONTHLY LIGHTING PEAK LOAD(AUG);MONTHLY LIGHTING PEAK LOAD(SEPT);MONTHLY LIGHTING PEAK LOAD(OCT);MONTHLY LIGHTING PEAK LOAD(NOV);MONTHLY LIGHTING PEAK LOAD(DEC)` @@ -63,6 +63,7 @@ exports.run = async (application, param, tmp_path) => { console.log(building) let meb = `${building}` let values = results.results[building] + meb = `${meb};${values.total_heating_area};${values.year_of_construction};${values.function}` values.yearly_cooling_demand.forEach(element => meb = `${meb};${element}`) values.yearly_heating_demand.forEach(element => meb = `${meb};${element}`) values.monthly_cooling_demand.forEach(element => meb = `${meb};${element}`) @@ -85,11 +86,11 @@ exports.run = async (application, param, tmp_path) => { meb_lines.push(meb) } require("fs").writeFile( - `${tmp_path}/meb.csv`, + `${tmp_path}/insel_meb.csv`, `${meb_header}\n${meb_lines.join('\n')}`, function (err) { console.log(err ? err : 'meb saved') } ) - BrowserWindow.fromId(1).webContents.send('task-completed', `meb`) + BrowserWindow.fromId(1).webContents.send('task-completed', `meb`) return } else if (response.status == 400) { diff --git a/workflows/retrofit/module/module.js b/workflows/retrofit/module/module.js index be8e0b4..74dc3f2 100644 --- a/workflows/retrofit/module/module.js +++ b/workflows/retrofit/module/module.js @@ -46,7 +46,7 @@ exports.run = async (application, param, tmp_path) => { if (response.status == 200) { results = await response.json() - var meb_header = "SCENARIO;BUILDING NAME;TOTAL HEATING AREA" + var meb_header = "SCENARIO;BUILDING NAME;TOTAL HEATING AREA;YEAR_OF_CONSTRUCTION;FUNTION" meb_header = `${meb_header};YEARLY COOLING DEMAND;YEARLY HEATING DEMAND;MONTHLY COOLING DEMAND(JAN);MONTHLY COOLING DEMAND(FEB);MONTHLY COOLING DEMAND(MAR);MONTHLY COOLING DEMAND(APR);MONTHLY COOLING DEMAND(MAY);MONTHLY COOLING DEMAND(JUN);MONTHLY COOLING DEMAND(JUL);MONTHLY COOLING DEMAND(AUG);MONTHLY COOLING DEMAND(SEPT);MONTHLY COOLING DEMAND(OCT);MONTHLY COOLING DEMAND(NOV);MONTHLY COOLING DEMAND(DEC);MONTHLY HEATING DEMAND(JAN);MONTHLY HEATING DEMAND(FEB);MONTHLY HEATING DEMAND(MAR);MONTHLY HEATING DEMAND(APR);MONTHLY HEATING DEMAND(MAY);MONTHLY HEATING DEMAND(JUN);MONTHLY HEATING DEMAND(JUL);MONTHLY HEATING DEMAND(AUG);MONTHLY HEATING DEMAND(SEPT);MONTHLY HEATING DEMAND(OCT);MONTHLY HEATING DEMAND(NOV);MONTHLY HEATING DEMAND(DEC)` meb_header = `${meb_header};YEARLY COOLING PEAK LOAD;YEARLY HEATING PEAK LOAD;MONTHLY COOLING PEAK LOAD (JAN);MONTHLY COOLING PEAK LOAD (FEB);MONTHLY COOLING PEAK LOAD (MAR);MONTHLY COOLING PEAK LOAD (APR);MONTHLY COOLING PEAK LOAD (MAY);MONTHLY COOLING PEAK LOAD (JUN);MONTHLY COOLING PEAK LOAD (JUL);MONTHLY COOLING PEAK LOAD (AUG);MONTHLY COOLING PEAK LOAD (SEPT);MONTHLY COOLING PEAK LOAD (OCT);MONTHLY COOLING PEAK LOAD (NOV);MONTHLY COOLING PEAK LOAD (DEC);MONTHLY HEATING PEAK LOAD (JAN);MONTHLY HEATING PEAK LOAD (FEB);MONTHLY HEATING PEAK LOAD (MAR);MONTHLY HEATING PEAK LOAD (APR);MONTHLY HEATING PEAK LOAD (MAY);MONTHLY HEATING PEAK LOAD (JUN);MONTHLY HEATING PEAK LOAD (JUL);MONTHLY HEATING PEAK LOAD (AUG);MONTHLY HEATING PEAK LOAD (SEPT);MONTHLY HEATING PEAK LOAD (OCT);MONTHLY HEATING PEAK LOAD (NOV);MONTHLY HEATING PEAK LOAD (DEC)` meb_header = `${meb_header};YEARLY LIGHTING PEAK LOAD;MONTHLY LIGHTING PEAK LOAD(JAN);MONTHLY LIGHTING PEAK LOAD(FEB);MONTHLY LIGHTING PEAK LOAD(MAR);MONTHLY LIGHTING PEAK LOAD(APR);MONTHLY LIGHTING PEAK LOAD(MAY);MONTHLY LIGHTING PEAK LOAD(JUN);MONTHLY LIGHTING PEAK LOAD(JUL);MONTHLY LIGHTING PEAK LOAD(AUG);MONTHLY LIGHTING PEAK LOAD(SEPT);MONTHLY LIGHTING PEAK LOAD(OCT);MONTHLY LIGHTING PEAK LOAD(NOV);MONTHLY LIGHTING PEAK LOAD(DEC)` @@ -58,7 +58,7 @@ exports.run = async (application, param, tmp_path) => { meb_header = `${meb_header};YEARLY DOMESTIC HOT WATER CONSUMPTION;YEARLY DOMESTIC HOT WATER HEAT DEMAND;MONTHLY DOMESTIC HOT WATER CONSUMPTION(JAN);MONTHLY DOMESTIC HOT WATER CONSUMPTION(FEB);MONTHLY DOMESTIC HOT WATER CONSUMPTION(MAR);MONTHLY DOMESTIC HOT WATER CONSUMPTION(APR);MONTHLY DOMESTIC HOT WATER CONSUMPTION(MAY);MONTHLY DOMESTIC HOT WATER CONSUMPTION(JUN);MONTHLY DOMESTIC HOT WATER CONSUMPTION(JUL);MONTHLY DOMESTIC HOT WATER CONSUMPTION(AUG);MONTHLY DOMESTIC HOT WATER CONSUMPTION(SEPT);MONTHLY DOMESTIC HOT WATER CONSUMPTION(OCT);MONTHLY DOMESTIC HOT WATER CONSUMPTION(NOV);MONTHLY DOMESTIC HOT WATER CONSUMPTION(DEC);MONTHLY DOMESTIC HOT WATER HEAT DEMAND(JAN);MONTHLY DOMESTIC HOT WATER HEAT DEMAND(FEB);MONTHLY DOMESTIC HOT WATER HEAT DEMAND(MAR);MONTHLY DOMESTIC HOT WATER HEAT DEMAND(APR);MONTHLY DOMESTIC HOT WATER HEAT DEMAND(MAY);MONTHLY DOMESTIC HOT WATER HEAT DEMAND(JUN);MONTHLY DOMESTIC HOT WATER HEAT DEMAND(JUL);MONTHLY DOMESTIC HOT WATER HEAT DEMAND(AUG);MONTHLY DOMESTIC HOT WATER HEAT DEMAND(SEPT);MONTHLY DOMESTIC HOT WATER HEAT DEMAND(OCT);MONTHLY DOMESTIC HOT WATER HEAT DEMAND(NOV);MONTHLY DOMESTIC HOT WATER HEAT DEMAND(DEC)` meb_header = `${meb_header};YEARLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION;MONTHLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION(JAN);MONTHLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION(FEB);MONTHLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION(MAR);MONTHLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION(APR);MONTHLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION(MAY);MONTHLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION(JUN);MONTHLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION(JUL);MONTHLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION(AUG);MONTHLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION(SEPT);MONTHLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION(OCT);MONTHLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION(NOV);MONTHLY DISTRIBUTION SYSTEMS ELECTRICAL CONSUMPTION(DEC)` - var costs_header = "SCENARIO;BUILDING NAME;TOTAL HEATING AREA" + var costs_header = "SCENARIO;BUILDING NAME;TOTAL HEATING AREA;YEAR_OF_CONSTRUCTION;FUNTION" costs_header = `${costs_header};TOTAL CAPITAL COSTS SKIN;TOTAL CAPITAL COSTS SYSTEMS;END OF LIFE COSTS;TOTAL OPERATIONAL COSTS;TOTAL MAINTENANCE COSTS;OPERATIONAL INCOMES` costs_header = `${costs_header};B2010 OPAQUE WALLS(1);B2010 OPAQUE WALLS(2);B2010 OPAQUE WALLS(3);B2010 OPAQUE WALLS(4);B2010 OPAQUE WALLS(5);B2010 OPAQUE WALLS(6);B2010 OPAQUE WALLS(7);B2010 OPAQUE WALLS(8);B2010 OPAQUE WALLS(9);B2010 OPAQUE WALLS(10);B2010 OPAQUE WALLS(11);B2010 OPAQUE WALLS(12);B2010 OPAQUE WALLS(13);B2010 OPAQUE WALLS(14);B2010 OPAQUE WALLS(15);B2010 OPAQUE WALLS(16);B2010 OPAQUE WALLS(17);B2010 OPAQUE WALLS(18);B2010 OPAQUE WALLS(19);B2010 OPAQUE WALLS(20);B2010 OPAQUE WALLS(21);B2010 OPAQUE WALLS(22);B2010 OPAQUE WALLS(23);B2010 OPAQUE WALLS(24);B2010 OPAQUE WALLS(25);B2010 OPAQUE WALLS(26);B2010 OPAQUE WALLS(27);B2010 OPAQUE WALLS(28);B2010 OPAQUE WALLS(29);B2010 OPAQUE WALLS(30);B2010 OPAQUE WALLS(31)` costs_header = `${costs_header};B2020 TRANSPARENT(1);B2020 TRANSPARENT(2);B2020 TRANSPARENT(3);B2020 TRANSPARENT(4);B2020 TRANSPARENT(5);B2020 TRANSPARENT(6);B2020 TRANSPARENT(7);B2020 TRANSPARENT(8);B2020 TRANSPARENT(9);B2020 TRANSPARENT(10);B2020 TRANSPARENT(11);B2020 TRANSPARENT(12);B2020 TRANSPARENT(13);B2020 TRANSPARENT(14);B2020 TRANSPARENT(15);B2020 TRANSPARENT(16);B2020 TRANSPARENT(17);B2020 TRANSPARENT(18);B2020 TRANSPARENT(19);B2020 TRANSPARENT(20);B2020 TRANSPARENT(21);B2020 TRANSPARENT(22);B2020 TRANSPARENT(23);B2020 TRANSPARENT(24);B2020 TRANSPARENT(25);B2020 TRANSPARENT(26);B2020 TRANSPARENT(27);B2020 TRANSPARENT(28);B2020 TRANSPARENT(29);B2020 TRANSPARENT(30);B2020 TRANSPARENT(31)` @@ -83,7 +83,7 @@ exports.run = async (application, param, tmp_path) => { costs_header = `${costs_header};SUBSIDIES HVAC(1);SUBSIDIES HVAC(2);SUBSIDIES HVAC(3);SUBSIDIES HVAC(4);SUBSIDIES HVAC(5);SUBSIDIES HVAC(6);SUBSIDIES HVAC(7);SUBSIDIES HVAC(8);SUBSIDIES HVAC(9);SUBSIDIES HVAC(10);SUBSIDIES HVAC(11);SUBSIDIES HVAC(12);SUBSIDIES HVAC(13);SUBSIDIES HVAC(14);SUBSIDIES HVAC(15);SUBSIDIES HVAC(16);SUBSIDIES HVAC(17);SUBSIDIES HVAC(18);SUBSIDIES HVAC(19);SUBSIDIES HVAC(20);SUBSIDIES HVAC(21);SUBSIDIES HVAC(22);SUBSIDIES HVAC(23);SUBSIDIES HVAC(24);SUBSIDIES HVAC(25);SUBSIDIES HVAC(26);SUBSIDIES HVAC(27);SUBSIDIES HVAC(28);SUBSIDIES HVAC(29);SUBSIDIES HVAC(30);SUBSIDIES HVAC(31)` costs_header = `${costs_header};SUBSIDIES PV(1);SUBSIDIES PV(2);SUBSIDIES PV(3);SUBSIDIES PV(4);SUBSIDIES PV(5);SUBSIDIES PV(6);SUBSIDIES PV(7);SUBSIDIES PV(8);SUBSIDIES PV(9);SUBSIDIES PV(10);SUBSIDIES PV(11);SUBSIDIES PV(12);SUBSIDIES PV(13);SUBSIDIES PV(14);SUBSIDIES PV(15);SUBSIDIES PV(16);SUBSIDIES PV(17);SUBSIDIES PV(18);SUBSIDIES PV(19);SUBSIDIES PV(20);SUBSIDIES PV(21);SUBSIDIES PV(22);SUBSIDIES PV(23);SUBSIDIES PV(24);SUBSIDIES PV(25);SUBSIDIES PV(26);SUBSIDIES PV(27);SUBSIDIES PV(28);SUBSIDIES PV(29);SUBSIDIES PV(30);SUBSIDIES PV(31)` - var operational_co2_header = "SCENARIO;BUILDING NAME;TOTAL HEATING AREA" + var operational_co2_header = "SCENARIO;BUILDING NAME;TOTAL HEATING AREA;YEAR_OF_CONSTRUCTION;FUNTION" operational_co2_header = `${operational_co2_header};HEATING YEAR;HEATING MONTH(JAN);HEATING MONTH(FEB);HEATING MONTH(MAR);HEATING MONTH(APR);HEATING MONTH(MAY);HEATING MONTH(JUN);HEATING MONTH(JUL);HEATING MONTH(AUG);HEATING MONTH(SEPT);HEATING MONTH(OCT);HEATING MONTH(NOV);HEATING MONTH(DEC)` operational_co2_header = `${operational_co2_header};DOMESTIC HOT WATER YEAR;DOMESTIC HOT WATER MONTH(JAN);DOMESTIC HOT WATER MONTH(FEB);DOMESTIC HOT WATER MONTH(MAR);DOMESTIC HOT WATER MONTH(APR);DOMESTIC HOT WATER MONTH(MAY);DOMESTIC HOT WATER MONTH(JUN);DOMESTIC HOT WATER MONTH(JUL);DOMESTIC HOT WATER MONTH(AUG);DOMESTIC HOT WATER MONTH(SEPT);DOMESTIC HOT WATER MONTH(OCT);DOMESTIC HOT WATER MONTH(NOV);DOMESTIC HOT WATER MONTH(DEC)` operational_co2_header = `${operational_co2_header};COOLING YEAR;COOLING MONTH(JAN);COOLING MONTH(FEB);COOLING MONTH(MAR);COOLING MONTH(APR);COOLING MONTH(MAY);COOLING MONTH(JUN);COOLING MONTH(JUL);COOLING MONTH(AUG);COOLING MONTH(SEPT);COOLING MONTH(OCT);COOLING MONTH(NOV);COOLING MONTH(DEC)` @@ -98,7 +98,7 @@ exports.run = async (application, param, tmp_path) => { for (var scenario in results.results) { var value = results.results[scenario]; value.forEach(building_info => { - const base_line = `"${scenario}";"${building_info.building}";${building_info.total_heating_area}` + const base_line = `"${scenario}";"${building_info.building}";${building_info.total_heating_area};${building_info.year_of_construction};${building_info.function}` let meb = `${base_line}` building_info['insel meb'].yearly_cooling_demand.forEach(element => meb = `${meb};${element}`) building_info['insel meb'].yearly_heating_demand.forEach(element => meb = `${meb};${element}`) @@ -172,21 +172,21 @@ exports.run = async (application, param, tmp_path) => { }) } require("fs").writeFile( - `${tmp_path}/meb.csv`, + `${tmp_path}/retrofit_meb.csv`, `${meb_header}\n${meb_lines.join('\n')}`, function (err) { console.log(err ? err : 'meb saved') } ) require("fs").writeFile( - `${tmp_path}/cost.csv`, + `${tmp_path}/retrofit_cost.csv`, `${costs_header}\n${cost_lines.join('\n')}`, function (err) { console.log(err ? err : 'cost saved') } ) require("fs").writeFile( - `${tmp_path}/operational_co2.csv`, + `${tmp_path}/retrofit_operational_co2.csv`, `${operational_co2_header}\n${operational_co2_lines.join('\n')}`, function (err) { console.log(err ? err : 'operational_co2 saved') } ) - BrowserWindow.fromId(1).webContents.send('task-completed', `meb
costs
operational_co2`) + BrowserWindow.fromId(1).webContents.send('task-completed', `meb
costs
operational_co2`) } else { console.log('unautorized retrofit')