modifications for hourly values

This commit is contained in:
pilar 2020-10-26 08:26:31 -04:00
parent 51df504a52
commit 7b3197c5f0
5 changed files with 48 additions and 15 deletions

View File

@ -2,6 +2,7 @@
Building module Building module
SPDX - License - Identifier: LGPL - 3.0 - or -later SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
contributors: Pilar Monsalvete pilar_monsalvete@yahoo.es
""" """
from typing import List from typing import List

View File

@ -18,16 +18,20 @@ class MonthlyToHourlyDemand:
@property @property
def hourly_heating(self): def hourly_heating(self):
"""
hourly distribution of the monthly heating of a building
: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
external_temp = self._building.hourly_external_temperature external_temp = self._building.hourly_external_temperature
# todo: review index depending on how the schedules are defined, either 8760 or 24 hours # todo: review index depending on how the schedules are defined, either 8760 or 24 hours
# todo: usage_zone values not implemented
period = 'day' period = 'day'
for usage_zone in self._building.usage_zones: for usage_zone in self._building.usage_zones:
temp_set = usage_zone.heating_setpoint temp_set = usage_zone.heating_setpoint
temp_back = usage_zone.heating_setback temp_back = usage_zone.heating_setback
occupancy = usage_zone.occupancy(period) occupancy = usage_zone.occupancy.occupant_schedule(period)
# todo: heating_schedule is still missing
heating_schedule = usage_zone.heating_schedule_month heating_schedule = usage_zone.heating_schedule_month
self._hourly_heating = pd.DataFrame(columns=['monthly to hourly']) self._hourly_heating = pd.DataFrame(columns=['monthly to hourly'])
@ -40,8 +44,7 @@ class MonthlyToHourlyDemand:
external_temp_med += external_temp[i]/24 external_temp_med += external_temp[i]/24
for hour in range(0, 24): for hour in range(0, 24):
if external_temp_med < temp_set[i] & heating_schedule[month] == 1: if external_temp_med < temp_set[i] & heating_schedule[month] == 1:
schedule = usage_zone.heating_schedule_day[day] if occupancy[hour] == 1:
if schedule[hour] == 1:
temp_grad_day = temp_set[i] - external_temp[i] temp_grad_day = temp_set[i] - external_temp[i]
else: else:
temp_grad_day = temp_back[i] - external_temp[i] temp_grad_day = temp_back[i] - external_temp[i]

View File

@ -11,7 +11,8 @@ class Occupancy:
""" """
def __init__(self, internal_heat_gain, heat_dissipation, occupant_rate, occupant_type, occupant_zone, def __init__(self, internal_heat_gain, heat_dissipation, occupant_rate, occupant_type, occupant_zone,
number_of_occupants, arrival_time, departure_time, break_time, day_of_week, pd_of_meetings_duration): number_of_occupants, arrival_time=None, departure_time=None, break_time=None, day_of_week=None,
pd_of_meetings_duration=None, occupant_schedule=None):
""" """
Constructor Constructor
""" """
@ -21,12 +22,13 @@ class Occupancy:
self._occupant_rate = occupant_rate self._occupant_rate = occupant_rate
self._occupant_type = occupant_type self._occupant_type = occupant_type
self._occupant_zone = occupant_zone self._occupant_zone = occupant_zone
self._occupant_schedule = occupant_schedule
self._number_of_occupants = number_of_occupants self._number_of_occupants = number_of_occupants
self._arrival_time = arrival_time = None self._arrival_time = arrival_time
self._departure_time = departure_time = None self._departure_time = departure_time
self._break_time = break_time = None self._break_time = break_time
self._day_of_week = day_of_week = None self._day_of_week = day_of_week
self._pd_of_meetings_duration = pd_of_meetings_duration = None self._pd_of_meetings_duration = pd_of_meetings_duration
@property @property
def internal_heat_gain(self): def internal_heat_gain(self):
@ -68,6 +70,14 @@ class Occupancy:
""" """
return self._occupant_zone return self._occupant_zone
@property
def occupant_schedule(self):
"""
Get the schedule when an occupant is in a zone
:return: occupant schedule
"""
return self._occupant_schedule
@property @property
def number_of_occupants(self): def number_of_occupants(self):
""" """
@ -101,7 +111,7 @@ class Occupancy:
return self._break_time return self._break_time
@property @property
def day_of_week (self): def day_of_week(self):
""" """
Get the day of the week Get the day of the week
:return: day of the week :return: day of the week

View File

@ -7,6 +7,7 @@ from typing import List
from city_model_structure.internal_gains import InternalGains from city_model_structure.internal_gains import InternalGains
from helpers.configuration_helper import ConfigurationHelper from helpers.configuration_helper import ConfigurationHelper
from city_model_structure.occupancy import Occupancy
class UsageZone: class UsageZone:
@ -24,6 +25,8 @@ class UsageZone:
# todo: this must come from library, talk to Rabeeh # todo: this must come from library, talk to Rabeeh
self._mechanical_air_change = ConfigurationHelper().min_air_change self._mechanical_air_change = ConfigurationHelper().min_air_change
self._occupancy = None
@property @property
def internal_gains(self) -> List[InternalGains]: def internal_gains(self) -> List[InternalGains]:
""" """
@ -159,3 +162,19 @@ class UsageZone:
:return: None :return: None
""" """
self._usage = value self._usage = value
@property
def occupancy(self) -> List[Occupancy]:
"""
Get occupancy data
:return: [Occupancy]
"""
return self._occupancy
@occupancy.setter
def occupancy(self, values):
"""
Set occupancy
:param values: [Occupancy]
"""
self._occupancy = values

View File

@ -28,7 +28,7 @@ class DemoOccupancyParameters:
row['7pm'], row['8pm'], row['9pm'], row['10pm'], row['11pm'], row['12pm']] row['7pm'], row['8pm'], row['9pm'], row['10pm'], row['11pm'], row['12pm']]
row = occupancy.iloc[index + 2] row = occupancy.iloc[index + 2]
building.sunday_schedule = [row['1am'], row['2am'], row['3am'], row['4am'], row['5am'], row['6am'], building.sunday_schedule = [row['1am'], row['2am'], row['3am'], row['4am'], row['5am'], row['6am'],
row['7am'], row['8am'], row['9am'], row['10am'], row['11am'], row['12am'], row['7am'], row['8am'], row['9am'], row['10am'], row['11am'], row['12am'],
row['1pm'], row['2pm'], row['3pm'], row['4pm'], row['5pm'], row['6pm'], row['1pm'], row['2pm'], row['3pm'], row['4pm'], row['5pm'], row['6pm'],
row['7pm'], row['8pm'], row['9pm'], row['10pm'], row['11pm'], row['12pm']] row['7pm'], row['8pm'], row['9pm'], row['10pm'], row['11pm'], row['12pm']]
break break