solved some small errors in meb exporter

This commit is contained in:
Pilar Monsalvete 2023-05-23 17:19:50 -04:00
parent d432373156
commit ee58d21b47
6 changed files with 77 additions and 129 deletions

View File

@ -1,181 +1,116 @@
<catalog lod="1"> <catalog lod="1">
<generation_equipments>
<equipment id="1" type="boiler" fuel_type="gas">
<name>Fuel-fired water boiler</name>
<heating_efficiency>0.85</heating_efficiency>
</equipment>
<equipment id="2" type="boiler" fuel_type="electricity">
<name>Electric water boiler</name>
<heating_efficiency>1</heating_efficiency>
</equipment>
<equipment id="3" type="furnace" fuel_type="gas">
<name>Fuel-fired furnace and fuel boiler for acs</name>
<heating_efficiency>0.85</heating_efficiency>
</equipment>
<equipment id="4" type="furnace" fuel_type="electricity">
<name>Electrical furnace and fuel boiler for acs</name>
<heating_efficiency>1</heating_efficiency>
</equipment>
<equipment id="5" type="cooler" fuel_type="electricity">
<name>Air cooled DX with external condenser</name>
<cooling_efficiency>3.23</cooling_efficiency>
</equipment>
<equipment id="6" type="electricity generator" fuel_type="renewable">
<name>PV system</name>
<electrical_efficiency>0.22</electrical_efficiency>
</equipment>
</generation_equipments>
<distribution_equipments>
<equipment id="1" type="??">
<name>???</name>
<distribution_heat_losses units="%">10</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">1000000000</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">1000000000</distribution_consumption_variable_flow>
</equipment>
<equipment id="2" type="??">
<name>???</name>
<distribution_heat_losses units="%">25</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">1000000000</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">1000000000</distribution_consumption_variable_flow>
</equipment>
<equipment id="3" type="??">
<name>???</name>
<distribution_heat_losses units="%">0</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">1000000000</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">1000000000</distribution_consumption_variable_flow>
</equipment>
</distribution_equipments>
<dissipation_equipments>
<equipment id="1" type="baseboards">
<name>Baseboards</name>
<parasitic_consumption>???</parasitic_consumption>
</equipment>
</dissipation_equipments>
<systems> <systems>
<system id = "1"> <system id="1" type="boiler" fuel_type="gas">
<name>Fuel-fired water boiler with baseboards</name> <name>Fuel-fired water boiler with baseboards</name>
<demands> <demands>
<demand>heating</demand> <demand>heating</demand>
<demand>domestic_hot_water</demand> <demand>domestic_hot_water</demand>
</demands> </demands>
<equipments> <heating_efficiency>0.85</heating_efficiency>
<generation_id>1</generation_id> <distribution_heat_losses units="%">10</distribution_heat_losses>
<distribution_id>1</distribution_id> <distribution_consumption_fix_flow units="%">1000000000</distribution_consumption_fix_flow>
<dissipation_id>???</dissipation_id> <distribution_consumption_variable_flow units="%">1000000000</distribution_consumption_variable_flow>
</equipments>
<storage>false</storage> <storage>false</storage>
</system> </system>
<system id="2"> <system id="2" type="boiler" fuel_type="electricity">
<name>Electrical resistance water boiler</name> <name>Electrical resistance water boiler</name>
<demands> <demands>
<demand>heating</demand> <demand>heating</demand>
<demand>domestic_hot_water</demand> <demand>domestic_hot_water</demand>
</demands> </demands>
<equipments> <heating_efficiency>1</heating_efficiency>
<generation_id>2</generation_id> <distribution_heat_losses units="%">10</distribution_heat_losses>
<distribution_id>1</distribution_id> <distribution_consumption_fix_flow units="%">1000000000</distribution_consumption_fix_flow>
<dissipation_id>???</dissipation_id> <distribution_consumption_variable_flow units="%">1000000000</distribution_consumption_variable_flow>
</equipments>
<storage>true</storage> <storage>true</storage>
</system> </system>
<system id="3"> <system id="3" type="furnace" fuel_type="gas">
<name>Fuel-fired furnace and fuel boiler for acs</name> <name>Fuel-fired furnace and fuel boiler for acs</name>
<demands> <demands>
<demand>heating</demand> <demand>heating</demand>
<demand>domestic_hot_water</demand> <demand>domestic_hot_water</demand>
</demands> </demands>
<equipments> <heating_efficiency>0.85</heating_efficiency>
<generation_id>3</generation_id> <distribution_heat_losses units="%">25</distribution_heat_losses>
<distribution_id>2</distribution_id> <distribution_consumption_fix_flow units="%">1000000000</distribution_consumption_fix_flow>
<dissipation_id>???</dissipation_id> <distribution_consumption_variable_flow units="%">1000000000</distribution_consumption_variable_flow>
</equipments>
<storage>false</storage> <storage>false</storage>
</system> </system>
<system id="4"> <system id="4" type="furnace" fuel_type="electricity">
<name>Electrical resistance furnace and electrical boiler for acs</name> <name>Electrical resistance furnace and electrical boiler for acs</name>
<demands> <demands>
<demand>heating</demand> <demand>heating</demand>
<demand>domestic_hot_water</demand> <demand>domestic_hot_water</demand>
</demands> </demands>
<equipments> <heating_efficiency>1</heating_efficiency>
<generation_id>4</generation_id> <distribution_heat_losses units="%">25</distribution_heat_losses>
<distribution_id>2</distribution_id> <distribution_consumption_fix_flow units="%">1000000000</distribution_consumption_fix_flow>
<dissipation_id>???</dissipation_id> <distribution_consumption_variable_flow units="%">1000000000</distribution_consumption_variable_flow>
</equipments>
<storage>false</storage> <storage>false</storage>
</system> </system>
<system id="5"> <system id="5" type="baseboard" fuel_type="gas">
<name>Baseboards: hydronic with fuel boiler</name> <name>Baseboards: hydronic with fuel boiler</name>
<demands> <demands>
<demand>heating</demand> <demand>heating</demand>
<demand>domestic_hot_water</demand> <demand>domestic_hot_water</demand>
</demands> </demands>
<equipments> <heating_efficiency>0.85</heating_efficiency>
<generation_id>1</generation_id> <distribution_heat_losses units="%">10</distribution_heat_losses>
<distribution_id>1</distribution_id> <distribution_consumption_fix_flow units="%">1000000000</distribution_consumption_fix_flow>
<dissipation_id>???</dissipation_id> <distribution_consumption_variable_flow units="%">1000000000</distribution_consumption_variable_flow>
</equipments>
<storage>false</storage> <storage>false</storage>
</system> </system>
<system id="6"> <system id="6" type="baseboard" fuel_type="electricity">
<name>Electrical baseboards and electrical boiler for acs</name> <name>Electrical baseboards and electrical boiler for acs</name>
<demands> <demands>
<demand>heating</demand> <demand>heating</demand>
<demand>domestic_hot_water</demand> <demand>domestic_hot_water</demand>
</demands> </demands>
<equipments> <heating_efficiency>1</heating_efficiency>
<generation_id>2</generation_id> <distribution_heat_losses units="%">0</distribution_heat_losses>
<distribution_id>3</distribution_id> <distribution_consumption_fix_flow units="%">1000000000</distribution_consumption_fix_flow>
<dissipation_id>???</dissipation_id> <distribution_consumption_variable_flow units="%">1000000000</distribution_consumption_variable_flow>
</equipments>
<storage>false</storage> <storage>false</storage>
</system> </system>
<system id="7"> <system id="7" type="cooler" fuel_type="electricity">
<name>Air cooled DX with external condenser</name> <name>Air cooled DX with external condenser</name>
<demands> <demands>
<demand>cooling</demand> <demand>cooling</demand>
</demands> </demands>
<equipments> <cooling_efficiency>3.23</cooling_efficiency>
<generation_id>5</generation_id> <distribution_heat_losses units="%">0</distribution_heat_losses>
<distribution_id>3</distribution_id> <distribution_consumption_fix_flow units="%">1000000000</distribution_consumption_fix_flow>
<dissipation_id>???</dissipation_id> <distribution_consumption_variable_flow units="%">1000000000</distribution_consumption_variable_flow>
</equipments>
<storage>false</storage> <storage>false</storage>
</system> </system>
<system id="8"> <system id="8" type="cooler" fuel_type="electricity">
<name>Water cooled, water chiller</name> <name>Water cooled, water chiller</name>
<demands> <demands>
<demand>cooling</demand> <demand>cooling</demand>
</demands> </demands>
<equipments> <cooling_efficiency>3.23</cooling_efficiency>
<generation_id>5</generation_id> <distribution_heat_losses units="%">10</distribution_heat_losses>
<distribution_id>1</distribution_id> <distribution_consumption_fix_flow units="%">1000000000</distribution_consumption_fix_flow>
<dissipation_id>???</dissipation_id> <distribution_consumption_variable_flow units="%">1000000000</distribution_consumption_variable_flow>
</equipments>
<storage>false</storage> <storage>false</storage>
</system> </system>
<system id="9"> <system id="9" type="cooler" fuel_type="electricity">
<name>Air cooled DX</name> <name>Air cooled DX</name>
<demands> <demands>
<demand>cooling</demand> <demand>cooling</demand>
</demands> </demands>
<equipments> <cooling_efficiency>3.23</cooling_efficiency>
<generation_id>5</generation_id> <distribution_heat_losses units="%">0</distribution_heat_losses>
<distribution_id>3</distribution_id> <distribution_consumption_fix_flow units="%">1000000000</distribution_consumption_fix_flow>
<dissipation_id>???</dissipation_id> <distribution_consumption_variable_flow units="%">1000000000</distribution_consumption_variable_flow>
</equipments>
<storage>false</storage> <storage>false</storage>
</system> </system>
<system id="10"> <system id="10" type="electricity generator" fuel_type="renewable">
<name>PV system</name> <name>PV system</name>
<demands> <demands>
<demand>electricity</demand> <demand>electricity</demand>
</demands> </demands>
<equipments> <electrical_efficiency>0.22</electrical_efficiency>
<generation_id>6</generation_id>
<distribution_id>???</distribution_id>
<dissipation_id>???</dissipation_id>
</equipments>
<storage>true</storage> <storage>true</storage>
</system> </system>
</systems> </systems>

View File

@ -130,7 +130,15 @@ class InselMonthlyEnergyBalance(Insel):
f'% BP(11) #1 Area of zone {i + 1} (m2)') f'% BP(11) #1 Area of zone {i + 1} (m2)')
total_internal_gain = 0 total_internal_gain = 0
for ig in usage.internal_gains: 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'{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 ' parameters.append(f'{usage.thermal_control.mean_heating_set_point} % BP(13) #3 Heating setpoint temperature '
f'zone {i + 1} (degree Celsius)') f'zone {i + 1} (degree Celsius)')

View File

@ -127,7 +127,7 @@ class ConfigurationHelper:
def soil_thickness(self) -> float: def soil_thickness(self) -> float:
""" """
Get configured soil thickness for surfaces touching the ground Get configured soil thickness for surfaces touching the ground
:return: 0.5 :return: 0.5 m
""" """
return self._config.getfloat('buildings', 'soil_thickness').real return self._config.getfloat('buildings', 'soil_thickness').real

View File

@ -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], '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]} 'holiday': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}
DAYS_A_YEAR = {'monday': 53, DAYS_A_YEAR = {'monday': 51,
'tuesday': 52, 'tuesday': 50,
'wednesday': 52, 'wednesday': 50,
'thursday': 52, 'thursday': 50,
'friday': 52, 'friday': 50,
'saturday': 52, 'saturday': 52,
'sunday': 52, 'sunday': 52,
'holiday': 0} 'holiday': 10}
# data types # data types
ANY_NUMBER = 'any_number' ANY_NUMBER = 'any_number'

View File

@ -105,18 +105,19 @@ class NrcanPhysicsParameters:
thermal_boundary.window_ratio = 0 thermal_boundary.window_ratio = 0
if thermal_boundary.type == cte.WALL or thermal_boundary.type == cte.ROOF: if thermal_boundary.type == cte.WALL or thermal_boundary.type == cte.ROOF:
if construction_archetype.window is not None: 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 = \ thermal_boundary.window_ratio = \
float(construction_archetype.window_ratio['east']) / 100 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: else:
thermal_boundary.window_ratio = \ thermal_boundary.window_ratio = \
float(construction_archetype.window_ratio['north']) / 100 float(construction_archetype.window_ratio['west']) / 100
except ValueError: except ValueError:
# This is the normal operation way when the windows are defined in the geometry # This is the normal operation way when the windows are defined in the geometry
continue continue

View File

@ -54,6 +54,9 @@ class NrcanUsageParameters:
sys.stderr.write(f'Building {building.name} has unknown usage archetype for usage: {comnet_usage_name}\n') sys.stderr.write(f'Building {building.name} has unknown usage archetype for usage: {comnet_usage_name}\n')
continue 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: for internal_zone in building.internal_zones:
if internal_zone.area is None: if internal_zone.area is None:
raise Exception('Internal zone area not defined, ACH cannot be calculated') 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') raise Exception('Internal zone volume not defined, ACH cannot be calculated')
if internal_zone.area <= 0: if internal_zone.area <= 0:
raise Exception('Internal zone area is zero, ACH cannot be calculated') 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 = Usage()
usage.name = usage_name usage.name = usage_name
self._assign_values(usage, archetype_usage, volume_per_area, building.cold_water_temperature) self._assign_values(usage, archetype_usage, volume_per_area, building.cold_water_temperature)