finished the first part of the test.
This commit is contained in:
parent
23a8fbe86d
commit
f0ad1462d0
|
@ -82,7 +82,10 @@ class NorthAmericaCustomEnergySystemParameters:
|
|||
for system in archetype.systems:
|
||||
energy_system = GenericEnergySystem()
|
||||
_hub_demand_types = []
|
||||
for demand_type in system.demand_types:
|
||||
demand_types = system.demand_types
|
||||
if type(demand_types) == str:
|
||||
demand_types = [demand_types]
|
||||
for demand_type in demand_types:
|
||||
_hub_demand_types.append(Dictionaries().north_america_demand_type_to_hub_energy_demand_type[demand_type])
|
||||
energy_system.name = system.name
|
||||
energy_system.demand_types = _hub_demand_types
|
||||
|
@ -119,11 +122,11 @@ class NorthAmericaCustomEnergySystemParameters:
|
|||
|
||||
_thermal_storage_system = ThermalStorageSystem()
|
||||
archetype_storage_equipments = system.energy_storage_systems
|
||||
for archetype_storage_equipment in archetype_storage_equipments:
|
||||
_type = archetype_storage_equipment.name
|
||||
_thermal_storage_system.maximum_operating_temperature = archetype_storage_equipment.maximum_operating_temperature
|
||||
_thermal_storage_system.height = archetype_storage_equipment.height
|
||||
_thermal_storage_system.layers = archetype_storage_equipment.layers
|
||||
if archetype_storage_equipments is not None:
|
||||
for archetype_storage_equipment in archetype_storage_equipments:
|
||||
_thermal_storage_system.maximum_operating_temperature = archetype_storage_equipment.maximum_operating_temperature
|
||||
_thermal_storage_system.height = archetype_storage_equipment.height
|
||||
_thermal_storage_system.layers = archetype_storage_equipment.layers
|
||||
energy_system.energy_storage_system = _thermal_storage_system
|
||||
|
||||
building_systems.append(energy_system)
|
||||
|
@ -139,6 +142,7 @@ class NorthAmericaCustomEnergySystemParameters:
|
|||
_building_energy_systems = []
|
||||
energy_systems = energy_systems_connection['Energy System Type'][
|
||||
energy_systems_connection['Building'] == building.name]
|
||||
print(energy_systems)
|
||||
for energy_system in energy_systems:
|
||||
if str(energy_system) == 'nan':
|
||||
break
|
||||
|
@ -150,16 +154,16 @@ class NorthAmericaCustomEnergySystemParameters:
|
|||
|
||||
_building_distribution_system = DistributionSystem()
|
||||
_building_distribution_system.generic_distribution_system = \
|
||||
copy.deepcopy(_generic_building_energy_system.distribution_systems)
|
||||
copy.deepcopy(_generic_building_energy_system.distribution_system)
|
||||
_building_emission_system = EmissionSystem()
|
||||
_building_emission_system.generic_emission_system = \
|
||||
copy.deepcopy(_generic_building_energy_system.emission_systems)
|
||||
copy.deepcopy(_generic_building_energy_system.emission_system)
|
||||
_building_generation_system = GenerationSystem()
|
||||
_building_generation_system.generic_generation_system = \
|
||||
copy.deepcopy(_generic_building_energy_system.generation_system)
|
||||
_building_storage_system = ThermalStorageSystem()
|
||||
_building_storage_system.generic_storage_system = \
|
||||
copy.deepcopy(_generic_building_energy_system.storage_system)
|
||||
copy.deepcopy(_generic_building_energy_system.energy_storage_system)
|
||||
|
||||
_building_energy_equipment.generation_system = _building_generation_system
|
||||
_building_energy_equipment.distribution_system = _building_distribution_system
|
||||
|
|
|
@ -125,4 +125,65 @@ class TestSystemsFactory(TestCase):
|
|||
building.energy_systems_archetype_name = 'PV+ASHP+GasBoiler+TES'
|
||||
|
||||
EnergySystemsFactory('north_america', self._city).enrich()
|
||||
self.assertEqual(17, len(self._city.energy_systems_connection_table))
|
||||
self.assertEqual(17, len(self._city.energy_systems_connection_table))
|
||||
|
||||
def test_north_america_custom_system_results(self):
|
||||
"""
|
||||
Enrich the city with the construction information and verify it
|
||||
"""
|
||||
ConstructionFactory('nrcan', self._city).enrich()
|
||||
UsageFactory('nrcan', self._city).enrich()
|
||||
WeatherFactory('epw', self._city).enrich()
|
||||
ExportsFactory('sra', self._city, self._output_path).export()
|
||||
sra_path = (self._output_path / f'{self._city.name}_sra.xml').resolve()
|
||||
subprocess.run(['sra', str(sra_path)])
|
||||
ResultFactory('sra', self._city, self._output_path).enrich()
|
||||
EnergyBuildingsExportsFactory('insel_monthly_energy_balance', self._city, self._output_path).export()
|
||||
for building in self._city.buildings:
|
||||
insel_path = (self._output_path / f'{building.name}.insel')
|
||||
subprocess.run(['insel', str(insel_path)])
|
||||
ResultFactory('insel_monthly_energy_balance', self._city, self._output_path).enrich()
|
||||
|
||||
for building in self._city.buildings:
|
||||
building.energy_systems_archetype_name = 'PV+ASHP+GasBoiler+TES'
|
||||
EnergySystemsFactory('north_america', self._city).enrich()
|
||||
# Need to assign energy systems to buildings:
|
||||
energy_systems_connection = self._city.energy_systems_connection_table
|
||||
for building in self._city.buildings:
|
||||
_building_energy_systems = []
|
||||
energy_systems = energy_systems_connection['Energy System Type'][
|
||||
energy_systems_connection['Building'] == building.name]
|
||||
for energy_system in energy_systems:
|
||||
_generic_building_energy_systems = self._city.generic_energy_systems[energy_system]
|
||||
for _generic_building_energy_system in _generic_building_energy_systems:
|
||||
_building_energy_equipment = EnergySystem()
|
||||
_building_energy_equipment.demand_types = _generic_building_energy_system.demand_types
|
||||
|
||||
_building_distribution_system = DistributionSystem()
|
||||
_building_distribution_system.generic_distribution_system = (
|
||||
copy.deepcopy(_generic_building_energy_system.distribution_systems)
|
||||
)
|
||||
_building_emission_system = EmissionSystem()
|
||||
_building_emission_system.generic_emission_system = (
|
||||
copy.deepcopy(_generic_building_energy_system.emission_systems)
|
||||
)
|
||||
_building_generation_system = GenerationSystem()
|
||||
_building_generation_system.generic_generation_system = (
|
||||
copy.deepcopy(_generic_building_energy_system.generation_system)
|
||||
)
|
||||
if cte.HEATING in _building_energy_equipment.demand_types:
|
||||
_building_generation_system.heat_power = building.heating_peak_load[cte.YEAR][0]
|
||||
if cte.COOLING in _building_energy_equipment.demand_types:
|
||||
_building_generation_system.cooling_power = building.cooling_peak_load[cte.YEAR][0]
|
||||
_building_energy_equipment.generation_system = _building_generation_system
|
||||
_building_energy_equipment.distribution_system = _building_distribution_system
|
||||
_building_energy_equipment.emission_system = _building_emission_system
|
||||
|
||||
_building_energy_systems.append(_building_energy_equipment)
|
||||
building.energy_systems = _building_energy_systems
|
||||
|
||||
for building in self._city.buildings:
|
||||
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])
|
||||
self.assertLess(0, building.onsite_electrical_production[cte.YEAR][0])
|
Loading…
Reference in New Issue
Block a user