new catalog model and factory finished and test passed

This commit is contained in:
Pilar Monsalvete 2023-10-12 11:59:52 -04:00
parent 57ee3e734b
commit 1a7ad20135
4 changed files with 94 additions and 68 deletions

View File

@ -6,12 +6,14 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca
"""
from typing import Union, List
from typing import Union, List, TypeVar
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.energy_storage_system import EnergyStorageSystem
from hub.catalog_factories.data_models.energy_systems.emission_system import EmissionSystem
GenerationSystem = TypeVar('GenerationSystem')
class DistributionSystem:
"""

View File

@ -31,8 +31,8 @@ class MontrealCustomCatalog(Catalog):
'demand', 'system_id'))
self._catalog_generation_equipments = self._load_generation_equipments()
self._catalog_distribution_equipments = self._load_distribution_equipments()
self._catalog_emission_equipments = self._load_emission_equipments()
self._catalog_distribution_equipments = self._load_distribution_equipments()
self._catalog_systems = self._load_systems()
self._catalog_archetypes = self._load_archetypes()
# store the full catalog data model in self._content
@ -59,10 +59,20 @@ class MontrealCustomCatalog(Catalog):
electricity_efficiency = None
if 'electrical_efficiency' in equipment:
electricity_efficiency = float(equipment['electrical_efficiency'])
storage_systems = None
storage = literal_eval(equipment['storage'].capitalize())
if storage:
if equipment_type == 'electricity generator':
storage_system = ElectricalStorageSystem(equipment_id)
else:
storage_system = ThermalStorageSystem(equipment_id)
storage_systems = [storage_system]
if model_name == 'PV system':
generation_system = PvGenerationSystem(equipment_id,
model_name=model_name,
electricity_efficiency=electricity_efficiency,
energy_storage_systems=storage_systems
)
else:
generation_system = NonPvGenerationSystem(equipment_id,
@ -72,14 +82,8 @@ class MontrealCustomCatalog(Catalog):
heat_efficiency=heating_efficiency,
cooling_efficiency=cooling_efficiency,
electricity_efficiency=electricity_efficiency,
)
storage = literal_eval(equipment['storage'].capitalize())
if storage:
if equipment_type == 'electricity generator':
storage_system = ElectricalStorageSystem(equipment_id)
else:
storage_system = ThermalStorageSystem(equipment_id)
generation_system.energy_storage_systems = [storage_system]
energy_storage_systems=storage_systems
)
_equipments.append(generation_system)
return _equipments
@ -102,12 +106,19 @@ class MontrealCustomCatalog(Catalog):
distribution_consumption_variable_flow = float(
equipment['distribution_consumption_variable_flow']['#text']) / 100
emission_equipment = equipment['dissipation_id']
_emission_equipments = None
for equipment_archetype in self._catalog_emission_equipments:
if int(equipment_archetype.id) == int(emission_equipment):
_emission_equipments = [equipment_archetype]
distribution_system = DistributionSystem(equipment_id,
model_name=model_name,
system_type=equipment_type,
distribution_consumption_fix_flow=distribution_consumption_fix_flow,
distribution_consumption_variable_flow=distribution_consumption_variable_flow,
heat_losses=distribution_heat_losses)
heat_losses=distribution_heat_losses,
emission_systems=_emission_equipments)
_equipments.append(distribution_system)
return _equipments
@ -148,18 +159,6 @@ class MontrealCustomCatalog(Catalog):
for equipment_archetype in self._catalog_distribution_equipments:
if int(equipment_archetype.id) == int(distribution_equipment):
_distribution_equipments = [equipment_archetype]
emission_equipment = system['equipments']['dissipation_id']
_emission_equipments = None
for equipment_archetype in self._catalog_emission_equipments:
if int(equipment_archetype.id) == int(emission_equipment):
_emission_equipments = [equipment_archetype]
_catalog_systems.append(System(system_id,
demands,

View File

@ -38,53 +38,96 @@
</equipment>
</generation_equipments>
<distribution_equipments>
<equipment id="1" type="Water distribution heating">
<equipment id="1" type="Water distribution heating with baseboards">
<name>Water distribution heating</name>
<distribution_heat_losses units="%">10</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">2</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">0</distribution_consumption_variable_flow>
<dissipation_id>1</dissipation_id>
</equipment>
<equipment id="2" type="Water distribution cooling">
<equipment id="2" type="Water distribution heating with fan-coils">
<name>Water distribution heating</name>
<distribution_heat_losses units="%">10</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">2</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">0</distribution_consumption_variable_flow>
<dissipation_id>2</dissipation_id>
</equipment>
<equipment id="3" type="Water distribution heating with inductors">
<name>Water distribution heating</name>
<distribution_heat_losses units="%">10</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">2</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">0</distribution_consumption_variable_flow>
<dissipation_id>3</dissipation_id>
</equipment>
<equipment id="4" type="Water distribution cooling with fan-coils">
<name>Water distribution cooling</name>
<distribution_heat_losses units="%">5</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">4</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">0</distribution_consumption_variable_flow>
<dissipation_id>2</dissipation_id>
</equipment>
<equipment id="3" type="Central air distribution heating">
<equipment id="5" type="Central air distribution heating with fan-coils">
<name>Central air distribution heating</name>
<distribution_heat_losses units="%">10</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">0</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">13</distribution_consumption_variable_flow>
<dissipation_id>2</dissipation_id>
</equipment>
<equipment id="4" type="Central air distribution cooling">
<equipment id="6" type="Central air distribution heating with inductors">
<name>Central air distribution heating</name>
<distribution_heat_losses units="%">10</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">0</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">13</distribution_consumption_variable_flow>
<dissipation_id>3</dissipation_id>
</equipment>
<equipment id="7" type="Central air distribution cooling with fan-coils">
<name>Central air distribution cooling</name>
<distribution_heat_losses units="%">5</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">0</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">13</distribution_consumption_variable_flow>
<dissipation_id>2</dissipation_id>
</equipment>
<equipment id="5" type="Local air distribution heating">
<equipment id="8" type="Local air distribution heating with baseboards">
<name>Local air distribution heating</name>
<distribution_heat_losses units="%">5</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">8</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">0</distribution_consumption_variable_flow>
<dissipation_id>1</dissipation_id>
</equipment>
<equipment id="6" type="Local air distribution cooling">
<equipment id="9" type="Local air distribution heating with inductors">
<name>Local air distribution heating</name>
<distribution_heat_losses units="%">5</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">8</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">0</distribution_consumption_variable_flow>
<dissipation_id>3</dissipation_id>
</equipment>
<equipment id="10" type="Local air distribution cooling with inductors">
<name>Local air distribution cooling</name>
<distribution_heat_losses units="%">2</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">8</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">0</distribution_consumption_variable_flow>
<dissipation_id>3</dissipation_id>
</equipment>
<equipment id="7" type="Refrigerant distribution">
<equipment id="11" type="Refrigerant distribution with fan-coils">
<name>Refrigerant distribution</name>
<distribution_heat_losses units="%">1</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">1</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">0</distribution_consumption_variable_flow>
<dissipation_id>2</dissipation_id>
</equipment>
<equipment id="8" type="No distribution">
<equipment id="12" type="No distribution with baseboards">
<name>No distribution</name>
<distribution_heat_losses units="%">0</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">0</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">0</distribution_consumption_variable_flow>
<dissipation_id>1</dissipation_id>
</equipment>
<equipment id="13" type="No distribution with inductors">
<name>No distribution</name>
<distribution_heat_losses units="%">0</distribution_heat_losses>
<distribution_consumption_fix_flow units="%">0</distribution_consumption_fix_flow>
<distribution_consumption_variable_flow units="%">0</distribution_consumption_variable_flow>
<dissipation_id>3</dissipation_id>
</equipment>
</distribution_equipments>
<dissipation_equipments>
@ -111,7 +154,6 @@
<equipments>
<generation_id>1</generation_id>
<distribution_id>1</distribution_id>
<dissipation_id>1</dissipation_id>
</equipments>
</system>
<system id = "16">
@ -122,8 +164,7 @@
</demands>
<equipments>
<generation_id>2</generation_id>
<distribution_id>8</distribution_id>
<dissipation_id>1</dissipation_id>
<distribution_id>12</distribution_id>
</equipments>
</system>
<system id = "2">
@ -134,8 +175,7 @@
</demands>
<equipments>
<generation_id>1</generation_id>
<distribution_id>1</distribution_id>
<dissipation_id>2</dissipation_id>
<distribution_id>2</distribution_id>
</equipments>
</system>
<system id="3">
@ -146,8 +186,7 @@
</demands>
<equipments>
<generation_id>2</generation_id>
<distribution_id>1</distribution_id>
<dissipation_id>2</dissipation_id>
<distribution_id>2</distribution_id>
</equipments>
</system>
<system id="4">
@ -158,9 +197,8 @@
</demands>
<equipments>
<generation_id>3</generation_id>
<distribution_id>5</distribution_id>
<dissipation_id>1</dissipation_id>
</equipments>
<distribution_id>8</distribution_id>
g </equipments>
</system>
<system id="5">
<name>Single zone packaged rooftop unit with electrical resistance furnace and baseboards and fuel boiler for acs</name>
@ -170,8 +208,7 @@
</demands>
<equipments>
<generation_id>4</generation_id>
<distribution_id>5</distribution_id>
<dissipation_id>1</dissipation_id>
<distribution_id>8</distribution_id>
</equipments>
</system>
<system id="6">
@ -183,7 +220,6 @@
<equipments>
<generation_id>1</generation_id>
<distribution_id>1</distribution_id>
<dissipation_id>1</dissipation_id>
</equipments>
</system>
<system id="7">
@ -194,8 +230,7 @@
</demands>
<equipments>
<generation_id>2</generation_id>
<distribution_id>8</distribution_id>
<dissipation_id>3</dissipation_id>
<distribution_id>13</distribution_id>
</equipments>
</system>
<system id="8">
@ -206,8 +241,7 @@
</demands>
<equipments>
<generation_id>2</generation_id>
<distribution_id>1</distribution_id>
<dissipation_id>3</dissipation_id>
<distribution_id>3</distribution_id>
</equipments>
</system>
<system id="9">
@ -218,8 +252,7 @@
</demands>
<equipments>
<generation_id>2</generation_id>
<distribution_id>8</distribution_id>
<dissipation_id>3</dissipation_id>
<distribution_id>13</distribution_id>
</equipments>
</system>
<system id="10">
@ -229,8 +262,7 @@
</demands>
<equipments>
<generation_id>5</generation_id>
<distribution_id>6</distribution_id>
<dissipation_id>3</dissipation_id>
<distribution_id>10</distribution_id>
</equipments>
</system>
<system id="11">
@ -240,8 +272,7 @@
</demands>
<equipments>
<generation_id>5</generation_id>
<distribution_id>2</distribution_id>
<dissipation_id>2</dissipation_id>
<distribution_id>4</distribution_id>
</equipments>
</system>
<system id="12">
@ -251,8 +282,7 @@
</demands>
<equipments>
<generation_id>5</generation_id>
<distribution_id>6</distribution_id>
<dissipation_id>3</dissipation_id>
<distribution_id>10</distribution_id>
</equipments>
</system>
<system id="13">
@ -262,8 +292,7 @@
</demands>
<equipments>
<generation_id>5</generation_id>
<distribution_id>6</distribution_id>
<dissipation_id>3</dissipation_id>
<distribution_id>10</distribution_id>
</equipments>
</system>
<system id="14">
@ -273,8 +302,7 @@
</demands>
<equipments>
<generation_id>5</generation_id>
<distribution_id>3</distribution_id>
<dissipation_id>3</dissipation_id>
<distribution_id>6</distribution_id>
</equipments>
</system>
<system id="15">
@ -284,8 +312,7 @@
</demands>
<equipments>
<generation_id>6</generation_id>
<distribution_id>5</distribution_id>
<dissipation_id>3</dissipation_id>
<distribution_id>9</distribution_id>
</equipments>
</system>
<system id="17">
@ -296,8 +323,7 @@
</demands>
<equipments>
<generation_id>7</generation_id>
<distribution_id>3</distribution_id>
<dissipation_id>2</dissipation_id>
<distribution_id>5</distribution_id>
</equipments>
</system>
<system id="18">
@ -307,8 +333,7 @@
</demands>
<equipments>
<generation_id>7</generation_id>
<distribution_id>4</distribution_id>
<dissipation_id>2</dissipation_id>
<distribution_id>7</distribution_id>
</equipments>
</system>
</systems>

View File

@ -22,7 +22,7 @@ class TestSystemsCatalog(TestCase):
generation_equipments = catalog.names('generation_equipments')
self.assertEqual(7, len(generation_equipments['generation_equipments']))
distribution_equipments = catalog.names('distribution_equipments')
self.assertEqual(8, len(distribution_equipments['distribution_equipments']))
self.assertEqual(13, len(distribution_equipments['distribution_equipments']))
with self.assertRaises(ValueError):
catalog.names('unknown')