diff --git a/main.py b/main.py index 9ec1687..c56dc04 100644 --- a/main.py +++ b/main.py @@ -43,7 +43,7 @@ try: UsageFactory(usage_format, city).enrich() print('enrich usage... done') for building in city.buildings: - building.energy_systems_archetype_name = 'system 1 gas' + building.energy_systems_archetype_name = 'system 1 gas pv' EnergySystemsFactory(energy_systems_format, city).enrich() print('enrich systems... done') diff --git a/results.py b/results.py index 960634e..d4b65b2 100644 --- a/results.py +++ b/results.py @@ -57,12 +57,64 @@ class Results: heating_peak_load_results = building.heating_peak_load[cte.MONTH] else: heating_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} heating peak load W']) - if cte.MONTH in building.cooling_peak_load.keys(): cooling_peak_load_results = building.cooling_peak_load[cte.MONTH] else: cooling_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} cooling peak load W']) + if cte.MONTH in building.onsite_electrical_production.keys(): + monthly_onsite_electrical_production = building.onsite_electrical_production[cte.MONTH] + onsite_electrical_production = pd.DataFrame(monthly_onsite_electrical_production, + columns=[f'{building.name} onsite electrical production Wh']) + else: + onsite_electrical_production = pd.DataFrame(array, columns=[f'{building.name} onsite electrical production Wh']) + + heating = 0 + cooling = 0 + for system in building.energy_systems: + for demand_type in system.demand_types: + if demand_type == cte.HEATING: + heating = 1 + if demand_type == cte.COOLING: + cooling = 1 + if cte.MONTH in building.heating_peak_load.keys() and cte.MONTH in building.cooling_peak_load.keys(): + peak_lighting = 0 + peak_appliances = 0 + for thermal_zone in building.internal_zones[0].thermal_zones: + lighting = thermal_zone.lighting + for schedule in lighting.schedules: + for value in schedule.values: + if value * lighting.density * thermal_zone.total_floor_area > peak_lighting: + peak_lighting = value * lighting.density * thermal_zone.total_floor_area + appliances = thermal_zone.appliances + for schedule in appliances.schedules: + for value in schedule.values: + if value * appliances.density * thermal_zone.total_floor_area > peak_appliances: + peak_appliances = value * appliances.density * thermal_zone.total_floor_area + + monthly_electricity_peak = [0.9 * peak_lighting + 0.7 * peak_appliances]*12 + conditioning_peak = [] + for i, value in enumerate(building.heating_peak_load[cte.MONTH]['heating peak loads']): + if cooling * building.cooling_peak_load[cte.MONTH]['cooling peak loads'][i] > heating * value: + conditioning_peak.append(cooling * building.cooling_peak_load[cte.MONTH]['cooling peak loads'][i]) + else: + conditioning_peak.append(heating * value) + monthly_electricity_peak[i] += 0.8 * conditioning_peak[i] + + electricity_peak_load_results = pd.DataFrame(monthly_electricity_peak + , columns=[f'{building.name} electricity peak load W']) + else: + electricity_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} electricity peak load W']) + + if cte.MONTH in building.distribution_systems_electrical_consumption.keys(): + extra_electrical_consumption = pd.DataFrame(building.distribution_systems_electrical_consumption[cte.MONTH], + columns=[ + f'{building.name} electrical consumption for distribution Wh']) + else: + extra_electrical_consumption = pd.DataFrame(array, + columns=[ + f'{building.name} electrical consumption for distribution Wh']) + if print_results is None: print_results = heating_results else: @@ -76,7 +128,10 @@ class Results: cooling_consumption_results, dhw_consumption_results, heating_peak_load_results, - cooling_peak_load_results], axis='columns') + cooling_peak_load_results, + electricity_peak_load_results, + onsite_electrical_production, + extra_electrical_consumption], axis='columns') file += '\n' file += f'name: {building.name}\n' file += f'year of construction: {building.year_of_construction}\n'