modified ca_usage_parameters.py to make a walk around for a bug in python
This commit is contained in:
parent
3a0eb76834
commit
7b9ce04e16
|
@ -9,6 +9,7 @@ class InternalGains:
|
||||||
"""
|
"""
|
||||||
InternalGains class
|
InternalGains class
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self._average_internal_gain = None
|
self._average_internal_gain = None
|
||||||
self._convective_fraction = None
|
self._convective_fraction = None
|
||||||
|
|
|
@ -70,7 +70,6 @@ class Surface:
|
||||||
"""
|
"""
|
||||||
Set surface short wave reflectance
|
Set surface short wave reflectance
|
||||||
:param value: float
|
:param value: float
|
||||||
:return: None
|
|
||||||
"""
|
"""
|
||||||
self._swr = value
|
self._swr = value
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,17 @@ class CityObject:
|
||||||
return s
|
return s
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
def surface_by_id(self, identification_number) -> Union[Surface, None]:
|
||||||
|
"""
|
||||||
|
Get the city object surface with a given name
|
||||||
|
:param identification_number: str
|
||||||
|
:return: None or Surface
|
||||||
|
"""
|
||||||
|
for s in self.surfaces:
|
||||||
|
if str(s.id) == str(identification_number):
|
||||||
|
return s
|
||||||
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def centroid(self):
|
def centroid(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -18,10 +18,10 @@ class MonthlyToHourlyDemand:
|
||||||
self._building = building
|
self._building = building
|
||||||
self._conditioning_seasons = conditioning_seasons
|
self._conditioning_seasons = conditioning_seasons
|
||||||
|
|
||||||
@property
|
def hourly_heating(self, key):
|
||||||
def hourly_heating(self):
|
|
||||||
"""
|
"""
|
||||||
hourly distribution of the monthly heating of a building
|
hourly distribution of the monthly heating of a building
|
||||||
|
:param key: string
|
||||||
:return: [hourly_heating]
|
:return: [hourly_heating]
|
||||||
"""
|
"""
|
||||||
# todo: this method and the insel model have to be reviewed for more than one thermal zone
|
# todo: this method and the insel model have to be reviewed for more than one thermal zone
|
||||||
|
@ -43,13 +43,13 @@ class MonthlyToHourlyDemand:
|
||||||
for day in range(1, month_range[1]+1):
|
for day in range(1, month_range[1]+1):
|
||||||
external_temp_med = 0
|
external_temp_med = 0
|
||||||
for hour in range(0, 24):
|
for hour in range(0, 24):
|
||||||
external_temp_med += external_temp['inseldb'][i]/24
|
external_temp_med += external_temp[key][i]/24
|
||||||
for hour in range(0, 24):
|
for hour in range(0, 24):
|
||||||
if external_temp_med < temp_set and heating_schedule[month-1] == 1:
|
if external_temp_med < temp_set and heating_schedule[month-1] == 1:
|
||||||
if occupancy[hour] > 0:
|
if occupancy[hour] > 0:
|
||||||
temp_grad_day.append(temp_set - external_temp['inseldb'][i])
|
temp_grad_day.append(temp_set - external_temp[key][i])
|
||||||
else:
|
else:
|
||||||
temp_grad_day.append(temp_back - external_temp['inseldb'][i])
|
temp_grad_day.append(temp_back - external_temp[key][i])
|
||||||
else:
|
else:
|
||||||
temp_grad_day.append(0)
|
temp_grad_day.append(0)
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import sys
|
||||||
|
|
||||||
from imports.usage_feeders.hft_usage_interface import HftUsageInterface
|
from imports.usage_feeders.hft_usage_interface import HftUsageInterface
|
||||||
from city_model_structure.attributes.usage_zone import UsageZone
|
from city_model_structure.attributes.usage_zone import UsageZone
|
||||||
|
from city_model_structure.attributes.internal_gains import InternalGains
|
||||||
|
|
||||||
class CaUsageParameters(HftUsageInterface):
|
class CaUsageParameters(HftUsageInterface):
|
||||||
"""
|
"""
|
||||||
|
@ -48,7 +48,17 @@ class CaUsageParameters(HftUsageInterface):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _assign_values(usage_zone, archetype):
|
def _assign_values(usage_zone, archetype):
|
||||||
usage_zone.usage = archetype.usage
|
usage_zone.usage = archetype.usage
|
||||||
usage_zone.internal_gains = archetype.internal_gains
|
# gue to the low 'tipado' of python, usage_zone.internal_gains = archetype.internal_gains assigns the wrong
|
||||||
|
# object type to usage_zone.internal_gains. Therefore, this walk around has been done.
|
||||||
|
internal_gains = []
|
||||||
|
for ig in archetype.internal_gains:
|
||||||
|
internal_gain = InternalGains()
|
||||||
|
internal_gain.average_internal_gain = ig.average_internal_gain
|
||||||
|
internal_gain.convective_fraction = ig.convective_fraction
|
||||||
|
internal_gain.radiative_fraction = ig.radiative_fraction
|
||||||
|
internal_gain.latent_fraction = ig.latent_fraction
|
||||||
|
internal_gains.append(internal_gain)
|
||||||
|
usage_zone.internal_gains = internal_gains
|
||||||
usage_zone.heating_setpoint = archetype.heating_setpoint
|
usage_zone.heating_setpoint = archetype.heating_setpoint
|
||||||
usage_zone.heating_setback = archetype.heating_setback
|
usage_zone.heating_setback = archetype.heating_setback
|
||||||
usage_zone.cooling_setpoint = archetype.cooling_setpoint
|
usage_zone.cooling_setpoint = archetype.cooling_setpoint
|
||||||
|
|
Loading…
Reference in New Issue
Block a user