2020-10-19 10:07:03 -04:00
|
|
|
"""
|
|
|
|
monthly_to_hourly_demand module
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
|
|
|
|
"""
|
|
|
|
import pandas as pd
|
|
|
|
import helpers.constants as cte
|
|
|
|
|
|
|
|
|
|
|
|
class MonthlyToHourlyDemand:
|
|
|
|
"""
|
|
|
|
MonthlyToHourlyDemand class
|
|
|
|
"""
|
|
|
|
def __init__(self, building):
|
|
|
|
self._hourly_heating = pd.DataFrame()
|
|
|
|
self._hourly_cooling = pd.DataFrame()
|
|
|
|
self._building = building
|
|
|
|
|
|
|
|
@property
|
|
|
|
def hourly_heating(self):
|
|
|
|
# todo: this method and the insel model have to be reviewed for more than one thermal zone
|
|
|
|
external_temp = self._building.hourly_external_temperature
|
|
|
|
|
|
|
|
# todo: review index depending on how the schedules are defined, either 8760 or 24 hours
|
|
|
|
# todo: usage_zone values not implemented
|
|
|
|
period = 'day'
|
|
|
|
for usage_zone in self._building.usage_zones:
|
2020-10-19 14:28:38 -04:00
|
|
|
temp_set = usage_zone.heating_setpoint
|
|
|
|
temp_back = usage_zone.heating_setback
|
|
|
|
occupancy = usage_zone.occupancy(period)
|
2020-10-19 10:07:03 -04:00
|
|
|
heating_schedule = usage_zone.heating_schedule_month
|
|
|
|
|
|
|
|
self._hourly_heating = pd.DataFrame(columns=['monthly to hourly'])
|
|
|
|
i = 0
|
|
|
|
for month in range(0, 12):
|
|
|
|
temp_grad_month = 0
|
|
|
|
for day in cte.days_of_month[month]:
|
|
|
|
external_temp_med = 0
|
|
|
|
for hour in range(0, 24):
|
|
|
|
external_temp_med += external_temp[i]/24
|
|
|
|
for hour in range(0, 24):
|
|
|
|
if external_temp_med < temp_set[i] & heating_schedule[month] == 1:
|
|
|
|
schedule = usage_zone.heating_schedule_day[day]
|
|
|
|
if schedule[hour] == 1:
|
|
|
|
temp_grad_day = temp_set[i] - external_temp[i]
|
|
|
|
else:
|
|
|
|
temp_grad_day = temp_back[i] - external_temp[i]
|
|
|
|
else:
|
|
|
|
temp_grad_day = 0
|
|
|
|
|
|
|
|
temp_grad_month += temp_grad_day
|
|
|
|
self._hourly_heating.append(self._building.monthly_heating(month)*temp_grad_day/temp_grad_month)
|
|
|
|
i += 1
|
|
|
|
|
|
|
|
return self._hourly_heating
|
|
|
|
|
|
|
|
@property
|
|
|
|
def hourly_cooling(self) -> NotImplementedError:
|
|
|
|
raise NotImplementedError
|