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
"""
def __init__(self, lod, name, systems):
def __init__(self, lod, name, schema, systems):
self._lod = lod
self._name = name
self._schema = schema
self._systems = systems
@property
@ -37,6 +38,14 @@ class Archetype:
"""
return self._name
@property
def schema(self):
"""
Get schema path
:return: string
"""
return self._schema
@property
def systems(self) -> List[System]:
"""
@ -53,6 +62,7 @@ class Archetype:
content = {
'Archetype': {
'name': self.name,
'schema': self.schema,
'level of detail': self.lod,
'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
"""
from pathlib import Path
import xmltodict
from hub.catalog_factories.catalog import Catalog
from hub.catalog_factories.data_models.energy_systems.system import System
@ -366,17 +367,19 @@ class NorthAmericaEnergySystemCatalog(Catalog):
return _catalog_systems
def _load_archetypes(self):
base_path = Path(Path(__file__).parent.parent.parent / 'data/energy_systems')
_system_archetypes = []
system_clusters = self._archetypes['EnergySystemCatalog']['system_archetypes']['system_archetype']
for system_cluster in system_clusters:
name = system_cluster['name']
schema_path = Path(base_path / system_cluster['schema'])
systems = system_cluster['systems']['system_id']
integer_system_ids = [int(item) for item in systems]
_systems = []
for system_archetype in self._systems:
if int(system_archetype.id) in integer_system_ids:
_systems.append(system_archetype)
_system_archetypes.append(Archetype(None, name, _systems))
_system_archetypes.append(Archetype(None, name, schema_path, _systems))
return _system_archetypes
def _load_materials(self):

View File

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

View File

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