Finished the work on north_america_energy_system_catalog.py

added the schematics to the catalogue
This commit is contained in:
Saeed Ranjbar 2023-10-16 10:34:27 -04:00
parent 3a7f9173c7
commit 78795acdcf
10 changed files with 50 additions and 30 deletions

View File

@ -15,10 +15,11 @@ class Archetype:
""" """
Archetype class Archetype class
""" """
def __init__(self, lod, name, systems): def __init__(self, lod, name, schema, systems):
self._lod = lod self._lod = lod
self._name = name self._name = name
self._schema = schema
self._systems = systems self._systems = systems
@property @property
@ -37,6 +38,14 @@ class Archetype:
""" """
return self._name return self._name
@property
def schema(self):
"""
Get schema path
:return: string
"""
return self._schema
@property @property
def systems(self) -> List[System]: def systems(self) -> List[System]:
""" """
@ -53,6 +62,7 @@ class Archetype:
content = { content = {
'Archetype': { 'Archetype': {
'name': self.name, 'name': self.name,
'schema': self.schema,
'level of detail': self.lod, 'level of detail': self.lod,
'systems': _systems 'systems': _systems
} }

View File

@ -6,6 +6,7 @@ Project Coder Saeed Ranjbar saeed.ranjbar@concordia.ca
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
from pathlib import Path
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.system import System from hub.catalog_factories.data_models.energy_systems.system import System
@ -366,17 +367,19 @@ class NorthAmericaEnergySystemCatalog(Catalog):
return _catalog_systems return _catalog_systems
def _load_archetypes(self): def _load_archetypes(self):
base_path = Path(Path(__file__).parent.parent.parent / 'data/energy_systems')
_system_archetypes = [] _system_archetypes = []
system_clusters = self._archetypes['EnergySystemCatalog']['system_archetypes']['system_archetype'] system_clusters = self._archetypes['EnergySystemCatalog']['system_archetypes']['system_archetype']
for system_cluster in system_clusters: for system_cluster in system_clusters:
name = system_cluster['name'] name = system_cluster['name']
schema_path = Path(base_path / system_cluster['schema'])
systems = system_cluster['systems']['system_id'] systems = system_cluster['systems']['system_id']
integer_system_ids = [int(item) for item in systems] integer_system_ids = [int(item) for item in systems]
_systems = [] _systems = []
for system_archetype in self._systems: for system_archetype in self._systems:
if int(system_archetype.id) in integer_system_ids: if int(system_archetype.id) in integer_system_ids:
_systems.append(system_archetype) _systems.append(system_archetype)
_system_archetypes.append(Archetype(None, name, _systems)) _system_archetypes.append(Archetype(None, name, schema_path, _systems))
return _system_archetypes return _system_archetypes
def _load_materials(self): def _load_materials(self):

View File

@ -716,31 +716,35 @@ class Building(CityObject):
if self.energy_systems is None: if self.energy_systems is None:
return self._distribution_systems_electrical_consumption return self._distribution_systems_electrical_consumption
for energy_system in self.energy_systems: for energy_system in self.energy_systems:
emission_system = energy_system.emission_systems.generic_emission_system energy_emission_systems = energy_system.emission_systems
parasitic_energy_consumption = 0 energy_distribution_systems = energy_system.distribution_systems
if emission_system is not None: for energy_emission_system in energy_distribution_systems:
parasitic_energy_consumption = emission_system.parasitic_energy_consumption emission_system = energy_emission_system.generic_emission_system
distribution_system = energy_system.distribution_systems.generic_distribution_system parasitic_energy_consumption = 0
consumption_variable_flow = distribution_system.distribution_consumption_variable_flow if emission_system is not None:
for demand_type in energy_system.demand_types: parasitic_energy_consumption = emission_system.parasitic_energy_consumption
if demand_type.lower() == cte.HEATING.lower(): for energy_distribution_system in energy_emission_systems:
if _peak_load_type == cte.HEATING.lower(): distribution_system = energy_distribution_system.generic_distribution_system
_consumption_fix_flow = distribution_system.distribution_consumption_fix_flow consumption_variable_flow = distribution_system.distribution_consumption_variable_flow
for heating_demand_key in self.heating_demand: for demand_type in energy_system.demand_types:
_consumption = [0] * len(self.heating_demand[heating_demand_key]) if demand_type.lower() == cte.HEATING.lower():
_demand = self.heating_demand[heating_demand_key] if _peak_load_type == cte.HEATING.lower():
for i, _ in enumerate(_consumption): _consumption_fix_flow = distribution_system.distribution_consumption_fix_flow
_consumption[i] += (parasitic_energy_consumption + consumption_variable_flow) * _demand[i] for heating_demand_key in self.heating_demand:
self._distribution_systems_electrical_consumption[heating_demand_key] = _consumption _consumption = [0] * len(self.heating_demand[heating_demand_key])
if demand_type.lower() == cte.COOLING.lower(): _demand = self.heating_demand[heating_demand_key]
if _peak_load_type == cte.COOLING.lower(): for i, _ in enumerate(_consumption):
_consumption_fix_flow = distribution_system.distribution_consumption_fix_flow _consumption[i] += (parasitic_energy_consumption + consumption_variable_flow) * _demand[i]
for demand_key in self.cooling_demand: self._distribution_systems_electrical_consumption[heating_demand_key] = _consumption
_consumption = self._distribution_systems_electrical_consumption[demand_key] if demand_type.lower() == cte.COOLING.lower():
_demand = self.cooling_demand[demand_key] if _peak_load_type == cte.COOLING.lower():
for i, _ in enumerate(_consumption): _consumption_fix_flow = distribution_system.distribution_consumption_fix_flow
_consumption[i] += (parasitic_energy_consumption + consumption_variable_flow) * _demand[i] for demand_key in self.cooling_demand:
self._distribution_systems_electrical_consumption[demand_key] = _consumption _consumption = self._distribution_systems_electrical_consumption[demand_key]
_demand = self.cooling_demand[demand_key]
for i, _ in enumerate(_consumption):
_consumption[i] += (parasitic_energy_consumption + consumption_variable_flow) * _demand[i]
self._distribution_systems_electrical_consumption[demand_key] = _consumption
for key, item in self._distribution_systems_electrical_consumption.items(): for key, item in self._distribution_systems_electrical_consumption.items():
for i in range(0, len(item)): for i in range(0, len(item)):
@ -759,8 +763,6 @@ class Building(CityObject):
if demand_type.lower() == consumption_type.lower(): if demand_type.lower() == consumption_type.lower():
if consumption_type in (cte.HEATING, cte.DOMESTIC_HOT_WATER): if consumption_type in (cte.HEATING, cte.DOMESTIC_HOT_WATER):
for generation_system in energy_system_generation_systems: for generation_system in energy_system_generation_systems:
generic_gen = generation_system.generic_generation_system
print(generation_system)
coefficient_of_performance = generation_system.generic_generation_system.heat_efficiency coefficient_of_performance = generation_system.generic_generation_system.heat_efficiency
elif consumption_type == cte.COOLING: elif consumption_type == cte.COOLING:
for generation_system in energy_system_generation_systems: for generation_system in energy_system_generation_systems:

View File

@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<EnergySystemCatalog> <EnergySystemCatalog>
<schemas_path>./schemas/</schemas_path>
<medias> <medias>
<media media_id="1" media_name="Water" density="981.0" heatCapacity="4180.0" evaporationTemperature="100.0"/> <media media_id="1" media_name="Water" density="981.0" heatCapacity="4180.0" evaporationTemperature="100.0"/>
</medias> </medias>
@ -177,6 +176,7 @@
<system_archetypes> <system_archetypes>
<system_archetype id="1"> <system_archetype id="1">
<name>PV+ASHP+GasBoiler+TES</name> <name>PV+ASHP+GasBoiler+TES</name>
<schema>schemas/PV+ASHP+GasBoiler+TES.jpg</schema>
<systems> <systems>
<system_id>7</system_id> <system_id>7</system_id>
<system_id>1</system_id> <system_id>1</system_id>
@ -184,6 +184,7 @@
</system_archetype> </system_archetype>
<system_archetype id="2"> <system_archetype id="2">
<name>PV+ASHP+ElectricBoiler+TES</name> <name>PV+ASHP+ElectricBoiler+TES</name>
<schema>schemas/PV+ASHP+ElectricBoiler+TES.jpg</schema>
<systems> <systems>
<system_id>7</system_id> <system_id>7</system_id>
<system_id>2</system_id> <system_id>2</system_id>
@ -191,6 +192,7 @@
</system_archetype> </system_archetype>
<system_archetype id="3"> <system_archetype id="3">
<name>PV+GSHP+GasBoiler+TES</name> <name>PV+GSHP+GasBoiler+TES</name>
<schema>schemas/PV+GSHP+GasBoiler+TES.jpg</schema>
<systems> <systems>
<system_id>7</system_id> <system_id>7</system_id>
<system_id>3</system_id> <system_id>3</system_id>
@ -198,6 +200,7 @@
</system_archetype> </system_archetype>
<system_archetype id="4"> <system_archetype id="4">
<name>PV+GSHP+ElectricBoiler+TES</name> <name>PV+GSHP+ElectricBoiler+TES</name>
<schema>schemas/PV+GSHP+ElectricBoiler+TES.jpg</schema>
<systems> <systems>
<system_id>7</system_id> <system_id>7</system_id>
<system_id>4</system_id> <system_id>4</system_id>
@ -205,6 +208,7 @@
</system_archetype> </system_archetype>
<system_archetype id="5"> <system_archetype id="5">
<name>PV+WSHP+GasBoiler+TES</name> <name>PV+WSHP+GasBoiler+TES</name>
<schema>schemas/PV+WSHP+GasBoiler+TES.jpg</schema>
<systems> <systems>
<system_id>7</system_id> <system_id>7</system_id>
<system_id>5</system_id> <system_id>5</system_id>
@ -212,6 +216,7 @@
</system_archetype> </system_archetype>
<system_archetype id="6"> <system_archetype id="6">
<name>PV+WSHP+ElectricBoiler+TES</name> <name>PV+WSHP+ElectricBoiler+TES</name>
<schema>schemas/PV+WSHP+ElectricBoiler+TES.jpg</schema>
<systems> <systems>
<system_id>7</system_id> <system_id>7</system_id>
<system_id>6</system_id> <system_id>6</system_id>

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB