adapted systems importer to new catalog

This commit is contained in:
Pilar Monsalvete 2023-05-29 11:56:56 -04:00
parent dcb5cb4134
commit 183807b8e0
17 changed files with 357 additions and 109 deletions

View File

@ -7,15 +7,15 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
from typing import List from typing import List
from hub.catalog_factories.data_models.energy_systems.equipment import Equipment from hub.catalog_factories.data_models.energy_systems.system import System
class Archetype: class Archetype:
def __init__(self, lod, name, equipments): def __init__(self, lod, name, systems):
self._lod = lod self._lod = lod
self._name = name self._name = name
self._equipments = equipments self._systems = systems
@property @property
def lod(self): def lod(self):
@ -34,9 +34,9 @@ class Archetype:
return f'{self._name}_lod{self._lod}' return f'{self._name}_lod{self._lod}'
@property @property
def equipments(self) -> List[Equipment]: def systems(self) -> List[System]:
""" """
Get list of equipments that compose the total energy system Get list of equipments that compose the total energy system
:return: [Equipment] :return: [Equipment]
""" """
return self._equipments return self._systems

View File

@ -7,20 +7,44 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
class Content: class Content:
def __init__(self, archetypes, equipments): def __init__(self, archetypes, systems, generations, distributions, emissions):
self._archetypes = archetypes self._archetypes = archetypes
self._equipments = equipments self._systems = systems
self._generations = generations
self._distributions = distributions
self._emissions = emissions
@property @property
def archetypes(self): def archetypes(self):
""" """
All archetype systems in the catalog All archetype system clusters in the catalog
""" """
return self._archetypes return self._archetypes
@property @property
def equipments(self): def systems(self):
""" """
All equipments in the catalog All systems in the catalog
""" """
return self._equipments return self._systems
@property
def generation_equipments(self):
"""
All generation equipments in the catalog
"""
return self._generations
@property
def distribution_equipments(self):
"""
All distribution equipments in the catalog
"""
return self._distributions
@property
def emission_equipments(self):
"""
All emission equipments in the catalog
"""
return self._emissions

View File

@ -7,15 +7,49 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
class DistributionSystem: class DistributionSystem:
def __init__(self, system_type, supply_temperature, distribution_consumption_fix_flow, def __init__(self, system_id, name, system_type, supply_temperature, distribution_consumption_fix_flow,
distribution_consumption_variable_flow, heat_losses): distribution_consumption_variable_flow, heat_losses):
self._system_id = system_id
self._name = name
self._type = system_type self._type = system_type
self._supply_temperature = supply_temperature self._supply_temperature = supply_temperature
self._distribution_consumption_fix_flow = distribution_consumption_fix_flow self._distribution_consumption_fix_flow = distribution_consumption_fix_flow
self._distribution_consumption_variable_flow = distribution_consumption_variable_flow self._distribution_consumption_variable_flow = distribution_consumption_variable_flow
self._heat_losses = heat_losses self._heat_losses = heat_losses
@property
def id(self):
"""
Get system id
:return: float
"""
return self._system_id
@id.setter
def id(self, value):
"""
Set system id
:param value: float
"""
self._system_id = value
@property
def name(self):
"""
Get name
:return: string
"""
return self._name
@name.setter
def name(self, value):
"""
Set name
:param value: string
"""
self._name = value
@property @property
def type(self): def type(self):
""" """

View File

@ -7,10 +7,45 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
class EmissionSystem: class EmissionSystem:
def __init__(self, system_type, parasitic_energy_consumption): def __init__(self, system_id, name, system_type, parasitic_energy_consumption):
self._system_id = system_id
self._name = name
self._type = system_type self._type = system_type
self._parasitic_energy_consumption = parasitic_energy_consumption self._parasitic_energy_consumption = parasitic_energy_consumption
@property
def id(self):
"""
Get system id
:return: float
"""
return self._system_id
@id.setter
def id(self, value):
"""
Set system id
:param value: float
"""
self._system_id = value
@property
def name(self):
"""
Get name
:return: string
"""
return self._name
@name.setter
def name(self, value):
"""
Set name
:param value: string
"""
self._name = value
@property @property
def type(self): def type(self):
""" """

View File

@ -10,9 +10,11 @@ from typing import Union
class GenerationSystem: class GenerationSystem:
def __init__(self, system_type, fuel_type, source_types, heat_efficiency, cooling_efficiency, electricity_efficiency, def __init__(self, system_id, name, system_type, fuel_type, source_types, heat_efficiency, cooling_efficiency,
source_temperature, source_mass_flow, storage, auxiliary_equipment): electricity_efficiency, source_temperature, source_mass_flow, storage, auxiliary_equipment):
self._system_id = system_id
self._name = name
self._type = system_type self._type = system_type
self._fuel_type = fuel_type self._fuel_type = fuel_type
self._source_types = source_types self._source_types = source_types
@ -24,6 +26,38 @@ class GenerationSystem:
self._storage = storage self._storage = storage
self._auxiliary_equipment = auxiliary_equipment self._auxiliary_equipment = auxiliary_equipment
@property
def id(self):
"""
Get system id
:return: float
"""
return self._system_id
@id.setter
def id(self, value):
"""
Set system id
:param value: float
"""
self._system_id = value
@property
def name(self):
"""
Get name
:return: string
"""
return self._name
@name.setter
def name(self, value):
"""
Set name
:param value: string
"""
self._name = value
@property @property
def type(self): def type(self):
""" """

View File

@ -12,10 +12,10 @@ from hub.catalog_factories.data_models.energy_systems.distribution_system import
from hub.catalog_factories.data_models.energy_systems.emission_system import EmissionSystem from hub.catalog_factories.data_models.energy_systems.emission_system import EmissionSystem
class Equipment: class System:
def __init__(self, def __init__(self,
lod, lod,
equipment_id, system_id,
name, name,
demand_types, demand_types,
generation_system, generation_system,
@ -23,7 +23,7 @@ class Equipment:
emission_system): emission_system):
self._lod = lod self._lod = lod
self._equipment_id = equipment_id self._system_id = system_id
self._name = name self._name = name
self._demand_types = demand_types self._demand_types = demand_types
self._generation_system = generation_system self._generation_system = generation_system
@ -44,7 +44,7 @@ class Equipment:
Get equipment id Get equipment id
:return: string :return: string
""" """
return self._equipment_id return self._system_id
@property @property
def name(self): def name(self):

View File

@ -8,10 +8,11 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
import xmltodict import xmltodict
from hub.catalog_factories.catalog import Catalog from hub.catalog_factories.catalog import Catalog
from hub.catalog_factories.data_models.energy_systems.equipment import Equipment from hub.catalog_factories.data_models.energy_systems.system import System
from hub.catalog_factories.data_models.energy_systems.content import Content from hub.catalog_factories.data_models.energy_systems.content import Content
from hub.catalog_factories.data_models.energy_systems.generation_system import GenerationSystem from hub.catalog_factories.data_models.energy_systems.generation_system import GenerationSystem
from hub.catalog_factories.data_models.energy_systems.distribution_system import DistributionSystem from hub.catalog_factories.data_models.energy_systems.distribution_system import DistributionSystem
from hub.catalog_factories.data_models.energy_systems.emission_system import EmissionSystem
from hub.catalog_factories.data_models.energy_systems.archetype import Archetype from hub.catalog_factories.data_models.energy_systems.archetype import Archetype
@ -19,46 +20,45 @@ class MontrealCustomCatalog(Catalog):
def __init__(self, path): def __init__(self, path):
path = str(path / 'montreal_custom_systems.xml') path = str(path / 'montreal_custom_systems.xml')
with open(path) as xml: with open(path) as xml:
self._archetypes = xmltodict.parse(xml.read(), force_list=('system', 'system_cluster', 'demand', 'system_id')) self._archetypes = xmltodict.parse(xml.read(), force_list=('system', 'system_cluster', 'equipment',
'demand', 'system_id'))
self._lod = float(self._archetypes['catalog']['@lod']) self._lod = float(self._archetypes['catalog']['@lod'])
self._catalog_generation_equipments = self._load_generation_equipments()
self._catalog_distribution_equipments = self._load_distribution_equipments()
self._catalog_emission_equipments = self._load_emission_equipments()
self._catalog_systems = self._load_systems() self._catalog_systems = self._load_systems()
self._catalog_archetypes = self._load_archetypes() self._catalog_archetypes = self._load_archetypes()
# store the full catalog data model in self._content # store the full catalog data model in self._content
self._content = Content(self._catalog_archetypes, self._content = Content(self._catalog_archetypes,
self._catalog_systems) self._catalog_systems,
self._catalog_generation_equipments,
self._catalog_distribution_equipments,
self._catalog_emission_equipments)
def _load_systems(self): def _load_generation_equipments(self):
_catalog_systems = [] _equipments = []
systems = self._archetypes['catalog']['systems']['system'] equipments = self._archetypes['catalog']['generation_equipments']['equipment']
for system in systems: for equipment in equipments:
system_id = float(system['@id']) equipment_id = float(equipment['@id'])
system_type = system['@type'] equipment_type = equipment['@type']
fuel_type = system['@fuel_type'] fuel_type = equipment['@fuel_type']
name = system['name'] name = equipment['name']
demands = system['demands']['demand']
heating_efficiency = None heating_efficiency = None
if 'heating_efficiency' in system: if 'heating_efficiency' in equipment:
heating_efficiency = float(system['heating_efficiency']) heating_efficiency = float(equipment['heating_efficiency'])
cooling_efficiency = None cooling_efficiency = None
if 'cooling_efficiency' in system: if 'cooling_efficiency' in equipment:
cooling_efficiency = float(system['cooling_efficiency']) cooling_efficiency = float(equipment['cooling_efficiency'])
electricity_efficiency = None electricity_efficiency = None
if 'electricity_efficiency' in system: if 'electrical_efficiency' in equipment:
electricity_efficiency = float(system['electricity_efficiency']) electricity_efficiency = float(equipment['electrical_efficiency'])
distribution_heat_losses = None storage = eval(equipment['storage'].capitalize())
if 'distribution_heat_losses' in system: generation_system = GenerationSystem(equipment_id,
distribution_heat_losses = float(system['distribution_heat_losses']['#text']) / 100 name,
distribution_consumption_fix_flow = None equipment_type,
if 'distribution_consumption_fix_flow' in system:
distribution_consumption_fix_flow = float(system['distribution_consumption_fix_flow']['#text']) / 100
distribution_consumption_variable_flow = None
if 'distribution_consumption_variable_flow' in system:
distribution_consumption_variable_flow = float(system['distribution_consumption_variable_flow']['#text']) / 100
storage = eval(system['storage'].capitalize())
generation_system = GenerationSystem(system_type,
fuel_type, fuel_type,
None, None,
heating_efficiency, heating_efficiency,
@ -68,18 +68,87 @@ class MontrealCustomCatalog(Catalog):
None, None,
storage, storage,
None) None)
distribution_system = DistributionSystem(None,
_equipments.append(generation_system)
return _equipments
def _load_distribution_equipments(self):
_equipments = []
equipments = self._archetypes['catalog']['distribution_equipments']['equipment']
for equipment in equipments:
equipment_id = float(equipment['@id'])
equipment_type = equipment['@type']
name = equipment['name']
distribution_heat_losses = None
if 'distribution_heat_losses' in equipment:
distribution_heat_losses = float(equipment['distribution_heat_losses']['#text']) / 100
distribution_consumption_fix_flow = None
if 'distribution_consumption_fix_flow' in equipment:
distribution_consumption_fix_flow = float(equipment['distribution_consumption_fix_flow']['#text']) / 100
distribution_consumption_variable_flow = None
if 'distribution_consumption_variable_flow' in equipment:
distribution_consumption_variable_flow = float(equipment['distribution_consumption_variable_flow']['#text']) / 100
distribution_system = DistributionSystem(equipment_id,
name,
equipment_type,
None, None,
distribution_consumption_fix_flow, distribution_consumption_fix_flow,
distribution_consumption_variable_flow, distribution_consumption_variable_flow,
distribution_heat_losses) distribution_heat_losses)
_catalog_systems.append(Equipment(self._lod,
system_id, _equipments.append(distribution_system)
name, return _equipments
demands,
generation_system, def _load_emission_equipments(self):
distribution_system, _equipments = []
None)) equipments = self._archetypes['catalog']['dissipation_equipments']['equipment']
for equipment in equipments:
equipment_id = float(equipment['@id'])
equipment_type = equipment['@type']
name = equipment['name']
parasitic_consumption = None
if 'parasitic_consumption' in equipment:
parasitic_consumption = float(equipment['parasitic_consumption']['#text']) / 100
emission_system = EmissionSystem(equipment_id,
name,
equipment_type,
parasitic_consumption)
_equipments.append(emission_system)
return _equipments
def _load_systems(self):
_catalog_systems = []
systems = self._archetypes['catalog']['systems']['system']
for system in systems:
system_id = float(system['@id'])
name = system['name']
demands = system['demands']['demand']
generation_equipment = system['equipments']['generation_id']
_generation_equipment = None
for equipment_archetype in self._catalog_generation_equipments:
if int(equipment_archetype.id) == int(generation_equipment):
_generation_equipment = equipment_archetype
distribution_equipment = system['equipments']['distribution_id']
_distribution_equipment = None
for equipment_archetype in self._catalog_distribution_equipments:
if int(equipment_archetype.id) == int(distribution_equipment):
_distribution_equipment = equipment_archetype
emission_equipment = system['equipments']['dissipation_id']
_emission_equipment = None
for equipment_archetype in self._catalog_emission_equipments:
if int(equipment_archetype.id) == int(emission_equipment):
_emission_equipment = equipment_archetype
_catalog_systems.append(System(self._lod,
system_id,
name,
demands,
_generation_equipment,
_distribution_equipment,
_emission_equipment))
return _catalog_systems return _catalog_systems
def _load_archetypes(self): def _load_archetypes(self):
@ -102,18 +171,34 @@ class MontrealCustomCatalog(Catalog):
:parm: optional category filter :parm: optional category filter
""" """
if category is None: if category is None:
_names = {'archetypes': [], 'systems': []} _names = {'archetypes': [], 'systems': [], 'generation_equipments': [], 'distribution_equipments': [],
'emission_equipments':[]}
for archetype in self._content.archetypes: for archetype in self._content.archetypes:
_names['archetypes'].append(archetype.name) _names['archetypes'].append(archetype.name)
for system in self._content.equipments: for system in self._content.systems:
_names['systems'].append(system.name) _names['systems'].append(system.name)
for equipment in self._content.generation_equipments:
_names['generation_equipments'].append(equipment.name)
for equipment in self._content.distribution_equipments:
_names['distribution_equipments'].append(equipment.name)
for equipment in self._content.emission_equipments:
_names['emission_equipments'].append(equipment.name)
else: else:
_names = {category: []} _names = {category: []}
if category.lower() == 'archetypes': if category.lower() == 'archetypes':
for archetype in self._content.archetypes: for archetype in self._content.archetypes:
_names[category].append(archetype.name) _names[category].append(archetype.name)
elif category.lower() == 'systems': elif category.lower() == 'systems':
for system in self._content.equipments: for system in self._content.systems:
_names[category].append(system.name)
elif category.lower() == 'generation_equipments':
for system in self._content.generation_equipments:
_names[category].append(system.name)
elif category.lower() == 'distribution_equipments':
for system in self._content.distribution_equipments:
_names[category].append(system.name)
elif category.lower() == 'emission_equipments':
for system in self._content.emission_equipments:
_names[category].append(system.name) _names[category].append(system.name)
else: else:
raise ValueError(f'Unknown category [{category}]') raise ValueError(f'Unknown category [{category}]')
@ -130,7 +215,13 @@ class MontrealCustomCatalog(Catalog):
if category.lower() == 'archetypes': if category.lower() == 'archetypes':
return self._content.archetypes return self._content.archetypes
elif category.lower() == 'systems': elif category.lower() == 'systems':
return self._content.equipments return self._content.systems
elif category.lower() == 'generation_equipments':
return self._content.generation_equipments
elif category.lower() == 'distribution_equipments':
return self._content.distribution_equipments
elif category.lower() == 'emission_equipments':
return self._content.emission_equipments
else: else:
raise ValueError(f'Unknown category [{category}]') raise ValueError(f'Unknown category [{category}]')
@ -142,7 +233,16 @@ class MontrealCustomCatalog(Catalog):
for entry in self._content.archetypes: for entry in self._content.archetypes:
if entry.name.lower() == name.lower(): if entry.name.lower() == name.lower():
return entry return entry
for entry in self._content.equipments: for entry in self._content.systems:
if entry.name.lower() == name.lower():
return entry
for entry in self._content.generation_equipments:
if entry.name.lower() == name.lower():
return entry
for entry in self._content.distribution_equipments:
if entry.name.lower() == name.lower():
return entry
for entry in self._content.emission_equipments:
if entry.name.lower() == name.lower(): if entry.name.lower() == name.lower():
return entry return entry
raise IndexError(f"{name} doesn't exists in the catalog") raise IndexError(f"{name} doesn't exists in the catalog")

View File

@ -671,15 +671,28 @@ class Building(CityObject):
Get total electricity produced onsite in Wh Get total electricity produced onsite in Wh
return: dict return: dict
""" """
# Add other systems whenever new ones appear # Add other systems whenever new ones appear
orientation_losses_factor = {cte.MONTH: {'north': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
'east': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
'south': [2.137931, 1.645503, 1.320946, 1.107817, 0.993213, 0.945175,
0.967949, 1.065534, 1.24183, 1.486486, 1.918033, 2.210526],
'west': [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]},
cte.YEAR: {'north': [0],
'east': [0],
'south': [1.212544],
'west': [0]}
}
for energy_system in self.energy_systems: for energy_system in self.energy_systems:
if energy_system.generation_system.generic_generation_system.type == cte.PHOTOVOLTAIC: if energy_system.generation_system.generic_generation_system.type == cte.PHOTOVOLTAIC:
_efficiency = energy_system.generation_system.generic_generation_system.electricity_efficiency _efficiency = energy_system.generation_system.generic_generation_system.electricity_efficiency
self._onsite_electrical_production = {} self._onsite_electrical_production = {}
for _key in self.roofs[0].global_irradiance.keys(): for _key in self.roofs[0].global_irradiance.keys():
_results = [0 for _ in range(0, len(self.roofs[0].global_irradiance[_key]))] _results = [0 for _ in range(0, len(self.roofs[0].global_irradiance[_key][cte.SRA]))]
for surface in self.surfaces: for surface in self.roofs:
_results = [x + y * _efficiency * surface.perimeter_area * surface.solar_collectors_area_reduction_factor _results = [x + y * _efficiency * surface.perimeter_area
for x, y in zip(_results, surface.global_irradiance[_key])] * surface.solar_collectors_area_reduction_factor * z
for x, y, z in zip(_results, surface.global_irradiance[_key][cte.SRA],
orientation_losses_factor[cte.MONTH]['south'])]
self._onsite_electrical_production[_key] = _results self._onsite_electrical_production[_key] = _results
return self._onsite_electrical_production return self._onsite_electrical_production

View File

@ -359,7 +359,6 @@ class Surface:
:return: float :return: float
""" """
if self._solar_collectors_area_reduction_factor is None: if self._solar_collectors_area_reduction_factor is None:
_solar_collectors_area_reduction_factor = 0
if self.type == cte.ROOF: if self.type == cte.ROOF:
_protected_building_restriction = 1 _protected_building_restriction = 1
# 10 degrees range # 10 degrees range
@ -369,12 +368,12 @@ class Surface:
_separation_of_panels = 0.46 _separation_of_panels = 0.46
_shadow_between_panels = 0.7 _shadow_between_panels = 0.7
else: else:
# pitched # tilted
_construction_restriction = 0.9 _construction_restriction = 0.9
_separation_of_panels = 0.9 _separation_of_panels = 0.9
_shadow_between_panels = 1 _shadow_between_panels = 1
_solar_collectors_area_reduction_factor = _protected_building_restriction * _construction_restriction \ self._solar_collectors_area_reduction_factor = _protected_building_restriction * _construction_restriction \
* _separation_of_panels * _shadow_between_panels * _separation_of_panels * _shadow_between_panels
return self._solar_collectors_area_reduction_factor return self._solar_collectors_area_reduction_factor
@solar_collectors_area_reduction_factor.setter @solar_collectors_area_reduction_factor.setter

View File

@ -3,26 +3,32 @@
<equipment id="1" type="boiler" fuel_type="gas"> <equipment id="1" type="boiler" fuel_type="gas">
<name>Fuel-fired water boiler</name> <name>Fuel-fired water boiler</name>
<heating_efficiency>0.85</heating_efficiency> <heating_efficiency>0.85</heating_efficiency>
<storage>false</storage>
</equipment> </equipment>
<equipment id="2" type="boiler" fuel_type="electricity"> <equipment id="2" type="boiler" fuel_type="electricity">
<name>Electric water boiler</name> <name>Electric water boiler</name>
<heating_efficiency>1</heating_efficiency> <heating_efficiency>1</heating_efficiency>
<storage>true</storage>
</equipment> </equipment>
<equipment id="3" type="furnace" fuel_type="gas"> <equipment 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>
<heating_efficiency>0.85</heating_efficiency> <heating_efficiency>0.85</heating_efficiency>
<storage>false</storage>
</equipment> </equipment>
<equipment id="4" type="furnace" fuel_type="electricity"> <equipment id="4" type="furnace" fuel_type="electricity">
<name>Electrical furnace and fuel boiler for acs</name> <name>Electrical furnace and fuel boiler for acs</name>
<heating_efficiency>1</heating_efficiency> <heating_efficiency>1</heating_efficiency>
<storage>false</storage>
</equipment> </equipment>
<equipment id="5" type="cooler" fuel_type="electricity"> <equipment id="5" type="cooler" fuel_type="electricity">
<name>Air cooled DX with external condenser</name> <name>Air cooled DX with external condenser</name>
<cooling_efficiency>3.23</cooling_efficiency> <cooling_efficiency>3.23</cooling_efficiency>
<storage>false</storage>
</equipment> </equipment>
<equipment id="6" type="electricity generator" fuel_type="renewable"> <equipment id="6" type="electricity generator" fuel_type="renewable">
<name>PV system</name> <name>PV system</name>
<electrical_efficiency>0.22</electrical_efficiency> <electrical_efficiency>0.22</electrical_efficiency>
<storage>true</storage>
</equipment> </equipment>
</generation_equipments> </generation_equipments>
<distribution_equipments> <distribution_equipments>
@ -78,15 +84,15 @@
<dissipation_equipments> <dissipation_equipments>
<equipment id="1" type="baseboards"> <equipment id="1" type="baseboards">
<name>Baseboards</name> <name>Baseboards</name>
<parasitic_consumption>0</parasitic_consumption> <parasitic_consumption units="%">0</parasitic_consumption>
</equipment> </equipment>
<equipment id="2" type="fan-coils"> <equipment id="2" type="fan-coils">
<name>fan-coils</name> <name>fan-coils</name>
<parasitic_consumption>2</parasitic_consumption> <parasitic_consumption units="%">2</parasitic_consumption>
</equipment> </equipment>
<equipment id="3" type="inductors"> <equipment id="3" type="inductors">
<name>inductors</name> <name>inductors</name>
<parasitic_consumption>0</parasitic_consumption> <parasitic_consumption units="%">0</parasitic_consumption>
</equipment> </equipment>
</dissipation_equipments> </dissipation_equipments>
<systems> <systems>
@ -101,7 +107,6 @@
<distribution_id>1</distribution_id> <distribution_id>1</distribution_id>
<dissipation_id>1</dissipation_id> <dissipation_id>1</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id = "2"> <system id = "2">
<name>4 pipe fan coils with fuel fired boiler</name> <name>4 pipe fan coils with fuel fired boiler</name>
@ -114,7 +119,6 @@
<distribution_id>1</distribution_id> <distribution_id>1</distribution_id>
<dissipation_id>2</dissipation_id> <dissipation_id>2</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id="3"> <system id="3">
<name>4 pipe fan coils with electrical resistance water boiler</name> <name>4 pipe fan coils with electrical resistance water boiler</name>
@ -127,7 +131,6 @@
<distribution_id>1</distribution_id> <distribution_id>1</distribution_id>
<dissipation_id>2</dissipation_id> <dissipation_id>2</dissipation_id>
</equipments> </equipments>
<storage>true</storage>
</system> </system>
<system id="4"> <system id="4">
<name>Single zone packaged rooftop unit with fuel-fired furnace and baseboards and fuel boiler for acs</name> <name>Single zone packaged rooftop unit with fuel-fired furnace and baseboards and fuel boiler for acs</name>
@ -140,7 +143,6 @@
<distribution_id>5</distribution_id> <distribution_id>5</distribution_id>
<dissipation_id>1</dissipation_id> <dissipation_id>1</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id="5"> <system id="5">
<name>Single zone packaged rooftop unit with electrical resistance furnace and baseboards and fuel boiler for acs</name> <name>Single zone packaged rooftop unit with electrical resistance furnace and baseboards and fuel boiler for acs</name>
@ -153,7 +155,6 @@
<distribution_id>5</distribution_id> <distribution_id>5</distribution_id>
<dissipation_id>1</dissipation_id> <dissipation_id>1</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id="6"> <system id="6">
<name>Single zone make-up air unit with baseboard heating with fuel fired boiler</name> <name>Single zone make-up air unit with baseboard heating with fuel fired boiler</name>
@ -166,7 +167,6 @@
<distribution_id>1</distribution_id> <distribution_id>1</distribution_id>
<dissipation_id>1</dissipation_id> <dissipation_id>1</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id="7"> <system id="7">
<name>Single zone make-up air unit with electrical baseboard heating and DHW with resistance</name> <name>Single zone make-up air unit with electrical baseboard heating and DHW with resistance</name>
@ -179,7 +179,6 @@
<distribution_id>5</distribution_id> <distribution_id>5</distribution_id>
<dissipation_id>3</dissipation_id> <dissipation_id>3</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id="8"> <system id="8">
<name>Multi-zone built-up system with baseboard heater hydronic with fuel fired boiler</name> <name>Multi-zone built-up system with baseboard heater hydronic with fuel fired boiler</name>
@ -192,7 +191,6 @@
<distribution_id>1</distribution_id> <distribution_id>1</distribution_id>
<dissipation_id>3</dissipation_id> <dissipation_id>3</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id="9"> <system id="9">
<name>Multi-zone built-up system with electrical baseboard heater and electrical hot water</name> <name>Multi-zone built-up system with electrical baseboard heater and electrical hot water</name>
@ -205,7 +203,6 @@
<distribution_id>1</distribution_id> <distribution_id>1</distribution_id>
<dissipation_id>3</dissipation_id> <dissipation_id>3</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id="10"> <system id="10">
<name>Unitary air conditioner air cooled DX with external condenser</name> <name>Unitary air conditioner air cooled DX with external condenser</name>
@ -217,7 +214,6 @@
<distribution_id>6</distribution_id> <distribution_id>6</distribution_id>
<dissipation_id>3</dissipation_id> <dissipation_id>3</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id="11"> <system id="11">
<name>4 pipe fan coils with water cooled, water chiller</name> <name>4 pipe fan coils with water cooled, water chiller</name>
@ -229,7 +225,6 @@
<distribution_id>2</distribution_id> <distribution_id>2</distribution_id>
<dissipation_id>2</dissipation_id> <dissipation_id>2</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id="12"> <system id="12">
<name>Single zone packaged rooftop unit with air cooled DX</name> <name>Single zone packaged rooftop unit with air cooled DX</name>
@ -241,7 +236,6 @@
<distribution_id>6</distribution_id> <distribution_id>6</distribution_id>
<dissipation_id>3</dissipation_id> <dissipation_id>3</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id="13"> <system id="13">
<name>Single zone make-up air unit with air cooled DX</name> <name>Single zone make-up air unit with air cooled DX</name>
@ -253,7 +247,6 @@
<distribution_id>6</distribution_id> <distribution_id>6</distribution_id>
<dissipation_id>3</dissipation_id> <dissipation_id>3</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id="14"> <system id="14">
<name>Multi-zone built-up system with water cooled, water chiller</name> <name>Multi-zone built-up system with water cooled, water chiller</name>
@ -265,7 +258,6 @@
<distribution_id>3</distribution_id> <distribution_id>3</distribution_id>
<dissipation_id>3</dissipation_id> <dissipation_id>3</dissipation_id>
</equipments> </equipments>
<storage>false</storage>
</system> </system>
<system id="15"> <system id="15">
<name>PV system</name> <name>PV system</name>
@ -277,7 +269,6 @@
<distribution_id>5</distribution_id> <distribution_id>5</distribution_id>
<dissipation_id>3</dissipation_id> <dissipation_id>3</dissipation_id>
</equipments> </equipments>
<storage>true</storage>
</system> </system>
</systems> </systems>
<system_clusters> <system_clusters>

View File

@ -24,6 +24,8 @@ _CONSTRUCTION_CODE = {
cte.INTERIOR_SLAB: '8' cte.INTERIOR_SLAB: '8'
} }
_NUMBER_DAYS_PER_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
class InselMonthlyEnergyBalance(Insel): class InselMonthlyEnergyBalance(Insel):
@ -252,7 +254,8 @@ class InselMonthlyEnergyBalance(Insel):
raise ValueError(f'surface: {surface.name} from building {building.name} has no global irradiance!') raise ValueError(f'surface: {surface.name} from building {building.name} has no global irradiance!')
global_irradiance = surface.global_irradiance[cte.MONTH] global_irradiance = surface.global_irradiance[cte.MONTH]
for j in range(0, len(global_irradiance)): for j in range(0, len(global_irradiance)):
parameters.append(f'{j + 1} {global_irradiance.at[j, radiation_calculation_method]}') parameters.append(f'{j + 1} '
f'{global_irradiance.at[j, radiation_calculation_method] / 24 / _NUMBER_DAYS_PER_MONTH[j]}')
else: else:
for j in range(0, 12): for j in range(0, 12):
parameters.append(f'{j + 1} 0.0') parameters.append(f'{j + 1} 0.0')

View File

@ -182,6 +182,8 @@ ONSITE_ELECTRICITY = 'Onsite Electricity'
PHOTOVOLTAIC = 'Photovoltaic' PHOTOVOLTAIC = 'Photovoltaic'
BOILER = 'Boiler' BOILER = 'Boiler'
HEAT_PUMP = 'Heat Pump' HEAT_PUMP = 'Heat Pump'
BASEBOARD = 'Baseboard'
CHILLER = 'Chiller'
# Geometry # Geometry
EPSILON = 0.0000001 EPSILON = 0.0000001

View File

@ -11,14 +11,22 @@ import hub.helpers.constants as cte
class MontrealSystemToHubEnergyGenerationSystem: class MontrealSystemToHubEnergyGenerationSystem:
def __init__(self): def __init__(self):
self._dictionary = {'Fuel-fired water boiler with baseboards': cte.BOILER, self._dictionary = {
'Electrical resistance water boiler': cte.BOILER, 'Unitary air conditioner with baseboard heater fuel fired boiler': cte.BOILER,
'Fuel-fired furnace and fuel boiler for acs': cte.BOILER, '4 pipe fan coils with fuel fired boiler': cte.BOILER,
'Baseboards: hydronic with fuel boiler': cte.BOILER, '4 pipe fan coils with electrical resistance water boiler': cte.BOILER,
'Electrical baseboards and electrical boiler for acs': cte.BOILER, 'Single zone packaged rooftop unit with fuel-fired furnace and baseboards and fuel boiler for acs': cte.BOILER,
'Air cooled DX with external condenser': cte.HEAT_PUMP, 'Single zone packaged rooftop unit with electrical resistance furnace and baseboards and fuel boiler for acs': cte.BOILER,
'Water cooled, water chiller': cte.HEAT_PUMP, 'Single zone make-up air unit with baseboard heating with fuel fired boiler': cte.BOILER,
'PV system': cte.PHOTOVOLTAIC 'Single zone make-up air unit with electrical baseboard heating and DHW with resistance': cte.BASEBOARD,
'Multi-zone built-up system with baseboard heater hydronic with fuel fired boiler': cte.BOILER,
'Multi-zone built-up system with electrical baseboard heater and electrical hot water': cte.BASEBOARD,
'Unitary air conditioner air cooled DX with external condenser': cte.CHILLER,
'4 pipe fan coils with water cooled, water chiller': cte.CHILLER,
'Single zone packaged rooftop unit with air cooled DX': cte.CHILLER,
'Single zone make-up air unit with air cooled DX': cte.CHILLER,
'Multi-zone built-up system with water cooled, water chiller': cte.CHILLER,
'PV system': cte.PHOTOVOLTAIC
} }
@property @property

View File

@ -52,7 +52,7 @@ class MontrealCustomEnergySystemParameters:
building_systems = [] building_systems = []
data = [archetype_name, building.name] data = [archetype_name, building.name]
_energy_systems_connection_table.loc[len(_energy_systems_connection_table)] = data _energy_systems_connection_table.loc[len(_energy_systems_connection_table)] = data
for equipment in archetype.equipments: for equipment in archetype.systems:
energy_system = GenericEnergySystem() energy_system = GenericEnergySystem()
_hub_demand_types = [] _hub_demand_types = []
for demand_type in equipment.demand_types: for demand_type in equipment.demand_types:

View File

@ -32,17 +32,18 @@ class SimplifiedRadiosityAlgorithm:
array = np.concatenate((array, np.full(total_hours, i + 1))) array = np.concatenate((array, np.full(total_hours, i + 1)))
return pd.DataFrame(array, columns=[cte.MONTH]) return pd.DataFrame(array, columns=[cte.MONTH])
def _get_monthly_mean_values(self, values): def _get_monthly_values(self, values):
out = None out = None
if values is not None: if values is not None:
if cte.MONTH not in values.columns: if cte.MONTH not in values.columns:
values = pd.concat([self._month_hour, pd.DataFrame(values)], axis=1) values = pd.concat([self._month_hour, pd.DataFrame(values)], axis=1)
out = values.groupby(cte.MONTH, as_index=False).mean() out = values.groupby(cte.MONTH, as_index=False).sum()
del out[cte.MONTH] del out[cte.MONTH]
return out return out
def _get_yearly_mean_values(self, values): @staticmethod
return values.mean() def _get_yearly_values(values):
return [values.sum()]
def _read_results(self): def _read_results(self):
try: try:
@ -83,7 +84,7 @@ class SimplifiedRadiosityAlgorithm:
surface_id = header_id.split(':')[2] surface_id = header_id.split(':')[2]
surface = building.surface_by_id(surface_id) surface = building.surface_by_id(surface_id)
new_value = pd.DataFrame(radiation[[header_id]].to_numpy(), columns=[cte.SRA]) new_value = pd.DataFrame(radiation[[header_id]].to_numpy(), columns=[cte.SRA])
month_new_value = self._get_monthly_mean_values(new_value) month_new_value = self._get_monthly_values(new_value)
if cte.MONTH not in surface.global_irradiance: if cte.MONTH not in surface.global_irradiance:
surface.global_irradiance[cte.MONTH] = month_new_value surface.global_irradiance[cte.MONTH] = month_new_value
else: else:
@ -93,7 +94,7 @@ class SimplifiedRadiosityAlgorithm:
else: else:
pd.concat([surface.global_irradiance[cte.HOUR], new_value], axis=1) pd.concat([surface.global_irradiance[cte.HOUR], new_value], axis=1)
if cte.YEAR not in surface.global_irradiance: if cte.YEAR not in surface.global_irradiance:
surface.global_irradiance[cte.YEAR] = self._get_yearly_mean_values(new_value) surface.global_irradiance[cte.YEAR] = pd.DataFrame(self._get_yearly_values(new_value), columns=[cte.SRA])
self._city.level_of_detail.surface_radiation = 2 self._city.level_of_detail.surface_radiation = 2
for building in self._city.buildings: for building in self._city.buildings:
building.level_of_detail.surface_radiation = 2 building.level_of_detail.surface_radiation = 2

View File

@ -14,13 +14,16 @@ class TestSystemsCatalog(TestCase):
def test_montreal_custom_catalog(self): def test_montreal_custom_catalog(self):
catalog = EnergySystemsCatalogFactory('montreal_custom').catalog catalog = EnergySystemsCatalogFactory('montreal_custom').catalog
catalog_categories = catalog.names() catalog_categories = catalog.names()
for archetype in catalog.entries('archetypes'):
for equipment in archetype.equipments:
print(equipment._equipment_id)
archetypes = catalog.names('archetypes') archetypes = catalog.names('archetypes')
self.assertEqual(18, len(archetypes['archetypes'])) self.assertEqual(18, len(archetypes['archetypes']))
equipments = catalog.names('equipments') systems = catalog.names('systems')
self.assertEqual(10, len(equipments['equipments'])) self.assertEqual(15, len(systems['systems']))
generation_equipments = catalog.names('generation_equipments')
self.assertEqual(6, len(generation_equipments['generation_equipments']))
distribution_equipments = catalog.names('distribution_equipments')
self.assertEqual(8, len(distribution_equipments['distribution_equipments']))
emission_equipments = catalog.names('emission_equipments')
self.assertEqual(3, len(emission_equipments['emission_equipments']))
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
catalog.names('unknown') catalog.names('unknown')

View File

@ -69,7 +69,7 @@ class TestSystemsFactory(TestCase):
ResultFactory('insel_monthly_energy_balance', self._city, self._output_path).enrich() ResultFactory('insel_monthly_energy_balance', self._city, self._output_path).enrich()
for building in self._city.buildings: for building in self._city.buildings:
building.energy_systems_archetype_name = 'system 1 gas' building.energy_systems_archetype_name = 'system 1 gas pv'
EnergySystemsFactory('montreal_custom', self._city).enrich() EnergySystemsFactory('montreal_custom', self._city).enrich()
# Need to assign energy systems to buildings: # Need to assign energy systems to buildings:
energy_systems_connection = self._city.energy_systems_connection_table energy_systems_connection = self._city.energy_systems_connection_table
@ -107,3 +107,4 @@ class TestSystemsFactory(TestCase):
self.assertLess(0, building.heating_consumption[cte.YEAR][0]) self.assertLess(0, building.heating_consumption[cte.YEAR][0])
self.assertLess(0, building.cooling_consumption[cte.YEAR][0]) self.assertLess(0, building.cooling_consumption[cte.YEAR][0])
self.assertLess(0, building.domestic_hot_water_consumption[cte.YEAR][0]) self.assertLess(0, building.domestic_hot_water_consumption[cte.YEAR][0])
self.assertLess(0, building.onsite_electrical_production[cte.YEAR][0])