hub/occupancy/occupancy_feeders/demo_occupancy_parameters.py

35 lines
2.2 KiB
Python
Raw Normal View History

2020-10-22 11:02:41 -04:00
"""
PhysicsFactory retrieve the specific physics module for the given region
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
import pandas as pd
from occupancy.occupancy_feeders.helpers.occupancy_helper import OccupancyHelper
class DemoOccupancyParameters:
def __init__(self, city, base_path):
self._city = city
self._demo_schedules_path = base_path / 'demo_schedules.xlsx'
xls = pd.ExcelFile(self._demo_schedules_path)
for building in city.buildings:
occupancy = pd.read_excel(xls, sheet_name=OccupancyHelper.pluto_occupancy_function(building.function),
skiprows=[0, 1, 2, 3])
for index, row in occupancy.iterrows():
building.week_day_schedule = [row['1am'], row['2am'], row['3am'], row['4am'], row['5am'], row['6am'],
row['7am'], row['8am'], row['9am'], row['10am'], row['11am'], row['12am'],
row['1pm'], row['2pm'], row['3pm'], row['4pm'], row['5pm'], row['6pm'],
row['7pm'], row['8pm'], row['9pm'], row['10pm'], row['11pm'], row['12pm']]
row = occupancy.iloc[index + 1]
building.saturday_schedule = [row['1am'], row['2am'], row['3am'], row['4am'], row['5am'], row['6am'],
row['7am'], row['8am'], row['9am'], row['10am'], row['11am'], row['12am'],
row['1pm'], row['2pm'], row['3pm'], row['4pm'], row['5pm'], row['6pm'],
row['7pm'], row['8pm'], row['9pm'], row['10pm'], row['11pm'], row['12pm']]
row = occupancy.iloc[index + 2]
building.sunday_schedule = [row['1am'], row['2am'], row['3am'], row['4am'], row['5am'], row['6am'],
row['7am'], row['8am'], row['9am'], row['10am'], row['11am'], row['12am'],
row['1pm'], row['2pm'], row['3pm'], row['4pm'], row['5pm'], row['6pm'],
row['7pm'], row['8pm'], row['9pm'], row['10pm'], row['11pm'], row['12pm']]
break