Cost now returns all the needed outputs and a small performance improvement done.

This commit is contained in:
Guille Gutierrez 2023-07-24 11:46:59 -04:00
parent 1052478ace
commit 8cb2ad265d
3 changed files with 31 additions and 16 deletions

View File

@ -136,15 +136,29 @@ class Cost:
life_cycle_operational_costs, life_cycle_operational_costs,
life_cycle_maintenance_costs, life_cycle_maintenance_costs,
life_cycle_operational_incomes, life_cycle_operational_incomes,
life_cycle_capital_incomes life_cycle_capital_incomes,
global_capital_costs,
global_capital_incomes,
global_end_of_life_costs,
global_operational_costs,
global_maintenance_costs,
global_operational_incomes
] ]
results.index = ['total_capital_costs_skin', results.index = [
'total_capital_costs_systems', 'total_capital_costs_skin',
'end_of_life_costs', 'total_capital_costs_systems',
'total_operational_costs', 'end_of_life_costs',
'total_maintenance_costs', 'total_operational_costs',
'operational_incomes', 'total_maintenance_costs',
'capital_incomes'] 'operational_incomes',
'capital_incomes',
'global_capital_costs',
'global_capital_incomes',
'global_end_of_life_costs',
'global_operational_costs',
'global_maintenance_costs',
'global_operational_incomes'
]
return results return results

View File

@ -39,15 +39,14 @@ class PeakLoad:
for thermal_zone in self._building.internal_zones[0].thermal_zones: for thermal_zone in self._building.internal_zones[0].thermal_zones:
lighting = thermal_zone.lighting lighting = thermal_zone.lighting
for schedule in lighting.schedules: for schedule in lighting.schedules:
for value in schedule.values: peak = max(schedule.values) * lighting.density * thermal_zone.total_floor_area
if value * lighting.density * thermal_zone.total_floor_area > peak_lighting: if peak > peak_lighting:
peak_lighting = value * lighting.density * thermal_zone.total_floor_area peak_lighting = peak
appliances = thermal_zone.appliances appliances = thermal_zone.appliances
for schedule in appliances.schedules: for schedule in appliances.schedules:
for value in schedule.values: peak = max(schedule.values) * appliances.density * thermal_zone.total_floor_area
if value * appliances.density * thermal_zone.total_floor_area > peak_appliances: if peak > peak_appliances:
peak_appliances = value * appliances.density * thermal_zone.total_floor_area peak_appliances = peak
monthly_electricity_peak = [0.9 * peak_lighting + 0.7 * peak_appliances] * 12 monthly_electricity_peak = [0.9 * peak_lighting + 0.7 * peak_appliances] * 12
conditioning_peak = [] conditioning_peak = []
for i, value in enumerate(self._building.heating_peak_load[cte.MONTH]): for i, value in enumerate(self._building.heating_peak_load[cte.MONTH]):

View File

@ -1,3 +1,4 @@
import datetime
import glob import glob
import os import os
import subprocess import subprocess
@ -25,6 +26,7 @@ class Initialize:
@property @property
def city(self): def city(self):
if self._city is None: if self._city is None:
start = datetime.datetime.now()
print('init tests') print('init tests')
city_file = (Path(__file__).parent / 'data/test.geojson').resolve() city_file = (Path(__file__).parent / 'data/test.geojson').resolve()
output_path = (Path(__file__).parent / 'output').resolve() output_path = (Path(__file__).parent / 'output').resolve()
@ -50,7 +52,7 @@ class Initialize:
subprocess.run(['insel', str(insel_file)], stdout=subprocess.DEVNULL) subprocess.run(['insel', str(insel_file)], stdout=subprocess.DEVNULL)
ResultFactory('insel_monthly_energy_balance', city, output_path).enrich() ResultFactory('insel_monthly_energy_balance', city, output_path).enrich()
self._city = city self._city = city
print('init completed') print(f'init completed {datetime.datetime.now() - start}')
return self._city return self._city