Changes in libs to new concept of keywords in libraries. Missing new tests.

This commit is contained in:
Pilar 2021-05-26 18:17:23 -04:00
parent e486e352a4
commit 9dcc12fd68
40 changed files with 641 additions and 788 deletions

View File

@ -54,7 +54,7 @@ class Occupants:
@property
def occupancy_rate(self):
"""
Get rate of occupancy
Get rate of schedules
:return: float
"""
return self._occupancy_rate
@ -62,7 +62,7 @@ class Occupants:
@occupancy_rate.setter
def occupancy_rate(self, value):
"""
Set rate of occupancy
Set rate of schedules
:param value: float
:return:
"""
@ -71,7 +71,7 @@ class Occupants:
@property
def occupant_type(self):
"""
Get type of occupancy
Get type of schedules
:return: string
"""
return self._occupant_type
@ -79,7 +79,7 @@ class Occupants:
@occupant_type.setter
def occupant_type(self, value):
"""
Set type of occupancy
Set type of schedules
:param value: float
:return:
"""

View File

@ -264,7 +264,7 @@ class UsageZone:
@property
def occupancy_density(self):
"""
Get occupancy density in persons per m2
Get schedules density in persons per m2
:return: float
"""
return self._occupancy_density
@ -272,7 +272,7 @@ class UsageZone:
@occupancy_density.setter
def occupancy_density(self, values):
"""
occupancy density in persons per m2
schedules density in persons per m2
:param values: float
"""
self._occupancy_density = values

View File

@ -1,5 +1,5 @@
"""
TestOccupancyFactory test and validate the city model structure occupancy parameters
TestOccupancyFactory test and validate the city model structure schedules parameters
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Soroush Samareh Abolhassani - soroush.samarehabolhassani@mail.concordia.ca
"""
@ -187,7 +187,7 @@ class Idf:
def add_occupancy(self):
for zone in self._idf.idfobjects["ZONE"]:
self._idf.newidfobject("PEOPLE",
Name=zone.Name + "_" + "occupancy",
Name=zone.Name + "_" + "schedules",
Zone_or_ZoneList_Name=zone.Name,
Number_of_People_Schedule_Name='occupant schedule',
Number_of_People_Calculation_Method="People",

View File

@ -1,19 +1,19 @@
"""
PhysicsFactory retrieve the specific physics module for the given region
ConstructionFactory (before PhysicsFactory) retrieve the specific construction module for the given region
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from imports.physics_feeders.us_new_york_city_physics_parameters import UsNewYorkCityPhysicsParameters
from imports.physics_feeders.us_physics_parameters import UsPhysicsParameters
from imports.physics_feeders.ca_physics_parameters import CaPhysicsParameters
from imports.construction_feeders.us_new_york_city_physics_parameters import UsNewYorkCityPhysicsParameters
from imports.construction_feeders.us_physics_parameters import UsPhysicsParameters
from imports.construction_feeders.ca_physics_parameters import CaPhysicsParameters
from pathlib import Path
class PhysicsFactory:
class ConstructionFactory:
"""
PhysicsFactor class
"""
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/physics')):
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/construction')):
self._handler = '_' + handler.lower().replace(' ', '_')
self._city = city
self._base_path = base_path
@ -35,7 +35,7 @@ class PhysicsFactory:
def enrich(self):
"""
Enrich the city with the physics information
Enrich the city with the construction information
:return: None
"""
getattr(self, self._handler, lambda: None)()

View File

@ -5,8 +5,8 @@ Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
import sys
from imports.physics_feeders.nrel_physics_interface import NrelPhysicsInterface
from imports.physics_feeders.helpers.ca_to_library_types import CaToLibraryTypes
from imports.construction_feeders.nrel_physics_interface import NrelPhysicsInterface
from imports.construction_feeders.helpers.construction_helper import ConstructionHelper
class CaPhysicsParameters(NrelPhysicsInterface):
@ -19,7 +19,7 @@ class CaPhysicsParameters(NrelPhysicsInterface):
def enrich_buildings(self):
"""
Returns the city with the physics parameters assigned to the buildings
Returns the city with the construction parameters assigned to the buildings
:return:
"""
city = self._city
@ -53,7 +53,7 @@ class CaPhysicsParameters(NrelPhysicsInterface):
thermal_zone.infiltration_rate_system_on = archetype.infiltration_rate_system_on
thermal_zone.infiltration_rate_system_off = archetype.infiltration_rate_system_off
for thermal_boundary in thermal_zone.bounded:
construction_type = CaToLibraryTypes.construction_types[thermal_boundary.type]
construction_type = ConstructionHelper.nrcan_construction_types[thermal_boundary.type]
thermal_boundary_archetype = self._search_construction_in_archetype(archetype, construction_type)
thermal_boundary.u_value = thermal_boundary_archetype.overall_u_value
thermal_boundary.outside_solar_absorptance = thermal_boundary_archetype.outside_solar_absorptance

View File

@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
from typing import List
from imports.physics_feeders.data_classes.nrel_thermal_boundary_archetype import NrelThermalBoundaryArchetype
from imports.construction_feeders.data_classes.nrel_thermal_boundary_archetype import NrelThermalBoundaryArchetype
class NrelBuildingArchetype:

View File

@ -5,8 +5,8 @@ Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
from typing import List
from imports.physics_feeders.data_classes.nrel_layer_archetype import NrelLayerArchetype
from imports.physics_feeders.data_classes.nrel_thermal_opening_archetype import NrelThermalOpeningArchetype
from imports.construction_feeders.data_classes.nrel_layer_archetype import NrelLayerArchetype
from imports.construction_feeders.data_classes.nrel_thermal_opening_archetype import NrelThermalOpeningArchetype
class NrelThermalBoundaryArchetype:

View File

@ -0,0 +1,149 @@
"""
Construction helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import sys
class ConstructionHelper:
# NREL
function_to_nrel = {
'residential': 'residential',
'single family house': 'single family house',
'multifamily house': 'multifamily house',
'hotel': 'hotel',
'hospital': 'hospital',
'outpatient': 'outpatient',
'commercial': 'commercial',
'strip mall': 'strip mall',
'warehouse': 'warehouse',
'primary school': 'primary school',
'secondary school': 'secondary school',
'office': 'office',
'large office': 'large office'
}
nrel_function_default_value = 'residential'
nrel_standards = {
'ASHRAE Std189': 1,
'ASHRAE 90.1_2004': 2
}
reference_city_to_nrel_climate_zone = {
'Miami': 'ASHRAE_2004:1A',
'Houston': 'ASHRAE_2004:2A',
'Phoenix': 'ASHRAE_2004:2B',
'Atlanta': 'ASHRAE_2004:3A',
'Los Angeles': 'ASHRAE_2004:3B',
'Las Vegas': 'ASHRAE_2004:3B',
'San Francisco': 'ASHRAE_2004:3C',
'Baltimore': 'ASHRAE_2004:4A',
'Albuquerque': 'ASHRAE_2004:4B',
'Seattle': 'ASHRAE_2004:4C',
'Chicago': 'ASHRAE_2004:5A',
'Boulder': 'ASHRAE_2004:5B',
'Minneapolis': 'ASHRAE_2004:6A',
'Helena': 'ASHRAE_2004:6B',
'Duluth': 'ASHRAE_2004:7A',
'Fairbanks': 'ASHRAE_2004:8A'
}
nrel_window_types = ['window', 'door', 'skylight']
# todo: review with the same idea, to define a internal set and do the conversion to NREL
nrel_construction_types = {
'Wall': 'exterior wall',
'interior wall': 'interior wall',
'ground wall': 'ground wall',
'Ground': 'exterior slab',
'attic floor': 'attic floor',
'interior slab': 'interior slab',
'Roof': 'roof'
}
# NRCAN
function_to_nrcan = {
'residential': 'residential',
'single family house': 'single family house',
'multifamily house': 'multifamily house',
'hotel': 'hotel',
'hospital': 'hospital',
'outpatient': 'outpatient',
'commercial': 'commercial',
'strip mall': 'strip mall',
'warehouse': 'warehouse',
'primary school': 'primary school',
'secondary school': 'secondary school',
'office': 'office',
'large office': 'large office'
}
nrcan_function_default_value = 'residential'
nrcan_window_types = ['window']
# todo: review with the same idea, to define a internal set and do the conversion to NREL
nrcan_construction_types = {
'Wall': 'wall',
'ground wall': 'basement_wall',
'Ground': 'floor',
'attic floor': 'attic floor',
'interior slab': 'interior slab',
'Roof': 'roof'
}
@staticmethod
def nrel_from_function(function):
"""
Get NREL function from the given internal function key
:param function: str
:return: str
"""
try:
return ConstructionHelper.function_to_nrel[function]
except KeyError:
sys.stderr.write('Error: keyword not found. Returned default NREL function "residential"\n')
return ConstructionHelper.nrel_function_default_value
@staticmethod
def yoc_to_nrel_standard(year_of_construction):
"""
Year of construction to NREL standard
:param year_of_construction: int
:return: str
"""
if int(year_of_construction) < 2009:
standard = 'ASHRAE 90.1_2004'
else:
standard = 'ASHRAE 189.1_2009'
return standard
@staticmethod
def city_to_reference_city(city):
"""
City name to reference city
:param city: str
:return: str
"""
# ToDo: Dummy function that needs to be implemented
reference_city = 'Baltimore'
if city is not None:
reference_city = 'Baltimore'
return reference_city
@staticmethod
def city_to_nrel_climate_zone(city):
"""
City name to NREL climate zone
:param city: str
:return: str
"""
reference_city = ConstructionHelper.city_to_reference_city(city)
return ConstructionHelper.reference_city_to_nrel_climate_zone[reference_city]
@staticmethod
def nrcan_from_function(function):
"""
Get NREL function from the given internal function key
:param function: str
:return: str
"""
try:
return ConstructionHelper.function_to_nrcan[function]
except KeyError:
sys.stderr.write('Error: keyword not found. Returned default NRCAN function "residential"\n')
return ConstructionHelper.nrcan_function_default_value

View File

@ -6,10 +6,10 @@ Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
import xmltodict
from imports.physics_feeders.data_classes.nrel_building_achetype import NrelBuildingArchetype as nba
from imports.physics_feeders.data_classes.nrel_thermal_boundary_archetype import NrelThermalBoundaryArchetype as ntba
from imports.physics_feeders.data_classes.nrel_thermal_opening_archetype import NrelThermalOpeningArchetype as ntoa
from imports.physics_feeders.data_classes.nrel_layer_archetype import NrelLayerArchetype as nla
from imports.construction_feeders.data_classes.nrel_building_achetype import NrelBuildingArchetype as nba
from imports.construction_feeders.data_classes.nrel_thermal_boundary_archetype import NrelThermalBoundaryArchetype as ntba
from imports.construction_feeders.data_classes.nrel_thermal_opening_archetype import NrelThermalOpeningArchetype as ntoa
from imports.construction_feeders.data_classes.nrel_layer_archetype import NrelLayerArchetype as nla
class NrelPhysicsInterface:

View File

@ -6,9 +6,8 @@ Contributors Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
import sys
from imports.physics_feeders.nrel_physics_interface import NrelPhysicsInterface
from imports.physics_feeders.helpers.us_pluto_to_function import UsPlutoToFunction as pf
from imports.physics_feeders.helpers.us_to_library_types import UsToLibraryTypes
from imports.construction_feeders.nrel_physics_interface import NrelPhysicsInterface
from imports.construction_feeders.helpers.construction_helper import ConstructionHelper
from city_model_structure.attributes.layer import Layer
from city_model_structure.attributes.material import Material
@ -24,17 +23,17 @@ class UsNewYorkCityPhysicsParameters(NrelPhysicsInterface):
def enrich_buildings(self):
"""
Returns the city with the physics parameters assigned to the buildings
Returns the city with the construction parameters assigned to the buildings
:return:
"""
city = self._city
# it is assumed that all buildings have the same archetypes' keys
for building in city.buildings:
building_type = pf.function(building.function)
building_type = ConstructionHelper.nrel_from_function(building.function)
if building_type is None:
return
archetype = self._search_archetype(building_type,
UsToLibraryTypes.yoc_to_standard(building.year_of_construction),
ConstructionHelper.yoc_to_nrel_standard(building.year_of_construction),
self._climate_zone)
if archetype is None:
sys.stderr.write(f'Building {building.name} has unknown archetype for building function: {building.function} '
@ -61,7 +60,7 @@ class UsNewYorkCityPhysicsParameters(NrelPhysicsInterface):
thermal_zone.infiltration_rate_system_on = archetype.infiltration_rate_system_on
thermal_zone.infiltration_rate_system_off = archetype.infiltration_rate_system_off
for thermal_boundary in thermal_zone.bounded:
construction_type = UsToLibraryTypes.construction_types[thermal_boundary.type]
construction_type = ConstructionHelper.nrel_construction_types[thermal_boundary.type]
thermal_boundary_archetype = self._search_construction_in_archetype(archetype, construction_type)
if thermal_boundary_archetype.outside_solar_absorptance is not None:
thermal_boundary.outside_solar_absorptance = thermal_boundary_archetype.outside_solar_absorptance

View File

@ -6,8 +6,8 @@ Contributors Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
import sys
from imports.physics_feeders.nrel_physics_interface import NrelPhysicsInterface
from imports.physics_feeders.helpers.us_to_library_types import UsToLibraryTypes
from imports.construction_feeders.nrel_physics_interface import NrelPhysicsInterface
from imports.construction_feeders.helpers.us_to_library_types import UsToLibraryTypes
from city_model_structure.attributes.layer import Layer
from city_model_structure.attributes.material import Material
@ -23,7 +23,7 @@ class UsPhysicsParameters(NrelPhysicsInterface):
def enrich_buildings(self):
"""
Returns the city with the physics parameters assigned to the buildings
Returns the city with the construction parameters assigned to the buildings
:return:
"""
city = self._city

View File

@ -0,0 +1,295 @@
"""
Geometry helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
class GeometryHelper:
# function
pluto_to_function = {
'A0': 'single family house',
'A1': 'single family house',
'A2': 'single family house',
'A3': 'single family house',
'A4': 'single family house',
'A5': 'single family house',
'A6': 'single family house',
'A7': 'single family house',
'A8': 'single family house',
'A9': 'single family house',
'B1': 'multifamily house',
'B2': 'multifamily house',
'B3': 'multifamily house',
'B9': 'multifamily house',
'C0': 'residential',
'C1': 'residential',
'C2': 'residential',
'C3': 'residential',
'C4': 'residential',
'C5': 'residential',
'C6': 'residential',
'C7': 'residential',
'C8': 'residential',
'C9': 'residential',
'D0': 'residential',
'D1': 'residential',
'D2': 'residential',
'D3': 'residential',
'D4': 'residential',
'D5': 'residential',
'D6': 'residential',
'D7': 'residential',
'D8': 'residential',
'D9': 'residential',
'E1': 'warehouse',
'E3': 'warehouse',
'E4': 'warehouse',
'E5': 'warehouse',
'E7': 'warehouse',
'E9': 'warehouse',
'F1': 'warehouse',
'F2': 'warehouse',
'F4': 'warehouse',
'F5': 'warehouse',
'F8': 'warehouse',
'F9': 'warehouse',
'G0': 'office',
'G1': 'office',
'G2': 'office',
'G3': 'office',
'G4': 'office',
'G5': 'office',
'G6': 'office',
'G7': 'office',
'G8': 'office',
'G9': 'office',
'H1': 'hotel',
'H2': 'hotel',
'H3': 'hotel',
'H4': 'hotel',
'H5': 'hotel',
'H6': 'hotel',
'H7': 'hotel',
'H8': 'hotel',
'H9': 'hotel',
'HB': 'hotel',
'HH': 'hotel',
'HR': 'hotel',
'HS': 'hotel',
'I1': 'hospital',
'I2': 'outpatient',
'I3': 'outpatient',
'I4': 'residential',
'I5': 'outpatient',
'I6': 'outpatient',
'I7': 'outpatient',
'I9': 'outpatient',
'J1': 'large office',
'J2': 'large office',
'J3': 'large office',
'J4': 'large office',
'J5': 'large office',
'J6': 'large office',
'J7': 'large office',
'J8': 'large office',
'J9': 'large office',
'K1': 'strip mall',
'K2': 'strip mall',
'K3': 'strip mall',
'K4': 'residential',
'K5': 'restaurant',
'K6': 'commercial',
'K7': 'commercial',
'K8': 'commercial',
'K9': 'commercial',
'L1': 'residential',
'L2': 'residential',
'L3': 'residential',
'L8': 'residential',
'L9': 'residential',
'M1': 'large office',
'M2': 'large office',
'M3': 'large office',
'M4': 'large office',
'M9': 'large office',
'N1': 'residential',
'N2': 'residential',
'N3': 'residential',
'N4': 'residential',
'N9': 'residential',
'O1': 'office',
'O2': 'office',
'O3': 'office',
'O4': 'office',
'O5': 'office',
'O6': 'office',
'O7': 'office',
'O8': 'office',
'O9': 'office',
'P1': 'large office',
'P2': 'hotel',
'P3': 'office',
'P4': 'office',
'P5': 'office',
'P6': 'office',
'P7': 'large office',
'P8': 'large office',
'P9': 'office',
'Q0': 'office',
'Q1': 'office',
'Q2': 'office',
'Q3': 'office',
'Q4': 'office',
'Q5': 'office',
'Q6': 'office',
'Q7': 'office',
'Q8': 'office',
'Q9': 'office',
'R0': 'residential',
'R1': 'residential',
'R2': 'residential',
'R3': 'residential',
'R4': 'residential',
'R5': 'residential',
'R6': 'residential',
'R7': 'residential',
'R8': 'residential',
'R9': 'residential',
'RA': 'residential',
'RB': 'residential',
'RC': 'residential',
'RD': 'residential',
'RG': 'residential',
'RH': 'residential',
'RI': 'residential',
'RK': 'residential',
'RM': 'residential',
'RR': 'residential',
'RS': 'residential',
'RW': 'residential',
'RX': 'residential',
'RZ': 'residential',
'S0': 'residential',
'S1': 'residential',
'S2': 'residential',
'S3': 'residential',
'S4': 'residential',
'S5': 'residential',
'S9': 'residential',
'T1': 'na',
'T2': 'na',
'T9': 'na',
'U0': 'warehouse',
'U1': 'warehouse',
'U2': 'warehouse',
'U3': 'warehouse',
'U4': 'warehouse',
'U5': 'warehouse',
'U6': 'warehouse',
'U7': 'warehouse',
'U8': 'warehouse',
'U9': 'warehouse',
'V0': 'na',
'V1': 'na',
'V2': 'na',
'V3': 'na',
'V4': 'na',
'V5': 'na',
'V6': 'na',
'V7': 'na',
'V8': 'na',
'V9': 'na',
'W1': 'primary school',
'W2': 'primary school',
'W3': 'secondary school',
'W4': 'secondary school',
'W5': 'secondary school',
'W6': 'secondary school',
'W7': 'secondary school',
'W8': 'primary school',
'W9': 'secondary school',
'Y1': 'large office',
'Y2': 'large office',
'Y3': 'large office',
'Y4': 'large office',
'Y5': 'large office',
'Y6': 'large office',
'Y7': 'large office',
'Y8': 'large office',
'Y9': 'large office',
'Z0': 'na',
'Z1': 'large office',
'Z2': 'na',
'Z3': 'na',
'Z4': 'na',
'Z5': 'na',
'Z6': 'na',
'Z7': 'na',
'Z8': 'na',
'Z9': 'na'
}
hft_to_function = {
'residential': 'residential',
'single family house': 'single family house',
'multifamily house': 'multifamily house',
'hotel': 'hotel',
'hospital': 'hospital',
'outpatient': 'outpatient',
'commercial': 'commercial',
'strip mall': 'strip mall',
'warehouse': 'warehouse',
'primary school': 'primary school',
'secondary school': 'secondary school',
'office': 'office',
'large office': 'large office'
}
# usage
fuction_to_usage = {
'full service restaurant': 'restaurant',
'highrise apartment': 'residential',
'hospital': 'health care',
'large hotel': 'hotel',
'large office': 'office and administration',
'medium office': 'office and administration',
'midrise apartment': 'residential',
'outpatient healthcare': 'health care',
'primary school': 'education',
'quick service restaurant': 'restaurant',
'secondary school': 'education',
'small hotel': 'hotel',
'small office': 'office and administration',
'stand alone retail': 'retail',
'strip mall': 'hall',
'supermarket': 'retail',
'warehouse': 'industry',
'residential': 'residential'
}
@staticmethod
def function_from_hft(building_hft_function):
"""
Get internal function from the given HfT function
:param building_hft_function: str
:return: str
"""
return GeometryHelper.hft_to_function[building_hft_function]
@staticmethod
def function_from_pluto(building_pluto_function):
"""
Get internal function from the given pluto function
:param building_pluto_function: str
:return: str
"""
return GeometryHelper.pluto_to_function[building_pluto_function]
@staticmethod
def usage_from_function(building_function):
"""
Get the internal usage for the given internal building function
:param building_function: str
:return: str
"""
return GeometryHelper.fuction_to_usage[building_function]

View File

@ -1,34 +0,0 @@
"""
Schedules helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
class SchedulesHelper:
comnet_pluto_function = {
'C1': 'C-12 Residential',
'C5': 'C-12 Residential',
'D3': 'C-12 Residential',
'D6': 'C-12 Residential',
'I1': 'C-2 Health',
'RI': 'C-12 Residential',
'RM': 'C-12 Residential',
'U0': 'C-10 Warehouse',
'W4': 'C-9 School',
}
comnet_function = {
'residential': 'C-12 Residential'
}
@staticmethod
def comnet_pluto_schedules_function(building_pluto_function):
"""
Get Comnet function from the given pluto function
:param building_pluto_function: str
:return: str
"""
try:
return SchedulesHelper.comnet_pluto_function[building_pluto_function]
except KeyError:
return SchedulesHelper.comnet_function[building_pluto_function]

View File

@ -1,39 +0,0 @@
"""
Schedules retrieve the specific usage schedules module for the given standard
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
contributors Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
import pandas as pd
from imports.occupancy_feeders.helpers.schedules_helper import SchedulesHelper
class ComnetSchedules:
def __init__(self, city, base_path):
self._city = city
self._comnet_schedules_path = base_path / 'comnet_archetypes.xlsx'
xls = pd.ExcelFile(self._comnet_schedules_path)
# todo: review for more than one usage_zones per building
for building in city.buildings:
schedules = dict()
usage_schedules = pd.read_excel(xls, sheet_name=SchedulesHelper.comnet_pluto_schedules_function(building.function)
, skiprows=[0, 1, 2, 3], nrows=39, usecols="A:AA")
# todo: should we save the data type? How?
number_of_schedule_types = 13
schedules_per_schedule_type = 3
day_types = dict({'week_day': 0, 'saturday': 1, 'sunday': 2})
for schedule_types in range(0, number_of_schedule_types):
data = pd.DataFrame()
columns_names = []
name = ''
for schedule_day in range(0, schedules_per_schedule_type):
row_cells = usage_schedules.iloc[schedules_per_schedule_type*schedule_types + schedule_day]
if schedule_day == day_types['week_day']:
name = row_cells[0]
columns_names.append(row_cells[2])
data1 = row_cells[schedules_per_schedule_type:]
data = pd.concat([data, data1], axis=1)
data.columns = columns_names
schedules[name] = data
building.usage_zones[0].schedules = schedules

View File

@ -1,22 +0,0 @@
"""
CaToLibraryTypes helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
class CaToLibraryTypes:
"""
CaToLibraryTypes
"""
window_types = ['window']
construction_types = {
'Wall': 'wall',
'ground wall': 'basement_wall',
'Ground': 'floor',
'attic floor': 'attic floor',
'interior slab': 'interior slab',
'Roof': 'roof'
}

View File

@ -1,243 +0,0 @@
"""
UsPlutoToFunction helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
class UsPlutoToFunction:
"""
UsPlutoToFunction
"""
building_function = {
'A0': 'single family house',
'A1': 'single family house',
'A2': 'single family house',
'A3': 'single family house',
'A4': 'single family house',
'A5': 'single family house',
'A6': 'single family house',
'A7': 'single family house',
'A8': 'single family house',
'A9': 'single family house',
'B1': 'multifamily house',
'B2': 'multifamily house',
'B3': 'multifamily house',
'B9': 'multifamily house',
'C0': 'residential',
'C1': 'residential',
'C2': 'residential',
'C3': 'residential',
'C4': 'residential',
'C5': 'residential',
'C6': 'residential',
'C7': 'residential',
'C8': 'residential',
'C9': 'residential',
'D0': 'residential',
'D1': 'residential',
'D2': 'residential',
'D3': 'residential',
'D4': 'residential',
'D5': 'residential',
'D6': 'residential',
'D7': 'residential',
'D8': 'residential',
'D9': 'residential',
'E1': 'warehouse',
'E3': 'warehouse',
'E4': 'warehouse',
'E5': 'warehouse',
'E7': 'warehouse',
'E9': 'warehouse',
'F1': 'warehouse',
'F2': 'warehouse',
'F4': 'warehouse',
'F5': 'warehouse',
'F8': 'warehouse',
'F9': 'warehouse',
'G0': 'office',
'G1': 'office',
'G2': 'office',
'G3': 'office',
'G4': 'office',
'G5': 'office',
'G6': 'office',
'G7': 'office',
'G8': 'office',
'G9': 'office',
'H1': 'hotel',
'H2': 'hotel',
'H3': 'hotel',
'H4': 'hotel',
'H5': 'hotel',
'H6': 'hotel',
'H7': 'hotel',
'H8': 'hotel',
'H9': 'hotel',
'HB': 'hotel',
'HH': 'hotel',
'HR': 'hotel',
'HS': 'hotel',
'I1': 'hospital',
'I2': 'outpatient',
'I3': 'outpatient',
'I4': 'residential',
'I5': 'outpatient',
'I6': 'outpatient',
'I7': 'outpatient',
'I9': 'outpatient',
'J1': 'large office',
'J2': 'large office',
'J3': 'large office',
'J4': 'large office',
'J5': 'large office',
'J6': 'large office',
'J7': 'large office',
'J8': 'large office',
'J9': 'large office',
'K1': 'strip mall',
'K2': 'strip mall',
'K3': 'strip mall',
'K4': 'residential',
'K5': 'restaurant',
'K6': 'commercial',
'K7': 'commercial',
'K8': 'commercial',
'K9': 'commercial',
'L1': 'residential',
'L2': 'residential',
'L3': 'residential',
'L8': 'residential',
'L9': 'residential',
'M1': 'large office',
'M2': 'large office',
'M3': 'large office',
'M4': 'large office',
'M9': 'large office',
'N1': 'residential',
'N2': 'residential',
'N3': 'residential',
'N4': 'residential',
'N9': 'residential',
'O1': 'office',
'O2': 'office',
'O3': 'office',
'O4': 'office',
'O5': 'office',
'O6': 'office',
'O7': 'office',
'O8': 'office',
'O9': 'office',
'P1': 'large office',
'P2': 'hotel',
'P3': 'office',
'P4': 'office',
'P5': 'office',
'P6': 'office',
'P7': 'large office',
'P8': 'large office',
'P9': 'office',
'Q0': 'office',
'Q1': 'office',
'Q2': 'office',
'Q3': 'office',
'Q4': 'office',
'Q5': 'office',
'Q6': 'office',
'Q7': 'office',
'Q8': 'office',
'Q9': 'office',
'R0': 'residential',
'R1': 'residential',
'R2': 'residential',
'R3': 'residential',
'R4': 'residential',
'R5': 'residential',
'R6': 'residential',
'R7': 'residential',
'R8': 'residential',
'R9': 'residential',
'RA': 'residential',
'RB': 'residential',
'RC': 'residential',
'RD': 'residential',
'RG': 'residential',
'RH': 'residential',
'RI': 'residential',
'RK': 'residential',
'RM': 'residential',
'RR': 'residential',
'RS': 'residential',
'RW': 'residential',
'RX': 'residential',
'RZ': 'residential',
'S0': 'residential',
'S1': 'residential',
'S2': 'residential',
'S3': 'residential',
'S4': 'residential',
'S5': 'residential',
'S9': 'residential',
'T1': 'na',
'T2': 'na',
'T9': 'na',
'U0': 'warehouse',
'U1': 'warehouse',
'U2': 'warehouse',
'U3': 'warehouse',
'U4': 'warehouse',
'U5': 'warehouse',
'U6': 'warehouse',
'U7': 'warehouse',
'U8': 'warehouse',
'U9': 'warehouse',
'V0': 'na',
'V1': 'na',
'V2': 'na',
'V3': 'na',
'V4': 'na',
'V5': 'na',
'V6': 'na',
'V7': 'na',
'V8': 'na',
'V9': 'na',
'W1': 'primary school',
'W2': 'primary school',
'W3': 'secondary school',
'W4': 'secondary school',
'W5': 'secondary school',
'W6': 'secondary school',
'W7': 'secondary school',
'W8': 'primary school',
'W9': 'secondary school',
'Y1': 'large office',
'Y2': 'large office',
'Y3': 'large office',
'Y4': 'large office',
'Y5': 'large office',
'Y6': 'large office',
'Y7': 'large office',
'Y8': 'large office',
'Y9': 'large office',
'Z0': 'na',
'Z1': 'large office',
'Z2': 'na',
'Z3': 'na',
'Z4': 'na',
'Z5': 'na',
'Z6': 'na',
'Z7': 'na',
'Z8': 'na',
'Z9': 'na'
}
@staticmethod
def function(building_pluto_function):
"""
Get nrel function from the given pluto function
:param building_pluto_function: str
:return: str
"""
return UsPlutoToFunction.building_function[building_pluto_function]

View File

@ -1,82 +0,0 @@
"""
UsToLibraryTypes helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
class UsToLibraryTypes:
"""
UsToLibraryTypes
"""
standards = {
'ASHRAE Std189': 1,
'ASHRAE 90.1_2004': 2
}
reference_city_climate_zone = {
'Miami': 'ASHRAE_2004:1A',
'Houston': 'ASHRAE_2004:2A',
'Phoenix': 'ASHRAE_2004:2B',
'Atlanta': 'ASHRAE_2004:3A',
'Los Angeles': 'ASHRAE_2004:3B',
'Las Vegas': 'ASHRAE_2004:3B',
'San Francisco': 'ASHRAE_2004:3C',
'Baltimore': 'ASHRAE_2004:4A',
'Albuquerque': 'ASHRAE_2004:4B',
'Seattle': 'ASHRAE_2004:4C',
'Chicago': 'ASHRAE_2004:5A',
'Boulder': 'ASHRAE_2004:5B',
'Minneapolis': 'ASHRAE_2004:6A',
'Helena': 'ASHRAE_2004:6B',
'Duluth': 'ASHRAE_2004:7A',
'Fairbanks': 'ASHRAE_2004:8A'
}
window_types = ['window', 'door', 'skylight']
construction_types = {
'Wall': 'exterior wall',
'interior wall': 'interior wall',
'ground wall': 'ground wall',
'Ground': 'exterior slab',
'attic floor': 'attic floor',
'interior slab': 'interior slab',
'Roof': 'roof'
}
@staticmethod
def yoc_to_standard(year_of_construction):
"""
Year of construction to standard
:param year_of_construction: int
:return: str
"""
if int(year_of_construction) < 2009:
standard = 'ASHRAE 90.1_2004'
else:
standard = 'ASHRAE 189.1_2009'
return standard
@staticmethod
def city_to_reference_city(city):
"""
City name to reference city
:param city: str
:return: str
"""
# ToDo: Dummy function that needs to be implemented
reference_city = 'Baltimore'
if city is not None:
reference_city = 'Baltimore'
return reference_city
@staticmethod
def city_to_climate_zone(city):
"""
City name to climate zone
:param city: str
:return: str
"""
reference_city = UsToLibraryTypes.city_to_reference_city(city)
return UsToLibraryTypes.reference_city_climate_zone[reference_city]

View File

@ -5,14 +5,14 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
"""
from pathlib import Path
from imports.occupancy_feeders.usage_schedules import ComnetSchedules
from imports.schedules_feeders.comnet_schedules_parameters import ComnetSchedules
class SchedulesFactory:
"""
SchedulesFactor class
"""
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/occupancy')):
def __init__(self, handler, city, base_path=Path(Path(__file__).parent.parent / 'data/schedules')):
self._handler = '_' + handler.lower().replace(' ', '_')
self._city = city
self._base_path = base_path

View File

@ -0,0 +1,40 @@
"""
Schedules retrieve the specific usage schedules module for the given standard
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import pandas as pd
from imports.schedules_feeders.helpers.schedules_helper import SchedulesHelper
class ComnetSchedules:
def __init__(self, city, base_path):
self._city = city
self._comnet_schedules_path = base_path / 'comnet_archetypes.xlsx'
xls = pd.ExcelFile(self._comnet_schedules_path)
for building in city.buildings:
schedules = dict()
for usage_zone in building.usage_zones:
usage_schedules = pd.read_excel(xls,
sheet_name=SchedulesHelper.comnet_from_usage(usage_zone.usage),
skiprows=[0, 1, 2, 3], nrows=39, usecols="A:AA")
# todo: should we save the data type? How?
number_of_schedule_types = 13
schedules_per_schedule_type = 3
day_types = dict({'week_day': 0, 'saturday': 1, 'sunday': 2})
for schedule_types in range(0, number_of_schedule_types):
data = pd.DataFrame()
columns_names = []
name = ''
for schedule_day in range(0, schedules_per_schedule_type):
row_cells = usage_schedules.iloc[schedules_per_schedule_type*schedule_types + schedule_day]
if schedule_day == day_types['week_day']:
name = row_cells[0]
columns_names.append(row_cells[2])
data1 = row_cells[schedules_per_schedule_type:]
data = pd.concat([data, data1], axis=1)
data.columns = columns_names
schedules[name] = data
usage_zone.schedules = schedules

View File

@ -0,0 +1,35 @@
"""
Schedules helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import sys
class SchedulesHelper:
usage_to_comnet = {
'residential': 'C-12 Residential',
'industry': 'C-10 Warehouse',
'office and administration': 'C-5 Office',
'hotel': 'C-3 Hotel',
'health care': 'C-2 Health',
'retail': 'C-8 Retail',
'hall': 'C-8 Retail',
'restaurant': 'C-7 Restaurant',
'education': 'C-9 School'
}
comnet_default_value = 'C-12 Residential'
@staticmethod
def comnet_from_usage(usage):
"""
Get Comnet usage from the given internal usage key
:param usage: str
:return: str
"""
try:
return SchedulesHelper.usage_to_comnet[usage]
except KeyError:
sys.stderr.write('Error: keyword not found. Returned default Comnet schedules "residential"\n')
return SchedulesHelper.comnet_default_value

View File

@ -9,6 +9,7 @@ from imports.usage_feeders.hft_usage_interface import HftUsageInterface
from city_model_structure.attributes.usage_zone import UsageZone
from city_model_structure.attributes.internal_gains import InternalGains
class CaUsageParameters(HftUsageInterface):
"""
CaUsageParameters class

View File

@ -98,7 +98,7 @@ class HftUsageZoneArchetype:
@property
def occupancy(self):
"""
Get occupancy data
Get schedules data
:return: [Occupancy]
"""
return self._occupancy
@ -114,7 +114,7 @@ class HftUsageZoneArchetype:
@property
def occupancy_density(self):
"""
Get occupancy density in persons per m2
Get schedules density in persons per m2
:return: float
"""
return self._occupancy_density

View File

@ -6,7 +6,7 @@ Contributors Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
import sys
from imports.usage_feeders.helpers.us_function_to_usage import UsFunctionToUsage as fu
from imports.geometry_feeders.helpers.geometry_helper import GeometryHelper as gh
from imports.usage_feeders.hft_usage_interface import HftUsageInterface
from city_model_structure.attributes.usage_zone import UsageZone
@ -26,10 +26,11 @@ class DeUsageParameters(HftUsageInterface):
"""
city = self._city
for building in city.buildings:
archetype = self._search_archetype(fu.usage(building.function))
archetype = self._search_archetype(gh.fuction_to_usage(building.function))
if archetype is None:
sys.stderr.write(f'Building {building.name} has unknown archetype for building function:'
f' {building.function}, that assigns building usage as {fu.usage(building.function)}\n')
f' {building.function}, that assigns building usage as '
f'{gh.fuction_to_usage(building.function)}\n')
continue
# todo: what to do with mix-usage usages from gml?
mix_usage = False

View File

@ -1,40 +0,0 @@
"""
UsFunctionToUsage helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
class UsFunctionToUsage:
"""
UsFunctionToUsage class
"""
_building_usage = {
'full service restaurant': 'restaurant',
'highrise apartment': 'residential',
'hospital': 'health care',
'large hotel': 'hotel',
'large office': 'office and administration',
'medium office': 'office and administration',
'midrise apartment': 'residential',
'outpatient healthcare': 'health care',
'primary school': 'education',
'quick service restaurant': 'restaurant',
'secondary school': 'education',
'small hotel': 'hotel',
'small office': 'office and administration',
'stand alone retail': 'retail',
'strip mall': 'hall',
'supermarket': 'retail',
'warehouse': 'industry',
'residential': 'residential'
}
@staticmethod
def usage(building_function):
"""
Get the usage for the given building function
:param building_function: str
:return: str
"""
return UsFunctionToUsage._building_usage[building_function]

View File

@ -1,243 +0,0 @@
"""
UsPlutoToUsage helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from imports.usage_feeders.helpers.us_function_to_usage import UsFunctionToUsage
class UsPlutoToUsage:
"""
UsPlutoToUsage class
"""
_building_function = {
'A0': 'single family house',
'A1': 'single family house',
'A2': 'single family house',
'A3': 'single family house',
'A4': 'single family house',
'A5': 'single family house',
'A6': 'single family house',
'A7': 'single family house',
'A8': 'single family house',
'A9': 'single family house',
'B1': 'multifamily house',
'B2': 'multifamily house',
'B3': 'multifamily house',
'B9': 'multifamily house',
'C0': 'residential',
'C1': 'residential',
'C2': 'residential',
'C3': 'residential',
'C4': 'residential',
'C5': 'residential',
'C6': 'residential',
'C7': 'residential',
'C8': 'residential',
'C9': 'residential',
'D0': 'residential',
'D1': 'residential',
'D2': 'residential',
'D3': 'residential',
'D4': 'residential',
'D5': 'residential',
'D6': 'residential',
'D7': 'residential',
'D8': 'residential',
'D9': 'residential',
'E1': 'warehouse',
'E3': 'warehouse',
'E4': 'warehouse',
'E5': 'warehouse',
'E7': 'warehouse',
'E9': 'warehouse',
'F1': 'warehouse',
'F2': 'warehouse',
'F4': 'warehouse',
'F5': 'warehouse',
'F8': 'warehouse',
'F9': 'warehouse',
'G0': 'office',
'G1': 'office',
'G2': 'office',
'G3': 'office',
'G4': 'office',
'G5': 'office',
'G6': 'office',
'G7': 'office',
'G8': 'office',
'G9': 'office',
'H1': 'hotel',
'H2': 'hotel',
'H3': 'hotel',
'H4': 'hotel',
'H5': 'hotel',
'H6': 'hotel',
'H7': 'hotel',
'H8': 'hotel',
'H9': 'hotel',
'HB': 'hotel',
'HH': 'hotel',
'HR': 'hotel',
'HS': 'hotel',
'I1': 'hospital',
'I2': 'outpatient',
'I3': 'outpatient',
'I4': 'residential',
'I5': 'outpatient',
'I6': 'outpatient',
'I7': 'outpatient',
'I9': 'outpatient',
'J1': 'large office',
'J2': 'large office',
'J3': 'large office',
'J4': 'large office',
'J5': 'large office',
'J6': 'large office',
'J7': 'large office',
'J8': 'large office',
'J9': 'large office',
'K1': 'strip mall',
'K2': 'strip mall',
'K3': 'strip mall',
'K4': 'residential',
'K5': 'restaurant',
'K6': 'commercial',
'K7': 'commercial',
'K8': 'commercial',
'K9': 'commercial',
'L1': 'residential',
'L2': 'residential',
'L3': 'residential',
'L8': 'residential',
'L9': 'residential',
'M1': 'large office',
'M2': 'large office',
'M3': 'large office',
'M4': 'large office',
'M9': 'large office',
'N1': 'residential',
'N2': 'residential',
'N3': 'residential',
'N4': 'residential',
'N9': 'residential',
'O1': 'office',
'O2': 'office',
'O3': 'office',
'O4': 'office',
'O5': 'office',
'O6': 'office',
'O7': 'office',
'O8': 'office',
'O9': 'office',
'P1': 'large office',
'P2': 'hotel',
'P3': 'office',
'P4': 'office',
'P5': 'office',
'P6': 'office',
'P7': 'large office',
'P8': 'large office',
'P9': 'office',
'Q0': 'office',
'Q1': 'office',
'Q2': 'office',
'Q3': 'office',
'Q4': 'office',
'Q5': 'office',
'Q6': 'office',
'Q7': 'office',
'Q8': 'office',
'Q9': 'office',
'R0': 'residential',
'R1': 'residential',
'R2': 'residential',
'R3': 'residential',
'R4': 'residential',
'R5': 'residential',
'R6': 'residential',
'R7': 'residential',
'R8': 'residential',
'R9': 'residential',
'RA': 'residential',
'RB': 'residential',
'RC': 'residential',
'RD': 'residential',
'RG': 'residential',
'RH': 'residential',
'RI': 'residential',
'RK': 'residential',
'RM': 'residential',
'RR': 'residential',
'RS': 'residential',
'RW': 'residential',
'RX': 'residential',
'RZ': 'residential',
'S0': 'residential',
'S1': 'residential',
'S2': 'residential',
'S3': 'residential',
'S4': 'residential',
'S5': 'residential',
'S9': 'residential',
'T1': 'na',
'T2': 'na',
'T9': 'na',
'U0': 'warehouse',
'U1': 'warehouse',
'U2': 'warehouse',
'U3': 'warehouse',
'U4': 'warehouse',
'U5': 'warehouse',
'U6': 'warehouse',
'U7': 'warehouse',
'U8': 'warehouse',
'U9': 'warehouse',
'V0': 'na',
'V1': 'na',
'V2': 'na',
'V3': 'na',
'V4': 'na',
'V5': 'na',
'V6': 'na',
'V7': 'na',
'V8': 'na',
'V9': 'na',
'W1': 'primary school',
'W2': 'primary school',
'W3': 'secondary school',
'W4': 'secondary school',
'W5': 'secondary school',
'W6': 'secondary school',
'W7': 'secondary school',
'W8': 'primary school',
'W9': 'secondary school',
'Y1': 'large office',
'Y2': 'large office',
'Y3': 'large office',
'Y4': 'large office',
'Y5': 'large office',
'Y6': 'large office',
'Y7': 'large office',
'Y8': 'large office',
'Y9': 'large office',
'Z0': 'na',
'Z1': 'large office',
'Z2': 'na',
'Z3': 'na',
'Z4': 'na',
'Z5': 'na',
'Z6': 'na',
'Z7': 'na',
'Z8': 'na',
'Z9': 'na'
}
@staticmethod
def usage(building_pluto_function):
"""
Get the nrel usage for the given building pluto function
:param building_pluto_function: str
:return: str
"""
return UsFunctionToUsage.usage(UsPlutoToUsage._building_function[building_pluto_function])

View File

@ -0,0 +1,34 @@
"""
Usage helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import sys
class UsageHelper:
usage_to_hft = {
'residential': 'residential',
'industry': 'industry',
'office and administration': 'office and administration',
'hotel': 'hotel',
'health care': 'health care',
'retail': 'retail',
'hall': 'hall',
'restaurant': 'restaurant',
'education': 'education'
}
hft_default_value = 'residential'
@staticmethod
def hft_from_usage(usage):
"""
Get HfT usage from the given internal usage key
:param usage: str
:return: str
"""
try:
return UsageHelper.usage_to_hft[usage]
except KeyError:
sys.stderr.write('Error: keyword not found. Returned default HfT usage "residential"\n')
return UsageHelper.hft_default_value

View File

@ -30,9 +30,9 @@ class HftUsageInterface:
@staticmethod
def _parse_zone_usage_type(usage, zone_usage_type):
occupancy_density = zone_usage_type['occupancy']['occupancyDensity']
hours_day = zone_usage_type['occupancy']['usageHoursPerDay']
days_year = zone_usage_type['occupancy']['usageDaysPerYear']
occupancy_density = zone_usage_type['schedules']['occupancyDensity']
hours_day = zone_usage_type['schedules']['usageHoursPerDay']
days_year = zone_usage_type['schedules']['usageDaysPerYear']
cooling_setpoint = zone_usage_type['endUses']['space_cooling']['coolingSetPointTemperature']
heating_setpoint = zone_usage_type['endUses']['space_heating']['heatingSetPointTemperature']
heating_setback = zone_usage_type['endUses']['space_heating']['heatingSetBackTemperature']
@ -53,14 +53,14 @@ class HftUsageInterface:
electrical_app_average_consumption_sqm_year = \
float(zone_usage_type['endUses']['all_electrical_appliances']['averageConsumptionPerSqmAndYear'])/3.6
# todo: for internal_gain in usage_zone_variant['occupancy']['internGains']:????????????????
# todo: for internal_gain in usage_zone_variant['schedules']['internGains']:????????????????
# There are no more internal gains? How is it saved when more than one???
internal_gains = []
if 'internGains' in zone_usage_type['occupancy']:
latent_fraction = zone_usage_type['occupancy']['internGains']['latentFraction']
convective_fraction = zone_usage_type['occupancy']['internGains']['convectiveFraction']
average_internal_gain = zone_usage_type['occupancy']['internGains']['averageInternGainPerSqm']
radiative_fraction = zone_usage_type['occupancy']['internGains']['radiantFraction']
if 'internGains' in zone_usage_type['schedules']:
latent_fraction = zone_usage_type['schedules']['internGains']['latentFraction']
convective_fraction = zone_usage_type['schedules']['internGains']['convectiveFraction']
average_internal_gain = zone_usage_type['schedules']['internGains']['averageInternGainPerSqm']
radiative_fraction = zone_usage_type['schedules']['internGains']['radiantFraction']
else:
latent_fraction = 0
convective_fraction = 0
@ -91,7 +91,7 @@ class HftUsageInterface:
dhw_preparation_temperature = usage_zone.dhw_preparation_temperature
electrical_app_average_consumption_sqm_year = usage_zone.electrical_app_average_consumption_sqm_year
# todo: for internal_gain in usage_zone_variant['occupancy']['internGains']:????????????????
# todo: for internal_gain in usage_zone_variant['schedules']['internGains']:????????????????
# There are no more internal gains? How is it saved when more than one???
# for internal_gain in usage_zone.internal_gains:
internal_gains = usage_zone.internal_gains[0]
@ -100,10 +100,10 @@ class HftUsageInterface:
average_internal_gain = internal_gains.average_internal_gain
radiative_fraction = internal_gains.radiative_fraction
if 'usageHoursPerDay' in usage_zone_variant['occupancy']:
hours_day = usage_zone_variant['occupancy']['usageHoursPerDay']
if 'usageDaysPerYear' in usage_zone_variant['occupancy']:
days_year = usage_zone_variant['occupancy']['usageDaysPerYear']
if 'usageHoursPerDay' in usage_zone_variant['schedules']:
hours_day = usage_zone_variant['schedules']['usageHoursPerDay']
if 'usageDaysPerYear' in usage_zone_variant['schedules']:
days_year = usage_zone_variant['schedules']['usageDaysPerYear']
if 'space_cooling' in usage_zone_variant['endUses'] and usage_zone_variant['endUses']['space_cooling'] is not None:
if 'coolingSetPointTemperature' in usage_zone_variant['endUses']['space_cooling']:
cooling_setpoint = usage_zone_variant['endUses']['space_cooling']['coolingSetPointTemperature']
@ -115,18 +115,18 @@ class HftUsageInterface:
if 'ventilation' in usage_zone_variant['endUses'] and usage_zone_variant['endUses']['ventilation'] is not None:
if 'mechanicalAirChangeRate' in usage_zone_variant['endUses']['ventilation']:
mechanical_air_change = usage_zone_variant['endUses']['ventilation']['mechanicalAirChangeRate']
# todo: for internal_gain in usage_zone_variant['occupancy']['internGains']:????????????????
# todo: for internal_gain in usage_zone_variant['schedules']['internGains']:????????????????
# There are no more internal gains? How is it saved when more than one???
if 'internalGains' in usage_zone_variant['occupancy'] and usage_zone_variant['occupancy']['internGains'] is not None:
if 'internalGains' in usage_zone_variant['schedules'] and usage_zone_variant['schedules']['internGains'] is not None:
internal_gains = []
if 'latentFraction' in usage_zone_variant['occupancy']['internGains']:
latent_fraction = usage_zone_variant['occupancy']['internGains']['latentFraction']
if 'convectiveFraction' in usage_zone_variant['occupancy']['internGains']:
convective_fraction = usage_zone_variant['occupancy']['internGains']['convectiveFraction']
if 'averageInternGainPerSqm' in usage_zone_variant['occupancy']['internGains']:
average_internal_gain = usage_zone_variant['occupancy']['internGains']['averageInternGainPerSqm']
if 'radiantFraction' in usage_zone_variant['occupancy']['internGains']:
radiative_fraction = usage_zone_variant['occupancy']['internGains']['radiantFraction']
if 'latentFraction' in usage_zone_variant['schedules']['internGains']:
latent_fraction = usage_zone_variant['schedules']['internGains']['latentFraction']
if 'convectiveFraction' in usage_zone_variant['schedules']['internGains']:
convective_fraction = usage_zone_variant['schedules']['internGains']['convectiveFraction']
if 'averageInternGainPerSqm' in usage_zone_variant['schedules']['internGains']:
average_internal_gain = usage_zone_variant['schedules']['internGains']['averageInternGainPerSqm']
if 'radiantFraction' in usage_zone_variant['schedules']['internGains']:
radiative_fraction = usage_zone_variant['schedules']['internGains']['radiantFraction']
internal_gains.append(higa(average_internal_gain, convective_fraction, radiative_fraction, latent_fraction))
usage_zone_archetype = huza(usage=usage, internal_gains=internal_gains, heating_set_point=heating_setpoint,
heating_set_back=heating_setback, cooling_set_point=cooling_setpoint,

View File

@ -6,7 +6,7 @@ Contributors Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
import sys
from imports.usage_feeders.helpers.us_pluto_to_usage import UsPlutoToUsage as pu
from imports.geometry_feeders.helpers.geometry_helper import GeometryHelper as gh
from imports.usage_feeders.hft_usage_interface import HftUsageInterface
from city_model_structure.attributes.usage_zone import UsageZone
@ -26,10 +26,11 @@ class UsNewYorkCityUsageParameters(HftUsageInterface):
"""
city = self._city
for building in city.buildings:
archetype = self._search_archetype(pu.usage(building.function))
archetype = self._search_archetype(gh.fuction_to_usage(building.function))
if archetype is None:
sys.stderr.write(f'Building {building.name} has unknown archetype for building function:'
f' {building.function}, that assigns building usage as {pu.usage(building.function)}\n')
f' {building.function}, that assigns building usage as '
f'{gh.fuction_to_usage(building.function)}\n')
continue
# todo: what to do with mix-usage usages from gml?
mix_usage = False

View File

@ -5,7 +5,7 @@ Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
import sys
from imports.usage_feeders.helpers.us_function_to_usage import UsFunctionToUsage as fu
from imports.geometry_feeders.helpers.geometry_helper import GeometryHelper as gh
from imports.usage_feeders.hft_usage_interface import HftUsageInterface
from city_model_structure.attributes.usage_zone import UsageZone
@ -25,10 +25,11 @@ class UsUsageParameters(HftUsageInterface):
"""
city = self._city
for building in city.buildings:
archetype = self._search_archetype(fu.usage(building.function))
archetype = self._search_archetype(gh.fuction_to_usage(building.function))
if archetype is None:
sys.stderr.write(f'Building {building.name} has unknown archetype for building function:'
f' {building.function}, that assigns building usage as {fu.usage(building.function)}\n')
f' {building.function}, that assigns building usage as '
f'{gh.fuction_to_usage(building.function)}\n')
continue
# todo: what to do with mix-usage usages from gml?
mix_usage = False

View File

@ -1,5 +1,5 @@
"""
TestPhysicsFactory test and validate the city model structure physics parameters
TestConstructionFactory test and validate the city model structure construction parameters
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
@ -7,12 +7,12 @@ from pathlib import Path
from unittest import TestCase
from imports.geometry_factory import GeometryFactory
from imports.physics_factory import PhysicsFactory
from imports.construction_factory import ConstructionFactory
class TestPhysicsFactory(TestCase):
class TestConstructionFactory(TestCase):
"""
TestPhysicsFactory TestCase
TestConstructionFactory TestCase
"""
def setUp(self) -> None:
"""
@ -41,7 +41,7 @@ class TestPhysicsFactory(TestCase):
for opening in tb.thermal_openings:
opening.hi = 10
opening.he = 25
PhysicsFactory('us_new_york', self._nyc_with_physics).enrich()
ConstructionFactory('us_new_york', self._nyc_with_physics).enrich()
return self._nyc_with_physics
def test_city_with_physics_extended_library(self):
@ -69,7 +69,7 @@ class TestPhysicsFactory(TestCase):
def test_reduced_library(self):
file_path = (self._example_path / 'lod2_buildings.gml').resolve()
city = self._get_citygml(file_path)
PhysicsFactory('ca', city).enrich()
ConstructionFactory('ca', city).enrich()
for building in city.buildings:
self.assertIsNotNone(building.average_storey_height, 'average_storey_height is none')
self.assertIsNotNone(building.storeys_above_ground, 'storeys_above_ground is none')

View File

@ -9,7 +9,7 @@ from pathlib import Path
from unittest import TestCase
import pandas as pd
from imports.geometry_factory import GeometryFactory
from imports.physics_factory import PhysicsFactory
from imports.construction_factory import ConstructionFactory
from imports.schedules_factory import SchedulesFactory
from imports.usage_factory import UsageFactory
from exports.exports_factory import ExportsFactory
@ -33,7 +33,7 @@ class TestExports(TestCase):
if self._city_gml is None:
file_path = (self._example_path / 'one_building_in_kelowna.gml').resolve()
self._city_gml = GeometryFactory('citygml', file_path).city
PhysicsFactory('ca', self._city_gml).enrich()
ConstructionFactory('ca', self._city_gml).enrich()
UsageFactory('ca', self._city_gml).enrich()
SchedulesFactory('comnet', self._city_gml).enrich()
cli = 'C:\\Users\\Pilar\\PycharmProjects\\monthlyenergybalance\\tests_data\\weather\\inseldb_Summerland.cli'

View File

@ -1,12 +1,12 @@
"""
TestOccupancyFactory test and validate the city model structure occupancy parameters
TestOccupancyFactory test and validate the city model structure schedules parameters
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from pathlib import Path
from unittest import TestCase
from imports.geometry_factory import GeometryFactory
from imports.physics_factory import PhysicsFactory
from imports.construction_factory import ConstructionFactory
from imports.usage_factory import UsageFactory
from imports.schedules_factory import SchedulesFactory
import os
@ -31,7 +31,7 @@ class TestIdf(TestCase):
if self._city_gml is None:
file_path = (self._example_path / '20buildings.gml').resolve()
self._city_gml = GeometryFactory('citygml', file_path).city
PhysicsFactory('us_new_york', self._city_gml)
ConstructionFactory('us_new_york', self._city_gml)
UsageFactory('us_new_york', self._city_gml)
UsageFactory('us_new_york', self._city_gml)
SchedulesFactory('demo', self._city_gml)

View File

@ -55,7 +55,7 @@ class TestUsageFactory(TestCase):
self.assertIsNotNone(usage_zone.dhw_average_volume_pers_day, 'usage is none')
self.assertIsNotNone(usage_zone.dhw_preparation_temperature, 'usage is none')
self.assertIsNotNone(usage_zone.electrical_app_average_consumption_sqm_year, 'usage is none')
# todo: missing occupancy, schedules and heating schedule
# todo: missing schedules, schedules and heating schedule
def test_hft_interface(self):
file_path = (self._example_path / 'lod2_buildings.gml').resolve()