Compare commits

..

No commits in common. "76b67b38dfac2a40e9cc74852f277f345553bedf" and "3db3acd3c611f0ec88f97f9749520019c13e3958" have entirely different histories.

18 changed files with 368 additions and 1639 deletions

View File

@ -15,20 +15,11 @@ class Archetype:
"""
Archetype class
"""
def __init__(self, name, systems):
def __init__(self, name, systems, archetype_cluster_id=None):
self._cluster_id = archetype_cluster_id
self._name = name
self._systems = systems
@property
def cluster_id(self):
"""
Get id
:return: string
"""
return self._cluster_id
@property
def name(self):
"""
@ -52,7 +43,6 @@ class Archetype:
_systems.append(_system.to_dictionary())
content = {
'Archetype': {
'cluster_id': self.cluster_id,
'name': self.name,
'systems': _systems
}

View File

@ -119,7 +119,7 @@ class ThermalStorageSystem(EnergyStorageSystem):
'height [m]': self.height,
'layers': _layers,
'maximum operating temperature [Celsius]': self.maximum_operating_temperature,
'storage_medium': _medias,
'storage_medium': self.storage_medium.to_dictionary(),
'heating coil capacity [W]': self.heating_coil_capacity
}
}

View File

@ -69,7 +69,7 @@ class MontrealCustomCatalog(Catalog):
storage_system = ThermalStorageSystem(equipment_id)
storage_systems = [storage_system]
if model_name == 'PV system':
system_type = 'photovoltaic'
system_type = 'Photovoltaic'
generation_system = PvGenerationSystem(equipment_id,
name=None,
system_type= system_type,

View File

@ -30,8 +30,7 @@ class MontrealFutureSystemCatalogue(Catalog):
path = str(path / 'montreal_future_systems.xml')
with open(path, 'r', encoding='utf-8') as xml:
self._archetypes = xmltodict.parse(xml.read(),
force_list=['pv_generation_component', 'templateStorages', 'demand',
'system', 'system_id'])
force_list=['pv_generation_component', 'templateStorages', 'demand'])
self._storage_components = self._load_storage_components()
self._generation_components = self._load_generation_components()
@ -50,7 +49,7 @@ class MontrealFutureSystemCatalogue(Catalog):
'non_pv_generation_component']
if non_pv_generation_components is not None:
for non_pv in non_pv_generation_components:
system_id = non_pv['generation_system_id']
system_id = non_pv['system_id']
name = non_pv['name']
system_type = non_pv['system_type']
model_name = non_pv['model_name']
@ -182,7 +181,7 @@ class MontrealFutureSystemCatalogue(Catalog):
'pv_generation_component']
if pv_generation_components is not None:
for pv in pv_generation_components:
system_id = pv['generation_system_id']
system_id = pv['system_id']
name = pv['name']
system_type = pv['system_type']
model_name = pv['model_name']
@ -382,7 +381,6 @@ class MontrealFutureSystemCatalogue(Catalog):
_system_archetypes = []
system_clusters = self._archetypes['EnergySystemCatalog']['system_archetypes']['system_archetype']
for system_cluster in system_clusters:
archetype_id = system_cluster['@cluster_id']
name = system_cluster['name']
systems = system_cluster['systems']['system_id']
integer_system_ids = [int(item) for item in systems]
@ -390,7 +388,7 @@ class MontrealFutureSystemCatalogue(Catalog):
for system_archetype in self._systems:
if int(system_archetype.id) in integer_system_ids:
_systems.append(system_archetype)
_system_archetypes.append(Archetype(archetype_cluster_id=archetype_id, name=name, systems=_systems))
_system_archetypes.append(Archetype(name=name, systems=_systems))
return _system_archetypes
def _load_materials(self):

View File

@ -92,7 +92,6 @@ class Building(CityObject):
logging.error('Building %s [%s] has an unexpected surface type %s.', self.name, self.aliases, surface.type)
self._domestic_hot_water_peak_load = None
self._fuel_consumption_breakdown = {}
self._systems_archetype_cluster_id = None
self._pv_generation = {}
@property
@ -868,10 +867,9 @@ class Building(CityObject):
Get energy consumption of different sectors
return: dict
"""
fuel_breakdown = {cte.ELECTRICITY: {cte.LIGHTING: self.lighting_electrical_demand[cte.YEAR][0] if self.lighting_electrical_demand else 0,
cte.APPLIANCES: self.appliances_electrical_demand[cte.YEAR][0] if self.appliances_electrical_demand else 0}}
fuel_breakdown = {cte.ELECTRICITY: {cte.LIGHTING: self.lighting_electrical_demand[cte.YEAR][0],
cte.APPLIANCES: self.appliances_electrical_demand[cte.YEAR][0]}}
energy_systems = self.energy_systems
if energy_systems is not None:
for energy_system in energy_systems:
demand_types = energy_system.demand_types
generation_systems = energy_system.generation_systems
@ -887,8 +885,7 @@ class Building(CityObject):
if storage_systems:
for storage_system in storage_systems:
if storage_system.type_energy_stored == 'thermal' and storage_system.heating_coil_energy_consumption:
fuel_breakdown[cte.ELECTRICITY][f'{demand_type}'] += (
storage_system.heating_coil_energy_consumption)[f'{demand_type}'][cte.YEAR][0]
fuel_breakdown[cte.ELECTRICITY][f'{demand_type}'] += storage_system.heating_coil_energy_consumption[cte.YEAR][0]
#TODO: When simulation models of all energy system archetypes are created, this part can be removed
heating_fuels = []
dhw_fuels = []
@ -903,52 +900,20 @@ class Building(CityObject):
if key == cte.ELECTRICITY and cte.COOLING not in fuel_breakdown[key]:
for energy_system in energy_systems:
if cte.COOLING in energy_system.demand_types and cte.COOLING not in fuel_breakdown[key]:
if self.cooling_consumption:
fuel_breakdown[energy_system.generation_systems[0].fuel_type][cte.COOLING] = self.cooling_consumption[cte.YEAR][0]
for generation_system in energy_system.generation_systems:
fuel_breakdown[generation_system.fuel_type][cte.COOLING] = self.cooling_consumption[cte.YEAR][0]
for fuel in heating_fuels:
if cte.HEATING not in fuel_breakdown[fuel]:
for energy_system in energy_systems:
if cte.HEATING in energy_system.demand_types:
if self.heating_consumption:
fuel_breakdown[energy_system.generation_systems[0].fuel_type][cte.HEATING] = self.heating_consumption[cte.YEAR][0]
for generation_system in energy_system.generation_systems:
fuel_breakdown[generation_system.fuel_type][cte.HEATING] = self.heating_consumption[cte.YEAR][0]
for fuel in dhw_fuels:
if cte.DOMESTIC_HOT_WATER not in fuel_breakdown[fuel]:
for energy_system in energy_systems:
if cte.DOMESTIC_HOT_WATER in energy_system.demand_types:
if self.domestic_hot_water_consumption:
fuel_breakdown[energy_system.generation_systems[0].fuel_type][cte.DOMESTIC_HOT_WATER] = self.domestic_hot_water_consumption[cte.YEAR][0]
for generation_system in energy_system.generation_systems:
fuel_breakdown[generation_system.fuel_type][cte.DOMESTIC_HOT_WATER] = self.domestic_hot_water_consumption[cte.YEAR][0]
self._fuel_consumption_breakdown = fuel_breakdown
return self._fuel_consumption_breakdown
@property
def energy_systems_archetype_cluster_id(self):
"""
Get energy systems archetype id
:return: str
"""
return self._systems_archetype_cluster_id
@energy_systems_archetype_cluster_id.setter
def energy_systems_archetype_cluster_id(self, value):
"""
Set energy systems archetype id
:param value: str
"""
self._systems_archetype_cluster_id = value
@property
def pv_generation(self):
"""
temporary attribute to get the onsite pv generation in W
:return: dict
"""
return self._pv_generation
@pv_generation.setter
def pv_generation(self, value):
"""
temporary attribute to set the onsite pv generation in W
:param value: float
"""
self._pv_generation = value

View File

@ -157,7 +157,6 @@ class Surface:
if self._inclination is None:
self._inclination = np.arccos(self.perimeter_polygon.normal[2])
return self._inclination
@property
def type(self):
"""

View File

@ -198,7 +198,7 @@
<equipments>
<generation_id>3</generation_id>
<distribution_id>8</distribution_id>
</equipments>
g </equipments>
</system>
<system id="5">
<name>Single zone packaged rooftop unit with electrical resistance furnace and baseboards and fuel boiler for acs</name>
@ -240,7 +240,7 @@
<demand>domestic_hot_water</demand>
</demands>
<equipments>
<generation_id>1</generation_id>
<generation_id>2</generation_id>
<distribution_id>3</distribution_id>
</equipments>
</system>
@ -302,7 +302,7 @@
</demands>
<equipments>
<generation_id>5</generation_id>
<distribution_id>4</distribution_id>
<distribution_id>6</distribution_id>
</equipments>
</system>
<system id="15">

File diff suppressed because it is too large Load Diff

View File

@ -253,7 +253,7 @@
<pv_generation_component>
<system_id>7</system_id>
<name>template Photovoltaic Module</name>
<system_type>photovoltaic</system_type>
<system_type>Photovoltaic</system_type>
<model_name/>
<manufacturer/>
<nominal_electricity_output/>
@ -264,7 +264,7 @@
<standard_test_condition_cell_temperature>25</standard_test_condition_cell_temperature>
<standard_test_condition_radiation>1000</standard_test_condition_radiation>
<standard_test_condition_maximum_power>500</standard_test_condition_maximum_power>
<cell_temperature_coefficient>0.3</cell_temperature_coefficient>
<cell_temperature_coefficient/>
<width>2.0</width>
<height>1.0</height>
<distribution_systems/>
@ -274,7 +274,7 @@
<pv_generation_component>
<system_id>8</system_id>
<name>Photovoltaic Module</name>
<system_type>photovoltaic</system_type>
<system_type>Photovoltaic</system_type>
<model_name>RE400CAA Pure 2</model_name>
<manufacturer>REC</manufacturer>
<nominal_electricity_output>305</nominal_electricity_output>
@ -295,7 +295,7 @@
<pv_generation_component>
<system_id>9</system_id>
<name>Photovoltaic Module</name>
<system_type>photovoltaic</system_type>
<system_type>Photovoltaic</system_type>
<model_name>RE410CAA Pure 2</model_name>
<manufacturer>REC</manufacturer>
<nominal_electricity_output>312</nominal_electricity_output>
@ -316,7 +316,7 @@
<pv_generation_component>
<system_id>10</system_id>
<name>Photovoltaic Module</name>
<system_type>photovoltaic</system_type>
<system_type>Photovoltaic</system_type>
<model_name>RE420CAA Pure 2</model_name>
<manufacturer>REC</manufacturer>
<nominal_electricity_output>320</nominal_electricity_output>
@ -337,7 +337,7 @@
<pv_generation_component>
<system_id>11</system_id>
<name>Photovoltaic Module</name>
<system_type>photovoltaic</system_type>
<system_type>Photovoltaic</system_type>
<model_name>RE430CAA Pure 2</model_name>
<manufacturer>REC</manufacturer>
<nominal_electricity_output>327</nominal_electricity_output>
@ -358,7 +358,7 @@
<pv_generation_component>
<system_id>12</system_id>
<name>Photovoltaic Module</name>
<system_type>photovoltaic</system_type>
<system_type>Photovoltaic</system_type>
<model_name>REC600AA Pro M</model_name>
<manufacturer>REC</manufacturer>
<nominal_electricity_output>457</nominal_electricity_output>
@ -379,7 +379,7 @@
<pv_generation_component>
<system_id>13</system_id>
<name>Photovoltaic Module</name>
<system_type>photovoltaic</system_type>
<system_type>Photovoltaic</system_type>
<model_name>REC610AA Pro M</model_name>
<manufacturer>REC</manufacturer>
<nominal_electricity_output>464</nominal_electricity_output>
@ -400,7 +400,7 @@
<pv_generation_component>
<system_id>14</system_id>
<name>Photovoltaic Module</name>
<system_type>photovoltaic</system_type>
<system_type>Photovoltaic</system_type>
<model_name>REC620AA Pro M</model_name>
<manufacturer>REC</manufacturer>
<nominal_electricity_output>472</nominal_electricity_output>
@ -421,7 +421,7 @@
<pv_generation_component>
<system_id>15</system_id>
<name>Photovoltaic Module</name>
<system_type>photovoltaic</system_type>
<system_type>Photovoltaic</system_type>
<model_name>REC630AA Pro M</model_name>
<manufacturer>REC</manufacturer>
<nominal_electricity_output>480</nominal_electricity_output>
@ -442,7 +442,7 @@
<pv_generation_component>
<system_id>16</system_id>
<name>Photovoltaic Module</name>
<system_type>photovoltaic</system_type>
<system_type>Photovoltaic</system_type>
<model_name>REC640AA Pro M</model_name>
<manufacturer>REC</manufacturer>
<nominal_electricity_output>487</nominal_electricity_output>

View File

@ -304,7 +304,6 @@ GRID = 'Grid'
ONSITE_ELECTRICITY = 'Onsite Electricity'
PHOTOVOLTAIC = 'Photovoltaic'
BOILER = 'Boiler'
FURNACE = 'Furnace'
HEAT_PUMP = 'Heat Pump'
BASEBOARD = 'Baseboard'
ELECTRICITY_GENERATOR = 'Electricity generator'

View File

@ -17,7 +17,6 @@ class MontrealCustomFuelToHubFuel:
self._dictionary = {
'gas': cte.GAS,
'natural gas': cte.GAS,
'biomass': cte.BIOMASS,
'electricity': cte.ELECTRICITY,
'renewable': cte.RENEWABLE,
'butane': cte.BUTANE,

View File

@ -15,10 +15,10 @@ class MontrealGenerationSystemToHubEnergyGenerationSystem:
def __init__(self):
self._dictionary = {
'boiler': cte.BOILER,
'furnace': cte.FURNACE,
'furnace': cte.BASEBOARD,
'cooler': cte.CHILLER,
'electricity generator': cte.ELECTRICITY_GENERATOR,
'photovoltaic': cte.PHOTOVOLTAIC,
'Photovoltaic': cte.PHOTOVOLTAIC,
'heat pump': cte.HEAT_PUMP,
'joule': cte.JOULE,
'split': cte.SPLIT,

View File

@ -3,7 +3,6 @@ Montreal custom energy system importer
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Project Contributor Saeed Ranjbar saeed.ranjbar@concordia.ca
"""
import logging
@ -84,9 +83,9 @@ class MontrealCustomEnergySystemParameters:
def _create_generation_systems(archetype_system):
_generation_systems = []
for archetype_generation_system in archetype_system.generation_systems:
if archetype_generation_system.system_type == 'photovoltaic':
if archetype_generation_system.system_type == 'Photovoltaic':
_generation_system = PvGenerationSystem()
_type = archetype_generation_system.system_type
_type = 'Photovoltaic'
_generation_system.system_type = Dictionaries().montreal_generation_system_to_hub_energy_generation_system[
_type]
_fuel_type = Dictionaries().montreal_custom_fuel_to_hub_fuel[archetype_generation_system.fuel_type]
@ -137,13 +136,13 @@ class MontrealCustomEnergySystemParameters:
_distribution_system.distribution_consumption_variable_flow = \
archetype_distribution_system.distribution_consumption_variable_flow
_distribution_system.heat_losses = archetype_distribution_system.heat_losses
_generic_emission_system = None
_emission_system = None
if archetype_distribution_system.emission_systems is not None:
_emission_systems = []
for emission_system in archetype_distribution_system.emission_systems:
_generic_emission_system = EmissionSystem()
_generic_emission_system.parasitic_energy_consumption = emission_system.parasitic_energy_consumption
_emission_systems.append(_generic_emission_system)
_emission_system = EmissionSystem()
_emission_system.parasitic_energy_consumption = emission_system.parasitic_energy_consumption
_emission_systems.append(_emission_system)
_distribution_system.emission_systems = _emission_systems
_distribution_systems.append(_distribution_system)
return _distribution_systems

View File

@ -43,7 +43,6 @@ class MontrealFutureEnergySystemParameters:
archetype_name = building.energy_systems_archetype_name
try:
archetype = self._search_archetypes(montreal_custom_catalog, archetype_name)
building.energy_systems_archetype_cluster_id = archetype.cluster_id
except KeyError:
logging.error('Building %s has unknown energy system archetype for system name %s', building.name,
archetype_name)
@ -88,7 +87,7 @@ class MontrealFutureEnergySystemParameters:
archetype_generation_systems = archetype_system.generation_systems
if archetype_generation_systems is not None:
for archetype_generation_system in archetype_system.generation_systems:
if archetype_generation_system.system_type == 'photovoltaic':
if archetype_generation_system.system_type == 'Photovoltaic':
_generation_system = PvGenerationSystem()
_generation_system.name = archetype_generation_system.name
_generation_system.model_name = archetype_generation_system.model_name
@ -104,21 +103,15 @@ class MontrealFutureEnergySystemParameters:
_generation_system.nominal_radiation = archetype_generation_system.nominal_radiation
_generation_system.standard_test_condition_cell_temperature = archetype_generation_system.standard_test_condition_cell_temperature
_generation_system.standard_test_condition_maximum_power = archetype_generation_system.standard_test_condition_maximum_power
_generation_system.standard_test_condition_radiation = archetype_generation_system.standard_test_condition_radiation
_generation_system.cell_temperature_coefficient = archetype_generation_system.cell_temperature_coefficient
_generation_system.width = archetype_generation_system.width
_generation_system.height = archetype_generation_system.height
_generation_system.tilt_angle = self._city.latitude
_generic_storage_system = None
if archetype_generation_system.energy_storage_systems is not None:
_storage_systems = []
for storage_system in archetype_generation_system.energy_storage_systems:
if storage_system.type_energy_stored == 'electrical':
_generic_storage_system = ElectricalStorageSystem()
_generic_storage_system.type_energy_stored = 'electrical'
_storage_systems.append(_generic_storage_system)
_generation_system.energy_storage_systems = _storage_systems
_generation_system.energy_storage_systems = [_generic_storage_system]
else:
_generation_system = NonPvGenerationSystem()
_generation_system.name = archetype_generation_system.name
@ -192,13 +185,13 @@ class MontrealFutureEnergySystemParameters:
_distribution_system.distribution_consumption_variable_flow = \
archetype_distribution_system.distribution_consumption_variable_flow
_distribution_system.heat_losses = archetype_distribution_system.heat_losses
_generic_emission_system = None
_emission_system = None
if archetype_distribution_system.emission_systems is not None:
_emission_systems = []
for emission_system in archetype_distribution_system.emission_systems:
_generic_emission_system = EmissionSystem()
_generic_emission_system.parasitic_energy_consumption = emission_system.parasitic_energy_consumption
_emission_systems.append(_generic_emission_system)
_emission_system = EmissionSystem()
_emission_system.parasitic_energy_consumption = emission_system.parasitic_energy_consumption
_emission_systems.append(_emission_system)
_distribution_system.emission_systems = _emission_systems
_distribution_systems.append(_distribution_system)
return _distribution_systems

View File

@ -87,7 +87,7 @@ class PalmaEnergySystemParameters:
archetype_generation_systems = archetype_system.generation_systems
if archetype_generation_systems is not None:
for archetype_generation_system in archetype_system.generation_systems:
if archetype_generation_system.system_type == 'photovoltaic':
if archetype_generation_system.system_type == 'Photovoltaic':
_generation_system = PvGenerationSystem()
_generation_system.name = archetype_generation_system.name
_generation_system.model_name = archetype_generation_system.model_name

View File

@ -39,11 +39,11 @@ class TestSystemsCatalog(TestCase):
catalog_categories = catalog.names()
archetypes = catalog.names()
self.assertEqual(34, len(archetypes['archetypes']))
self.assertEqual(15, len(archetypes['archetypes']))
systems = catalog.names('systems')
self.assertEqual(39, len(systems['systems']))
self.assertEqual(12, len(systems['systems']))
generation_equipments = catalog.names('generation_equipments')
self.assertEqual(49, len(generation_equipments['generation_equipments']))
self.assertEqual(27, len(generation_equipments['generation_equipments']))
with self.assertRaises(ValueError):
catalog.names('unknown')
@ -55,7 +55,6 @@ class TestSystemsCatalog(TestCase):
with self.assertRaises(IndexError):
catalog.get_entry('unknown')
def test_palma_catalog(self):
catalog = EnergySystemsCatalogFactory('palma').catalog
catalog_categories = catalog.names()

View File

@ -114,8 +114,7 @@ class TestSystemsFactory(TestCase):
ResultFactory('insel_monthly_energy_balance', self._city, self._output_path).enrich()
for building in self._city.buildings:
building.energy_systems_archetype_name = ('Central Hydronic Air and Gas Source Heating System with Unitary Split '
'Cooling and Air Source HP DHW and Grid Tied PV')
building.energy_systems_archetype_name = 'PV+ASHP+GasBoiler+TES'
EnergySystemsFactory('montreal_future', self._city).enrich()
# Need to assign energy systems to buildings:
for building in self._city.buildings:
@ -132,7 +131,6 @@ class TestSystemsFactory(TestCase):
self.assertLess(0, building.heating_consumption[cte.YEAR][0])
self.assertLess(0, building.cooling_consumption[cte.YEAR][0])
self.assertLess(0, building.domestic_hot_water_consumption[cte.YEAR][0])
if 'PV' in building.energy_systems_archetype_name:
self.assertLess(0, building.onsite_electrical_production[cte.YEAR][0])
def test_palma_system_results(self):