Merge branch 'bugs_in_meb_exporter' into 'master'
Bugs in meb exporter See merge request Guille/hub!42
This commit is contained in:
commit
610bcfcb80
|
@ -116,7 +116,7 @@ class NrelCatalog(Catalog):
|
||||||
climate_zone = archetype['@climate_zone']
|
climate_zone = archetype['@climate_zone']
|
||||||
construction_period = reference_standard_to_construction_period[archetype['@reference_standard']]
|
construction_period = reference_standard_to_construction_period[archetype['@reference_standard']]
|
||||||
average_storey_height = archetype['average_storey_height']['#text']
|
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']
|
extra_loses_due_to_thermal_bridges = archetype['extra_loses_due_to_thermal_bridges']['#text']
|
||||||
indirect_heated_ratio = archetype['indirect_heated_ratio']['#text']
|
indirect_heated_ratio = archetype['indirect_heated_ratio']['#text']
|
||||||
infiltration_rate_for_ventilation_system_off = archetype['infiltration_rate_for_ventilation_system_off']['#text']
|
infiltration_rate_for_ventilation_system_off = archetype['infiltration_rate_for_ventilation_system_off']['#text']
|
||||||
|
|
|
@ -215,7 +215,7 @@ class ThermalBoundary:
|
||||||
h_i = self.hi
|
h_i = self.hi
|
||||||
h_e = self.he
|
h_e = self.he
|
||||||
if self.type == cte.GROUND:
|
if self.type == cte.GROUND:
|
||||||
r_value = 1.0 / h_i
|
r_value = 1.0 / h_i + ch().soil_thickness / ch().soil_conductivity
|
||||||
else:
|
else:
|
||||||
r_value = 1.0/h_i + 1.0/h_e
|
r_value = 1.0/h_i + 1.0/h_e
|
||||||
try:
|
try:
|
||||||
|
@ -223,7 +223,7 @@ class ThermalBoundary:
|
||||||
if layer.material.no_mass:
|
if layer.material.no_mass:
|
||||||
r_value += float(layer.material.thermal_resistance)
|
r_value += float(layer.material.thermal_resistance)
|
||||||
else:
|
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
|
self._u_value = 1.0/r_value
|
||||||
except TypeError:
|
except TypeError:
|
||||||
raise Exception('Constructions layers are not initialized') from TypeError
|
raise Exception('Constructions layers are not initialized') from TypeError
|
||||||
|
|
|
@ -76,7 +76,7 @@ class ThermalOpening:
|
||||||
if self._overall_u_value is None and self.thickness is not None:
|
if self._overall_u_value is None and self.thickness is not None:
|
||||||
h_i = self.hi
|
h_i = self.hi
|
||||||
h_e = self.he
|
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
|
self._overall_u_value = 1 / r_value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -134,7 +134,7 @@ class ThermalOpening:
|
||||||
if self._overall_u_value is None and self.conductivity is not None:
|
if self._overall_u_value is None and self.conductivity is not None:
|
||||||
h_i = self.hi
|
h_i = self.hi
|
||||||
h_e = self.he
|
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
|
self._overall_u_value = 1 / r_value
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
|
@ -11,5 +11,10 @@ comnet_occupancy_sensible_radiant = 0.1
|
||||||
comnet_plugs_latent = 0
|
comnet_plugs_latent = 0
|
||||||
comnet_plugs_convective = 0.75
|
comnet_plugs_convective = 0.75
|
||||||
comnet_plugs_radiant = 0.25
|
comnet_plugs_radiant = 0.25
|
||||||
|
#W/m2K
|
||||||
convective_heat_transfer_coefficient_interior = 3.5
|
convective_heat_transfer_coefficient_interior = 3.5
|
||||||
convective_heat_transfer_coefficient_exterior = 20
|
convective_heat_transfer_coefficient_exterior = 20
|
||||||
|
#W/mK
|
||||||
|
soil_conductivity = 3
|
||||||
|
#m
|
||||||
|
soil_thickness = 0.5
|
|
@ -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
|
import numpy as np
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
@ -53,8 +60,8 @@ class InselMonthlyEnergyBalance(Insel):
|
||||||
inputs.append(f"{str(100 + i)}.1 % Radiation surface {str(i)}")
|
inputs.append(f"{str(100 + i)}.1 % Radiation surface {str(i)}")
|
||||||
|
|
||||||
# BUILDING PARAMETERS
|
# BUILDING PARAMETERS
|
||||||
parameters = [f'{0.85 * building.volume} % BP(1) Heated Volume (vBrutto)',
|
parameters = [f'{0.85 * building.volume} % BP(1) Heated Volume (m3)',
|
||||||
f'{building.average_storey_height} % BP(2) Average storey height / m',
|
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.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.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, '
|
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]
|
internal_zone = building.internal_zones[0]
|
||||||
thermal_zone = internal_zone.thermal_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.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.effective_thermal_capacity / 1000} % BP(7) Effective heat capacity (kJ/m2K)')
|
||||||
parameters.append(f'{thermal_zone.additional_thermal_bridge_u_value * thermal_zone.total_floor_area} '
|
parameters.append(f'{thermal_zone.additional_thermal_bridge_u_value} '
|
||||||
f'% BP(8) Additional U-value for heat bridge')
|
f'% BP(8) Additional U-value for heat bridge W/m2K')
|
||||||
parameters.append('0 % BP(9) Usage type (0=standard, 1=IWU)')
|
parameters.append('1 % BP(9) Usage type (0=standard, 1=IWU)')
|
||||||
|
|
||||||
# ZONES AND SURFACES
|
# 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):
|
for i, usage_zone in enumerate(internal_zone.usage_zones):
|
||||||
percentage_usage = usage_zone.percentage
|
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
|
total_internal_gain = 0
|
||||||
for ig in usage_zone.internal_gains:
|
for ig in usage_zone.internal_gains:
|
||||||
total_internal_gain += float(ig.average_internal_gain) * \
|
total_internal_gain += float(ig.average_internal_gain) * \
|
||||||
(float(ig.convective_fraction) + float(ig.radiative_fraction))
|
(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'{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 '
|
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 '
|
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 '
|
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.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.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'
|
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'% 1. Surface type (1=wall, 2=ground 3=roof, 4=flat roof)\n'
|
||||||
f'% 2. Areas above ground\n'
|
f'% 2. Areas above ground (m2)\n'
|
||||||
f'% 3. Areas below ground\n'
|
f'% 3. Areas below ground (m2)\n'
|
||||||
f'% 4. U-value\n'
|
f'% 4. U-value (W/m2K)\n'
|
||||||
f'% 5. Window area\n'
|
f'% 5. Window area (m2)\n'
|
||||||
f'% 6. Window frame fraction\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'% 8. Window g-value\n'
|
||||||
f'% 9. Short-wave reflectance\n'
|
f'% 9. Short-wave reflectance\n'
|
||||||
f'% #1 #2 #3 #4 #5 #6 #7 #8 #9\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)
|
window_area = thermal_boundary.opaque_area * thermal_boundary.window_ratio / (1 - thermal_boundary.window_ratio)
|
||||||
|
|
||||||
parameters.append(type_code)
|
parameters.append(type_code)
|
||||||
parameters.append(0.85 * thermal_boundary.opaque_area)
|
if thermal_boundary.type != cte.GROUND:
|
||||||
parameters.append('0.0')
|
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(thermal_boundary.u_value)
|
||||||
parameters.append(0.85 * window_area)
|
parameters.append(window_area)
|
||||||
|
|
||||||
if window_area <= 0.001:
|
if window_area <= 0.001:
|
||||||
parameters.append(0.0)
|
parameters.append(0.0)
|
||||||
|
@ -130,7 +141,7 @@ class InselMonthlyEnergyBalance(Insel):
|
||||||
|
|
||||||
i_block = 20
|
i_block = 20
|
||||||
inputs = ['1']
|
inputs = ['1']
|
||||||
parameters = ['12 % Monthly ambient temperature']
|
parameters = ['12 % Monthly ambient temperature (degree Celsius)']
|
||||||
|
|
||||||
external_temperature = building.external_temperature[cte.MONTH]
|
external_temperature = building.external_temperature[cte.MONTH]
|
||||||
|
|
||||||
|
@ -151,9 +162,9 @@ class InselMonthlyEnergyBalance(Insel):
|
||||||
|
|
||||||
for i, surface in enumerate(surfaces):
|
for i, surface in enumerate(surfaces):
|
||||||
i_block = 101 + i
|
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)}, '
|
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':
|
if surface.type != 'Ground':
|
||||||
global_irradiance = surface.global_irradiance[cte.MONTH]
|
global_irradiance = surface.global_irradiance[cte.MONTH]
|
||||||
|
|
|
@ -111,7 +111,7 @@ class ConfigurationHelper:
|
||||||
def convective_heat_transfer_coefficient_interior(self) -> float:
|
def convective_heat_transfer_coefficient_interior(self) -> float:
|
||||||
"""
|
"""
|
||||||
Get configured convective heat transfer coefficient for surfaces inside the building
|
Get configured convective heat transfer coefficient for surfaces inside the building
|
||||||
:return: 3.5
|
:return: 3.5 W/m2K
|
||||||
"""
|
"""
|
||||||
return self._config.getfloat('buildings', 'convective_heat_transfer_coefficient_interior').real
|
return self._config.getfloat('buildings', 'convective_heat_transfer_coefficient_interior').real
|
||||||
|
|
||||||
|
@ -119,6 +119,22 @@ class ConfigurationHelper:
|
||||||
def convective_heat_transfer_coefficient_exterior(self) -> float:
|
def convective_heat_transfer_coefficient_exterior(self) -> float:
|
||||||
"""
|
"""
|
||||||
Get configured convective heat transfer coefficient for surfaces outside the building
|
Get configured convective heat transfer coefficient for surfaces outside the building
|
||||||
:return: 20
|
:return: 20 W/m2K
|
||||||
"""
|
"""
|
||||||
return self._config.getfloat('buildings', 'convective_heat_transfer_coefficient_exterior').real
|
return self._config.getfloat('buildings', 'convective_heat_transfer_coefficient_exterior').real
|
||||||
|
|
||||||
|
@property
|
||||||
|
def soil_conductivity(self) -> float:
|
||||||
|
"""
|
||||||
|
Get configured soil conductivity for surfaces touching the ground
|
||||||
|
:return: 3 W/mK
|
||||||
|
"""
|
||||||
|
return self._config.getfloat('buildings', 'soil_conductivity').real
|
||||||
|
|
||||||
|
@property
|
||||||
|
def soil_thickness(self) -> float:
|
||||||
|
"""
|
||||||
|
Get configured soil thickness for surfaces touching the ground
|
||||||
|
:return: 0.5
|
||||||
|
"""
|
||||||
|
return self._config.getfloat('buildings', 'soil_thickness').real
|
||||||
|
|
|
@ -42,8 +42,8 @@ class ComnetUsageParameters:
|
||||||
"""
|
"""
|
||||||
number_usage_types = 33
|
number_usage_types = 33
|
||||||
xl_file = pd.ExcelFile(self._base_path)
|
xl_file = pd.ExcelFile(self._base_path)
|
||||||
file_data = pd.read_excel(xl_file, sheet_name="Modeling Data", skiprows=[0, 1, 2],
|
file_data = pd.read_excel(xl_file, sheet_name="Modeling Data", usecols="A:AB", skiprows=[0, 1, 2],
|
||||||
nrows=number_usage_types, usecols="A:AB")
|
nrows=number_usage_types)
|
||||||
|
|
||||||
lighting_data = {}
|
lighting_data = {}
|
||||||
plug_loads_data = {}
|
plug_loads_data = {}
|
||||||
|
@ -109,8 +109,8 @@ class ComnetUsageParameters:
|
||||||
|
|
||||||
schedules_usage = UsageHelper.schedules_key(data['schedules_key'][comnet_usage][0])
|
schedules_usage = UsageHelper.schedules_key(data['schedules_key'][comnet_usage][0])
|
||||||
|
|
||||||
_extracted_data = pd.read_excel(schedules_data, sheet_name=schedules_usage,
|
_extracted_data = pd.read_excel(schedules_data, sheet_name=schedules_usage, usecols="A:AA", skiprows=[0, 1, 2, 3],
|
||||||
skiprows=[0, 1, 2, 3], nrows=39, usecols="A:AA")
|
nrows=39)
|
||||||
schedules = []
|
schedules = []
|
||||||
number_of_schedule_types = 13
|
number_of_schedule_types = 13
|
||||||
schedules_per_schedule_type = 3
|
schedules_per_schedule_type = 3
|
||||||
|
|
Loading…
Reference in New Issue
Block a user