Add retrieve result test and correct lock in sqlalchemy
This commit is contained in:
parent
deb04cbe2d
commit
30908eda6d
@ -440,8 +440,7 @@ class Building(CityObject):
|
||||
"""
|
||||
results = {}
|
||||
if cte.HOUR in self.heating_demand:
|
||||
monthly_values = PeakLoads().\
|
||||
peak_loads_from_hourly(self.heating_demand[cte.HOUR])
|
||||
monthly_values = PeakLoads().peak_loads_from_hourly(self.heating_demand[cte.HOUR])
|
||||
else:
|
||||
monthly_values = PeakLoads(self).heating_peak_loads_from_methodology
|
||||
if monthly_values is None:
|
||||
|
@ -33,9 +33,7 @@ class ThermalControl:
|
||||
def _minimum_value(schedules):
|
||||
minimum = 1000
|
||||
for schedule in schedules:
|
||||
for value in schedule.values:
|
||||
if value < minimum:
|
||||
minimum = value
|
||||
minimum = min(minimum, min(schedule.values))
|
||||
return minimum
|
||||
|
||||
@property
|
||||
|
@ -63,8 +63,7 @@ class LoadsCalculation:
|
||||
:return: int
|
||||
"""
|
||||
heating_load_transmitted = 0
|
||||
for internal_zone in self._building.internal_zones:
|
||||
for thermal_zone in internal_zone.thermal_zones_from_internal_zones:
|
||||
for thermal_zone in self._building.thermal_zones_from_internal_zones:
|
||||
internal_temperature = thermal_zone.thermal_control.mean_heating_set_point
|
||||
heating_load_transmitted += self._get_load_transmitted(thermal_zone, internal_temperature, ambient_temperature,
|
||||
ground_temperature)
|
||||
@ -76,8 +75,7 @@ class LoadsCalculation:
|
||||
:return: int
|
||||
"""
|
||||
cooling_load_transmitted = 0
|
||||
for internal_zone in self._building.internal_zones:
|
||||
for thermal_zone in internal_zone.thermal_zones_from_internal_zones:
|
||||
for thermal_zone in self._building.thermal_zones_from_internal_zones:
|
||||
internal_temperature = thermal_zone.thermal_control.mean_cooling_set_point
|
||||
cooling_load_transmitted += self._get_load_transmitted(thermal_zone, internal_temperature, ambient_temperature,
|
||||
ground_temperature)
|
||||
@ -89,8 +87,7 @@ class LoadsCalculation:
|
||||
:return: int
|
||||
"""
|
||||
heating_ventilation_load = 0
|
||||
for internal_zone in self._building.internal_zones:
|
||||
for thermal_zone in internal_zone.thermal_zones_from_internal_zones:
|
||||
for thermal_zone in self._building.thermal_zones_from_internal_zones:
|
||||
internal_temperature = thermal_zone.thermal_control.mean_heating_set_point
|
||||
heating_ventilation_load += self._get_load_ventilation(thermal_zone, internal_temperature, ambient_temperature)
|
||||
return heating_ventilation_load
|
||||
@ -101,8 +98,7 @@ class LoadsCalculation:
|
||||
:return: int
|
||||
"""
|
||||
cooling_ventilation_load = 0
|
||||
for internal_zone in self._building.internal_zones:
|
||||
for thermal_zone in internal_zone.thermal_zones_from_internal_zones:
|
||||
for thermal_zone in self._building.thermal_zones_from_internal_zones:
|
||||
internal_temperature = thermal_zone.thermal_control.mean_cooling_set_point
|
||||
cooling_ventilation_load += self._get_load_ventilation(thermal_zone, internal_temperature, ambient_temperature)
|
||||
return cooling_ventilation_load
|
||||
@ -115,8 +111,7 @@ class LoadsCalculation:
|
||||
cooling_load_occupancy_sensible = 0
|
||||
cooling_load_lighting = 0
|
||||
cooling_load_equipment_sensible = 0
|
||||
for internal_zone in self._building.internal_zones:
|
||||
for thermal_zone in internal_zone.thermal_zones_from_internal_zones:
|
||||
for thermal_zone in self._building.thermal_zones_from_internal_zones:
|
||||
cooling_load_occupancy_sensible += (thermal_zone.occupancy.sensible_convective_internal_gain
|
||||
+ thermal_zone.occupancy.sensible_radiative_internal_gain) \
|
||||
* thermal_zone.footprint_area
|
||||
@ -137,8 +132,7 @@ class LoadsCalculation:
|
||||
:return: int
|
||||
"""
|
||||
cooling_load_radiation = 0
|
||||
for internal_zone in self._building.internal_zones:
|
||||
for thermal_zone in internal_zone.thermal_zones_from_internal_zones:
|
||||
for thermal_zone in self._building.thermal_zones_from_internal_zones:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
for thermal_opening in thermal_boundary.thermal_openings:
|
||||
radiation = thermal_boundary.parent_surface.global_irradiance[cte.HOUR][hour] * cte.WATTS_HOUR_TO_JULES
|
||||
|
@ -54,13 +54,11 @@ class PeakLoads:
|
||||
"""
|
||||
month = 1
|
||||
peaks = [0 for _ in range(12)]
|
||||
print('hv', hourly_values)
|
||||
for i in range(0, len(hourly_values)):
|
||||
if _MONTH_STARTING_HOUR[month] <= i:
|
||||
month += 1
|
||||
if hourly_values[i] > peaks[month-1]:
|
||||
peaks[month-1] = hourly_values[i]
|
||||
print('peak', peaks)
|
||||
return peaks
|
||||
|
||||
@property
|
||||
@ -75,18 +73,15 @@ class PeakLoads:
|
||||
ambient_temperature = self._building.external_temperature[cte.HOUR]
|
||||
for month in range(0, 12):
|
||||
ground_temperature = self._building.ground_temperature[cte.MONTH]['2'][month]
|
||||
heating_ambient_temperature = 100
|
||||
start_hour = _MONTH_STARTING_HOUR[month]
|
||||
end_hour = 8760
|
||||
if month < 11:
|
||||
end_hour = _MONTH_STARTING_HOUR[month + 1]
|
||||
for hour in range(start_hour, end_hour):
|
||||
temperature = ambient_temperature[hour]
|
||||
if temperature < heating_ambient_temperature:
|
||||
heating_ambient_temperature = temperature
|
||||
heating_ambient_temperature = min(ambient_temperature[start_hour:end_hour])
|
||||
loads = LoadsCalculation(self._building)
|
||||
heating_load_transmitted = loads.get_heating_transmitted_load(heating_ambient_temperature, ground_temperature)
|
||||
heating_load_ventilation_sensible = loads.get_heating_ventilation_load_sensible(heating_ambient_temperature)
|
||||
# todo: include heating ventilation latent
|
||||
heating_load_ventilation_latent = 0
|
||||
heating_load = heating_load_transmitted + heating_load_ventilation_sensible + heating_load_ventilation_latent
|
||||
heating_load = max(heating_load, 0)
|
||||
|
Loading…
Reference in New Issue
Block a user