From ee419b08492587c26e925002ad71872f877231f4 Mon Sep 17 00:00:00 2001 From: p_monsalvete Date: Fri, 28 Jul 2023 12:26:17 -0400 Subject: [PATCH 1/2] added dictionary from montreal fuel type to hub --- .../energy_systems/helpers/__init__.py | 0 .../helpers/energy_systems_helper.py | 29 +++++++++++++++++++ ...ontreal_custom_energy_system_parameters.py | 4 ++- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 hub/imports/energy_systems/helpers/__init__.py create mode 100644 hub/imports/energy_systems/helpers/energy_systems_helper.py diff --git a/hub/imports/energy_systems/helpers/__init__.py b/hub/imports/energy_systems/helpers/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/hub/imports/energy_systems/helpers/energy_systems_helper.py b/hub/imports/energy_systems/helpers/energy_systems_helper.py new file mode 100644 index 00000000..15bb2fa9 --- /dev/null +++ b/hub/imports/energy_systems/helpers/energy_systems_helper.py @@ -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 = { + cte.GAS: 'gas', + cte.ELECTRICITY: 'electricity', + cte.RENEWABLE: '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] + diff --git a/hub/imports/energy_systems/montreal_custom_energy_system_parameters.py b/hub/imports/energy_systems/montreal_custom_energy_system_parameters.py index f7349d3d..479e5630 100644 --- a/hub/imports/energy_systems/montreal_custom_energy_system_parameters.py +++ b/hub/imports/energy_systems/montreal_custom_energy_system_parameters.py @@ -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.emission_system import EmissionSystem from hub.helpers.dictionaries import Dictionaries +from hub.imports.energy_systems.helpers.energy_systems_helper import EnergySystemsHelper class MontrealCustomEnergySystemParameters: @@ -87,7 +88,8 @@ class MontrealCustomEnergySystemParameters: _type = str(system.name).split('_', maxsplit=1)[0] _generation_system.type = Dictionaries().montreal_system_to_hub_energy_generation_system[ _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.heat_efficiency = archetype_generation_equipment.heat_efficiency _generation_system.cooling_efficiency = archetype_generation_equipment.cooling_efficiency From 24324988b65b35c4d4eed796bfeb6cb978b7d8be Mon Sep 17 00:00:00 2001 From: p_monsalvete Date: Fri, 28 Jul 2023 13:18:23 -0400 Subject: [PATCH 2/2] added dictionary from montreal fuel type to hub --- hub/imports/energy_systems/helpers/energy_systems_helper.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hub/imports/energy_systems/helpers/energy_systems_helper.py b/hub/imports/energy_systems/helpers/energy_systems_helper.py index 15bb2fa9..8cce5273 100644 --- a/hub/imports/energy_systems/helpers/energy_systems_helper.py +++ b/hub/imports/energy_systems/helpers/energy_systems_helper.py @@ -13,9 +13,9 @@ class EnergySystemsHelper: EnergySystems helper """ _montreal_custom_fuel_to_hub_fuel = { - cte.GAS: 'gas', - cte.ELECTRICITY: 'electricity', - cte.RENEWABLE: 'renewable' + 'gas': cte.GAS, + 'electricity': cte.ELECTRICITY, + 'renewable': cte.RENEWABLE } @staticmethod