Modified workflow to include Sanam's schedules
This commit is contained in:
parent
242e4624f9
commit
b135a97ad2
1
data/.gitignore
vendored
Normal file
1
data/.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
!.gitignore
|
48
imports/customized_imports/stochastic_schedules_importer.py
Normal file
48
imports/customized_imports/stochastic_schedules_importer.py
Normal file
|
@ -0,0 +1,48 @@
|
|||
"""
|
||||
StochasticSchedulesImporter
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
|
||||
|
||||
import pandas as pd
|
||||
from city_model_structure.attributes.schedule import Schedule
|
||||
import helpers.constants as cte
|
||||
|
||||
|
||||
class StochasticSchedulesImporter:
|
||||
"""
|
||||
StochasticSchedulesImporter class
|
||||
"""
|
||||
def __init__(self, city, base_path, buildings=None):
|
||||
file = 'Occupancy_schedules_EVBuilding.xlsx'
|
||||
path = str(base_path / file)
|
||||
if buildings is None:
|
||||
self._buildings = city.buildings
|
||||
else:
|
||||
self._buildings = buildings
|
||||
self._xls = pd.ExcelFile(path)
|
||||
|
||||
def enrich_buildings(self):
|
||||
"""
|
||||
Returns the city with the usage parameters assigned to the buildings
|
||||
:return:
|
||||
"""
|
||||
_daily_schedules = pd.read_excel(self._xls, nrows=261, usecols="A:Y")
|
||||
year = []
|
||||
for day in range(1, 262):
|
||||
values = _daily_schedules.iloc[day-1][1:].to_numpy()
|
||||
year.extend(values)
|
||||
schedule = Schedule()
|
||||
schedule.values = year
|
||||
schedule.type = cte.OCCUPANCY
|
||||
schedule.time_range = cte.YEAR
|
||||
schedule.time_step = cte.HOUR
|
||||
schedule.data_type = cte.FRACTION
|
||||
|
||||
for building in self._buildings:
|
||||
for internal_zone in building.internal_zones:
|
||||
for thermal_zone in internal_zone.thermal_zones:
|
||||
occupancy = thermal_zone.occupancy
|
||||
occupancy.occupancy_schedules = [schedule]
|
28
imports/customized_imports_factory.py
Normal file
28
imports/customized_imports_factory.py
Normal file
|
@ -0,0 +1,28 @@
|
|||
"""
|
||||
CustomizedImportsFactory is used to import any information using user customized formats
|
||||
This factory can only be called after calling the construction factory.
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class CustomizedImportsFactory:
|
||||
"""
|
||||
CustomizedImportsFactory class
|
||||
"""
|
||||
def __init__(self, importer_class, city, base_path=None):
|
||||
if base_path is None:
|
||||
base_path = Path('C:/Users/Pilar/Documents/Pycharm_repository/Workshops/ep_workflow/inputs/')
|
||||
self._importer_class = importer_class
|
||||
self._city = city
|
||||
self._base_path = base_path
|
||||
|
||||
def enrich(self):
|
||||
"""
|
||||
Returns the class that will enrich the city given
|
||||
:return: Class
|
||||
"""
|
||||
importer = self._importer_class(self._city, self._base_path)
|
||||
return importer.enrich_buildings()
|
|
@ -1,22 +1,22 @@
|
|||
import sys
|
||||
sys.path.append('/home/guille/Projects/Concordia/libs')
|
||||
sys.path.append('C:/Users/Pilar/PycharmProjects/libs')
|
||||
|
||||
from imports.geometry_factory import GeometryFactory
|
||||
from imports.construction_factory import ConstructionFactory
|
||||
from imports.usage_factory import UsageFactory
|
||||
from imports.schedules_factory import SchedulesFactory
|
||||
from exports.exports_factory import ExportsFactory
|
||||
from imports.customized_imports_factory import CustomizedImportsFactory
|
||||
from imports.customized_imports.stochastic_schedules_importer import StochasticSchedulesImporter as ssi
|
||||
|
||||
|
||||
city = GeometryFactory('citygml', '/home/guille/Documents/Concordia/EP_Workflow/one_building_in_kelowna.gml').city
|
||||
city = GeometryFactory('citygml', 'C:/Users/Pilar/Documents/Pycharm_repository/Workshops/ep_workflow/'
|
||||
'inputs/one_building_in_kelowna.gml').city
|
||||
for building in city.buildings:
|
||||
building.year_of_construction = 2006
|
||||
ConstructionFactory('nrel', city).enrich()
|
||||
UsageFactory('comnet', city).enrich()
|
||||
SchedulesFactory('comnet', city).enrich()
|
||||
for building in city.buildings:
|
||||
for usage in building.usage_zones:
|
||||
if usage.cooling_setpoint is None:
|
||||
usage.cooling_setpoint = 22.0
|
||||
if usage.heating_setpoint is None:
|
||||
usage.heating_setpoint = 22.0
|
||||
CustomizedImportsFactory(ssi, city).enrich()
|
||||
|
||||
_idf = ExportsFactory('idf', city, '/home/guille/Documents/Concordia/EP_Workflow/outputs/').export()
|
||||
_idf = ExportsFactory('idf', city,
|
||||
'C:/Users/Pilar/Documents/Pycharm_repository/Workshops/ep_workflow/outputs/').export_debug()
|
||||
_idf.run()
|
||||
|
|
Loading…
Reference in New Issue
Block a user