Merge pull request 'system_catalog_fix' (#37) from system_catalog_fix into main

Reviewed-on: https://nextgenerations-cities.encs.concordia.ca/gitea/CERC/hub/pulls/37
This commit is contained in:
Guille Gutierrez 2023-07-28 14:06:43 -04:00
commit 57322e1b19
3 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,29 @@
"""
Energy systems helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
from hub.helpers import constants as cte
class EnergySystemsHelper:
"""
EnergySystems helper
"""
_montreal_custom_fuel_to_hub_fuel = {
'gas': cte.GAS,
'electricity': cte.ELECTRICITY,
'renewable': cte.RENEWABLE
}
@staticmethod
def montreal_custom_fuel_to_hub_fuel(fuel):
"""
Get hub fuel from montreal_custom catalog fuel
:param fuel: str
:return: str
"""
return EnergySystemsHelper._montreal_custom_fuel_to_hub_fuel[fuel]

View File

@ -19,6 +19,7 @@ from hub.city_model_structure.energy_systems.generation_system import Generation
from hub.city_model_structure.energy_systems.distribution_system import DistributionSystem from hub.city_model_structure.energy_systems.distribution_system import DistributionSystem
from hub.city_model_structure.energy_systems.emission_system import EmissionSystem from hub.city_model_structure.energy_systems.emission_system import EmissionSystem
from hub.helpers.dictionaries import Dictionaries from hub.helpers.dictionaries import Dictionaries
from hub.imports.energy_systems.helpers.energy_systems_helper import EnergySystemsHelper
class MontrealCustomEnergySystemParameters: class MontrealCustomEnergySystemParameters:
@ -87,7 +88,8 @@ class MontrealCustomEnergySystemParameters:
_type = str(system.name).split('_', maxsplit=1)[0] _type = str(system.name).split('_', maxsplit=1)[0]
_generation_system.type = Dictionaries().montreal_system_to_hub_energy_generation_system[ _generation_system.type = Dictionaries().montreal_system_to_hub_energy_generation_system[
_type] _type]
_generation_system.fuel_type = archetype_generation_equipment.fuel_type _fuel_type = EnergySystemsHelper().montreal_custom_fuel_to_hub_fuel(archetype_generation_equipment.fuel_type)
_generation_system.fuel_type = _fuel_type
_generation_system.source_types = archetype_generation_equipment.source_types _generation_system.source_types = archetype_generation_equipment.source_types
_generation_system.heat_efficiency = archetype_generation_equipment.heat_efficiency _generation_system.heat_efficiency = archetype_generation_equipment.heat_efficiency
_generation_system.cooling_efficiency = archetype_generation_equipment.cooling_efficiency _generation_system.cooling_efficiency = archetype_generation_equipment.cooling_efficiency