city_retrofit/city_model_structure/building_demand/occupant.py

171 lines
4.5 KiB
Python
Raw Normal View History

2021-03-16 12:19:35 -04:00
"""
2022-03-08 19:19:52 -05:00
Occupant module
2021-03-16 12:19:35 -04:00
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Sanam Dabirian sanam.dabirian@mail.concordia.ca
Contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
2021-03-16 12:19:35 -04:00
"""
import calendar as cal
2021-03-16 12:19:35 -04:00
2022-03-08 19:19:52 -05:00
class Occupant:
2021-03-16 12:19:35 -04:00
"""
2022-03-08 19:19:52 -05:00
Occupant class
2021-03-16 12:19:35 -04:00
"""
def __init__(self):
"""
Constructor
"""
self._heat_dissipation = None
self._occupancy_rate = None
self._occupant_type = None
self._arrival_time = None
self._departure_time = None
self._break_time = None
self._day_of_week = None
self._pd_of_meetings_duration = 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
"""
2021-09-13 15:14:54 -04:00
self._heat_dissipation = float(value)
2021-03-16 12:19:35 -04:00
@property
def occupancy_rate(self):
"""
Get rate of schedules
2021-03-16 12:19:35 -04:00
:return: float
"""
return self._occupancy_rate
@occupancy_rate.setter
def occupancy_rate(self, value):
"""
Set rate of schedules
2021-03-16 12:19:35 -04:00
:param value: float
"""
2021-09-13 15:14:54 -04:00
self._occupancy_rate = float(value)
2021-03-16 12:19:35 -04:00
@property
def occupant_type(self):
"""
Get type of schedules
:return: str
2021-03-16 12:19:35 -04:00
"""
return self._occupant_type
@occupant_type.setter
def occupant_type(self, value):
"""
Set type of schedules
2021-03-16 12:19:35 -04:00
:param value: float
"""
2021-09-13 15:14:54 -04:00
self._occupant_type = float(value)
2021-03-16 12:19:35 -04:00
@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
"""
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: str
2021-03-16 12:19:35 -04:00
"""
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: str
2021-03-16 12:19:35 -04:00
"""
# 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 schedules out of archetypal days of week
2021-03-16 12:19:35 -04:00
:return: [float]
"""
if self._complete_year_schedule is None:
self._complete_year_schedule = []
for i in range(1, 13):
month_range = cal.monthrange(2015, i)[1]
for day in range(1, month_range+1):
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)
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