changed in data ACH to 1/s all Wh in J

This commit is contained in:
Pilar Monsalvete 2023-08-08 10:19:35 -04:00
parent 04ef636423
commit ab81edc33d
5 changed files with 41 additions and 33 deletions

View File

@ -318,7 +318,7 @@ class Building(CityObject):
@property @property
def heating_demand(self) -> dict: def heating_demand(self) -> dict:
""" """
Get heating demand in Wh Get heating demand in J
:return: dict{[float]} :return: dict{[float]}
""" """
return self._heating_demand return self._heating_demand
@ -326,7 +326,7 @@ class Building(CityObject):
@heating_demand.setter @heating_demand.setter
def heating_demand(self, value): def heating_demand(self, value):
""" """
Set heating demand in Wh Set heating demand in J
:param value: dict{[float]} :param value: dict{[float]}
""" """
self._heating_demand = value self._heating_demand = value
@ -334,7 +334,7 @@ class Building(CityObject):
@property @property
def cooling_demand(self) -> dict: def cooling_demand(self) -> dict:
""" """
Get cooling demand in Wh Get cooling demand in J
:return: dict{[float]} :return: dict{[float]}
""" """
return self._cooling_demand return self._cooling_demand
@ -342,7 +342,7 @@ class Building(CityObject):
@cooling_demand.setter @cooling_demand.setter
def cooling_demand(self, value): def cooling_demand(self, value):
""" """
Set cooling demand in Wh Set cooling demand in J
:param value: dict{[float]} :param value: dict{[float]}
""" """
self._cooling_demand = value self._cooling_demand = value
@ -350,7 +350,7 @@ class Building(CityObject):
@property @property
def lighting_electrical_demand(self) -> dict: def lighting_electrical_demand(self) -> dict:
""" """
Get lighting electrical demand in Wh Get lighting electrical demand in J
:return: dict{[float]} :return: dict{[float]}
""" """
return self._lighting_electrical_demand return self._lighting_electrical_demand
@ -358,7 +358,7 @@ class Building(CityObject):
@lighting_electrical_demand.setter @lighting_electrical_demand.setter
def lighting_electrical_demand(self, value): def lighting_electrical_demand(self, value):
""" """
Set lighting electrical demand in Wh Set lighting electrical demand in J
:param value: dict{[float]} :param value: dict{[float]}
""" """
self._lighting_electrical_demand = value self._lighting_electrical_demand = value
@ -366,7 +366,7 @@ class Building(CityObject):
@property @property
def appliances_electrical_demand(self) -> dict: def appliances_electrical_demand(self) -> dict:
""" """
Get appliances electrical demand in Wh Get appliances electrical demand in J
:return: dict{[float]} :return: dict{[float]}
""" """
return self._appliances_electrical_demand return self._appliances_electrical_demand
@ -374,7 +374,7 @@ class Building(CityObject):
@appliances_electrical_demand.setter @appliances_electrical_demand.setter
def appliances_electrical_demand(self, value): def appliances_electrical_demand(self, value):
""" """
Set appliances electrical demand in Wh Set appliances electrical demand in J
:param value: dict{[float]} :param value: dict{[float]}
""" """
self._appliances_electrical_demand = value self._appliances_electrical_demand = value
@ -382,7 +382,7 @@ class Building(CityObject):
@property @property
def domestic_hot_water_heat_demand(self) -> dict: def domestic_hot_water_heat_demand(self) -> dict:
""" """
Get domestic hot water heat demand in Wh Get domestic hot water heat demand in J
:return: dict{[float]} :return: dict{[float]}
""" """
return self._domestic_hot_water_heat_demand return self._domestic_hot_water_heat_demand
@ -390,7 +390,7 @@ class Building(CityObject):
@domestic_hot_water_heat_demand.setter @domestic_hot_water_heat_demand.setter
def domestic_hot_water_heat_demand(self, value): def domestic_hot_water_heat_demand(self, value):
""" """
Set domestic hot water heat demand in Wh Set domestic hot water heat demand in J
:param value: dict{[float]} :param value: dict{[float]}
""" """
self._domestic_hot_water_heat_demand = value self._domestic_hot_water_heat_demand = value
@ -447,7 +447,8 @@ class Building(CityObject):
monthly_values = PeakLoads(self).heating_peak_loads_from_methodology monthly_values = PeakLoads(self).heating_peak_loads_from_methodology
if monthly_values is None: if monthly_values is None:
return None return None
results[cte.MONTH] = monthly_values # todo: @Pilar!!!!
results[cte.MONTH] = monthly_values * cte.WATTS_HOUR_TO_JULES
results[cte.YEAR] = [max(monthly_values)] results[cte.YEAR] = [max(monthly_values)]
return results return results
@ -464,7 +465,8 @@ class Building(CityObject):
monthly_values = PeakLoads(self).cooling_peak_loads_from_methodology monthly_values = PeakLoads(self).cooling_peak_loads_from_methodology
if monthly_values is None: if monthly_values is None:
return None return None
results[cte.MONTH] = monthly_values # todo: @Pilar!!!!
results[cte.MONTH] = monthly_values * cte.WATTS_HOUR_TO_JULES
results[cte.YEAR] = [max(monthly_values)] results[cte.YEAR] = [max(monthly_values)]
return results return results
@ -618,7 +620,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 in Wh Get energy consumption for heating according to the heating system installed in J
return: dict return: dict
""" """
if len(self._heating_consumption) == 0: if len(self._heating_consumption) == 0:
@ -634,7 +636,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 in Wh Get energy consumption for cooling according to the cooling system installed in J
return: dict return: dict
""" """
if len(self._cooling_consumption) == 0: if len(self._cooling_consumption) == 0:
@ -650,7 +652,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 in Wh Get energy consumption for domestic according to the domestic hot water system installed in J
return: dict return: dict
""" """
if len(self._domestic_hot_water_consumption) == 0: if len(self._domestic_hot_water_consumption) == 0:
@ -692,7 +694,7 @@ class Building(CityObject):
@property @property
def distribution_systems_electrical_consumption(self): def distribution_systems_electrical_consumption(self):
""" """
Get total electricity consumption for distribution and emission systems in Wh Get total electricity consumption for distribution and emission systems in J
return: dict return: dict
""" """
if len(self._distribution_systems_electrical_consumption) != 0: if len(self._distribution_systems_electrical_consumption) != 0:

View File

@ -208,7 +208,7 @@ class CityObject:
@property @property
def global_horizontal(self) -> dict: def global_horizontal(self) -> dict:
""" """
Get global horizontal radiation surrounding the city object in W/m2 Get global horizontal radiation surrounding the city object in J/m2
:return: dict{dict{[float]}} :return: dict{dict{[float]}}
""" """
return self._global_horizontal return self._global_horizontal
@ -216,7 +216,7 @@ class CityObject:
@global_horizontal.setter @global_horizontal.setter
def global_horizontal(self, value): def global_horizontal(self, value):
""" """
Set global horizontal radiation surrounding the city object in W/m2 Set global horizontal radiation surrounding the city object in J/m2
:param value: dict{dict{[float]}} :param value: dict{dict{[float]}}
""" """
self._global_horizontal = value self._global_horizontal = value
@ -224,7 +224,7 @@ class CityObject:
@property @property
def diffuse(self) -> dict: def diffuse(self) -> dict:
""" """
Get diffuse radiation surrounding the city object in W/m2 Get diffuse radiation surrounding the city object in J/m2
:return: dict{dict{[float]}} :return: dict{dict{[float]}}
""" """
return self._diffuse return self._diffuse
@ -232,7 +232,7 @@ class CityObject:
@diffuse.setter @diffuse.setter
def diffuse(self, value): def diffuse(self, value):
""" """
Set diffuse radiation surrounding the city object in W/m2 Set diffuse radiation surrounding the city object in J/m2
:param value: dict{dict{[float]}} :param value: dict{dict{[float]}}
""" """
self._diffuse = value self._diffuse = value
@ -240,7 +240,7 @@ class CityObject:
@property @property
def beam(self) -> dict: def beam(self) -> dict:
""" """
Get beam radiation surrounding the city object in W/m2 Get beam radiation surrounding the city object in J/m2
:return: dict{dict{[float]}} :return: dict{dict{[float]}}
""" """
return self._beam return self._beam
@ -248,7 +248,7 @@ class CityObject:
@beam.setter @beam.setter
def beam(self, value): def beam(self, value):
""" """
Set beam radiation surrounding the city object in W/m2 Set beam radiation surrounding the city object in J/m2
:param value: dict{dict{[float]}} :param value: dict{dict{[float]}}
""" """
self._beam = value self._beam = value

View File

@ -66,8 +66,9 @@ class SimplifiedRadiosityAlgorithm:
else: else:
i = (total_days + day - 1) * 24 + hour - 1 i = (total_days + day - 1) * 24 + hour - 1
representative_building = self._city.buildings[0] representative_building = self._city.buildings[0]
content += f'{day} {month} {hour} {representative_building.global_horizontal[cte.HOUR][i]} ' \ _global = representative_building.global_horizontal[cte.HOUR][i] * cte.WATTS_HOUR_TO_JULES
f'{representative_building.beam[cte.HOUR][i]}\n' _beam = representative_building.beam[cte.HOUR][i] * cte.WATTS_HOUR_TO_JULES
content += f'{day} {month} {hour} {_global} {_beam}\n'
with open(file, 'w', encoding='utf-8') as file: with open(file, 'w', encoding='utf-8') as file:
file.write(content) file.write(content)

View File

@ -30,7 +30,7 @@ class InselMonthlyEnergyBalance:
demand = str(line).replace("['", '').replace("']", '').split() demand = str(line).replace("['", '').replace("']", '').split()
for i in range(0, 2): for i in range(0, 2):
if demand[i] != 'NaN': if demand[i] != 'NaN':
aux = float(demand[i]) * 1000 # kWh to Wh aux = float(demand[i]) * cte.WATTS_HOUR_TO_JULES * 1000 # kWh to J
demand[i] = str(aux) demand[i] = str(aux)
else: else:
demand[i] = '0' demand[i] = '0'
@ -66,7 +66,8 @@ class InselMonthlyEnergyBalance:
for value in schedule.values: for value in schedule.values:
total_day += value total_day += value
for day_type in schedule.day_types: for day_type in schedule.day_types:
total_lighting += total_day * cte.WEEK_DAYS_A_MONTH[day_type][month] * lighting_density total_lighting += total_day * cte.WEEK_DAYS_A_MONTH[day_type][month] \
* lighting_density / cte.WATTS_HOUR_TO_JULES
lighting_demand.append(total_lighting * area) lighting_demand.append(total_lighting * area)
for schedule in thermal_zone.appliances.schedules: for schedule in thermal_zone.appliances.schedules:
@ -74,7 +75,8 @@ class InselMonthlyEnergyBalance:
for value in schedule.values: for value in schedule.values:
total_day += value total_day += value
for day_type in schedule.day_types: for day_type in schedule.day_types:
total_appliances += total_day * cte.WEEK_DAYS_A_MONTH[day_type][month] * appliances_density total_appliances += total_day * cte.WEEK_DAYS_A_MONTH[day_type][month] \
* appliances_density / cte.WATTS_HOUR_TO_JULES
appliances_demand.append(total_appliances * area) appliances_demand.append(total_appliances * area)
for schedule in thermal_zone.domestic_hot_water.schedules: for schedule in thermal_zone.domestic_hot_water.schedules:
@ -83,7 +85,8 @@ class InselMonthlyEnergyBalance:
total_day += value total_day += value
for day_type in schedule.day_types: for day_type in schedule.day_types:
demand = ( demand = (
peak_flow * cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY * (service_temperature - cold_water[month]) peak_flow * cte.WATER_DENSITY * cte.WATER_HEAT_CAPACITY
* (service_temperature - cold_water[month]) / cte.WATTS_HOUR_TO_JULES
) )
total_dhw_demand += total_day * cte.WEEK_DAYS_A_MONTH[day_type][month] * demand total_dhw_demand += total_day * cte.WEEK_DAYS_A_MONTH[day_type][month] * demand
domestic_hot_water_demand.append(total_dhw_demand * area) domestic_hot_water_demand.append(total_dhw_demand * area)
@ -97,14 +100,15 @@ class InselMonthlyEnergyBalance:
def enrich(self): def enrich(self):
""" """
Enrich the city by using the insel monthly energy balance output files Enrich the city by using the insel monthly energy balance output files (J)
:return: None :return: None
""" """
for building in self._city.buildings: for building in self._city.buildings:
file_name = building.name + '.out' file_name = building.name + '.out'
insel_output_file_path = Path(self._base_path / file_name).resolve() insel_output_file_path = Path(self._base_path / file_name).resolve()
if insel_output_file_path.is_file(): if insel_output_file_path.is_file():
building.heating_demand[cte.MONTH], building.cooling_demand[cte.MONTH] = self._conditioning_demand(insel_output_file_path) building.heating_demand[cte.MONTH], building.cooling_demand[cte.MONTH] \
= self._conditioning_demand(insel_output_file_path)
building.heating_demand[cte.YEAR] = [sum(building.heating_demand[cte.MONTH])] building.heating_demand[cte.YEAR] = [sum(building.heating_demand[cte.MONTH])]
building.cooling_demand[cte.YEAR] = [sum(building.cooling_demand[cte.MONTH])] building.cooling_demand[cte.YEAR] = [sum(building.cooling_demand[cte.MONTH])]
self._dhw_and_electric_demand() self._dhw_and_electric_demand()

View File

@ -110,9 +110,10 @@ class EpwWeatherParameters:
# new_value = pd.DataFrame(self._weather_values[['dry_bulb_temperature_c']].to_numpy(), columns=['epw']) # new_value = pd.DataFrame(self._weather_values[['dry_bulb_temperature_c']].to_numpy(), columns=['epw'])
# number_invalid_records = new_value[new_value.epw == 99.9].count().epw # number_invalid_records = new_value[new_value.epw == 99.9].count().epw
building.external_temperature[cte.HOUR] = self._weather_values['dry_bulb_temperature_c'] building.external_temperature[cte.HOUR] = self._weather_values['dry_bulb_temperature_c']
building.global_horizontal[cte.HOUR] = self._weather_values['global_horizontal_radiation_wh_m2'] building.global_horizontal[cte.HOUR] = self._weather_values[
building.diffuse[cte.HOUR] = self._weather_values['diffuse_horizontal_radiation_wh_m2'] 'global_horizontal_radiation_wh_m2'] / cte.WATTS_HOUR_TO_JULES
building.beam[cte.HOUR] = self._weather_values['direct_normal_radiation_wh_m2'] building.diffuse[cte.HOUR] = self._weather_values['diffuse_horizontal_radiation_wh_m2'] / cte.WATTS_HOUR_TO_JULES
building.beam[cte.HOUR] = self._weather_values['direct_normal_radiation_wh_m2'] / cte.WATTS_HOUR_TO_JULES
building.cold_water_temperature[cte.HOUR] = wh().cold_water_temperature(building.external_temperature[cte.HOUR]) building.cold_water_temperature[cte.HOUR] = wh().cold_water_temperature(building.external_temperature[cte.HOUR])
# create the monthly and yearly values out of the hourly # create the monthly and yearly values out of the hourly