diff --git a/catalog_factories/usage/comnet_catalog.py b/catalog_factories/usage/comnet_catalog.py index b3eade63..41be303e 100644 --- a/catalog_factories/usage/comnet_catalog.py +++ b/catalog_factories/usage/comnet_catalog.py @@ -51,7 +51,7 @@ class ComnetCatalog(Catalog): ventilation_rate = ventilation_rate / (cte.METERS_TO_FEET * cte.MINUTES_TO_SECONDS) # get occupancy - occupancy_density = occupancy_archetype[0] / pow(cte.METERS_TO_FEET,2) + occupancy_density = occupancy_archetype[0] / pow(cte.METERS_TO_FEET, 2) sensible_heat_gain = occupancy_archetype[1] * cte.BTU_H_TO_WATTS latent_heat_gain = occupancy_archetype[1] * cte.BTU_H_TO_WATTS if occupancy_density != 0: diff --git a/catalog_factories/usage/usage_helper.py b/catalog_factories/usage/usage_helper.py index bdd66a45..3e2c8e6e 100644 --- a/catalog_factories/usage/usage_helper.py +++ b/catalog_factories/usage/usage_helper.py @@ -75,7 +75,7 @@ class UsageHelper: _comnet_data_type_to_hub_data_type = { 'Fraction': cte.FRACTION, 'OnOff': cte.ON_OFF, - 'Temperature': cte.TEMPERATURE + 'Temperature': cte.ANY_NUMBER } _comnet_schedules_key_to_comnet_schedules = { diff --git a/city_model_structure/building_demand/surface.py b/city_model_structure/building_demand/surface.py index 8c3e8a1f..1a1f30a0 100644 --- a/city_model_structure/building_demand/surface.py +++ b/city_model_structure/building_demand/surface.py @@ -13,7 +13,6 @@ from typing import List, Union from city_model_structure.attributes.polygon import Polygon from city_model_structure.attributes.plane import Plane from city_model_structure.attributes.point import Point -from city_model_structure.energy_systems.pv_system import PvSystem import helpers.constants as cte @@ -263,22 +262,6 @@ class Surface: """ self._holes_polygons = value - @property - def pv_system_installed(self) -> PvSystem: - """ - Get PV system installed on the surface - :return: PvSystem - """ - return self._pv_system_installed - - @pv_system_installed.setter - def pv_system_installed(self, value): - """ - Set PV system installed on the surface - :param value: PvSystem - """ - self._pv_system_installed = value - @property def inverse(self) -> Surface: """ diff --git a/city_model_structure/energy_systems/pv_system.py b/city_model_structure/energy_systems/pv_system.py deleted file mode 100644 index ead8e1d4..00000000 --- a/city_model_structure/energy_systems/pv_system.py +++ /dev/null @@ -1,123 +0,0 @@ -""" -pv_system defines a pv system including all components: PV panels, transformer... -SPDX - License - Identifier: LGPL - 3.0 - or -later -Copyright © 2022 Concordia CERC group -Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca -""" - -from typing import Union - - -class PvSystem: - """ - PvSystem class - """ - def __init__(self): - self._modules_mean_seasonal_efficiency = None - self._total_area = None - self._module_area = None - self._number_of_modules = None - self._overall_system_performance_ratio = None - self._electricity_generation = None - - @property - def modules_mean_seasonal_efficiency(self) -> Union[None, float]: - """ - Get mean modules efficiency (-) - :return: None or float - """ - return self._modules_mean_seasonal_efficiency - - @modules_mean_seasonal_efficiency.setter - def modules_mean_seasonal_efficiency(self, value): - """ - Set mean modules efficiency (-) - :param value: float - """ - if value is not None: - self._modules_mean_seasonal_efficiency = float(value) - - @property - def total_area(self) -> Union[None, float]: - """ - Get total modules area in square meters - :return: None or float - """ - return self._total_area - - @total_area.setter - def total_area(self, value): - """ - Set total modules area in square meters - :param value: float - """ - if value is not None: - self._total_area = float(value) - - @property - def module_area(self) -> Union[None, float]: - """ - Get module area in square meters - :return: None or float - """ - return self._module_area - - @module_area.setter - def module_area(self, value): - """ - Set module area in square meters - :param value: float - """ - if value is not None: - self._module_area = float(value) - - @property - def number_of_modules(self) -> Union[None, int]: - """ - Get number of modules - :return: None or int - """ - return self._number_of_modules - - @number_of_modules.setter - def number_of_modules(self, value): - """ - Set number of modules - :param value: int - """ - if value is not None: - self._number_of_modules = int(value) - - @property - def overall_system_performance_ratio(self) -> Union[None, float]: - """ - Get overall system performance ratio (-) - :return: None or float - """ - return self._overall_system_performance_ratio - - @overall_system_performance_ratio.setter - def overall_system_performance_ratio(self, value): - """ - Set overall system performance ratio (-) - :param value: float - """ - if value is not None: - self._overall_system_performance_ratio = float(value) - - @property - def electricity_generation(self) -> Union[None, float]: - """ - Get electricity generation in J - :return: None or float - """ - return self._electricity_generation - - @electricity_generation.setter - def electricity_generation(self, value): - """ - Set electricity generation in J - :param value: float - """ - if value is not None: - self._electricity_generation = float(value) diff --git a/exports/formats/idf.py b/exports/formats/idf.py index 6625990b..e09d401f 100644 --- a/exports/formats/idf.py +++ b/exports/formats/idf.py @@ -156,8 +156,8 @@ class Idf: Visible_Absorptance=layer.material.visible_absorptance ) - def _add_standard_compact_hourly_schedule(self, usage, schedules): - _kwargs = {'Name': f'{schedules[0].type} schedules {usage}', + def _add_standard_compact_hourly_schedule(self, usage, schedule_type, schedules): + _kwargs = {'Name': f'{schedule_type} schedules {usage}', 'Schedule_Type_Limits_Name': self.idf_type_limits[schedules[0].data_type], 'Field_1': 'Through: 12/31'} for j, schedule in enumerate(schedules): @@ -206,23 +206,23 @@ class Idf: _schedule.values = _infiltration_values _infiltration_schedules.append(_schedule) for schedule in self._idf.idfobjects[self._HOURLY_SCHEDULE]: - if schedule.Name == f'{_infiltration_schedules[0].type} schedules {thermal_zone.usage}': + if schedule.Name == f'Infiltration schedules {thermal_zone.usage}': return - return self._add_standard_compact_hourly_schedule(thermal_zone.usage, _infiltration_schedules) + return self._add_standard_compact_hourly_schedule(thermal_zone.usage, 'Infiltration', _infiltration_schedules) - def _add_schedules(self, usage, new_schedules, schedule_from_file=False): + def _add_schedules(self, usage, schedule_type, new_schedules, schedule_from_file=False): if schedule_from_file: new_schedule = new_schedules[0] for schedule in self._idf.idfobjects[self._FILE_SCHEDULE]: - if schedule.Name == f'{new_schedule.type} schedules {usage}': + if schedule.Name == f'{schedule_type} schedules {usage}': return file_name = self._write_schedules_file(usage, new_schedule) return self._add_file_schedule(usage, new_schedule, file_name) else: for schedule in self._idf.idfobjects[self._HOURLY_SCHEDULE]: - if schedule.Name == f'{new_schedules[0].type} schedules {usage}': + if schedule.Name == f'{schedule_type} schedules {usage}': return - return self._add_standard_compact_hourly_schedule(usage, new_schedules) + return self._add_standard_compact_hourly_schedule(usage, schedule_type, new_schedules) def _add_construction(self, thermal_boundary): for construction in self._idf.idfobjects[self._CONSTRUCTION]: @@ -277,15 +277,16 @@ class Idf: self._idf.newidfobject(self._ZONE, Name=thermal_zone.id, Volume=thermal_zone.volume) self._add_heating_system(thermal_zone) - def _add_thermostat(self, usage_zone): - thermostat_name = f'Thermostat {usage_zone.usage}' + def _add_thermostat(self, thermal_zone): + thermostat_name = f'Thermostat {thermal_zone.usage}' for thermostat in self._idf.idfobjects[self._THERMOSTAT]: if thermostat.Name == thermostat_name: return thermostat + # todo: change schedules to schedule name and create schedules using the add_schedule function return self._idf.newidfobject(self._THERMOSTAT, Name=thermostat_name, - Constant_Heating_Setpoint=usage_zone.thermal_control.mean_heating_set_point, - Constant_Cooling_Setpoint=usage_zone.thermal_control.mean_cooling_set_point) + Heating_Setpoint_Schedule_Name=f'Heating thermostat schedules {thermal_zone.usage}', + Cooling_Setpoint_Schedule_Name=f'Cooling thermostat schedules {thermal_zone.usage}') def _add_heating_system(self, thermal_zone): for air_system in self._idf.idfobjects[self._IDEAL_LOAD_AIR_SYSTEM]: @@ -301,6 +302,9 @@ class Idf: def _add_occupancy(self, thermal_zone): number_of_people = thermal_zone.occupancy.occupancy_density * thermal_zone.total_floor_area + print('aaaaaaaa', thermal_zone.occupancy.sensible_radiative_internal_gain) + print(thermal_zone.occupancy.sensible_convective_internal_gain) + print(thermal_zone.occupancy.latent_internal_gain) fraction_radiant = thermal_zone.occupancy.sensible_radiative_internal_gain / \ (thermal_zone.occupancy.sensible_radiative_internal_gain + thermal_zone.occupancy.sensible_convective_internal_gain + @@ -359,10 +363,12 @@ class Idf: self._add_window_construction_and_material(thermal_opening) usage = thermal_zone.usage self._add_infiltration_schedules(thermal_zone) - # todo: why is this schedule unused? - self._add_schedules(usage, thermal_zone.lighting.schedules) - self._add_schedules(usage, thermal_zone.occupancy.occupancy_schedules, schedule_from_file=True) - self._add_schedules(usage, thermal_zone.thermal_control.hvac_availability_schedules) + # todo: why are there schedules unused? + self._add_schedules(usage, 'Lighting', thermal_zone.lighting.schedules) + self._add_schedules(usage, 'Occupancy', thermal_zone.occupancy.occupancy_schedules, schedule_from_file=False) + self._add_schedules(usage, 'HVAC AVAIL', thermal_zone.thermal_control.hvac_availability_schedules) + self._add_schedules(usage, 'Heating thermostat', thermal_zone.thermal_control.heating_set_point_schedules) + self._add_schedules(usage, 'Cooling thermostat', thermal_zone.thermal_control.cooling_set_point_schedules) self._add_zone(thermal_zone) self._add_heating_system(thermal_zone) diff --git a/imports/schedules/comnet_schedules_parameters.py b/imports/schedules/comnet_schedules_parameters.py index 7897d274..deaca3b0 100644 --- a/imports/schedules/comnet_schedules_parameters.py +++ b/imports/schedules/comnet_schedules_parameters.py @@ -46,7 +46,7 @@ class ComnetSchedules: schedule.day_types = [cte.SUNDAY] schedule.type = name schedule.data_type = SchedulesHelper.data_type_from_comnet(data_type) - if schedule.data_type == cte.TEMPERATURE: + if schedule.data_type == cte.ANY_NUMBER: values = [] for cell in row_cells[schedules_per_schedule_type:].to_numpy(): values.append((float(cell) - 32.) * 5 / 9) diff --git a/imports/schedules/helpers/schedules_helper.py b/imports/schedules/helpers/schedules_helper.py index 0cdc3d3a..66510083 100644 --- a/imports/schedules/helpers/schedules_helper.py +++ b/imports/schedules/helpers/schedules_helper.py @@ -28,7 +28,7 @@ class SchedulesHelper: _comnet_to_data_type = { 'Fraction': cte.FRACTION, 'OnOff': cte.ON_OFF, - 'Temperature': cte.TEMPERATURE + 'Temperature': cte.ANY_NUMBER } # usage diff --git a/imports/usage/comnet_usage_parameters.py b/imports/usage/comnet_usage_parameters.py index 3aa1b22b..5f22994e 100644 --- a/imports/usage/comnet_usage_parameters.py +++ b/imports/usage/comnet_usage_parameters.py @@ -133,7 +133,7 @@ class ComnetUsageParameters: _schedule.day_types = [cte.SUNDAY, cte.HOLIDAY] _schedule.type = name _schedule.data_type = SchedulesHelper.data_type_from_comnet(data_type) - if _schedule.data_type == cte.TEMPERATURE: + if _schedule.data_type == cte.ANY_NUMBER: values = [] for cell in row_cells[schedules_per_schedule_type:].to_numpy(): values.append((float(cell) - 32.) * 5 / 9) @@ -229,15 +229,15 @@ class ComnetUsageParameters: usage_zone.mechanical_air_change = archetype.mechanical_air_change * cte.METERS_TO_FEET ** 2 \ * cte.HOUR_TO_MINUTES / cte.METERS_TO_FEET ** 3 / volume_per_area _occupancy = Occupancy() - _occupancy.occupancy_density = archetype.occupancy.occupancy_density / cte.METERS_TO_FEET**2 + _occupancy.occupancy_density = archetype.occupancy.occupancy_density * cte.METERS_TO_FEET**2 _occupancy.sensible_radiative_internal_gain = archetype.occupancy.sensible_radiative_internal_gain \ - * archetype.occupancy.occupancy_density / cte.METERS_TO_FEET**2 \ + * archetype.occupancy.occupancy_density \ * cte.BTU_H_TO_WATTS _occupancy.latent_internal_gain = archetype.occupancy.latent_internal_gain \ - * archetype.occupancy.occupancy_density / cte.METERS_TO_FEET**2 \ + * archetype.occupancy.occupancy_density \ * cte.BTU_H_TO_WATTS _occupancy.sensible_convective_internal_gain = archetype.occupancy.sensible_convective_internal_gain \ - * archetype.occupancy.occupancy_density / cte.METERS_TO_FEET**2 \ + * archetype.occupancy.occupancy_density \ * cte.BTU_H_TO_WATTS _occupancy.occupancy_schedules = archetype.occupancy.occupancy_schedules usage_zone.occupancy = _occupancy diff --git a/imports/usage/hft_usage_interface.py b/imports/usage/hft_usage_interface.py index aac00fc3..0eeea969 100644 --- a/imports/usage/hft_usage_interface.py +++ b/imports/usage/hft_usage_interface.py @@ -87,7 +87,7 @@ class HftUsageInterface: _schedule.type = 'heating temperature' _schedule.time_range = cte.DAY _schedule.time_step = cte.HOUR - _schedule.data_type = cte.TEMPERATURE + _schedule.data_type = cte.ANY_NUMBER _schedule.day_types = [cte.MONDAY, cte.TUESDAY, cte.WEDNESDAY, cte.THURSDAY, cte.FRIDAY, cte.SATURDAY, cte.SUNDAY] _values = zone_usage_type['endUses']['space_heating']['schedule']['weekDayProfile']['values'] @@ -108,7 +108,7 @@ class HftUsageInterface: _schedule.type = 'cooling temperature' _schedule.time_range = cte.DAY _schedule.time_step = cte.HOUR - _schedule.data_type = cte.TEMPERATURE + _schedule.data_type = cte.ANY_NUMBER _schedule.day_types = [cte.MONDAY, cte.TUESDAY, cte.WEDNESDAY, cte.THURSDAY, cte.FRIDAY, cte.SATURDAY, cte.SUNDAY] _values = zone_usage_type['endUses']['space_cooling']['schedule']['weekDayProfile']['values'] @@ -209,7 +209,7 @@ class HftUsageInterface: _schedule.type = 'heating temperature' _schedule.time_range = cte.DAY _schedule.time_step = cte.HOUR - _schedule.data_type = cte.TEMPERATURE + _schedule.data_type = cte.ANY_NUMBER _schedule.day_types = [cte.MONDAY, cte.TUESDAY, cte.WEDNESDAY, cte.THURSDAY, cte.FRIDAY, cte.SATURDAY, cte.SUNDAY] _values = usage_zone_variant['endUses']['space_heating']['schedule']['weekDayProfile']['values'] @@ -232,7 +232,7 @@ class HftUsageInterface: _schedule.type = 'cooling temperature' _schedule.time_range = cte.DAY _schedule.time_step = cte.HOUR - _schedule.data_type = cte.TEMPERATURE + _schedule.data_type = cte.ANY_NUMBER _schedule.day_types = [cte.MONDAY, cte.TUESDAY, cte.WEDNESDAY, cte.THURSDAY, cte.FRIDAY, cte.SATURDAY, cte.SUNDAY] _values = usage_zone_variant['endUses']['space_cooling']['schedule']['weekDayProfile']['values']