From 4a1f5099a3e980bf29d8dbd5f1181517ee1e257a Mon Sep 17 00:00:00 2001 From: Pilar Date: Mon, 28 Nov 2022 14:10:13 -0500 Subject: [PATCH] fixed some bug in the meb exporter as well as in the calculation of the overall U value of walls --- .../construction/nrel_catalog.py | 2 +- .../building_demand/thermal_boundary.py | 2 +- .../building_demand/thermal_opening.py | 4 +- .../insel/insel_monthly_energy_balance.py | 57 +++++++++++-------- imports/usage/comnet_usage_parameters.py | 8 +-- 5 files changed, 42 insertions(+), 31 deletions(-) diff --git a/catalog_factories/construction/nrel_catalog.py b/catalog_factories/construction/nrel_catalog.py index 99752162..6495b8e0 100644 --- a/catalog_factories/construction/nrel_catalog.py +++ b/catalog_factories/construction/nrel_catalog.py @@ -116,7 +116,7 @@ class NrelCatalog(Catalog): climate_zone = archetype['@climate_zone'] construction_period = reference_standard_to_construction_period[archetype['@reference_standard']] average_storey_height = archetype['average_storey_height']['#text'] - thermal_capacity = archetype['thermal_capacity']['#text'] + thermal_capacity = str(float(archetype['thermal_capacity']['#text']) * 1000) extra_loses_due_to_thermal_bridges = archetype['extra_loses_due_to_thermal_bridges']['#text'] indirect_heated_ratio = archetype['indirect_heated_ratio']['#text'] infiltration_rate_for_ventilation_system_off = archetype['infiltration_rate_for_ventilation_system_off']['#text'] diff --git a/city_model_structure/building_demand/thermal_boundary.py b/city_model_structure/building_demand/thermal_boundary.py index cf5ede7c..70998758 100644 --- a/city_model_structure/building_demand/thermal_boundary.py +++ b/city_model_structure/building_demand/thermal_boundary.py @@ -223,7 +223,7 @@ class ThermalBoundary: if layer.material.no_mass: r_value += float(layer.material.thermal_resistance) else: - r_value = r_value + float(layer.material.conductivity) / float(layer.thickness) + r_value += float(layer.thickness) / float(layer.material.conductivity) self._u_value = 1.0/r_value except TypeError: raise Exception('Constructions layers are not initialized') from TypeError diff --git a/city_model_structure/building_demand/thermal_opening.py b/city_model_structure/building_demand/thermal_opening.py index 89f90db4..5310d93b 100644 --- a/city_model_structure/building_demand/thermal_opening.py +++ b/city_model_structure/building_demand/thermal_opening.py @@ -76,7 +76,7 @@ class ThermalOpening: if self._overall_u_value is None and self.thickness is not None: h_i = self.hi h_e = self.he - r_value = 1 / h_i + 1 / h_e + float(self._conductivity) / float(self.thickness) + r_value = 1 / h_i + 1 / h_e + float(self.thickness) / float(self._conductivity) self._overall_u_value = 1 / r_value @property @@ -134,7 +134,7 @@ class ThermalOpening: if self._overall_u_value is None and self.conductivity is not None: h_i = self.hi h_e = self.he - r_value = 1 / h_i + 1 / h_e + float(self.conductivity) / float(self._thickness) + r_value = 1 / h_i + 1 / h_e + float(self._thickness) / float(self.conductivity) self._overall_u_value = 1 / r_value @property diff --git a/exports/building_energy/insel/insel_monthly_energy_balance.py b/exports/building_energy/insel/insel_monthly_energy_balance.py index b2471cfd..ef9a4db4 100644 --- a/exports/building_energy/insel/insel_monthly_energy_balance.py +++ b/exports/building_energy/insel/insel_monthly_energy_balance.py @@ -1,3 +1,10 @@ +""" +InselMonthlyEnergyBalance exports models to insel format +SPDX - License - Identifier: LGPL - 3.0 - or -later +Copyright © 2022 Concordia CERC group +Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca +""" + import numpy as np from pathlib import Path @@ -53,8 +60,8 @@ class InselMonthlyEnergyBalance(Insel): inputs.append(f"{str(100 + i)}.1 % Radiation surface {str(i)}") # BUILDING PARAMETERS - parameters = [f'{0.85 * building.volume} % BP(1) Heated Volume (vBrutto)', - f'{building.average_storey_height} % BP(2) Average storey height / m', + parameters = [f'{0.85 * building.volume} % BP(1) Heated Volume (m3)', + f'{building.average_storey_height} % BP(2) Average storey height (m)', f'{building.storeys_above_ground} % BP(3) Number of storeys above ground', f'{building.attic_heated} % BP(4) Attic heating type (0=no room, 1=unheated, 2=heated)', f'{building.basement_heated} % BP(5) Cellar heating type (0=no room, 1=unheated, 2=heated, ' @@ -64,40 +71,40 @@ class InselMonthlyEnergyBalance(Insel): internal_zone = building.internal_zones[0] thermal_zone = internal_zone.thermal_zones[0] parameters.append(f'{thermal_zone.indirectly_heated_area_ratio} % BP(6) Indirectly heated area ratio') - parameters.append(f'{thermal_zone.effective_thermal_capacity} % BP(7) Effective heat capacity') - parameters.append(f'{thermal_zone.additional_thermal_bridge_u_value * thermal_zone.total_floor_area} ' - f'% BP(8) Additional U-value for heat bridge') - parameters.append('0 % BP(9) Usage type (0=standard, 1=IWU)') + parameters.append(f'{thermal_zone.effective_thermal_capacity / 1000} % BP(7) Effective heat capacity (kJ/m2K)') + parameters.append(f'{thermal_zone.additional_thermal_bridge_u_value} ' + f'% BP(8) Additional U-value for heat bridge W/m2K') + parameters.append('1 % BP(9) Usage type (0=standard, 1=IWU)') # ZONES AND SURFACES - parameters.append(f'{len(internal_zone.usage_zones)} % BP(10) Number $z$ of zones') + parameters.append(f'{len(internal_zone.usage_zones)} % BP(10) Number of zones') for i, usage_zone in enumerate(internal_zone.usage_zones): percentage_usage = usage_zone.percentage - parameters.append(f'{float(internal_zone.area) * percentage_usage} % BP(11) #1 Area of zone {i + 1} (sqm)') + parameters.append(f'{float(internal_zone.area) * percentage_usage} % BP(11) #1 Area of zone {i + 1} (m2)') total_internal_gain = 0 for ig in usage_zone.internal_gains: total_internal_gain += float(ig.average_internal_gain) * \ (float(ig.convective_fraction) + float(ig.radiative_fraction)) parameters.append(f'{total_internal_gain} % BP(12) #2 Internal gains of zone {i + 1}') parameters.append(f'{usage_zone.thermal_control.mean_heating_set_point} % BP(13) #3 Heating setpoint temperature ' - f'zone {i + 1} (tSetHeat)') + f'zone {i + 1} (degree Celsius)') parameters.append(f'{usage_zone.thermal_control.heating_set_back} % BP(14) #4 Heating setback temperature ' - f'zone {i + 1} (tSetbackHeat)') + f'zone {i + 1} (degree Celsius)') parameters.append(f'{usage_zone.thermal_control.mean_cooling_set_point} % BP(15) #5 Cooling setpoint temperature ' - f'zone {i + 1} (tSetCool)') + f'zone {i + 1} (degree Celsius)') parameters.append(f'{usage_zone.hours_day} % BP(16) #6 Usage hours per day zone {i + 1}') parameters.append(f'{usage_zone.days_year} % BP(17) #7 Usage days per year zone {i + 1}') - parameters.append(f'{usage_zone.mechanical_air_change} % BP(18) #8 Minimum air change rate zone {i + 1} (h^-1)') + parameters.append(f'{usage_zone.mechanical_air_change} % BP(18) #8 Minimum air change rate zone {i + 1} (ACH)') parameters.append(f'{len(thermal_zone.thermal_boundaries)} % Number of surfaces = BP(11+8z) \n' f'% 1. Surface type (1=wall, 2=ground 3=roof, 4=flat roof)\n' - f'% 2. Areas above ground\n' - f'% 3. Areas below ground\n' - f'% 4. U-value\n' - f'% 5. Window area\n' + f'% 2. Areas above ground (m2)\n' + f'% 3. Areas below ground (m2)\n' + f'% 4. U-value (W/m2K)\n' + f'% 5. Window area (m2)\n' f'% 6. Window frame fraction\n' - f'% 7. Window U-value\n' + f'% 7. Window U-value (W/m2K)\n' f'% 8. Window g-value\n' f'% 9. Short-wave reflectance\n' f'% #1 #2 #3 #4 #5 #6 #7 #8 #9\n') @@ -107,10 +114,14 @@ class InselMonthlyEnergyBalance(Insel): window_area = thermal_boundary.opaque_area * thermal_boundary.window_ratio / (1 - thermal_boundary.window_ratio) parameters.append(type_code) - parameters.append(0.85 * thermal_boundary.opaque_area) - parameters.append('0.0') + if thermal_boundary.type != cte.GROUND: + parameters.append(thermal_boundary.opaque_area + window_area) + parameters.append('0.0') + else: + parameters.append('0.0') + parameters.append(thermal_boundary.opaque_area + window_area) parameters.append(thermal_boundary.u_value) - parameters.append(0.85 * window_area) + parameters.append(window_area) if window_area <= 0.001: parameters.append(0.0) @@ -130,7 +141,7 @@ class InselMonthlyEnergyBalance(Insel): i_block = 20 inputs = ['1'] - parameters = ['12 % Monthly ambient temperature'] + parameters = ['12 % Monthly ambient temperature (degree Celsius)'] external_temperature = building.external_temperature[cte.MONTH] @@ -151,9 +162,9 @@ class InselMonthlyEnergyBalance(Insel): for i, surface in enumerate(surfaces): i_block = 101 + i - inputs = ['1 % Monthly surface radiation (W/sqm)'] + inputs = ['1 % Monthly surface radiation (W/m2)'] parameters = [f'12 % Azimuth {np.rad2deg(surface.azimuth)}, ' - f'inclination {np.rad2deg(surface.inclination)} degrees'] + f'inclination {np.rad2deg(surface.inclination)} (degrees)'] if surface.type != 'Ground': global_irradiance = surface.global_irradiance[cte.MONTH] diff --git a/imports/usage/comnet_usage_parameters.py b/imports/usage/comnet_usage_parameters.py index 72eeefd6..c1cf1117 100644 --- a/imports/usage/comnet_usage_parameters.py +++ b/imports/usage/comnet_usage_parameters.py @@ -42,8 +42,8 @@ class ComnetUsageParameters: """ number_usage_types = 33 xl_file = pd.ExcelFile(self._base_path) - file_data = pd.read_excel(xl_file, sheet_name="Modeling Data", skiprows=[0, 1, 2], - nrows=number_usage_types, usecols="A:AB") + file_data = pd.read_excel(xl_file, sheet_name="Modeling Data", usecols="A:AB", skiprows=[0, 1, 2], + nrows=number_usage_types) lighting_data = {} plug_loads_data = {} @@ -109,8 +109,8 @@ class ComnetUsageParameters: schedules_usage = UsageHelper.schedules_key(data['schedules_key'][comnet_usage][0]) - _extracted_data = pd.read_excel(schedules_data, sheet_name=schedules_usage, - skiprows=[0, 1, 2, 3], nrows=39, usecols="A:AA") + _extracted_data = pd.read_excel(schedules_data, sheet_name=schedules_usage, usecols="A:AA", skiprows=[0, 1, 2, 3], + nrows=39) schedules = [] number_of_schedule_types = 13 schedules_per_schedule_type = 3