summer_course_2024/city_model_structure/attributes/occupants.py

225 lines
5.6 KiB
Python

"""
Occupants module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Sanam Dabirian sanam.dabirian@mail.concordia.ca
Contributors Pilar Monsalvete Álvarez de Uribarri pilar.monsalvete@concordia.ca
"""
from typing import TypeVar
import calendar as cal
UsageZone = TypeVar('UsageZone')
class Occupants:
"""
Occupants class
"""
def __init__(self):
"""
Constructor
"""
self._heat_dissipation = None
self._occupancy_rate = None
self._occupant_type = None
self._usage_zone = None
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
def usage_zone(self) -> UsageZone:
"""
Get the zone an occupant is in
:return: UsageZone
"""
return self._usage_zone
@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):
month_range = cal.monthrange(2018, i)
for day in range(1, month_range[1]+1):
if cal.weekday(2018, i, day) < 5:
for j in range(0, 24):
week_schedule = schedules['WD'][j]
self._complete_year_schedule.append(week_schedule)
elif cal.weekday(2018, i, day) == 5:
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