From ee58d21b4710e917f0bb3ab7dc24885932269b01 Mon Sep 17 00:00:00 2001 From: p_monsalvete Date: Tue, 23 May 2023 17:19:50 -0400 Subject: [PATCH] solved some small errors in meb exporter --- .../montreal_custom_systems.xml | 159 ++++++------------ .../insel/insel_monthly_energy_balance.py | 10 +- hub/helpers/configuration_helper.py | 2 +- hub/helpers/constants.py | 12 +- .../construction/nrcan_physics_parameters.py | 17 +- hub/imports/usage/nrcan_usage_parameters.py | 6 +- 6 files changed, 77 insertions(+), 129 deletions(-) diff --git a/hub/data/energy_systems/montreal_custom_systems.xml b/hub/data/energy_systems/montreal_custom_systems.xml index 97813ec6..99c073e9 100644 --- a/hub/data/energy_systems/montreal_custom_systems.xml +++ b/hub/data/energy_systems/montreal_custom_systems.xml @@ -1,181 +1,116 @@ - - - Fuel-fired water boiler - 0.85 - - - Electric water boiler - 1 - - - Fuel-fired furnace and fuel boiler for acs - 0.85 - - - Electrical furnace and fuel boiler for acs - 1 - - - Air cooled DX with external condenser - 3.23 - - - PV system - 0.22 - - - - - ??? - 10 - 1000000000 - 1000000000 - - - ??? - 25 - 1000000000 - 1000000000 - - - ??? - 0 - 1000000000 - 1000000000 - - - - - Baseboards - ??? - - - + Fuel-fired water boiler with baseboards heating domestic_hot_water - - 1 - 1 - ??? - + 0.85 + 10 + 1000000000 + 1000000000 false - + Electrical resistance water boiler heating domestic_hot_water - - 2 - 1 - ??? - + 1 + 10 + 1000000000 + 1000000000 true - + Fuel-fired furnace and fuel boiler for acs heating domestic_hot_water - - 3 - 2 - ??? - + 0.85 + 25 + 1000000000 + 1000000000 false - + Electrical resistance furnace and electrical boiler for acs heating domestic_hot_water - - 4 - 2 - ??? - + 1 + 25 + 1000000000 + 1000000000 false - + Baseboards: hydronic with fuel boiler heating domestic_hot_water - - 1 - 1 - ??? - + 0.85 + 10 + 1000000000 + 1000000000 false - + Electrical baseboards and electrical boiler for acs heating domestic_hot_water - - 2 - 3 - ??? - + 1 + 0 + 1000000000 + 1000000000 false - + Air cooled DX with external condenser cooling - - 5 - 3 - ??? - + 3.23 + 0 + 1000000000 + 1000000000 false - + Water cooled, water chiller cooling - - 5 - 1 - ??? - + 3.23 + 10 + 1000000000 + 1000000000 false - + Air cooled DX cooling - - 5 - 3 - ??? - + 3.23 + 0 + 1000000000 + 1000000000 false - + PV system electricity - - 6 - ??? - ??? - + 0.22 true 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 6cd228c5..c5286e51 100644 --- a/hub/exports/building_energy/insel/insel_monthly_energy_balance.py +++ b/hub/exports/building_energy/insel/insel_monthly_energy_balance.py @@ -130,7 +130,15 @@ class InselMonthlyEnergyBalance(Insel): f'% BP(11) #1 Area of zone {i + 1} (m2)') total_internal_gain = 0 for ig in usage.internal_gains: - total_internal_gain += ig.average_internal_gain * (ig.convective_fraction + ig.radiative_fraction) + internal_gain = ig.average_internal_gain * (ig.convective_fraction + ig.radiative_fraction) + for schedule in ig.schedules: + total_values = sum(schedule.values) + total_hours = 0 + for day_type in schedule.day_types: + total_hours += cte.DAYS_A_YEAR[day_type] / 365 / 24 + total_values *= total_hours + total_internal_gain += internal_gain * total_values + parameters.append(f'{total_internal_gain} % BP(12) #2 Internal gains of zone {i + 1}') parameters.append(f'{usage.thermal_control.mean_heating_set_point} % BP(13) #3 Heating setpoint temperature ' f'zone {i + 1} (degree Celsius)') diff --git a/hub/helpers/configuration_helper.py b/hub/helpers/configuration_helper.py index 936d46c7..2128cd45 100644 --- a/hub/helpers/configuration_helper.py +++ b/hub/helpers/configuration_helper.py @@ -127,7 +127,7 @@ class ConfigurationHelper: def soil_thickness(self) -> float: """ Get configured soil thickness for surfaces touching the ground - :return: 0.5 + :return: 0.5 m """ return self._config.getfloat('buildings', 'soil_thickness').real diff --git a/hub/helpers/constants.py b/hub/helpers/constants.py index c4a933aa..8b6df87b 100644 --- a/hub/helpers/constants.py +++ b/hub/helpers/constants.py @@ -57,14 +57,14 @@ DAYS_A_MONTH = {'monday': [5, 4, 4, 5, 4, 4, 5, 4, 4, 5, 4, 5], 'sunday': [4, 4, 4, 5, 4, 4, 5, 4, 5, 4, 4, 5], 'holiday': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]} -DAYS_A_YEAR = {'monday': 53, - 'tuesday': 52, - 'wednesday': 52, - 'thursday': 52, - 'friday': 52, +DAYS_A_YEAR = {'monday': 51, + 'tuesday': 50, + 'wednesday': 50, + 'thursday': 50, + 'friday': 50, 'saturday': 52, 'sunday': 52, - 'holiday': 0} + 'holiday': 10} # data types ANY_NUMBER = 'any_number' diff --git a/hub/imports/construction/nrcan_physics_parameters.py b/hub/imports/construction/nrcan_physics_parameters.py index d1d5db99..5574acb5 100644 --- a/hub/imports/construction/nrcan_physics_parameters.py +++ b/hub/imports/construction/nrcan_physics_parameters.py @@ -105,18 +105,19 @@ class NrcanPhysicsParameters: thermal_boundary.window_ratio = 0 if thermal_boundary.type == cte.WALL or thermal_boundary.type == cte.ROOF: if construction_archetype.window is not None: - if math.pi / 4 <= thermal_boundary.parent_surface.azimuth < 3 * math.pi / 4: + if -math.sqrt(2) / 2 < math.sin(thermal_boundary.parent_surface.azimuth) < math.sqrt(2) / 2: + if 0 < math.cos(thermal_boundary.parent_surface.azimuth): + thermal_boundary.window_ratio = \ + float(construction_archetype.window_ratio['north']) / 100 + else: + thermal_boundary.window_ratio = \ + float(construction_archetype.window_ratio['south']) / 100 + elif math.sqrt(2) / 2 <= math.sin(thermal_boundary.parent_surface.azimuth): thermal_boundary.window_ratio = \ float(construction_archetype.window_ratio['east']) / 100 - elif 3 * math.pi / 4 <= thermal_boundary.parent_surface.azimuth < 5 * math.pi / 4: - thermal_boundary.window_ratio = \ - float(construction_archetype.window_ratio['south']) / 100 - elif 5 * math.pi / 4 <= thermal_boundary.parent_surface.azimuth < 7 * math.pi / 4: - thermal_boundary.window_ratio = \ - float(construction_archetype.window_ratio['west']) / 100 else: thermal_boundary.window_ratio = \ - float(construction_archetype.window_ratio['north']) / 100 + float(construction_archetype.window_ratio['west']) / 100 except ValueError: # This is the normal operation way when the windows are defined in the geometry continue diff --git a/hub/imports/usage/nrcan_usage_parameters.py b/hub/imports/usage/nrcan_usage_parameters.py index 62d5e44d..6bf16958 100644 --- a/hub/imports/usage/nrcan_usage_parameters.py +++ b/hub/imports/usage/nrcan_usage_parameters.py @@ -54,6 +54,9 @@ class NrcanUsageParameters: sys.stderr.write(f'Building {building.name} has unknown usage archetype for usage: {comnet_usage_name}\n') continue + storeys = int(building.eave_height / building.average_storey_height) + volume_per_area = building.volume / building.floor_area / storeys + for internal_zone in building.internal_zones: if internal_zone.area is None: raise Exception('Internal zone area not defined, ACH cannot be calculated') @@ -61,7 +64,8 @@ class NrcanUsageParameters: raise Exception('Internal zone volume not defined, ACH cannot be calculated') if internal_zone.area <= 0: raise Exception('Internal zone area is zero, ACH cannot be calculated') - volume_per_area = internal_zone.volume / internal_zone.area + if len(building.internal_zones) > 1: + volume_per_area = internal_zone.volume / internal_zone.area usage = Usage() usage.name = usage_name self._assign_values(usage, archetype_usage, volume_per_area, building.cold_water_temperature)