2021-03-16 12:19:35 -04:00
|
|
|
"""
|
|
|
|
Occupants module
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
|
|
Copyright © 2020 Project Author Sanam Dabirian sanam.dabirian@mail.concordia.ca
|
2021-04-07 11:47:39 -04:00
|
|
|
Contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
2021-03-16 12:19:35 -04:00
|
|
|
"""
|
|
|
|
|
2021-03-16 13:43:59 -04:00
|
|
|
from typing import TypeVar
|
2021-03-16 12:19:35 -04:00
|
|
|
import calendar as cal
|
2021-03-16 13:43:59 -04:00
|
|
|
|
|
|
|
UsageZone = TypeVar('UsageZone')
|
2021-03-16 12:19:35 -04:00
|
|
|
|
|
|
|
|
|
|
|
class Occupants:
|
|
|
|
"""
|
|
|
|
Occupants class
|
|
|
|
"""
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
"""
|
|
|
|
Constructor
|
|
|
|
"""
|
|
|
|
|
|
|
|
self._heat_dissipation = None
|
|
|
|
self._occupancy_rate = None
|
|
|
|
self._occupant_type = None
|
2021-03-16 13:43:59 -04:00
|
|
|
self._usage_zone = None
|
2021-03-16 12:19:35 -04:00
|
|
|
self._occupant_schedule = None
|
|
|
|
self._number_of_occupants = None
|
|
|
|
self._arrival_time = None
|
|
|
|
self._departure_time = None
|
|
|
|
self._break_time = None
|
|
|
|
self._day_of_week = None
|
|
|
|
self._pd_of_meetings_duration = None
|
|
|
|
self._complete_year_schedule = None
|
|
|
|
|
|
|
|
@property
|
|
|
|
def heat_dissipation(self):
|
|
|
|
"""
|
|
|
|
Get heat dissipation of occupants in W/person
|
|
|
|
:return: float
|
|
|
|
"""
|
|
|
|
return self._heat_dissipation
|
|
|
|
|
|
|
|
@heat_dissipation.setter
|
|
|
|
def heat_dissipation(self, value):
|
|
|
|
"""
|
|
|
|
Set heat dissipation of occupants in W/person
|
|
|
|
:param value: float
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
self._heat_dissipation = value
|
|
|
|
|
|
|
|
@property
|
|
|
|
def occupancy_rate(self):
|
|
|
|
"""
|
|
|
|
Get rate of occupancy
|
|
|
|
:return: float
|
|
|
|
"""
|
|
|
|
return self._occupancy_rate
|
|
|
|
|
|
|
|
@occupancy_rate.setter
|
|
|
|
def occupancy_rate(self, value):
|
|
|
|
"""
|
|
|
|
Set rate of occupancy
|
|
|
|
:param value: float
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
self._occupancy_rate = value
|
|
|
|
|
|
|
|
@property
|
|
|
|
def occupant_type(self):
|
|
|
|
"""
|
|
|
|
Get type of occupancy
|
|
|
|
:return: string
|
|
|
|
"""
|
|
|
|
return self._occupant_type
|
|
|
|
|
|
|
|
@occupant_type.setter
|
|
|
|
def occupant_type(self, value):
|
|
|
|
"""
|
|
|
|
Set type of occupancy
|
|
|
|
:param value: float
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
self._occupant_type = value
|
|
|
|
|
|
|
|
@property
|
2021-03-16 13:43:59 -04:00
|
|
|
def usage_zone(self) -> UsageZone:
|
2021-03-16 12:19:35 -04:00
|
|
|
"""
|
|
|
|
Get the zone an occupant is in
|
|
|
|
:return: UsageZone
|
|
|
|
"""
|
2021-03-16 13:43:59 -04:00
|
|
|
return self._usage_zone
|
2021-03-16 12:19:35 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def occupant_schedule(self):
|
|
|
|
"""
|
|
|
|
Get the schedule when an occupant is in a zone (24 values, 1 per hour of the day)
|
|
|
|
:return: [float]
|
|
|
|
"""
|
|
|
|
return self._occupant_schedule
|
|
|
|
|
|
|
|
@occupant_schedule.setter
|
|
|
|
def occupant_schedule(self, value):
|
|
|
|
"""
|
|
|
|
Set the schedule when an occupant is in a zone (24 values, 1 per hour of the day)
|
|
|
|
:param value: [float]
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
self._occupant_schedule = value
|
|
|
|
|
|
|
|
@property
|
|
|
|
def number_of_occupants(self):
|
|
|
|
"""
|
|
|
|
Get the number of occupants
|
|
|
|
:return: int
|
|
|
|
"""
|
|
|
|
return self._number_of_occupants
|
|
|
|
|
|
|
|
@number_of_occupants.setter
|
|
|
|
def number_of_occupants(self, value):
|
|
|
|
"""
|
|
|
|
Set the number of occupants
|
|
|
|
:param value: int
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
self._number_of_occupants = value
|
|
|
|
|
|
|
|
@property
|
|
|
|
def arrival_time(self):
|
|
|
|
"""
|
|
|
|
Get the arrival time of the occupant (for office building) in UTC with format YYYYMMDD HH:mm:ss
|
|
|
|
:return: time
|
|
|
|
"""
|
|
|
|
return self._arrival_time
|
|
|
|
|
|
|
|
@arrival_time.setter
|
|
|
|
def arrival_time(self, value):
|
|
|
|
"""
|
|
|
|
Set the arrival time of the occupant (for office building) in UTC with format YYYYMMDD HH:mm:ss
|
|
|
|
:param value: time
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
self._arrival_time = value
|
|
|
|
|
|
|
|
@property
|
|
|
|
def departure_time(self):
|
|
|
|
"""
|
|
|
|
Get the departure time of the occupant (for office building) in UTC with format YYYYMMDD HH:mm:ss
|
|
|
|
:return: time
|
|
|
|
"""
|
|
|
|
return self._departure_time
|
|
|
|
|
|
|
|
@departure_time.setter
|
|
|
|
def departure_time(self, value):
|
|
|
|
"""
|
|
|
|
Set the departure time of the occupant (for office building) in UTC with format YYYYMMDD HH:mm:ss
|
|
|
|
:param value: time
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
self._departure_time = value
|
|
|
|
|
|
|
|
@property
|
|
|
|
def break_time(self):
|
|
|
|
"""
|
|
|
|
Get the lunch or break time of the occupant (for office building) in UTC with format ????
|
|
|
|
:return: break time
|
|
|
|
"""
|
|
|
|
# todo @Sanam: define this format, is it the starting time? is it a list with both, starting and ending time?
|
|
|
|
return self._break_time
|
|
|
|
|
|
|
|
@property
|
|
|
|
def day_of_week(self):
|
|
|
|
"""
|
|
|
|
Get the day of the week (MON, TUE, WED, THU, FRI, SAT, SUN)
|
|
|
|
:return: string
|
|
|
|
"""
|
|
|
|
# todo @Sanam: is this a property or should it be a function
|
|
|
|
# to get the day of the week of an specific day of the year?
|
|
|
|
return self._day_of_week
|
|
|
|
|
|
|
|
@property
|
|
|
|
def pd_of_meetings_duration(self):
|
|
|
|
"""
|
|
|
|
Get the probability distribution of the meeting duration
|
|
|
|
:return: ??
|
|
|
|
"""
|
|
|
|
# todo @Sanam: what format are you expecting here??
|
|
|
|
return self._pd_of_meetings_duration
|
|
|
|
|
|
|
|
@pd_of_meetings_duration.setter
|
|
|
|
def pd_of_meetings_duration(self, value):
|
|
|
|
"""
|
|
|
|
Get the probability distribution of the meeting duration
|
|
|
|
:param value: ??
|
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
# todo @Sanam: what format are you expecting here??
|
|
|
|
self._pd_of_meetings_duration = value
|
|
|
|
|
|
|
|
def get_complete_year_schedule(self, schedules):
|
|
|
|
"""
|
|
|
|
Get the a non-leap year (8760 h), starting on Monday schedule out of archetypal days of week
|
|
|
|
:return: [float]
|
|
|
|
"""
|
|
|
|
if self._complete_year_schedule is None:
|
|
|
|
self._complete_year_schedule = []
|
|
|
|
for i in range(1, 13):
|
2021-05-25 13:34:57 -04:00
|
|
|
month_range = cal.monthrange(2015, i)
|
2021-03-16 12:19:35 -04:00
|
|
|
for day in range(1, month_range[1]+1):
|
2021-05-25 13:34:57 -04:00
|
|
|
if cal.weekday(2015, i, day) < 5:
|
2021-03-16 12:19:35 -04:00
|
|
|
for j in range(0, 24):
|
|
|
|
week_schedule = schedules['WD'][j]
|
|
|
|
self._complete_year_schedule.append(week_schedule)
|
2021-05-25 13:34:57 -04:00
|
|
|
elif cal.weekday(2015, i, day) == 5:
|
2021-03-16 12:19:35 -04:00
|
|
|
for j in range(0, 24):
|
|
|
|
week_schedule = schedules['Sat'][j]
|
|
|
|
self._complete_year_schedule.append(week_schedule)
|
|
|
|
else:
|
|
|
|
for j in range(0, 24):
|
|
|
|
week_schedule = schedules['Sun'][j]
|
|
|
|
self._complete_year_schedule.append(week_schedule)
|
|
|
|
return self._complete_year_schedule
|