diff --git a/hub/RECOGNIZED_FUNTIONS_AND_USAGES.md b/hub/RECOGNIZED_FUNTIONS_AND_USAGES.md index 107ba6f2..518b2ecc 100644 --- a/hub/RECOGNIZED_FUNTIONS_AND_USAGES.md +++ b/hub/RECOGNIZED_FUNTIONS_AND_USAGES.md @@ -1,21 +1,16 @@ # Functions and usages internally recognized within the hub -The hub uses a list of building functions a building usages that are the only ones recognized. All new categories should be added to the dictionaries that translate from the input formats to the libs functions. From the libs functions to the libs usages and from the libs usages and libs functions to the output formats. +The hub uses a list of building functions that are the only ones recognized. All new categories should be added to the dictionaries that translate from the input formats to the hub functions and from the hub functions to the output formats. -Input formats accepted: -* Function: - * pluto - * hft - Output formats accepted: * Function: * nrel * nrcan + * eilat * Usage: - * ca - * hft + * nrcan * comnet - * Eilat + * eilat Libs_functions: * single family house diff --git a/hub/city_model_structure/building_demand/thermal_boundary.py b/hub/city_model_structure/building_demand/thermal_boundary.py index f38049ee..d17a5b45 100644 --- a/hub/city_model_structure/building_demand/thermal_boundary.py +++ b/hub/city_model_structure/building_demand/thermal_boundary.py @@ -36,7 +36,9 @@ class ThermalBoundary: self._thickness = None self._internal_surface = None self._window_ratio = None - self._window_ratio_is_calculated = False + self._window_ratio_to_be_calculated = False + if self._windows_areas is not None: + self._window_ratio_to_be_calculated = True @property def id(self): @@ -101,18 +103,7 @@ class ThermalBoundary: :return: None or [ThermalOpening] """ if self._thermal_openings is None: - if self.window_ratio is not None: - if self.window_ratio == 0: - self._thermal_openings = [] - else: - thermal_opening = ThermalOpening() - if self.window_ratio == 1: - _area = self.opaque_area - else: - _area = self.opaque_area * self.window_ratio / (1-self.window_ratio) - thermal_opening.area = _area - self._thermal_openings = [thermal_opening] - else: + if self.windows_areas is not None: if len(self.windows_areas) > 0: self._thermal_openings = [] for window_area in self.windows_areas: @@ -121,6 +112,42 @@ class ThermalBoundary: self._thermal_openings.append(thermal_opening) else: self._thermal_openings = [] + else: + if self.window_ratio is not None: + if self.window_ratio == 0: + self._thermal_openings = [] + else: + thermal_opening = ThermalOpening() + if self.window_ratio == 1: + _area = self.opaque_area + else: + _area = self.opaque_area * self.window_ratio / (1-self.window_ratio) + thermal_opening.area = _area + self._thermal_openings = [thermal_opening] + else: + self._thermal_openings = [] + else: + if self.windows_areas is not None: + return self._thermal_openings + if self.window_ratio is not None: + if self.window_ratio == 0: + self._thermal_openings = [] + else: + if len(self._thermal_openings) == 0: + thermal_opening = ThermalOpening() + if self.window_ratio == 1: + _area = self.opaque_area + else: + _area = self.opaque_area * self.window_ratio / (1-self.window_ratio) + thermal_opening.area = _area + self._thermal_openings = [thermal_opening] + else: + for _thermal_opening in self._thermal_openings: + if self.window_ratio == 1: + _area = self.opaque_area + else: + _area = self.opaque_area * self.window_ratio / (1-self.window_ratio) + _thermal_opening.area = _area return self._thermal_openings @property @@ -174,16 +201,14 @@ class ThermalBoundary: If none of those sources are available, it returns None. :return: float """ - if self.windows_areas is not None: - if not self._window_ratio_is_calculated: - _calculated = True - if len(self.windows_areas) == 0: - self._window_ratio = 0 - else: - total_window_area = 0 - for window_area in self.windows_areas: - total_window_area += window_area - self._window_ratio = total_window_area / (self.opaque_area + total_window_area) + if self._window_ratio_to_be_calculated: + if len(self.windows_areas) == 0: + self._window_ratio = 0 + else: + total_window_area = 0 + for window_area in self.windows_areas: + total_window_area += window_area + self._window_ratio = total_window_area / (self.opaque_area + total_window_area) return self._window_ratio @window_ratio.setter @@ -192,7 +217,7 @@ class ThermalBoundary: Set thermal boundary window ratio :param value: str """ - if self._window_ratio_is_calculated: + if self._window_ratio_to_be_calculated: raise ValueError('Window ratio cannot be assigned when the windows are defined in the geometry.') self._window_ratio = float(value) diff --git a/hub/data/construction/eilat_constructions.json b/hub/data/construction/eilat_constructions.json index c0bd4c1c..f9ed1003 100644 --- a/hub/data/construction/eilat_constructions.json +++ b/hub/data/construction/eilat_constructions.json @@ -93,7 +93,7 @@ "shgc": 0.49, "type": "Window", "frame_ratio": 0, - "u_value": 10.09 + "u_value": 7.00 } }, { diff --git a/hub/exports/building_energy/insel/insel_monthly_energy_balance.py b/hub/exports/building_energy/insel/insel_monthly_energy_balance.py index 5121f17f..ad836d62 100644 --- a/hub/exports/building_energy/insel/insel_monthly_energy_balance.py +++ b/hub/exports/building_energy/insel/insel_monthly_energy_balance.py @@ -44,25 +44,25 @@ class InselMonthlyEnergyBalance: self._insel_files_paths.append(building.name + '.insel') file_name_out = building.name + '.out' output_path = Path(self._path / file_name_out).resolve() - if building.internal_zones is not None: - for internal_zone in building.internal_zones: - if internal_zone.thermal_zones is None: - logging.warning('Building %s has missing values. Monthly Energy Balance cannot be processed', building.name) - break - self._contents.append( - self._generate_meb_template(building, output_path, self._radiation_calculation_method, self._weather_format, self._custom_insel_block) - ) + if building.thermal_zones is None: + logging.warning('Building %s has missing values. Monthly Energy Balance cannot be processed', building.name) + + self._contents.append( + self._generate_meb_template(building, output_path, self._radiation_calculation_method, self._weather_format, self._custom_insel_block) + ) self._export() @staticmethod - def _add_block(file, block_number, block_type, inputs='', parameters=''): + def _add_block(file, block_number, block_type, inputs=None, parameters=None): file += "S " + str(block_number) + " " + block_type + "\n" - for block_input in inputs: - file += str(block_input) + "\n" - if len(parameters) > 0: - file += "P " + str(block_number) + "\n" - for block_parameter in parameters: - file += str(block_parameter) + "\n" + if inputs is not None: + for block_input in inputs: + file += str(block_input) + "\n" + if parameters is not None: + if len(parameters) > 0: + file += "P " + str(block_number) + "\n" + for block_parameter in parameters: + file += str(block_parameter) + "\n" return file def _export(self): @@ -222,6 +222,7 @@ class InselMonthlyEnergyBalance: parameters.append(0.0) parameters.append(0.0) else: + print(window_area, thermal_boundary.thermal_openings) thermal_opening = thermal_boundary.thermal_openings[0] parameters.append(thermal_opening.frame_ratio) parameters.append(thermal_opening.overall_u_value) diff --git a/hub/imports/construction/helpers/construction_helper.py b/hub/imports/construction/helpers/construction_helper.py index 59630d31..7f92111c 100644 --- a/hub/imports/construction/helpers/construction_helper.py +++ b/hub/imports/construction/helpers/construction_helper.py @@ -52,6 +52,7 @@ class ConstructionHelper: 'Repentigny': '6', "Montreal Int'l": '6', 'Levis': '7A', + 'Quebec City': '7A', 'Kelowna': '5', 'Park Slope': '4' }