Merge branch 'fixing_unittests_realted_to_changes_by_PMAU' into 'master'
ca is not a usage library anymore, it has been erased from test internal gains are calculated from occupancy and so again for monthly energy balance calculations See merge request Guille/hub!28
This commit is contained in:
commit
b81f55b5e5
|
@ -483,6 +483,9 @@ class ThermalZone:
|
|||
* internal_gain.latent_fraction
|
||||
for usage_zone in self.usage_zones:
|
||||
for internal_gain in usage_zone.internal_gains:
|
||||
if internal_gain.schedules is None:
|
||||
_schedules_defined = False
|
||||
break
|
||||
if len(internal_gain.schedules) == 0:
|
||||
_schedules_defined = False
|
||||
break
|
||||
|
|
|
@ -7,6 +7,7 @@ Code contributors: Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|||
"""
|
||||
import uuid
|
||||
from typing import Union, List
|
||||
import helpers.constants as cte
|
||||
from city_model_structure.building_demand.occupancy import Occupancy
|
||||
from city_model_structure.building_demand.lighting import Lighting
|
||||
from city_model_structure.building_demand.appliances import Appliances
|
||||
|
@ -79,9 +80,47 @@ class UsageZone:
|
|||
@property
|
||||
def internal_gains(self) -> List[InternalGain]:
|
||||
"""
|
||||
Get usage zone internal gains
|
||||
:return: [InternalGain]
|
||||
Calculates and returns the list of all internal gains defined
|
||||
:return: InternalGains
|
||||
"""
|
||||
if self._internal_gains is None:
|
||||
if self.occupancy is not None:
|
||||
if self.occupancy.latent_internal_gain is not None:
|
||||
_internal_gain = InternalGain()
|
||||
_internal_gain.type = cte.OCCUPANCY
|
||||
_total_heat_gain = (self.occupancy.sensible_convective_internal_gain
|
||||
+ self.occupancy.sensible_radiative_internal_gain
|
||||
+ self.occupancy.latent_internal_gain)
|
||||
_internal_gain.average_internal_gain = _total_heat_gain
|
||||
_internal_gain.latent_fraction = self.occupancy.latent_internal_gain / _total_heat_gain
|
||||
_internal_gain.radiative_fraction = self.occupancy.sensible_radiative_internal_gain / _total_heat_gain
|
||||
_internal_gain.convective_fraction = self.occupancy.sensible_convective_internal_gain / _total_heat_gain
|
||||
_internal_gain.schedules = self.occupancy.occupancy_schedules
|
||||
self._internal_gains = [_internal_gain]
|
||||
if self.lighting is not None:
|
||||
_internal_gain = InternalGain()
|
||||
_internal_gain.type = cte.LIGHTING
|
||||
_internal_gain.average_internal_gain = self.lighting.density
|
||||
_internal_gain.latent_fraction = self.lighting.latent_fraction
|
||||
_internal_gain.radiative_fraction = self.lighting.radiative_fraction
|
||||
_internal_gain.convective_fraction = self.lighting.convective_fraction
|
||||
_internal_gain.schedules = self.lighting.schedules
|
||||
if self._internal_gains is not None:
|
||||
self._internal_gains.append(_internal_gain)
|
||||
else:
|
||||
self._internal_gains = [_internal_gain]
|
||||
if self.appliances is not None:
|
||||
_internal_gain = InternalGain()
|
||||
_internal_gain.type = cte.APPLIANCES
|
||||
_internal_gain.average_internal_gain = self.appliances.density
|
||||
_internal_gain.latent_fraction = self.appliances.latent_fraction
|
||||
_internal_gain.radiative_fraction = self.appliances.radiative_fraction
|
||||
_internal_gain.convective_fraction = self.appliances.convective_fraction
|
||||
_internal_gain.schedules = self.appliances.schedules
|
||||
if self._internal_gains is not None:
|
||||
self._internal_gains.append(_internal_gain)
|
||||
else:
|
||||
self._internal_gains = [_internal_gain]
|
||||
return self._internal_gains
|
||||
|
||||
@internal_gains.setter
|
||||
|
|
|
@ -47,8 +47,8 @@ class TestGeometryFactory(TestCase):
|
|||
for internal_zone in building.internal_zones:
|
||||
self.assertIsNotNone(internal_zone.usage_zones, 'usage zones are not defined')
|
||||
self.assertIsNotNone(internal_zone.thermal_zones, 'thermal zones are not defined')
|
||||
self.assertIsNotNone(building.basement_heated, 'building basement_heated is none')
|
||||
self.assertIsNotNone(building.attic_heated, 'building attic_heated is none')
|
||||
self.assertIsNone(building.basement_heated, 'building basement_heated is not none')
|
||||
self.assertIsNone(building.attic_heated, 'building attic_heated is not none')
|
||||
self.assertIsNotNone(building.average_storey_height, 'building average_storey_height is none')
|
||||
self.assertIsNotNone(building.storeys_above_ground, 'building storeys_above_ground is none')
|
||||
self.assertTrue(building.is_conditioned, 'building is_conditioned is not conditioned')
|
||||
|
@ -91,9 +91,11 @@ class TestGeometryFactory(TestCase):
|
|||
|
||||
def _test_hft(self, file):
|
||||
_construction_keys = ['nrel']
|
||||
_usage_keys = ['ca', 'comnet', 'hft']
|
||||
_usage_keys = ['comnet', 'hft']
|
||||
for construction_key in _construction_keys:
|
||||
print('construction key: ', construction_key)
|
||||
for usage_key in _usage_keys:
|
||||
print('usage key: ', usage_key)
|
||||
# construction factory called first
|
||||
city = self._get_citygml(file)
|
||||
for building in city.buildings:
|
||||
|
|
|
@ -51,7 +51,7 @@ class TestExports(TestCase):
|
|||
building.year_of_construction = 2006
|
||||
ConstructionFactory('nrel', self._complete_city).enrich()
|
||||
UsageFactory('ca', self._complete_city).enrich()
|
||||
cli = 'C:\\Users\\Pilar\\PycharmProjects\\monthlyenergybalance\\tests_data\\weather\\inseldb_Summerland.cli'
|
||||
cli = (self._example_path / 'weather' / 'inseldb_Summerland.cli').resolve()
|
||||
self._complete_city.climate_file = Path(cli)
|
||||
self._complete_city.climate_reference_city = 'Summerland'
|
||||
dummy_measures = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
||||
|
|
Loading…
Reference in New Issue
Block a user