diff --git a/hub/catalog_factories/data_models/energy_systems/archetype.py b/hub/catalog_factories/data_models/energy_systems/archetype.py index 4834b8cc..010eaf0d 100644 --- a/hub/catalog_factories/data_models/energy_systems/archetype.py +++ b/hub/catalog_factories/data_models/energy_systems/archetype.py @@ -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 } diff --git a/hub/catalog_factories/energy_systems/north_america_energy_system_catalog.py b/hub/catalog_factories/energy_systems/north_america_energy_system_catalog.py index 77c4287c..40964652 100644 --- a/hub/catalog_factories/energy_systems/north_america_energy_system_catalog.py +++ b/hub/catalog_factories/energy_systems/north_america_energy_system_catalog.py @@ -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): diff --git a/hub/city_model_structure/building.py b/hub/city_model_structure/building.py index 8c7fbae7..98f8dc32 100644 --- a/hub/city_model_structure/building.py +++ b/hub/city_model_structure/building.py @@ -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: diff --git a/hub/data/energy_systems/north_america_systems.xml b/hub/data/energy_systems/north_america_systems.xml index 36cee745..8a1e738b 100644 --- a/hub/data/energy_systems/north_america_systems.xml +++ b/hub/data/energy_systems/north_america_systems.xml @@ -1,6 +1,5 @@ - ./schemas/ @@ -177,6 +176,7 @@ PV+ASHP+GasBoiler+TES + schemas/PV+ASHP+GasBoiler+TES.jpg 7 1 @@ -184,6 +184,7 @@ PV+ASHP+ElectricBoiler+TES + schemas/PV+ASHP+ElectricBoiler+TES.jpg 7 2 @@ -191,6 +192,7 @@ PV+GSHP+GasBoiler+TES + schemas/PV+GSHP+GasBoiler+TES.jpg 7 3 @@ -198,6 +200,7 @@ PV+GSHP+ElectricBoiler+TES + schemas/PV+GSHP+ElectricBoiler+TES.jpg 7 4 @@ -205,6 +208,7 @@ PV+WSHP+GasBoiler+TES + schemas/PV+WSHP+GasBoiler+TES.jpg 7 5 @@ -212,6 +216,7 @@ PV+WSHP+ElectricBoiler+TES + schemas/PV+WSHP+ElectricBoiler+TES.jpg 7 6 diff --git a/hub/data/energy_systems/schemas/PV+ASHP+ElectricBoiler+TES.jpg b/hub/data/energy_systems/schemas/PV+ASHP+ElectricBoiler+TES.jpg new file mode 100644 index 00000000..12ee33be Binary files /dev/null and b/hub/data/energy_systems/schemas/PV+ASHP+ElectricBoiler+TES.jpg differ diff --git a/hub/data/energy_systems/schemas/PV+ASHP+GasBoiler+TES.jpg b/hub/data/energy_systems/schemas/PV+ASHP+GasBoiler+TES.jpg new file mode 100644 index 00000000..12ee33be Binary files /dev/null and b/hub/data/energy_systems/schemas/PV+ASHP+GasBoiler+TES.jpg differ diff --git a/hub/data/energy_systems/schemas/PV+GSHP+ElectricBoiler+TES.jpg b/hub/data/energy_systems/schemas/PV+GSHP+ElectricBoiler+TES.jpg new file mode 100644 index 00000000..12ee33be Binary files /dev/null and b/hub/data/energy_systems/schemas/PV+GSHP+ElectricBoiler+TES.jpg differ diff --git a/hub/data/energy_systems/schemas/PV+GSHP+GasBoiler+TES.jpg b/hub/data/energy_systems/schemas/PV+GSHP+GasBoiler+TES.jpg new file mode 100644 index 00000000..12ee33be Binary files /dev/null and b/hub/data/energy_systems/schemas/PV+GSHP+GasBoiler+TES.jpg differ diff --git a/hub/data/energy_systems/schemas/PV+WSHP+ElectricBoiler+TES.jpg b/hub/data/energy_systems/schemas/PV+WSHP+ElectricBoiler+TES.jpg new file mode 100644 index 00000000..12ee33be Binary files /dev/null and b/hub/data/energy_systems/schemas/PV+WSHP+ElectricBoiler+TES.jpg differ diff --git a/hub/data/energy_systems/schemas/PV+WSHP+GasBoiler+TES.jpg b/hub/data/energy_systems/schemas/PV+WSHP+GasBoiler+TES.jpg new file mode 100644 index 00000000..12ee33be Binary files /dev/null and b/hub/data/energy_systems/schemas/PV+WSHP+GasBoiler+TES.jpg differ