summer_course_2024/city_model_structure/attributes/occupancy.py

150 lines
3.6 KiB
Python

"""
Building module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Sanam Dabirian sanam.dabirian@mail.concordia.ca
Contributors Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
import calendar as cal
class Occupancy:
"""
Occupancy class
"""
def __init__(self):
"""
Constructor
"""
self._internal_heat_gain = None
self._heat_dissipation = None
self._occupant_rate = None
self._occupant_type = None
self._occupant_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 internal_heat_gain(self):
"""
Get internal heat gain of occupants
:return: occupant heat gain
"""
return self._internal_heat_gain
@property
def heat_dissipation(self):
"""
Get heat dissipation of occupants
:return: heat dissipation
"""
return self._heat_dissipation
@property
def occupant_rate(self):
"""
Get rate of occupancy
:return: rate of occupancy
"""
return self._occupant_rate
@property
def occupant_type(self):
"""
Get type of occupancy
:return: type of occupancy
"""
return self._occupant_type
@property
def occupant_zone(self):
"""
Get the zone that occupant is in it
:return: 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
def number_of_occupants(self):
"""
Get the number of occupants
:return: number of occupants
"""
return self._number_of_occupants
@property
def arrival_time(self):
"""
Get the arrival time of the occupant (for office building)
:return: arrival time
"""
return self._arrival_time
@property
def departure_time(self):
"""
Get the departure time of the occupant (for office building)
:return: departure time
"""
return self._departure_time
@property
def break_time(self):
"""
Get the lunch or break time of the occupant (for office building)
:return: break time
"""
return self._break_time
@property
def day_of_week(self):
"""
Get the day of the week
:return: day of the week
"""
return self._day_of_week
@property
def pd_of_meetings_duration(self):
"""
Get the probability distribution of the meeting duration
:return: probability distribution of the meeting duration
"""
return self._pd_of_meetings_duration
def get_complete_year_schedule(self, schedules):
if self._complete_year_schedule is None:
self._complete_year_schedule = []
for i in range(1, 13):
month_range = cal.monthrange(2015, i)
for day in range(1, month_range[1]+1):
if cal.weekday(2015, i, day) < 5:
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:
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