added distribution_systems_electrical_consumption

This commit is contained in:
Pilar Monsalvete 2023-05-19 15:04:02 -04:00
parent bb279c39eb
commit 635c0162dc

View File

@ -51,6 +51,7 @@ class Building(CityObject):
self._heating_consumption = dict() self._heating_consumption = dict()
self._cooling_consumption = dict() self._cooling_consumption = dict()
self._domestic_hot_water_consumption = dict() self._domestic_hot_water_consumption = dict()
self._distribution_systems_electrical_consumption = dict()
self._onsite_electrical_production = dict() self._onsite_electrical_production = dict()
self._eave_height = None self._eave_height = None
self._energy_systems = None self._energy_systems = None
@ -533,7 +534,7 @@ class Building(CityObject):
@property @property
def heating_consumption(self): def heating_consumption(self):
""" """
Get energy consumption for heating according to the heating system installed Get energy consumption for heating according to the heating system installed in Wh
return: dict return: dict
""" """
if len(self._heating_consumption) == 0: if len(self._heating_consumption) == 0:
@ -547,7 +548,7 @@ class Building(CityObject):
@property @property
def cooling_consumption(self): def cooling_consumption(self):
""" """
Get energy consumption for cooling according to the cooling system installed Get energy consumption for cooling according to the cooling system installed in Wh
return: dict return: dict
""" """
if len(self._cooling_consumption) == 0: if len(self._cooling_consumption) == 0:
@ -561,7 +562,7 @@ class Building(CityObject):
@property @property
def domestic_hot_water_consumption(self): def domestic_hot_water_consumption(self):
""" """
Get energy consumption for domestic according to the domestic hot water system installed Get energy consumption for domestic according to the domestic hot water system installed in Wh
return: dict return: dict
""" """
if len(self._domestic_hot_water_consumption) == 0: if len(self._domestic_hot_water_consumption) == 0:
@ -572,6 +573,76 @@ class Building(CityObject):
self._domestic_hot_water_consumption[domestic_hot_water_demand_key] = final_energy_consumed self._domestic_hot_water_consumption[domestic_hot_water_demand_key] = final_energy_consumed
return self._domestic_hot_water_consumption return self._domestic_hot_water_consumption
def _calculate_working_hours(self):
_working_hours = {}
for internal_zone in self.internal_zones:
for thermal_zone in internal_zone.thermal_zones:
_working_hours_per_thermal_zone = {}
for schedule in thermal_zone.thermal_control.hvac_availability_schedules:
_working_hours_per_schedule = [0] * len(schedule.values)
for i, value in enumerate(schedule.values):
if value > 0:
_working_hours_per_schedule[i] = 1
for day_type in schedule.day_types:
_working_hours_per_thermal_zone[day_type] = _working_hours_per_schedule
if len(_working_hours) == 0:
_working_hours = _working_hours_per_thermal_zone
else:
for key in _working_hours.keys():
saved_values = _working_hours_per_thermal_zone[key]
for i, value in enumerate(_working_hours[key]):
if saved_values[i] == 1:
_working_hours[key][i] = 1
_total_hours = 0
for key in _working_hours:
_total_hours += _working_hours[key] * cte.DAYS_A_YEAR[key]
return _total_hours
@property
def distribution_systems_electrical_consumption(self):
"""
Get total electricity consumption for distribution and emission systems in Wh
return: dict
"""
if len(self._distribution_systems_electrical_consumption) == 0:
_peak_load = self.heating_peak_load[cte.YEAR]['heating peak loads'][0]
_peak_load_type = cte.HEATING
if _peak_load < self.cooling_peak_load[cte.YEAR]['cooling peak loads'][0]:
_peak_load = self.cooling_peak_load[cte.YEAR]['cooling peak loads'][0]
_peak_load_type = cte.COOLING
_consumption_fix_flow = 0
for energy_system in self.energy_systems:
emission_system = energy_system.emission_system.generic_emission_system
parasitic_energy_consumption = emission_system.parasitic_energy_consumption
distribution_system = energy_system.distribution_system.generic_distribution_system
consumption_variable_flow = distribution_system.distribution_consumption_variable_flow
for demand_type in energy_system.demand_types:
if demand_type.lower() == cte.HEATING:
if _peak_load_type == cte.HEATING:
_consumption_fix_flow = distribution_system.distribution_consumption_fix_flow
for heating_demand_key in self.heating:
_consumption = [0]*len(self.heating)
_demand = self.heating[heating_demand_key][cte.INSEL_MEB]
for i in range(0, len(_consumption)):
_consumption[i] += (parasitic_energy_consumption + consumption_variable_flow) * _demand[i]
self._distribution_systems_electrical_consumption[heating_demand_key] = _consumption
if demand_type.lower() == cte.COOLING:
if _peak_load_type == cte.COOLING:
_consumption_fix_flow = distribution_system.distribution_consumption_fix_flow
for demand_key in self.cooling:
_consumption = self._distribution_systems_electrical_consumption[demand_key]
_demand = self.cooling[demand_key][cte.INSEL_MEB]
for i in range(0, len(_consumption)):
_consumption[i] += (parasitic_energy_consumption + consumption_variable_flow) * _demand[i]
self._distribution_systems_electrical_consumption[demand_key] = _consumption
for key in self._distribution_systems_electrical_consumption:
for i in range(0, len(self._distribution_systems_electrical_consumption[key])):
self._distribution_systems_electrical_consumption[key][i] += _peak_load * _consumption_fix_flow \
* self._calculate_working_hours()
return self._distribution_systems_electrical_consumption
def _calculate_consumption(self, consumption_type, demand): def _calculate_consumption(self, consumption_type, demand):
# todo: modify when COP depends on the hour # todo: modify when COP depends on the hour
coefficient_of_performance = 0 coefficient_of_performance = 0
@ -597,7 +668,7 @@ class Building(CityObject):
@property @property
def onsite_electrical_production(self): def onsite_electrical_production(self):
""" """
Get total electricity produced onsite Get total electricity produced onsite in Wh
return: dict return: dict
""" """
# Add other systems whenever new ones appear # Add other systems whenever new ones appear