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 49f7086f..e657e598 100644 --- a/hub/imports/energy_systems/montreal_custom_energy_system_parameters.py +++ b/hub/imports/energy_systems/montreal_custom_energy_system_parameters.py @@ -75,48 +75,48 @@ class MontrealCustomEnergySystemParameters: @staticmethod def _create_generic_systems(archetype, building, _energy_systems_connection_table, _generic_energy_systems): - building_systems = [] data = [archetype.name, building.name] _energy_systems_connection_table.loc[len(_energy_systems_connection_table)] = data - for system in archetype.systems: - energy_system = GenericEnergySystem() - _hub_demand_types = [] - for demand_type in system.demand_types: - _hub_demand_types.append(Dictionaries().montreal_demand_type_to_hub_energy_demand_type[demand_type]) - energy_system.name = system.name - energy_system.demand_types = _hub_demand_types - _generation_system = GenericGenerationSystem() - archetype_generation_equipment = system.generation_system - _type = system.name - _generation_system.type = Dictionaries().montreal_system_to_hub_energy_generation_system[ - _type] - _fuel_type = Dictionaries().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_medium - _generation_system.heat_efficiency = archetype_generation_equipment.heat_efficiency - _generation_system.cooling_efficiency = archetype_generation_equipment.cooling_efficiency - _generation_system.electricity_efficiency = archetype_generation_equipment.electricity_efficiency - _generation_system.source_temperature = archetype_generation_equipment.source_temperature - _generation_system.source_mass_flow = archetype_generation_equipment.source_mass_flow - _generation_system.storage = archetype_generation_equipment.storage - _generation_system.auxiliary_equipment = None - - energy_system.generation_system = _generation_system - - _distribution_system = GenericDistributionSystem() - archetype_distribution_equipment = system.distribution_systems - _distribution_system.type = archetype_distribution_equipment.type - _distribution_system.supply_temperature = archetype_distribution_equipment.supply_temperature - _distribution_system.distribution_consumption_fix_flow = \ - archetype_distribution_equipment.distribution_consumption_fix_flow - _distribution_system.distribution_consumption_variable_flow = \ - archetype_distribution_equipment.distribution_consumption_variable_flow - _distribution_system.heat_losses = archetype_distribution_equipment.heat_losses - - energy_system.distribution_system = _distribution_system - - building_systems.append(energy_system) if archetype.name not in _generic_energy_systems: + building_systems = [] + for system in archetype.systems: + energy_system = GenericEnergySystem() + _hub_demand_types = [] + for demand_type in system.demand_types: + _hub_demand_types.append(Dictionaries().montreal_demand_type_to_hub_energy_demand_type[demand_type]) + energy_system.name = system.name + energy_system.demand_types = _hub_demand_types + _generation_system = GenericGenerationSystem() + archetype_generation_equipment = system.generation_system + _type = system.name + _generation_system.type = Dictionaries().montreal_system_to_hub_energy_generation_system[ + _type] + _fuel_type = Dictionaries().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_medium + _generation_system.heat_efficiency = archetype_generation_equipment.heat_efficiency + _generation_system.cooling_efficiency = archetype_generation_equipment.cooling_efficiency + _generation_system.electricity_efficiency = archetype_generation_equipment.electricity_efficiency + _generation_system.source_temperature = archetype_generation_equipment.source_temperature + _generation_system.source_mass_flow = archetype_generation_equipment.source_mass_flow + _generation_system.storage = archetype_generation_equipment.storage + _generation_system.auxiliary_equipment = None + + energy_system.generation_system = _generation_system + + _distribution_system = GenericDistributionSystem() + archetype_distribution_equipment = system.distribution_systems + _distribution_system.type = archetype_distribution_equipment.type + _distribution_system.supply_temperature = archetype_distribution_equipment.supply_temperature + _distribution_system.distribution_consumption_fix_flow = \ + archetype_distribution_equipment.distribution_consumption_fix_flow + _distribution_system.distribution_consumption_variable_flow = \ + archetype_distribution_equipment.distribution_consumption_variable_flow + _distribution_system.heat_losses = archetype_distribution_equipment.heat_losses + + energy_system.distribution_system = _distribution_system + + building_systems.append(energy_system) _generic_energy_systems[archetype.name] = building_systems return _energy_systems_connection_table, _generic_energy_systems diff --git a/tests/test_systems_catalog.py b/tests/test_systems_catalog.py index 862ea874..f24808f3 100644 --- a/tests/test_systems_catalog.py +++ b/tests/test_systems_catalog.py @@ -41,5 +41,3 @@ class TestSystemsCatalog(TestCase): def test_north_america_systems_catalog(self): catalog = EnergySystemsCatalogFactory('north_america').catalog print(catalog.entries()) - -