system_assignation/city_model_structure/attributes/occupants.py

225 lines
5.6 KiB
Python
Raw Normal View History

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
Contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
2021-03-16 12:19:35 -04:00
"""
from typing import TypeVar
2021-03-16 12:19:35 -04:00
import calendar as cal
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
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 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
:return:
"""
self._occupancy_rate = value
@property
def occupant_type(self):
"""
Get type of schedules
2021-03-16 12:19:35 -04:00
:return: string
"""
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
:return:
"""
self._occupant_type = value
@property
def usage_zone(self) -> UsageZone:
2021-03-16 12:19:35 -04:00
"""
Get the zone an occupant is in
:return: UsageZone
"""
return self._usage_zone
2021-03-16 12:19:35 -04:00
@property
def occupant_schedule(self):
"""
Get the schedules when an occupant is in a zone (24 values, 1 per hour of the day)
2021-03-16 12:19:35 -04:00
:return: [float]
"""
return self._occupant_schedule
@occupant_schedule.setter
def occupant_schedule(self, value):
"""
Set the schedules when an occupant is in a zone (24 values, 1 per hour of the day)
2021-03-16 12:19:35 -04:00
: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 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]
2021-03-16 12:19:35 -04:00
for day in range(1, month_range[1]+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