made some changes to the test_systems_factory.py to take into account the fact that generation systems are a list
This commit is contained in:
parent
d29161b05e
commit
0c7371787b
@ -27,6 +27,7 @@ class Building(CityObject):
|
||||
"""
|
||||
Building(CityObject) class
|
||||
"""
|
||||
|
||||
def __init__(self, name, surfaces, year_of_construction, function, terrains=None, city=None):
|
||||
super().__init__(name, surfaces)
|
||||
self._city = city
|
||||
@ -753,20 +754,19 @@ class Building(CityObject):
|
||||
if self.energy_systems is None:
|
||||
return None
|
||||
for energy_system in self.energy_systems:
|
||||
generation_systems = energy_system.generation_systems
|
||||
print(generation_systems)
|
||||
print(type(generation_systems))
|
||||
energy_system_generation_systems = energy_system.generation_systems
|
||||
for demand_type in energy_system.demand_types:
|
||||
if demand_type.lower() == consumption_type.lower():
|
||||
if consumption_type in (cte.HEATING, cte.DOMESTIC_HOT_WATER):
|
||||
for generation_system in generation_systems:
|
||||
for generation_system in energy_system_generation_systems:
|
||||
coefficient_of_performance = generation_system.generic_generation_system.heat_efficiency
|
||||
elif consumption_type == cte.COOLING:
|
||||
for generation_system in generation_systems:
|
||||
for generation_system in energy_system_generation_systems:
|
||||
coefficient_of_performance = generation_system.generic_generation_system.cooling_efficiency
|
||||
elif consumption_type == cte.ELECTRICITY:
|
||||
for generation_system in generation_systems:
|
||||
coefficient_of_performance = generation_system.generic_generation_system.electricity_efficiency
|
||||
for generation_system in energy_system_generation_systems:
|
||||
coefficient_of_performance = \
|
||||
generation_system.generic_generation_system.electricity_efficiency
|
||||
if coefficient_of_performance == 0:
|
||||
values = [0] * len(demand)
|
||||
final_energy_consumed = values
|
||||
@ -797,8 +797,10 @@ class Building(CityObject):
|
||||
if self.energy_systems is None:
|
||||
return self._onsite_electrical_production
|
||||
for energy_system in self.energy_systems:
|
||||
if energy_system.generation_systems.generic_generation_system.type == cte.PHOTOVOLTAIC:
|
||||
_efficiency = energy_system.generation_systems.generic_generation_system.electricity_efficiency
|
||||
energy_system_generation_systems = energy_system.generation_systems
|
||||
for generation_system in energy_system_generation_systems:
|
||||
if generation_system.generic_generation_system.type == cte.PHOTOVOLTAIC:
|
||||
_efficiency = generation_system.generic_generation_system.electricity_efficiency
|
||||
self._onsite_electrical_production = {}
|
||||
for _key in self.roofs[0].global_irradiance.keys():
|
||||
_results = [0 for _ in range(0, len(self.roofs[0].global_irradiance[_key]))]
|
||||
|
@ -158,12 +158,12 @@ class NorthAmericaCustomEnergySystemParameters:
|
||||
copy.deepcopy(_generic_building_generation_system)
|
||||
_generation_systems.append(_building_generation_system)
|
||||
_building_energy_equipment.generation_systems = _generation_systems
|
||||
_building_storage_system = ThermalStorageSystem()
|
||||
_building_storage_system.generic_storage_system = \
|
||||
copy.deepcopy(_generic_building_energy_system.energy_storage_systems)
|
||||
|
||||
|
||||
_building_energy_equipment.energy_storage_systems = _building_storage_system
|
||||
# _building_storage_system = ThermalStorageSystem()
|
||||
# _building_storage_system.generic_storage_system = \
|
||||
# copy.deepcopy(_generic_building_energy_system.energy_storage_systems)
|
||||
#
|
||||
#
|
||||
# _building_energy_equipment.energy_storage_systems = _building_storage_system
|
||||
|
||||
_building_energy_systems.append(_building_energy_equipment)
|
||||
building.energy_systems = _building_energy_systems
|
||||
|
@ -160,15 +160,9 @@ class TestSystemsFactory(TestCase):
|
||||
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_systems = _generic_building_energy_system.generation_systems
|
||||
_generic_system_generation_systems = []
|
||||
for _building_generation_system in _building_generation_systems:
|
||||
_building_generation_system = GenerationSystem()
|
||||
_building_generation_system.generic_generation_system = (
|
||||
copy.deepcopy(_generic_building_energy_system.generation_systems)
|
||||
@ -181,9 +175,9 @@ class TestSystemsFactory(TestCase):
|
||||
_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_systems = _building_generation_system
|
||||
_building_energy_equipment.distribution_systems = _building_distribution_system
|
||||
_building_energy_equipment.emission_systems = _building_emission_system
|
||||
_generic_system_generation_systems.append(_building_generation_system)
|
||||
print(_generic_system_generation_systems)
|
||||
_building_energy_equipment.generation_systems = _generic_system_generation_systems
|
||||
|
||||
_building_energy_systems.append(_building_energy_equipment)
|
||||
building.energy_systems = _building_energy_systems
|
||||
|
Loading…
Reference in New Issue
Block a user