starting point, not working

This commit is contained in:
Pilar Monsalvete 2023-10-10 05:03:31 -04:00
parent d29161b05e
commit 11dc02d0e8
14 changed files with 549 additions and 584 deletions

View File

@ -1,5 +1,5 @@
""" """
Energy System catalog archetype Energy System catalog archetype, understood as a cluster of energy systems
SPDX - License - Identifier: LGPL - 3.0 - or -later SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group Copyright © 2023 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
@ -15,20 +15,11 @@ class Archetype:
""" """
Archetype class Archetype class
""" """
def __init__(self, lod, name, systems): def __init__(self, name, systems):
self._lod = lod
self._name = name self._name = name
self._systems = systems self._systems = systems
@property
def lod(self):
"""
Get level of detail of the catalog
:return: string
"""
return self._lod
@property @property
def name(self): def name(self):
""" """
@ -53,7 +44,6 @@ class Archetype:
content = { content = {
'Archetype': { 'Archetype': {
'name': self.name, 'name': self.name,
'level of detail': self.lod,
'systems': _systems 'systems': _systems
} }
} }

View File

@ -10,13 +10,11 @@ class Content:
""" """
Content class Content class
""" """
def __init__(self, archetypes, systems, generations, distributions, emissions, storages): def __init__(self, archetypes, systems, generations=None, distributions=None):
self._archetypes = archetypes self._archetypes = archetypes
self._systems = systems self._systems = systems
self._generations = generations self._generations = generations
self._distributions = distributions self._distributions = distributions
self._emissions = emissions
self._storages = storages
@property @property
def archetypes(self): def archetypes(self):
@ -46,20 +44,6 @@ class Content:
""" """
return self._distributions return self._distributions
@property
def emission_equipments(self):
"""
All emission equipments in the catalog
"""
return self._emissions
@property
def storage_equipments(self):
"""
All storage equipments in the catalog
"""
return self._storages
def to_dictionary(self): def to_dictionary(self):
"""Class content to dictionary""" """Class content to dictionary"""
_archetypes = [] _archetypes = []

View File

@ -6,21 +6,27 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca
""" """
from typing import Union, List
from hub.catalog_factories.data_models.energy_systems.generation_system import GenerationSystem
class DistributionSystem: class DistributionSystem:
""" """
Distribution system class Distribution system class
""" """
def __init__(self, system_id, name, system_type, supply_temperature, distribution_consumption_fix_flow, def __init__(self, system_id, model_name=None, system_type=None, supply_temperature=None,
distribution_consumption_variable_flow, heat_losses): distribution_consumption_fix_flow=None, distribution_consumption_variable_flow=None, heat_losses=None,
generation_systems=None):
self._system_id = system_id self._system_id = system_id
self._name = name self._model_name = model_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
self._generation_systems = generation_systems
@property @property
def id(self): def id(self):
@ -31,12 +37,12 @@ class DistributionSystem:
return self._system_id return self._system_id
@property @property
def name(self): def model_name(self):
""" """
Get name Get model name
:return: string :return: string
""" """
return self._name return self._model_name
@property @property
def type(self): def type(self):
@ -79,17 +85,29 @@ class DistributionSystem:
""" """
return self._heat_losses return self._heat_losses
@property
def generation_systems(self) -> Union[None, List[GenerationSystem]]:
"""
Get generation systems connected to the distribution system
:return: [GenerationSystem]
"""
return self._generation_systems
def to_dictionary(self): def to_dictionary(self):
"""Class content to dictionary""" """Class content to dictionary"""
_generation_systems = [_generation_system.to_dictionary() for _generation_system in
self.generation_systems] if self.generation_systems is not None else None
content = { content = {
'Layer': { 'Layer': {
'id': self.id, 'id': self.id,
'name': self.name, 'model name': self.model_name,
'type': self.type, 'type': self.type,
'supply temperature [Celsius]': self.supply_temperature, 'supply temperature [Celsius]': self.supply_temperature,
'distribution consumption if fix flow over peak power [W/W]': self.distribution_consumption_fix_flow, 'distribution consumption if fix flow over peak power [W/W]': self.distribution_consumption_fix_flow,
'distribution consumption if variable flow over peak power [J/J]': self.distribution_consumption_variable_flow, 'distribution consumption if variable flow over peak power [J/J]': self.distribution_consumption_variable_flow,
'heat losses per energy produced [J/J]': self.heat_losses 'heat losses per energy produced [J/J]': self.heat_losses,
'generation systems connected': _generation_systems
} }
} }
return content return content

View File

@ -14,10 +14,12 @@ class ElectricalStorageSystem(EnergyStorageSystem):
Energy Storage System Class Energy Storage System Class
""" """
def __init__(self, storage_id, name, model_name, manufacturer, storage_type, nominal_capacity, losses_ratio, def __init__(self, storage_id, model_name=None, manufacturer=None, storage_type=None,
rated_output_power, nominal_efficiency, battery_voltage, depth_of_discharge, self_discharge_rate): nominal_capacity=None, losses_ratio=None, rated_output_power=None, nominal_efficiency=None,
battery_voltage=None, depth_of_discharge=None, self_discharge_rate=None):
super().__init__(storage_id, name, model_name, manufacturer, nominal_capacity, losses_ratio) super().__init__(storage_id, model_name, manufacturer, nominal_capacity, losses_ratio)
self._type_energy_stored = 'electrical'
self._storage_type = storage_type self._storage_type = storage_type
self._rated_output_power = rated_output_power self._rated_output_power = rated_output_power
self._nominal_efficiency = nominal_efficiency self._nominal_efficiency = nominal_efficiency
@ -25,10 +27,18 @@ class ElectricalStorageSystem(EnergyStorageSystem):
self._depth_of_discharge = depth_of_discharge self._depth_of_discharge = depth_of_discharge
self._self_discharge_rate = self_discharge_rate self._self_discharge_rate = self_discharge_rate
@property
def type_energy_stored(self):
"""
Get type of energy stored from ['electrical', 'thermal']
:return: string
"""
return self._type_energy_stored
@property @property
def storage_type(self): def storage_type(self):
""" """
Get storage type from ['electrical', 'lithium_ion', 'lead_acid', 'NiCd'] Get storage type from ['lithium_ion', 'lead_acid', 'NiCd']
:return: string :return: string
""" """
return self._storage_type return self._storage_type
@ -77,7 +87,7 @@ class ElectricalStorageSystem(EnergyStorageSystem):
"""Class content to dictionary""" """Class content to dictionary"""
content = {'Storage component': { content = {'Storage component': {
'storage id': self.id, 'storage id': self.id,
'name': self.name, 'type of energy stored': self.type_energy_stored,
'model name': self.model_name, 'model name': self.model_name,
'manufacturer': self.manufacturer, 'manufacturer': self.manufacturer,
'storage type': self.storage_type, 'storage type': self.storage_type,

View File

@ -10,10 +10,10 @@ class EmissionSystem:
""" """
Emission system class Emission system class
""" """
def __init__(self, system_id, name, system_type, parasitic_energy_consumption): def __init__(self, system_id, model_name=None, system_type=None, parasitic_energy_consumption=None):
self._system_id = system_id self._system_id = system_id
self._name = name self._model_name = model_name
self._type = system_type self._type = system_type
self._parasitic_energy_consumption = parasitic_energy_consumption self._parasitic_energy_consumption = parasitic_energy_consumption
@ -26,12 +26,12 @@ class EmissionSystem:
return self._system_id return self._system_id
@property @property
def name(self): def model_name(self):
""" """
Get name Get model name
:return: string :return: string
""" """
return self._name return self._model_name
@property @property
def type(self): def type(self):
@ -52,7 +52,7 @@ class EmissionSystem:
def to_dictionary(self): def to_dictionary(self):
"""Class content to dictionary""" """Class content to dictionary"""
content = {'Layer': {'id': self.id, content = {'Layer': {'id': self.id,
'name': self.name, 'model name': self.model_name,
'type': self.type, 'type': self.type,
'parasitic energy consumption per energy produced [J/J]': self.parasitic_energy_consumption 'parasitic energy consumption per energy produced [J/J]': self.parasitic_energy_consumption
} }

View File

@ -14,9 +14,9 @@ class EnergyStorageSystem(ABC):
Energy Storage System Abstract Class Energy Storage System Abstract Class
""" """
def __init__(self, storage_id, name, model_name, manufacturer, nominal_capacity, losses_ratio): def __init__(self, storage_id, model_name=None, manufacturer=None,
nominal_capacity=None, losses_ratio=None):
self._storage_id = storage_id self._storage_id = storage_id
self._name = name
self._model_name = model_name self._model_name = model_name
self._manufacturer = manufacturer self._manufacturer = manufacturer
self._nominal_capacity = nominal_capacity self._nominal_capacity = nominal_capacity
@ -31,12 +31,12 @@ class EnergyStorageSystem(ABC):
return self._storage_id return self._storage_id
@property @property
def name(self): def type_energy_stored(self):
""" """
Get storage name Get type of energy stored from ['electrical', 'thermal']
:return: string :return: string
""" """
return self._name raise NotImplementedError
@property @property
def model_name(self): def model_name(self):

View File

@ -6,53 +6,23 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca
""" """
from typing import Union from abc import ABC
from hub.catalog_factories.data_models.energy_systems.performance_curves import PerformanceCurves from typing import List, Union, TypeVar
DistributionSystem = TypeVar('DistributionSystem')
class GenerationSystem: class GenerationSystem(ABC):
""" """
Heat Generation system class Heat Generation system class
""" """
def __init__(self, system_id, name, model_name, manufacturer, system_type, fuel_type, nominal_thermal_output, def __init__(self, system_id, model_name=None, manufacturer=None, fuel_type=None, distribution_systems=None):
maximum_heat_output, minimum_heat_output, source_medium, supply_medium, heat_efficiency,
nominal_cooling_output, maximum_cooling_output, minimum_cooling_output, cooling_efficiency,
electricity_efficiency, source_temperature, source_mass_flow, nominal_electricity_output,
maximum_heat_supply_temperature, minimum_heat_supply_temperature,
maximum_cooling_supply_temperature, minimum_cooling_supply_temperature, heat_output_curve,
heat_fuel_consumption_curve, heat_efficiency_curve, cooling_output_curve, cooling_fuel_consumption_curve,
cooling_efficiency_curve):
self._system_id = system_id self._system_id = system_id
self._name = name
self._model_name = model_name self._model_name = model_name
self._manufacturer = manufacturer self._manufacturer = manufacturer
self._system_type = system_type
self._fuel_type = fuel_type self._fuel_type = fuel_type
self._nominal_thermal_output = nominal_thermal_output self._distribution_systems = distribution_systems
self._maximum_heat_output = maximum_heat_output
self._minimum_heat_output = minimum_heat_output
self._heat_efficiency = heat_efficiency
self._nominal_cooling_output = nominal_cooling_output
self._maximum_cooling_output = maximum_cooling_output
self._minimum_cooling_output = minimum_cooling_output
self._cooling_efficiency = cooling_efficiency
self._electricity_efficiency = electricity_efficiency
self._nominal_electricity_output = nominal_electricity_output
self._source_medium = source_medium
self._source_temperature = source_temperature
self._source_mass_flow = source_mass_flow
self._supply_medium = supply_medium
self._maximum_heat_supply_temperature = maximum_heat_supply_temperature
self._minimum_heat_supply_temperature = minimum_heat_supply_temperature
self._maximum_cooling_supply_temperature = maximum_cooling_supply_temperature
self._minimum_cooling_supply_temperature = minimum_cooling_supply_temperature
self._heat_output_curve = heat_output_curve
self._heat_fuel_consumption_curve = heat_fuel_consumption_curve
self._heat_efficiency_curve = heat_efficiency_curve
self._cooling_output_curve = cooling_output_curve
self._cooling_fuel_consumption_curve = cooling_fuel_consumption_curve
self._cooling_efficiency_curve = cooling_efficiency_curve
@property @property
def id(self): def id(self):
@ -63,12 +33,12 @@ class GenerationSystem:
return self._system_id return self._system_id
@property @property
def name(self): def system_type(self):
""" """
Get name Get type
:return: string :return: string
""" """
return self._name raise NotImplementedError
@property @property
def model_name(self): def model_name(self):
@ -86,14 +56,6 @@ class GenerationSystem:
""" """
return self._manufacturer return self._manufacturer
@property
def system_type(self):
"""
Get type
:return: string
"""
return self._system_type
@property @property
def fuel_type(self): def fuel_type(self):
""" """
@ -103,230 +65,13 @@ class GenerationSystem:
return self._fuel_type return self._fuel_type
@property @property
def nominal_thermal_output(self): def distribution_systems(self) -> Union[None, List[DistributionSystem]]:
""" """
Get nominal_thermal_output of heat generation devices in kW Get distributions systems connected to this generation system
:return: float :return: [DistributionSystems]
""" """
return self._nominal_thermal_output return self._distribution_systems
@property
def maximum_heat_output(self):
"""
Get maximum heat output of heat generation devices in W
:return: float
"""
return self._maximum_heat_output
@property
def minimum_heat_output(self):
"""
Get minimum heat output of heat generation devices in W
:return: float
"""
return self._minimum_heat_output
@property
def source_medium(self):
"""
Get source_type from [air, water, ground, district_heating, grid, on_site_electricity]
:return: [string]
"""
return self._source_medium
@property
def supply_medium(self):
"""
Get the supply medium from ['air', 'water']
:return: string
"""
return self._supply_medium
@property
def heat_efficiency(self):
"""
Get heat_efficiency
:return: float
"""
return self._heat_efficiency
@property
def nominal_cooling_output(self):
"""
Get nominal_thermal_output of heat generation devices in kW
:return: float
"""
return self._nominal_cooling_output
@property
def maximum_cooling_output(self):
"""
Get maximum heat output of heat generation devices in W
:return: float
"""
return self._maximum_cooling_output
@property
def minimum_cooling_output(self):
"""
Get minimum heat output of heat generation devices in W
:return: float
"""
return self._minimum_cooling_output
@property
def cooling_efficiency(self):
"""
Get cooling_efficiency
:return: float
"""
return self._cooling_efficiency
@property
def electricity_efficiency(self):
"""
Get electricity_efficiency
:return: float
"""
return self._electricity_efficiency
@property
def source_temperature(self):
"""
Get source_temperature in degree Celsius
:return: float
"""
return self._source_temperature
@property
def source_mass_flow(self):
"""
Get source_mass_flow in kg/s
:return: float
"""
return self._source_mass_flow
@property
def nominal_electricity_output(self):
"""
Get nominal_power_output of electricity generation devices or inverters in kW
:return: float
"""
return self._nominal_electricity_output
@property
def maximum_heat_supply_temperature(self):
"""
Get the maximum heat supply temperature in degree Celsius
:return: float
"""
return self._minimum_heat_supply_temperature
@property
def minimum_heat_supply_temperature(self):
"""
Get the minimum heat supply temperature in degree Celsius
:return: float
"""
return self._minimum_heat_supply_temperature
@property
def maximum_cooling_supply_temperature(self):
"""
Get the maximum cooling supply temperature in degree Celsius
:return: float
"""
return self._maximum_cooling_supply_temperature
@property
def minimum_cooling_supply_temperature(self):
"""
Get the minimum cooling supply temperature in degree Celsius
:return: float
"""
return self._minimum_cooling_supply_temperature
@property
def heat_output_curve(self) -> Union[None, PerformanceCurves]:
"""
Get the heat output curve of the heat generation device
:return: PerformanceCurve
"""
return self._heat_output_curve
@property
def heat_fuel_consumption_curve(self) -> Union[None, PerformanceCurves]:
"""
Get the heating fuel consumption curve of the heat generation device
:return: PerformanceCurve
"""
return self._heat_fuel_consumption_curve
@property
def heat_efficiency_curve(self) -> Union[None, PerformanceCurves]:
"""
Get the heating efficiency curve of the heat generation device
:return: PerformanceCurve
"""
return self._heat_efficiency_curve
@property
def cooling_output_curve(self) -> Union[None, PerformanceCurves]:
"""
Get the heat output curve of the heat generation device
:return: PerformanceCurve
"""
return self._cooling_output_curve
@property
def cooling_fuel_consumption_curve(self) -> Union[None, PerformanceCurves]:
"""
Get the heating fuel consumption curve of the heat generation device
:return: PerformanceCurve
"""
return self._cooling_fuel_consumption_curve
@property
def cooling_efficiency_curve(self) -> Union[None, PerformanceCurves]:
"""
Get the heating efficiency curve of the heat generation device
:return: PerformanceCurve
"""
return self._cooling_efficiency_curve
def to_dictionary(self): def to_dictionary(self):
"""Class content to dictionary""" """Class content to dictionary"""
content = {'Energy Generation component': { raise NotImplementedError
'id': self.id,
'name': self.name,
'model name': self.model_name,
'manufacturer': self.manufacturer,
'type': self.system_type,
'fuel type': self.fuel_type,
'nominal thermal output [W]': self.nominal_thermal_output,
'maximum heat output [W]': self.maximum_heat_output,
'minimum heat output [W]': self.minimum_heat_output,
'source medium': self.source_medium,
'supply medium': self.supply_medium,
'source temperature [Celsius]': self.source_temperature,
'source mass flow [kg/s]': self.source_mass_flow,
'heat efficiency': self.heat_efficiency,
'nominal cooling output [W]': self.nominal_cooling_output,
'maximum cooling output [W]': self.maximum_cooling_output,
'minimum cooling output [W]': self.minimum_cooling_output,
'cooling efficiency': self.cooling_efficiency,
'electricity efficiency': self.electricity_efficiency,
'nominal power output [W]': self.nominal_electricity_output,
'maximum heating supply temperature [Celsius]': self.maximum_heat_supply_temperature,
'minimum heating supply temperature [Celsius]': self.minimum_heat_supply_temperature,
'maximum cooling supply temperature [Celsius]': self.maximum_cooling_supply_temperature,
'minimum cooling supply temperature [Celsius]': self.minimum_cooling_supply_temperature,
'heat output curve': self.heat_output_curve,
'heat fuel consumption curve': self.heat_fuel_consumption_curve,
'heat efficiency curve': self.heat_efficiency_curve,
'cooling output curve': self.cooling_output_curve,
'cooling fuel consumption curve': self.cooling_fuel_consumption_curve,
'cooling efficiency curve': self.cooling_efficiency_curve
}
}
return content

View File

@ -0,0 +1,294 @@
"""
Energy System catalog non PV generation system
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca
"""
from typing import Union
from hub.catalog_factories.data_models.energy_systems.performance_curves import PerformanceCurves
from hub.catalog_factories.data_models.energy_systems.generation_system import GenerationSystem
class NonPvGenerationSystem(GenerationSystem):
"""
Non PV Generation system class
"""
def __init__(self, system_id, system_type, model_name=None, manufacturer=None, fuel_type=None,
nominal_thermal_output=None, maximum_heat_output=None, minimum_heat_output=None, source_medium=None,
supply_medium=None, heat_efficiency=None, nominal_cooling_output=None, maximum_cooling_output=None,
minimum_cooling_output=None, cooling_efficiency=None, electricity_efficiency=None,
source_temperature=None, source_mass_flow=None, nominal_electricity_output=None,
maximum_heat_supply_temperature=None, minimum_heat_supply_temperature=None,
maximum_cooling_supply_temperature=None, minimum_cooling_supply_temperature=None, heat_output_curve=None,
heat_fuel_consumption_curve=None, heat_efficiency_curve=None, cooling_output_curve=None,
cooling_fuel_consumption_curve=None, cooling_efficiency_curve=None):
super().__init__(system_id=system_id, model_name=model_name, manufacturer=manufacturer, fuel_type=fuel_type)
self._system_type = system_type
self._nominal_thermal_output = nominal_thermal_output
self._maximum_heat_output = maximum_heat_output
self._minimum_heat_output = minimum_heat_output
self._heat_efficiency = heat_efficiency
self._nominal_cooling_output = nominal_cooling_output
self._maximum_cooling_output = maximum_cooling_output
self._minimum_cooling_output = minimum_cooling_output
self._cooling_efficiency = cooling_efficiency
self._electricity_efficiency = electricity_efficiency
self._nominal_electricity_output = nominal_electricity_output
self._source_medium = source_medium
self._source_temperature = source_temperature
self._source_mass_flow = source_mass_flow
self._supply_medium = supply_medium
self._maximum_heat_supply_temperature = maximum_heat_supply_temperature
self._minimum_heat_supply_temperature = minimum_heat_supply_temperature
self._maximum_cooling_supply_temperature = maximum_cooling_supply_temperature
self._minimum_cooling_supply_temperature = minimum_cooling_supply_temperature
self._heat_output_curve = heat_output_curve
self._heat_fuel_consumption_curve = heat_fuel_consumption_curve
self._heat_efficiency_curve = heat_efficiency_curve
self._cooling_output_curve = cooling_output_curve
self._cooling_fuel_consumption_curve = cooling_fuel_consumption_curve
self._cooling_efficiency_curve = cooling_efficiency_curve
@property
def system_type(self):
"""
Get type
:return: string
"""
return self._system_type
@property
def nominal_thermal_output(self):
"""
Get nominal_thermal_output of heat generation devices in kW
:return: float
"""
return self._nominal_thermal_output
@property
def maximum_heat_output(self):
"""
Get maximum heat output of heat generation devices in W
:return: float
"""
return self._maximum_heat_output
@property
def minimum_heat_output(self):
"""
Get minimum heat output of heat generation devices in W
:return: float
"""
return self._minimum_heat_output
@property
def source_medium(self):
"""
Get source_type from [air, water, ground, district_heating, grid, on_site_electricity]
:return: [string]
"""
return self._source_medium
@property
def supply_medium(self):
"""
Get the supply medium from ['air', 'water']
:return: string
"""
return self._supply_medium
@property
def heat_efficiency(self):
"""
Get heat_efficiency
:return: float
"""
return self._heat_efficiency
@property
def nominal_cooling_output(self):
"""
Get nominal_thermal_output of heat generation devices in kW
:return: float
"""
return self._nominal_cooling_output
@property
def maximum_cooling_output(self):
"""
Get maximum heat output of heat generation devices in W
:return: float
"""
return self._maximum_cooling_output
@property
def minimum_cooling_output(self):
"""
Get minimum heat output of heat generation devices in W
:return: float
"""
return self._minimum_cooling_output
@property
def cooling_efficiency(self):
"""
Get cooling_efficiency
:return: float
"""
return self._cooling_efficiency
@property
def electricity_efficiency(self):
"""
Get electricity_efficiency
:return: float
"""
return self._electricity_efficiency
@property
def source_temperature(self):
"""
Get source_temperature in degree Celsius
:return: float
"""
return self._source_temperature
@property
def source_mass_flow(self):
"""
Get source_mass_flow in kg/s
:return: float
"""
return self._source_mass_flow
@property
def nominal_electricity_output(self):
"""
Get nominal_power_output of electricity generation devices or inverters in kW
:return: float
"""
return self._nominal_electricity_output
@property
def maximum_heat_supply_temperature(self):
"""
Get the maximum heat supply temperature in degree Celsius
:return: float
"""
return self._minimum_heat_supply_temperature
@property
def minimum_heat_supply_temperature(self):
"""
Get the minimum heat supply temperature in degree Celsius
:return: float
"""
return self._minimum_heat_supply_temperature
@property
def maximum_cooling_supply_temperature(self):
"""
Get the maximum cooling supply temperature in degree Celsius
:return: float
"""
return self._maximum_cooling_supply_temperature
@property
def minimum_cooling_supply_temperature(self):
"""
Get the minimum cooling supply temperature in degree Celsius
:return: float
"""
return self._minimum_cooling_supply_temperature
@property
def heat_output_curve(self) -> Union[None, PerformanceCurves]:
"""
Get the heat output curve of the heat generation device
:return: PerformanceCurve
"""
return self._heat_output_curve
@property
def heat_fuel_consumption_curve(self) -> Union[None, PerformanceCurves]:
"""
Get the heating fuel consumption curve of the heat generation device
:return: PerformanceCurve
"""
return self._heat_fuel_consumption_curve
@property
def heat_efficiency_curve(self) -> Union[None, PerformanceCurves]:
"""
Get the heating efficiency curve of the heat generation device
:return: PerformanceCurve
"""
return self._heat_efficiency_curve
@property
def cooling_output_curve(self) -> Union[None, PerformanceCurves]:
"""
Get the heat output curve of the heat generation device
:return: PerformanceCurve
"""
return self._cooling_output_curve
@property
def cooling_fuel_consumption_curve(self) -> Union[None, PerformanceCurves]:
"""
Get the heating fuel consumption curve of the heat generation device
:return: PerformanceCurve
"""
return self._cooling_fuel_consumption_curve
@property
def cooling_efficiency_curve(self) -> Union[None, PerformanceCurves]:
"""
Get the heating efficiency curve of the heat generation device
:return: PerformanceCurve
"""
return self._cooling_efficiency_curve
def to_dictionary(self):
"""Class content to dictionary"""
_distribution_systems = [_distribution_system.to_dictionary() for _distribution_system in
self.distribution_systems] if self.distribution_systems is not None else None
content = {
'Energy Generation component':
{
'id': self.id,
'model name': self.model_name,
'manufacturer': self.manufacturer,
'type': self.system_type,
'fuel type': self.fuel_type,
'nominal thermal output [W]': self.nominal_thermal_output,
'maximum heat output [W]': self.maximum_heat_output,
'minimum heat output [W]': self.minimum_heat_output,
'source medium': self.source_medium,
'supply medium': self.supply_medium,
'source temperature [Celsius]': self.source_temperature,
'source mass flow [kg/s]': self.source_mass_flow,
'heat efficiency': self.heat_efficiency,
'nominal cooling output [W]': self.nominal_cooling_output,
'maximum cooling output [W]': self.maximum_cooling_output,
'minimum cooling output [W]': self.minimum_cooling_output,
'cooling efficiency': self.cooling_efficiency,
'electricity efficiency': self.electricity_efficiency,
'nominal power output [W]': self.nominal_electricity_output,
'maximum heating supply temperature [Celsius]': self.maximum_heat_supply_temperature,
'minimum heating supply temperature [Celsius]': self.minimum_heat_supply_temperature,
'maximum cooling supply temperature [Celsius]': self.maximum_cooling_supply_temperature,
'minimum cooling supply temperature [Celsius]': self.minimum_cooling_supply_temperature,
'heat output curve': self.heat_output_curve,
'heat fuel consumption curve': self.heat_fuel_consumption_curve,
'heat efficiency curve': self.heat_efficiency_curve,
'cooling output curve': self.cooling_output_curve,
'cooling fuel consumption curve': self.cooling_fuel_consumption_curve,
'cooling efficiency curve': self.cooling_efficiency_curve,
'distribution systems connected': _distribution_systems
}
}
return content

View File

@ -14,26 +14,15 @@ class PvGenerationSystem(GenerationSystem):
Electricity Generation system class Electricity Generation system class
""" """
def __init__(self, system_id, name, model_name, manufacturer, electricity_efficiency, def __init__(self, system_id, model_name=None, manufacturer=None, electricity_efficiency=None,
nominal_electricity_output, nominal_ambient_temperature, nominal_cell_temperature, nominal_electricity_output=None, nominal_ambient_temperature=None, nominal_cell_temperature=None,
nominal_radiation, standard_test_condition_cell_temperature, standard_test_condition_maximum_power, nominal_radiation=None, standard_test_condition_cell_temperature=None,
cell_temperature_coefficient, width, height): standard_test_condition_maximum_power=None, cell_temperature_coefficient=None, width=None, height=None):
super().__init__(system_id=system_id, name=name, model_name=model_name, super().__init__(system_id=system_id, model_name=model_name,
manufacturer=manufacturer, system_type='pv', fuel_type='renewable', manufacturer=manufacturer, fuel_type='renewable')
nominal_thermal_output=None, maximum_heat_output=None, self._system_type = 'PV'
minimum_heat_output=None, source_medium=None, self._electricity_efficiency = electricity_efficiency
supply_medium=None, heat_efficiency=None, nominal_cooling_output=None, self._nominal_electricity_output = nominal_electricity_output
maximum_cooling_output=None, minimum_cooling_output=None,
cooling_efficiency=None, electricity_efficiency=electricity_efficiency,
source_temperature=None, source_mass_flow=None,
nominal_electricity_output=nominal_electricity_output,
maximum_heat_supply_temperature=None,
minimum_heat_supply_temperature=None,
maximum_cooling_supply_temperature=None,
minimum_cooling_supply_temperature=None, heat_output_curve=None,
heat_fuel_consumption_curve=None, heat_efficiency_curve=None,
cooling_output_curve=None, cooling_fuel_consumption_curve=None,
cooling_efficiency_curve=None)
self._nominal_ambient_temperature = nominal_ambient_temperature self._nominal_ambient_temperature = nominal_ambient_temperature
self._nominal_cell_temperature = nominal_cell_temperature self._nominal_cell_temperature = nominal_cell_temperature
self._nominal_radiation = nominal_radiation self._nominal_radiation = nominal_radiation
@ -43,6 +32,30 @@ class PvGenerationSystem(GenerationSystem):
self._width = width self._width = width
self._height = height self._height = height
@property
def system_type(self):
"""
Get type
:return: string
"""
return self._system_type
@property
def nominal_electricity_output(self):
"""
Get nominal_power_output of electricity generation devices or inverters in kW
:return: float
"""
return self._nominal_electricity_output
@property
def electricity_efficiency(self):
"""
Get electricity_efficiency
:return: float
"""
return self._electricity_efficiency
@property @property
def nominal_ambient_temperature(self): def nominal_ambient_temperature(self):
""" """
@ -109,9 +122,12 @@ class PvGenerationSystem(GenerationSystem):
def to_dictionary(self): def to_dictionary(self):
"""Class content to dictionary""" """Class content to dictionary"""
content = {'Energy Generation component': { _distribution_systems = [_distribution_system.to_dictionary() for _distribution_system in
self.distribution_systems] if self.distribution_systems is not None else None
content = {
'Energy Generation component':
{
'id': self.id, 'id': self.id,
'name': self.name,
'model name': self.model_name, 'model name': self.model_name,
'manufacturer': self.manufacturer, 'manufacturer': self.manufacturer,
'type': self.system_type, 'type': self.system_type,
@ -126,6 +142,7 @@ class PvGenerationSystem(GenerationSystem):
'cell temperature coefficient': self.cell_temperature_coefficient, 'cell temperature coefficient': self.cell_temperature_coefficient,
'width': self.width, 'width': self.width,
'height': self.height, 'height': self.height,
'distribution systems connected': _distribution_systems
} }
} }
return content return content

View File

@ -1,5 +1,5 @@
""" """
Energy System catalog heat generation system Energy Systems catalog System
SPDX - License - Identifier: LGPL - 3.0 - or -later SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group Copyright © 2023 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
@ -7,12 +7,10 @@ Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca
""" """
from typing import Union, List from typing import Union, List
from pathlib import Path
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.thermal_storage_system import ThermalStorageSystem
from hub.catalog_factories.data_models.energy_systems.electrical_storage_system import ElectricalStorageSystem
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
class System: class System:
@ -21,15 +19,14 @@ class System:
""" """
def __init__(self, def __init__(self,
lod,
system_id, system_id,
name,
demand_types, demand_types,
generation_systems, name=None,
distribution_systems, generation_systems=None,
emission_systems, distribution_systems=None,
energy_storage_systems): emission_systems=None,
self._lod = lod energy_storage_systems=None,
configuration_schema=None):
self._system_id = system_id self._system_id = system_id
self._name = name self._name = name
self._demand_types = demand_types self._demand_types = demand_types
@ -37,15 +34,7 @@ class System:
self._emission_systems = emission_systems self._emission_systems = emission_systems
self._generation_systems = generation_systems self._generation_systems = generation_systems
self._energy_storage_systems = energy_storage_systems self._energy_storage_systems = energy_storage_systems
# self._configuration = configuration self._configuration_schema = configuration_schema
@property
def lod(self):
"""
Get level of detail of the catalog
:return: string
"""
return self._lod
@property @property
def id(self): def id(self):
@ -72,7 +61,7 @@ class System:
return self._demand_types return self._demand_types
@property @property
def generation_systems(self) -> List[GenerationSystem]: def generation_systems(self) -> Union[None, List[GenerationSystem]]:
""" """
Get generation systems Get generation systems
:return: [GenerationSystem] :return: [GenerationSystem]
@ -88,20 +77,12 @@ class System:
return self._distribution_systems return self._distribution_systems
@property @property
def emission_systems(self) -> Union[None, List[EmissionSystem]]: def configuration_schema(self) -> Path:
""" """
Get emission systems Get system configuration schema
:return: [EmissionSystem] :return: Path
""" """
return self._emission_systems return self._configuration_schema
@property
def energy_storage_systems(self) -> Union[None, List[ThermalStorageSystem], List[ElectricalStorageSystem]]:
"""
Get energy storage systems
:return: [EnergyStorageSystem]
"""
return self._energy_storage_systems
def to_dictionary(self): def to_dictionary(self):
"""Class content to dictionary""" """Class content to dictionary"""
@ -110,19 +91,12 @@ class System:
_generation_systems.append(_generation.to_dictionary()) _generation_systems.append(_generation.to_dictionary())
_distribution_systems = [_distribution.to_dictionary() for _distribution in _distribution_systems = [_distribution.to_dictionary() for _distribution in
self.distribution_systems] if self.distribution_systems is not None else None self.distribution_systems] if self.distribution_systems is not None else None
_emission_systems = [_emission.to_dictionary() for _emission in
self.emission_systems] if self.emission_systems is not None else None
_storage_systems = [_storage.to_dictionary() for _storage in
self.energy_storage_systems] if self.energy_storage_systems is not None else None
content = {'system': {'id': self.id, content = {'system': {'id': self.id,
'name': self.name, 'name': self.name,
'level of detail': self.lod,
'demand types': self.demand_types, 'demand types': self.demand_types,
'generation system(s)': _generation_systems, 'generation system(s)': _generation_systems,
'distribution system(s)': _distribution_systems, 'distribution system(s)': _distribution_systems
'emission system(s)': _emission_systems,
'energy storage system(s)': _storage_systems,
} }
} }
return content return content

View File

@ -15,16 +15,26 @@ class ThermalStorageSystem(EnergyStorageSystem):
Energy Storage System Class Energy Storage System Class
""" """
def __init__(self, storage_id, name, model_name, manufacturer, storage_type, nominal_capacity, losses_ratio, def __init__(self, storage_id, model_name=None, manufacturer=None, storage_type=None,
volume, height, layers, maximum_operating_temperature): nominal_capacity=None, losses_ratio=None, volume=None, height=None, layers=None,
maximum_operating_temperature=None):
super().__init__(storage_id, name, model_name, manufacturer, nominal_capacity, losses_ratio) super().__init__(storage_id, model_name, manufacturer, nominal_capacity, losses_ratio)
self._type_energy_stored = 'thermal'
self._storage_type = storage_type self._storage_type = storage_type
self._volume = volume self._volume = volume
self._height = height self._height = height
self._layers = layers self._layers = layers
self._maximum_operating_temperature = maximum_operating_temperature self._maximum_operating_temperature = maximum_operating_temperature
@property
def type_energy_stored(self):
"""
Get type of energy stored from ['electrical', 'thermal']
:return: string
"""
return self._type_energy_stored
@property @property
def storage_type(self): def storage_type(self):
""" """
@ -72,9 +82,11 @@ class ThermalStorageSystem(EnergyStorageSystem):
_layers = [] _layers = []
for _layer in self.layers: for _layer in self.layers:
_layers.append(_layer.to_dictionary()) _layers.append(_layer.to_dictionary())
content = {'Storage component': { content = {
'Storage component':
{
'storage id': self.id, 'storage id': self.id,
'name': self.name, 'type of energy stored': self.type_energy_stored,
'model name': self.model_name, 'model name': self.model_name,
'manufacturer': self.manufacturer, 'manufacturer': self.manufacturer,
'storage type': self.storage_type, 'storage type': self.storage_type,

View File

@ -10,7 +10,8 @@ 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
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.non_pv_generation_system import NonPvGenerationSystem
from hub.catalog_factories.data_models.energy_systems.pv_generation_system import PvGenerationSystem
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.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
@ -29,7 +30,6 @@ class MontrealCustomCatalog(Catalog):
self._archetypes = xmltodict.parse(xml.read(), force_list=('system', 'system_cluster', 'equipment', self._archetypes = xmltodict.parse(xml.read(), force_list=('system', 'system_cluster', 'equipment',
'demand', 'system_id')) 'demand', 'system_id'))
self._lod = float(self._archetypes['catalog']['@lod'])
self._catalog_generation_equipments, self._catalog_storage_equipments = self._load_generation_and_storage_equipments() self._catalog_generation_equipments, self._catalog_storage_equipments = self._load_generation_and_storage_equipments()
self._catalog_distribution_equipments = self._load_distribution_equipments() self._catalog_distribution_equipments = self._load_distribution_equipments()
self._catalog_emission_equipments = self._load_emission_equipments() self._catalog_emission_equipments = self._load_emission_equipments()
@ -39,9 +39,7 @@ class MontrealCustomCatalog(Catalog):
self._content = Content(self._catalog_archetypes, self._content = Content(self._catalog_archetypes,
self._catalog_systems, self._catalog_systems,
self._catalog_generation_equipments, self._catalog_generation_equipments,
self._catalog_distribution_equipments, self._catalog_distribution_equipments)
self._catalog_emission_equipments,
None)
def _load_generation_and_storage_equipments(self): def _load_generation_and_storage_equipments(self):
_equipments = [] _equipments = []
@ -51,7 +49,7 @@ class MontrealCustomCatalog(Catalog):
equipment_id = float(equipment['@id']) equipment_id = float(equipment['@id'])
equipment_type = equipment['@type'] equipment_type = equipment['@type']
fuel_type = equipment['@fuel_type'] fuel_type = equipment['@fuel_type']
name = equipment['name'] model_name = equipment['name']
heating_efficiency = None heating_efficiency = None
if 'heating_efficiency' in equipment: if 'heating_efficiency' in equipment:
heating_efficiency = float(equipment['heating_efficiency']) heating_efficiency = float(equipment['heating_efficiency'])
@ -61,46 +59,27 @@ class MontrealCustomCatalog(Catalog):
electricity_efficiency = None electricity_efficiency = None
if 'electrical_efficiency' in equipment: if 'electrical_efficiency' in equipment:
electricity_efficiency = float(equipment['electrical_efficiency']) electricity_efficiency = float(equipment['electrical_efficiency'])
# todo: this may be optionals instead? if model_name == 'PV system':
generation_system = GenerationSystem(equipment_id, generation_system = PvGenerationSystem(equipment_id,
name, model_name=model_name,
None, electricity_efficiency=electricity_efficiency,
None, )
equipment_type, else:
fuel_type, generation_system = NonPvGenerationSystem(equipment_id,
None, model_name=model_name,
None, system_type=equipment_type,
None, fuel_type=fuel_type,
None, heat_efficiency=heating_efficiency,
None, cooling_efficiency=cooling_efficiency,
heating_efficiency, electricity_efficiency=electricity_efficiency,
None, )
None,
None,
cooling_efficiency,
electricity_efficiency,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None)
_equipments.append(generation_system) _equipments.append(generation_system)
storage = literal_eval(equipment['storage'].capitalize()) storage = literal_eval(equipment['storage'].capitalize())
if storage: if storage:
if equipment_type == 'electricity generator': if equipment_type == 'electricity generator':
storage_system = ElectricalStorageSystem(equipment_id, None, None, None, 'electrical', None, None, None, None, storage_system = ElectricalStorageSystem(equipment_id)
None, None, None)
else: else:
storage_system = ThermalStorageSystem(equipment_id, None, None, None, 'thermal', None, None, None, None, None, storage_system = ThermalStorageSystem(equipment_id)
None)
_storages.append(storage_system) _storages.append(storage_system)
return _equipments, _storages return _equipments, _storages
@ -111,7 +90,7 @@ class MontrealCustomCatalog(Catalog):
for equipment in equipments: for equipment in equipments:
equipment_id = float(equipment['@id']) equipment_id = float(equipment['@id'])
equipment_type = equipment['@type'] equipment_type = equipment['@type']
name = equipment['name'] model_name = equipment['name']
distribution_heat_losses = None distribution_heat_losses = None
if 'distribution_heat_losses' in equipment: if 'distribution_heat_losses' in equipment:
distribution_heat_losses = float(equipment['distribution_heat_losses']['#text']) / 100 distribution_heat_losses = float(equipment['distribution_heat_losses']['#text']) / 100
@ -124,12 +103,11 @@ class MontrealCustomCatalog(Catalog):
equipment['distribution_consumption_variable_flow']['#text']) / 100 equipment['distribution_consumption_variable_flow']['#text']) / 100
distribution_system = DistributionSystem(equipment_id, distribution_system = DistributionSystem(equipment_id,
name, model_name=model_name,
equipment_type, system_type=equipment_type,
None, distribution_consumption_fix_flow=distribution_consumption_fix_flow,
distribution_consumption_fix_flow, distribution_consumption_variable_flow=distribution_consumption_variable_flow,
distribution_consumption_variable_flow, heat_losses=distribution_heat_losses)
distribution_heat_losses)
_equipments.append(distribution_system) _equipments.append(distribution_system)
return _equipments return _equipments
@ -140,15 +118,15 @@ class MontrealCustomCatalog(Catalog):
for equipment in equipments: for equipment in equipments:
equipment_id = float(equipment['@id']) equipment_id = float(equipment['@id'])
equipment_type = equipment['@type'] equipment_type = equipment['@type']
name = equipment['name'] model_name = equipment['name']
parasitic_consumption = None parasitic_consumption = None
if 'parasitic_consumption' in equipment: if 'parasitic_consumption' in equipment:
parasitic_consumption = float(equipment['parasitic_consumption']['#text']) / 100 parasitic_consumption = float(equipment['parasitic_consumption']['#text']) / 100
emission_system = EmissionSystem(equipment_id, emission_system = EmissionSystem(equipment_id,
name, model_name=model_name,
equipment_type, system_type=equipment_type,
parasitic_consumption) parasitic_energy_consumption=parasitic_consumption)
_equipments.append(emission_system) _equipments.append(emission_system)
return _equipments return _equipments
@ -180,14 +158,13 @@ class MontrealCustomCatalog(Catalog):
if int(equipment_archetype.id) == int(emission_equipment): if int(equipment_archetype.id) == int(emission_equipment):
_emission_equipments = [equipment_archetype] _emission_equipments = [equipment_archetype]
_catalog_systems.append(System(self._lod, _catalog_systems.append(System(system_id,
system_id,
name,
demands, demands,
_generation_equipments, name=name,
_distribution_equipments, generation_systems=_generation_equipments,
_emission_equipments, distribution_systems=_distribution_equipments,
_storage_equipments)) emission_systems=_emission_equipments,
energy_storage_systems=_storage_equipments))
return _catalog_systems return _catalog_systems
def _load_archetypes(self): def _load_archetypes(self):
@ -201,7 +178,7 @@ class MontrealCustomCatalog(Catalog):
for system_archetype in self._catalog_systems: for system_archetype in self._catalog_systems:
if int(system_archetype.id) == int(system): if int(system_archetype.id) == int(system):
_systems.append(system_archetype) _systems.append(system_archetype)
_catalog_archetypes.append(Archetype(self._lod, name, _systems)) _catalog_archetypes.append(Archetype(name, _systems))
return _catalog_archetypes return _catalog_archetypes
def names(self, category=None): def names(self, category=None):
@ -217,11 +194,9 @@ class MontrealCustomCatalog(Catalog):
for system in self._content.systems: for system in self._content.systems:
_names['systems'].append(system.name) _names['systems'].append(system.name)
for equipment in self._content.generation_equipments: for equipment in self._content.generation_equipments:
_names['generation_equipments'].append(equipment.name) _names['generation_equipments'].append(equipment.model_name)
for equipment in self._content.distribution_equipments: for equipment in self._content.distribution_equipments:
_names['distribution_equipments'].append(equipment.name) _names['distribution_equipments'].append(equipment.model_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':
@ -232,13 +207,10 @@ class MontrealCustomCatalog(Catalog):
_names[category].append(system.name) _names[category].append(system.name)
elif category.lower() == 'generation_equipments': elif category.lower() == 'generation_equipments':
for system in self._content.generation_equipments: for system in self._content.generation_equipments:
_names[category].append(system.name) _names[category].append(system.model_name)
elif category.lower() == 'distribution_equipments': elif category.lower() == 'distribution_equipments':
for system in self._content.distribution_equipments: for system in self._content.distribution_equipments:
_names[category].append(system.name) _names[category].append(system.model_name)
elif category.lower() == 'emission_equipments':
for system in self._content.emission_equipments:
_names[category].append(system.name)
else: else:
raise ValueError(f'Unknown category [{category}]') raise ValueError(f'Unknown category [{category}]')
return _names return _names
@ -258,9 +230,6 @@ class MontrealCustomCatalog(Catalog):
return self._content.generation_equipments return self._content.generation_equipments
if category.lower() == 'distribution_equipments': if category.lower() == 'distribution_equipments':
return self._content.distribution_equipments return self._content.distribution_equipments
if category.lower() == 'emission_equipments':
return self._content.emission_equipments
raise ValueError(f'Unknown category [{category}]')
def get_entry(self, name): def get_entry(self, name):
""" """
@ -274,12 +243,9 @@ class MontrealCustomCatalog(Catalog):
if entry.name.lower() == name.lower(): if entry.name.lower() == name.lower():
return entry return entry
for entry in self._content.generation_equipments: for entry in self._content.generation_equipments:
if entry.name.lower() == name.lower(): if entry.model_name.lower() == name.lower():
return entry return entry
for entry in self._content.distribution_equipments: for entry in self._content.distribution_equipments:
if entry.name.lower() == name.lower(): if entry.model_name.lower() == name.lower():
return entry
for entry in self._content.emission_equipments:
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

@ -10,7 +10,7 @@ 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
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.non_pv_generation_system import NonPvGenerationSystem
from hub.catalog_factories.data_models.energy_systems.pv_generation_system import PvGenerationSystem from hub.catalog_factories.data_models.energy_systems.pv_generation_system import PvGenerationSystem
from hub.catalog_factories.data_models.energy_systems.thermal_storage_system import ThermalStorageSystem from hub.catalog_factories.data_models.energy_systems.thermal_storage_system import ThermalStorageSystem
from hub.catalog_factories.data_models.energy_systems.performance_curves import PerformanceCurves from hub.catalog_factories.data_models.energy_systems.performance_curves import PerformanceCurves
@ -34,10 +34,7 @@ class NorthAmericaEnergySystemCatalog(Catalog):
self._system_archetypes = self._load_archetypes() self._system_archetypes = self._load_archetypes()
self._content = Content(self._system_archetypes, self._content = Content(self._system_archetypes,
self._systems, self._systems,
self._generation_components, generations=self._generation_components)
None,
None,
self._storage_components)
def _load_generation_components(self): def _load_generation_components(self):
generation_components = [] generation_components = []
@ -47,53 +44,29 @@ class NorthAmericaEnergySystemCatalog(Catalog):
templates = self._archetypes['EnergySystemCatalog']['energy_generation_components']['templateGenerationEquipments'] templates = self._archetypes['EnergySystemCatalog']['energy_generation_components']['templateGenerationEquipments']
for boiler in boilers: for boiler in boilers:
boiler_id = boiler['@generation_id'] boiler_id = boiler['@generation_id']
boiler_name = boiler['@name'] system_type = boiler['@name']
boiler_model_name = boiler['@modelName'] boiler_model_name = boiler['@modelName']
boiler_manufacturer = boiler['@manufacturer'] boiler_manufacturer = boiler['@manufacturer']
system_type = 'boiler'
boiler_fuel_type = boiler['@fuel'] boiler_fuel_type = boiler['@fuel']
boiler_nominal_thermal_output = float(boiler['@installedThermalPower']) boiler_nominal_thermal_output = float(boiler['@installedThermalPower'])
boiler_maximum_heat_output = float(boiler['@maximumHeatOutput']) boiler_maximum_heat_output = float(boiler['@maximumHeatOutput'])
boiler_minimum_heat_output = float(boiler['@minimumHeatOutput']) boiler_minimum_heat_output = float(boiler['@minimumHeatOutput'])
boiler_heat_efficiency = float(boiler['@nominalEfficiency']) boiler_heat_efficiency = float(boiler['@nominalEfficiency'])
# todo: this may be optionals instead? boiler_component = NonPvGenerationSystem(boiler_id,
boiler_component = GenerationSystem(boiler_id,
boiler_name,
boiler_model_name,
boiler_manufacturer,
system_type, system_type,
boiler_fuel_type, model_name=boiler_model_name,
boiler_nominal_thermal_output, manufacturer=boiler_manufacturer,
boiler_maximum_heat_output, fuel_type=boiler_fuel_type,
boiler_minimum_heat_output, nominal_thermal_output=boiler_nominal_thermal_output,
None, maximum_heat_output=boiler_maximum_heat_output,
None, minimum_heat_output=boiler_minimum_heat_output,
boiler_heat_efficiency, heat_efficiency=boiler_heat_efficiency)
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None)
generation_components.append(boiler_component) generation_components.append(boiler_component)
for heat_pump in heat_pumps: for heat_pump in heat_pumps:
heat_pump_id = heat_pump['@generation_id'] heat_pump_id = heat_pump['@generation_id']
heat_pump_name = heat_pump['@name'] system_type = heat_pump['@name']
heat_pump_model_name = heat_pump['@modelName'] heat_pump_model_name = heat_pump['@modelName']
heat_pump_manufacturer = heat_pump['@manufacturer'] heat_pump_manufacturer = heat_pump['@manufacturer']
system_type = 'heat pump'
heat_pump_fuel_type = heat_pump['@fuel'] heat_pump_fuel_type = heat_pump['@fuel']
heat_pump_nominal_thermal_output = float(heat_pump['@installedThermalPower']) heat_pump_nominal_thermal_output = float(heat_pump['@installedThermalPower'])
heat_pump_maximum_heat_output = float(heat_pump['@maximumHeatOutput']) heat_pump_maximum_heat_output = float(heat_pump['@maximumHeatOutput'])
@ -111,40 +84,25 @@ class NorthAmericaEnergySystemCatalog(Catalog):
coefficients = list(heat_pump['performance_curve']['coefficients'].values()) coefficients = list(heat_pump['performance_curve']['coefficients'].values())
cop_curve = PerformanceCurves(cop_curve_type, dependant_variable, parameters, coefficients) cop_curve = PerformanceCurves(cop_curve_type, dependant_variable, parameters, coefficients)
heat_pump_component = GenerationSystem(heat_pump_id, heat_pump_component = NonPvGenerationSystem(heat_pump_id,
heat_pump_name,
heat_pump_model_name,
heat_pump_manufacturer,
system_type, system_type,
heat_pump_fuel_type, model_name=heat_pump_model_name,
heat_pump_nominal_thermal_output, manufacturer=heat_pump_manufacturer,
heat_pump_maximum_heat_output, fuel_type=heat_pump_fuel_type,
heat_pump_minimum_heat_output, nominal_thermal_output=heat_pump_nominal_thermal_output,
heat_pump_source_medium, maximum_heat_output=heat_pump_maximum_heat_output,
heat_pump_supply_medium, minimum_heat_output=heat_pump_minimum_heat_output,
heat_pump_nominal_cop, source_medium=heat_pump_source_medium,
None, supply_medium=heat_pump_supply_medium,
None, heat_efficiency=heat_pump_nominal_cop,
None, maximum_heat_supply_temperature=heat_pump_maximum_heat_supply_temperature,
None, minimum_heat_supply_temperature=heat_pump_minimum_heat_supply_temperature,
None, maximum_cooling_supply_temperature=heat_pump_maximum_cooling_supply_temperature,
None, minimum_cooling_supply_temperature=heat_pump_minimum_cooling_supply_temperature,
None, heat_efficiency_curve=cop_curve)
None,
heat_pump_maximum_heat_supply_temperature,
heat_pump_minimum_heat_supply_temperature,
heat_pump_maximum_cooling_supply_temperature,
heat_pump_minimum_cooling_supply_temperature,
None,
None,
cop_curve,
None,
None,
None)
generation_components.append(heat_pump_component) generation_components.append(heat_pump_component)
for pv in photovoltaics: for pv in photovoltaics:
pv_id = pv['@generation_id'] pv_id = pv['@generation_id']
pv_name = pv['@name']
pv_model_name = pv['@modelName'] pv_model_name = pv['@modelName']
pv_manufacturer = pv['@manufacturer'] pv_manufacturer = pv['@manufacturer']
pv_electricity_efficiency = pv['@nominalEfficiency'] pv_electricity_efficiency = pv['@nominalEfficiency']
@ -159,19 +117,18 @@ class NorthAmericaEnergySystemCatalog(Catalog):
height = float(pv['@height']) height = float(pv['@height'])
pv_component = PvGenerationSystem(pv_id, pv_component = PvGenerationSystem(pv_id,
pv_name, model_name=pv_model_name,
pv_model_name, manufacturer=pv_manufacturer,
pv_manufacturer, electricity_efficiency=pv_electricity_efficiency,
pv_electricity_efficiency, nominal_electricity_output=pv_nominal_electricity_output,
pv_nominal_electricity_output, nominal_ambient_temperature=nominal_ambient_temperature,
nominal_ambient_temperature, nominal_cell_temperature=nominal_cell_temperature,
nominal_cell_temperature, nominal_radiation=nominal_radiation,
nominal_radiation, standard_test_condition_cell_temperature=standard_test_condition_cell_temperature,
standard_test_condition_cell_temperature, standard_test_condition_maximum_power=standard_test_condition_maximum_power,
standard_test_condition_maximum_power, cell_temperature_coefficient=cell_temperature_coefficient,
cell_temperature_coefficient, width=width,
width, height=height)
height)
generation_components.append(pv_component) generation_components.append(pv_component)
for template in templates: for template in templates:
system_id = template['@generation_id'] system_id = template['@generation_id']
@ -294,7 +251,7 @@ class NorthAmericaEnergySystemCatalog(Catalog):
insulation_layer = Layer(None, 'insulation', insulation_material, thickness) insulation_layer = Layer(None, 'insulation', insulation_material, thickness)
thickness = float(tes['physical_characteristics']['@tankThickness']) / 100 # from cm to m thickness = float(tes['physical_characteristics']['@tankThickness']) / 100 # from cm to m
tank_layer = Layer(None, 'tank', tank_material, thickness) tank_layer = Layer(None, 'tank', tank_material, thickness)
# the convention is from outside to inside # the convention is from outside to inside
layers = [insulation_layer, tank_layer] layers = [insulation_layer, tank_layer]
storage_component = ThermalStorageSystem(storage_id, storage_component = ThermalStorageSystem(storage_id,
name, name,
@ -324,7 +281,7 @@ class NorthAmericaEnergySystemCatalog(Catalog):
insulation_layer = Layer(None, 'insulation', insulation_material, thickness) insulation_layer = Layer(None, 'insulation', insulation_material, thickness)
thickness = float(template['physical_characteristics']['@tankThickness']) / 100 # from cm to m thickness = float(template['physical_characteristics']['@tankThickness']) / 100 # from cm to m
tank_layer = Layer(None, 'tank', tank_material, thickness) tank_layer = Layer(None, 'tank', tank_material, thickness)
# the convention is from outside to inside # the convention is from outside to inside
layers = [insulation_layer, tank_layer] layers = [insulation_layer, tank_layer]
storage_component = ThermalStorageSystem(storage_id, storage_component = ThermalStorageSystem(storage_id,
name, name,

View File

@ -23,8 +23,6 @@ class TestSystemsCatalog(TestCase):
self.assertEqual(7, len(generation_equipments['generation_equipments'])) self.assertEqual(7, len(generation_equipments['generation_equipments']))
distribution_equipments = catalog.names('distribution_equipments') distribution_equipments = catalog.names('distribution_equipments')
self.assertEqual(8, len(distribution_equipments['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')