meb_debugging #8
|
@ -0,0 +1,45 @@
|
||||||
|
"""
|
||||||
|
Usage catalog domestic hot water
|
||||||
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||||
|
Copyright © 2023 Concordia CERC group
|
||||||
|
Project Coder Pilar Monsalvete Álvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||||
|
"""
|
||||||
|
|
||||||
|
from typing import Union, List
|
||||||
|
|
||||||
|
from hub.catalog_factories.data_models.usages.schedule import Schedule
|
||||||
|
|
||||||
|
|
||||||
|
class DomesticHotWater:
|
||||||
|
"""
|
||||||
|
DomesticHotWater class
|
||||||
|
"""
|
||||||
|
def __init__(self, density, service_temperature, schedules):
|
||||||
|
self._density = density
|
||||||
|
self._service_temperature = service_temperature
|
||||||
|
self._schedules = schedules
|
||||||
|
|
||||||
|
@property
|
||||||
|
def density(self) -> Union[None, float]:
|
||||||
|
"""
|
||||||
|
Get domestic hot water load density in Watts per m2
|
||||||
|
:return: None or float
|
||||||
|
"""
|
||||||
|
return self._density
|
||||||
|
|
||||||
|
@property
|
||||||
|
def service_temperature(self) -> Union[None, float]:
|
||||||
|
"""
|
||||||
|
Get service temperature in degrees Celsius
|
||||||
|
:return: None or float
|
||||||
|
"""
|
||||||
|
return self._service_temperature
|
||||||
|
|
||||||
|
@property
|
||||||
|
def schedules(self) -> Union[None, List[Schedule]]:
|
||||||
|
"""
|
||||||
|
Get schedules
|
||||||
|
dataType = fraction of loads
|
||||||
|
:return: None or [Schedule]
|
||||||
|
"""
|
||||||
|
return self._schedules
|
|
@ -10,6 +10,7 @@ from hub.catalog_factories.data_models.usages.appliances import Appliances
|
||||||
from hub.catalog_factories.data_models.usages.lighting import Lighting
|
from hub.catalog_factories.data_models.usages.lighting import Lighting
|
||||||
from hub.catalog_factories.data_models.usages.ocupancy import Occupancy
|
from hub.catalog_factories.data_models.usages.ocupancy import Occupancy
|
||||||
from hub.catalog_factories.data_models.usages.thermal_control import ThermalControl
|
from hub.catalog_factories.data_models.usages.thermal_control import ThermalControl
|
||||||
|
from hub.catalog_factories.data_models.usages.domestic_hot_water import DomesticHotWater
|
||||||
|
|
||||||
|
|
||||||
class Usage:
|
class Usage:
|
||||||
|
@ -21,7 +22,8 @@ class Usage:
|
||||||
occupancy,
|
occupancy,
|
||||||
lighting,
|
lighting,
|
||||||
appliances,
|
appliances,
|
||||||
thermal_control):
|
thermal_control,
|
||||||
|
domestic_hot_water):
|
||||||
self._name = name
|
self._name = name
|
||||||
self._hours_day = hours_day
|
self._hours_day = hours_day
|
||||||
self._days_year = days_year
|
self._days_year = days_year
|
||||||
|
@ -32,6 +34,7 @@ class Usage:
|
||||||
self._lighting = lighting
|
self._lighting = lighting
|
||||||
self._appliances = appliances
|
self._appliances = appliances
|
||||||
self._thermal_control = thermal_control
|
self._thermal_control = thermal_control
|
||||||
|
self._domestic_hot_water = domestic_hot_water
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def name(self) -> Union[None, str]:
|
def name(self) -> Union[None, str]:
|
||||||
|
@ -108,7 +111,15 @@ class Usage:
|
||||||
@property
|
@property
|
||||||
def thermal_control(self) -> Union[None, ThermalControl]:
|
def thermal_control(self) -> Union[None, ThermalControl]:
|
||||||
"""
|
"""
|
||||||
Get thermal control of this thermal zone
|
Get thermal control information
|
||||||
:return: None or ThermalControl
|
:return: None or ThermalControl
|
||||||
"""
|
"""
|
||||||
return self._thermal_control
|
return self._thermal_control
|
||||||
|
|
||||||
|
@property
|
||||||
|
def domestic_hot_water(self) -> Union[None, DomesticHotWater]:
|
||||||
|
"""
|
||||||
|
Get domestic hot water information
|
||||||
|
:return: None or DomesticHotWater
|
||||||
|
"""
|
||||||
|
return self._domestic_hot_water
|
||||||
|
|
189
hub/catalog_factories/energy_systems/nrcan_catalog.py
Normal file
189
hub/catalog_factories/energy_systems/nrcan_catalog.py
Normal file
|
@ -0,0 +1,189 @@
|
||||||
|
"""
|
||||||
|
NRCAN energy systems catalog
|
||||||
|
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 json
|
||||||
|
import urllib.request
|
||||||
|
import xmltodict
|
||||||
|
|
||||||
|
import hub.helpers.constants as cte
|
||||||
|
from hub.catalog_factories.catalog import Catalog
|
||||||
|
from hub.catalog_factories.data_models.usages.appliances import Appliances
|
||||||
|
from hub.catalog_factories.data_models.usages.content import Content
|
||||||
|
from hub.catalog_factories.data_models.usages.lighting import Lighting
|
||||||
|
from hub.catalog_factories.data_models.usages.ocupancy import Occupancy
|
||||||
|
from hub.catalog_factories.data_models.usages.schedule import Schedule
|
||||||
|
from hub.catalog_factories.data_models.usages.thermal_control import ThermalControl
|
||||||
|
from hub.catalog_factories.data_models.usages.usage import Usage
|
||||||
|
from hub.catalog_factories.usage.usage_helper import UsageHelper
|
||||||
|
|
||||||
|
|
||||||
|
class NrcanCatalog(Catalog):
|
||||||
|
def __init__(self, path):
|
||||||
|
path = str(path / 'nrcan.xml')
|
||||||
|
self._content = None
|
||||||
|
self._schedules = {}
|
||||||
|
with open(path) as xml:
|
||||||
|
self._metadata = xmltodict.parse(xml.read())
|
||||||
|
self._base_url = self._metadata['nrcan']['@base_url']
|
||||||
|
self._load_schedules()
|
||||||
|
self._content = Content(self._load_archetypes())
|
||||||
|
|
||||||
|
def _load_archetypes(self):
|
||||||
|
usages = []
|
||||||
|
name = self._metadata['nrcan']
|
||||||
|
url = f'{self._base_url}{name["space_types_location"]}'
|
||||||
|
with urllib.request.urlopen(url) as json_file:
|
||||||
|
space_types = json.load(json_file)['tables']['space_types']['table']
|
||||||
|
# space_types = [st for st in space_types if st['building_type'] == 'Space Function']
|
||||||
|
space_types = [st for st in space_types if st['space_type'] == 'WholeBuilding']
|
||||||
|
for space_type in space_types:
|
||||||
|
# usage_type = space_type['space_type']
|
||||||
|
usage_type = space_type['building_type']
|
||||||
|
occupancy_schedule_name = space_type['occupancy_schedule']
|
||||||
|
lighting_schedule_name = space_type['lighting_schedule']
|
||||||
|
appliance_schedule_name = space_type['electric_equipment_schedule']
|
||||||
|
hvac_schedule_name = space_type['exhaust_schedule']
|
||||||
|
if 'FAN' in hvac_schedule_name:
|
||||||
|
hvac_schedule_name = hvac_schedule_name.replace('FAN', 'Fan')
|
||||||
|
heating_setpoint_schedule_name = space_type['heating_setpoint_schedule']
|
||||||
|
cooling_setpoint_schedule_name = space_type['cooling_setpoint_schedule']
|
||||||
|
occupancy_schedule = self._get_schedules(occupancy_schedule_name)
|
||||||
|
lighting_schedule = self._get_schedules(lighting_schedule_name)
|
||||||
|
appliance_schedule = self._get_schedules(appliance_schedule_name)
|
||||||
|
heating_schedule = self._get_schedules(heating_setpoint_schedule_name)
|
||||||
|
cooling_schedule = self._get_schedules(cooling_setpoint_schedule_name)
|
||||||
|
hvac_availability = self._get_schedules(hvac_schedule_name)
|
||||||
|
|
||||||
|
occupancy_density = space_type['occupancy_per_area']
|
||||||
|
|
||||||
|
# ACH
|
||||||
|
mechanical_air_change = space_type['ventilation_air_changes']
|
||||||
|
# cfm/ft2 to m3/m2.s
|
||||||
|
ventilation_rate = space_type['ventilation_per_area'] / (cte.METERS_TO_FEET * cte.MINUTES_TO_SECONDS)
|
||||||
|
if ventilation_rate == 0:
|
||||||
|
# cfm/person to m3/m2.s
|
||||||
|
ventilation_rate = space_type['ventilation_per_person'] / occupancy_density\
|
||||||
|
/ (cte.METERS_TO_FEET * cte.MINUTES_TO_SECONDS)
|
||||||
|
|
||||||
|
# W/sqft to W/m2
|
||||||
|
lighting_density = space_type['lighting_per_area'] * cte.METERS_TO_FEET * cte.METERS_TO_FEET
|
||||||
|
lighting_radiative_fraction = space_type['lighting_fraction_radiant']
|
||||||
|
lighting_convective_fraction = 0
|
||||||
|
if lighting_radiative_fraction is not None:
|
||||||
|
lighting_convective_fraction = 1 - lighting_radiative_fraction
|
||||||
|
lighting_latent_fraction = 0
|
||||||
|
# W/sqft to W/m2
|
||||||
|
appliances_density = space_type['electric_equipment_per_area'] * cte.METERS_TO_FEET * cte.METERS_TO_FEET
|
||||||
|
appliances_radiative_fraction = space_type['electric_equipment_fraction_radiant']
|
||||||
|
appliances_latent_fraction = space_type['electric_equipment_fraction_latent']
|
||||||
|
appliances_convective_fraction = 0
|
||||||
|
if appliances_radiative_fraction is not None and appliances_latent_fraction is not None:
|
||||||
|
appliances_convective_fraction = 1 - appliances_radiative_fraction - appliances_latent_fraction
|
||||||
|
|
||||||
|
occupancy = Occupancy(occupancy_density,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
occupancy_schedule)
|
||||||
|
lighting = Lighting(lighting_density,
|
||||||
|
lighting_convective_fraction,
|
||||||
|
lighting_radiative_fraction,
|
||||||
|
lighting_latent_fraction,
|
||||||
|
lighting_schedule)
|
||||||
|
appliances = Appliances(appliances_density,
|
||||||
|
appliances_convective_fraction,
|
||||||
|
appliances_radiative_fraction,
|
||||||
|
appliances_latent_fraction,
|
||||||
|
appliance_schedule)
|
||||||
|
thermal_control = ThermalControl(None,
|
||||||
|
None,
|
||||||
|
None,
|
||||||
|
hvac_availability,
|
||||||
|
heating_schedule,
|
||||||
|
cooling_schedule)
|
||||||
|
hours_day = None
|
||||||
|
days_year = None
|
||||||
|
usages.append(Usage(usage_type,
|
||||||
|
hours_day,
|
||||||
|
days_year,
|
||||||
|
mechanical_air_change,
|
||||||
|
ventilation_rate,
|
||||||
|
occupancy,
|
||||||
|
lighting,
|
||||||
|
appliances,
|
||||||
|
thermal_control))
|
||||||
|
return usages
|
||||||
|
|
||||||
|
def names(self, category=None):
|
||||||
|
"""
|
||||||
|
Get the catalog elements names
|
||||||
|
:parm: optional category filter
|
||||||
|
"""
|
||||||
|
if category is None:
|
||||||
|
_names = {'archetypes': [], 'constructions': [], 'materials': [], 'windows': []}
|
||||||
|
for archetype in self._content.archetypes:
|
||||||
|
_names['archetypes'].append(archetype.name)
|
||||||
|
for construction in self._content.constructions:
|
||||||
|
_names['constructions'].append(construction.name)
|
||||||
|
for material in self._content.materials:
|
||||||
|
_names['materials'].append(material.name)
|
||||||
|
for window in self._content.windows:
|
||||||
|
_names['windows'].append(window.name)
|
||||||
|
else:
|
||||||
|
_names = {category: []}
|
||||||
|
if category.lower() == 'archetypes':
|
||||||
|
for archetype in self._content.archetypes:
|
||||||
|
_names[category].append(archetype.name)
|
||||||
|
elif category.lower() == 'constructions':
|
||||||
|
for construction in self._content.constructions:
|
||||||
|
_names[category].append(construction.name)
|
||||||
|
elif category.lower() == 'materials':
|
||||||
|
for material in self._content.materials:
|
||||||
|
_names[category].append(material.name)
|
||||||
|
elif category.lower() == 'windows':
|
||||||
|
for window in self._content.windows:
|
||||||
|
_names[category].append(window.name)
|
||||||
|
else:
|
||||||
|
raise ValueError(f'Unknown category [{category}]')
|
||||||
|
|
||||||
|
def entries(self, category=None):
|
||||||
|
"""
|
||||||
|
Get the catalog elements
|
||||||
|
:parm: optional category filter
|
||||||
|
"""
|
||||||
|
if category is None:
|
||||||
|
return self._content
|
||||||
|
else:
|
||||||
|
if category.lower() == 'archetypes':
|
||||||
|
return self._content.archetypes
|
||||||
|
elif category.lower() == 'constructions':
|
||||||
|
return self._content.constructions
|
||||||
|
elif category.lower() == 'materials':
|
||||||
|
return self._content.materials
|
||||||
|
elif category.lower() == 'windows':
|
||||||
|
return self._content.windows
|
||||||
|
else:
|
||||||
|
raise ValueError(f'Unknown category [{category}]')
|
||||||
|
|
||||||
|
def get_entry(self, name):
|
||||||
|
"""
|
||||||
|
Get one catalog element by names
|
||||||
|
:parm: entry name
|
||||||
|
"""
|
||||||
|
for entry in self._content.archetypes:
|
||||||
|
if entry.name.lower() == name.lower():
|
||||||
|
return entry
|
||||||
|
for entry in self._content.constructions:
|
||||||
|
if entry.name.lower() == name.lower():
|
||||||
|
return entry
|
||||||
|
for entry in self._content.materials:
|
||||||
|
if entry.name.lower() == name.lower():
|
||||||
|
return entry
|
||||||
|
for entry in self._content.windows:
|
||||||
|
if entry.name.lower() == name.lower():
|
||||||
|
return entry
|
||||||
|
raise IndexError(f"{name} doesn't exists in the catalog")
|
42
hub/catalog_factories/energy_systems_catalog_factory.py
Normal file
42
hub/catalog_factories/energy_systems_catalog_factory.py
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
"""
|
||||||
|
Usage catalog factory, publish the usage information
|
||||||
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||||
|
Copyright © 2022 Concordia CERC group
|
||||||
|
Project Coder Pilar Monsalvete Álvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||||
|
"""
|
||||||
|
|
||||||
|
from pathlib import Path
|
||||||
|
from typing import TypeVar
|
||||||
|
from hub.catalog_factories.energy_systems.nrcan_catalog import NrcanCatalog
|
||||||
|
from hub.hub_logger import logger
|
||||||
|
from hub.helpers.utils import validate_import_export_type
|
||||||
|
Catalog = TypeVar('Catalog')
|
||||||
|
|
||||||
|
|
||||||
|
class UsageCatalogFactory:
|
||||||
|
def __init__(self, file_type, base_path=None):
|
||||||
|
if base_path is None:
|
||||||
|
base_path = Path(Path(__file__).parent.parent / 'data/energy_systems')
|
||||||
|
self._catalog_type = '_' + file_type.lower()
|
||||||
|
class_funcs = validate_import_export_type(UsageCatalogFactory)
|
||||||
|
if self._catalog_type not in class_funcs:
|
||||||
|
err_msg = f"Wrong import type. Valid functions include {class_funcs}"
|
||||||
|
logger.error(err_msg)
|
||||||
|
raise Exception(err_msg)
|
||||||
|
self._path = base_path
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _nrcan(self):
|
||||||
|
"""
|
||||||
|
Retrieve NRCAN catalog
|
||||||
|
"""
|
||||||
|
# nrcan retrieves the data directly from github
|
||||||
|
return NrcanCatalog(self._path)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def catalog(self) -> Catalog:
|
||||||
|
"""
|
||||||
|
Enrich the city given to the class using the class given handler
|
||||||
|
:return: Catalog
|
||||||
|
"""
|
||||||
|
return getattr(self, self._catalog_type, lambda: None)
|
|
@ -14,6 +14,7 @@ from hub.catalog_factories.data_models.usages.appliances import Appliances
|
||||||
from hub.catalog_factories.data_models.usages.content import Content
|
from hub.catalog_factories.data_models.usages.content import Content
|
||||||
from hub.catalog_factories.data_models.usages.lighting import Lighting
|
from hub.catalog_factories.data_models.usages.lighting import Lighting
|
||||||
from hub.catalog_factories.data_models.usages.ocupancy import Occupancy
|
from hub.catalog_factories.data_models.usages.ocupancy import Occupancy
|
||||||
|
from hub.catalog_factories.data_models.usages.domestic_hot_water import DomesticHotWater
|
||||||
from hub.catalog_factories.data_models.usages.schedule import Schedule
|
from hub.catalog_factories.data_models.usages.schedule import Schedule
|
||||||
from hub.catalog_factories.data_models.usages.thermal_control import ThermalControl
|
from hub.catalog_factories.data_models.usages.thermal_control import ThermalControl
|
||||||
from hub.catalog_factories.data_models.usages.usage import Usage
|
from hub.catalog_factories.data_models.usages.usage import Usage
|
||||||
|
@ -51,6 +52,7 @@ class ComnetCatalog(Catalog):
|
||||||
ventilation_rate = self._archetypes['ventilation rate'][comnet_usage]
|
ventilation_rate = self._archetypes['ventilation rate'][comnet_usage]
|
||||||
# convert cfm/ft2 to m3/m2.s
|
# convert cfm/ft2 to m3/m2.s
|
||||||
ventilation_rate = ventilation_rate / (cte.METERS_TO_FEET * cte.MINUTES_TO_SECONDS)
|
ventilation_rate = ventilation_rate / (cte.METERS_TO_FEET * cte.MINUTES_TO_SECONDS)
|
||||||
|
domestic_hot_water_archetype = self._archetypes['water heating'][comnet_usage]
|
||||||
|
|
||||||
# get occupancy
|
# get occupancy
|
||||||
occupancy_density = occupancy_archetype[0] / pow(cte.METERS_TO_FEET, 2)
|
occupancy_density = occupancy_archetype[0] / pow(cte.METERS_TO_FEET, 2)
|
||||||
|
@ -96,6 +98,15 @@ class ComnetCatalog(Catalog):
|
||||||
self._schedules[schedule_name]['ClgSetPt']
|
self._schedules[schedule_name]['ClgSetPt']
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# get domestic hot water
|
||||||
|
density = domestic_hot_water_archetype
|
||||||
|
# convert Btu/h/occ to W/m2
|
||||||
|
density = float(density) * cte.BTU_H_TO_WATTS * occupancy_density
|
||||||
|
domestic_hot_water_service_temperature = self._schedules[schedule_name]['WtrHtrSetPt'][0].values[0]
|
||||||
|
domestic_hot_water = DomesticHotWater(density,
|
||||||
|
domestic_hot_water_service_temperature,
|
||||||
|
self._schedules[schedule_name]['Service Hot Water']
|
||||||
|
)
|
||||||
usages.append(Usage(comnet_usage,
|
usages.append(Usage(comnet_usage,
|
||||||
hours_day,
|
hours_day,
|
||||||
days_year,
|
days_year,
|
||||||
|
@ -104,7 +115,8 @@ class ComnetCatalog(Catalog):
|
||||||
occupancy,
|
occupancy,
|
||||||
lighting,
|
lighting,
|
||||||
appliances,
|
appliances,
|
||||||
thermal_control))
|
thermal_control,
|
||||||
|
domestic_hot_water))
|
||||||
|
|
||||||
self._content = Content(usages)
|
self._content = Content(usages)
|
||||||
|
|
||||||
|
@ -136,7 +148,7 @@ class ComnetCatalog(Catalog):
|
||||||
_schedule_values[day] = _extracted_data.iloc[start:end, 3:27].to_numpy().tolist()[0]
|
_schedule_values[day] = _extracted_data.iloc[start:end, 3:27].to_numpy().tolist()[0]
|
||||||
_schedule = []
|
_schedule = []
|
||||||
for day in _schedule_values:
|
for day in _schedule_values:
|
||||||
if schedule_name == 'ClgSetPt' or schedule_name == 'HtgSetPt':
|
if schedule_name == 'ClgSetPt' or schedule_name == 'HtgSetPt' or schedule_name == 'WtrHtrSetPt':
|
||||||
# to celsius
|
# to celsius
|
||||||
if 'n.a.' in _schedule_values[day]:
|
if 'n.a.' in _schedule_values[day]:
|
||||||
_schedule_values[day] = None
|
_schedule_values[day] = None
|
||||||
|
|
|
@ -16,6 +16,7 @@ from hub.catalog_factories.data_models.usages.appliances import Appliances
|
||||||
from hub.catalog_factories.data_models.usages.content import Content
|
from hub.catalog_factories.data_models.usages.content import Content
|
||||||
from hub.catalog_factories.data_models.usages.lighting import Lighting
|
from hub.catalog_factories.data_models.usages.lighting import Lighting
|
||||||
from hub.catalog_factories.data_models.usages.ocupancy import Occupancy
|
from hub.catalog_factories.data_models.usages.ocupancy import Occupancy
|
||||||
|
from hub.catalog_factories.data_models.usages.domestic_hot_water import DomesticHotWater
|
||||||
from hub.catalog_factories.data_models.usages.schedule import Schedule
|
from hub.catalog_factories.data_models.usages.schedule import Schedule
|
||||||
from hub.catalog_factories.data_models.usages.thermal_control import ThermalControl
|
from hub.catalog_factories.data_models.usages.thermal_control import ThermalControl
|
||||||
from hub.catalog_factories.data_models.usages.usage import Usage
|
from hub.catalog_factories.data_models.usages.usage import Usage
|
||||||
|
@ -36,7 +37,7 @@ class NrcanCatalog(Catalog):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _extract_schedule(raw):
|
def _extract_schedule(raw):
|
||||||
nrcan_schedule_type = raw['category']
|
nrcan_schedule_type = raw['category']
|
||||||
if 'Heating' in raw['name']:
|
if 'Heating' in raw['name'] and 'Water' not in raw['name']:
|
||||||
nrcan_schedule_type = f'{nrcan_schedule_type} Heating'
|
nrcan_schedule_type = f'{nrcan_schedule_type} Heating'
|
||||||
elif 'Cooling' in raw['name']:
|
elif 'Cooling' in raw['name']:
|
||||||
nrcan_schedule_type = f'{nrcan_schedule_type} Cooling'
|
nrcan_schedule_type = f'{nrcan_schedule_type} Cooling'
|
||||||
|
@ -45,8 +46,8 @@ class NrcanCatalog(Catalog):
|
||||||
hub_type = UsageHelper().nrcan_schedule_type_to_hub_schedule_type[nrcan_schedule_type]
|
hub_type = UsageHelper().nrcan_schedule_type_to_hub_schedule_type[nrcan_schedule_type]
|
||||||
data_type = UsageHelper().nrcan_data_type_to_hub_data_type[raw['units']]
|
data_type = UsageHelper().nrcan_data_type_to_hub_data_type[raw['units']]
|
||||||
time_step = UsageHelper().nrcan_time_to_hub_time[raw['type']]
|
time_step = UsageHelper().nrcan_time_to_hub_time[raw['type']]
|
||||||
# nrcan only uses yearly range for the schedules
|
# nrcan only uses daily range for the schedules
|
||||||
time_range = cte.YEAR
|
time_range = cte.DAY
|
||||||
day_types = UsageHelper().nrcan_day_type_to_hub_days[raw['day_types']]
|
day_types = UsageHelper().nrcan_day_type_to_hub_days[raw['day_types']]
|
||||||
return Schedule(hub_type, raw['values'], data_type, time_step, time_range, day_types)
|
return Schedule(hub_type, raw['values'], data_type, time_step, time_range, day_types)
|
||||||
|
|
||||||
|
@ -91,12 +92,14 @@ class NrcanCatalog(Catalog):
|
||||||
hvac_schedule_name = hvac_schedule_name.replace('FAN', 'Fan')
|
hvac_schedule_name = hvac_schedule_name.replace('FAN', 'Fan')
|
||||||
heating_setpoint_schedule_name = space_type['heating_setpoint_schedule']
|
heating_setpoint_schedule_name = space_type['heating_setpoint_schedule']
|
||||||
cooling_setpoint_schedule_name = space_type['cooling_setpoint_schedule']
|
cooling_setpoint_schedule_name = space_type['cooling_setpoint_schedule']
|
||||||
|
domestic_hot_water_schedule_name = space_type['service_water_heating_schedule']
|
||||||
occupancy_schedule = self._get_schedules(occupancy_schedule_name)
|
occupancy_schedule = self._get_schedules(occupancy_schedule_name)
|
||||||
lighting_schedule = self._get_schedules(lighting_schedule_name)
|
lighting_schedule = self._get_schedules(lighting_schedule_name)
|
||||||
appliance_schedule = self._get_schedules(appliance_schedule_name)
|
appliance_schedule = self._get_schedules(appliance_schedule_name)
|
||||||
heating_schedule = self._get_schedules(heating_setpoint_schedule_name)
|
heating_schedule = self._get_schedules(heating_setpoint_schedule_name)
|
||||||
cooling_schedule = self._get_schedules(cooling_setpoint_schedule_name)
|
cooling_schedule = self._get_schedules(cooling_setpoint_schedule_name)
|
||||||
hvac_availability = self._get_schedules(hvac_schedule_name)
|
hvac_availability = self._get_schedules(hvac_schedule_name)
|
||||||
|
domestic_hot_water_load_schedule = self._get_schedules(domestic_hot_water_schedule_name)
|
||||||
|
|
||||||
occupancy_density = space_type['occupancy_per_area']
|
occupancy_density = space_type['occupancy_per_area']
|
||||||
|
|
||||||
|
@ -124,6 +127,15 @@ class NrcanCatalog(Catalog):
|
||||||
if appliances_radiative_fraction is not None and appliances_latent_fraction is not None:
|
if appliances_radiative_fraction is not None and appliances_latent_fraction is not None:
|
||||||
appliances_convective_fraction = 1 - appliances_radiative_fraction - appliances_latent_fraction
|
appliances_convective_fraction = 1 - appliances_radiative_fraction - appliances_latent_fraction
|
||||||
|
|
||||||
|
# peak flow in m3/day/m2
|
||||||
|
domestic_hot_water_peak_flow = space_type['service_water_heating_peak_flow_per_area']
|
||||||
|
domestic_hot_water_service_temperature = space_type['service_water_heating_target_temperature']
|
||||||
|
average_domestic_hot_water_inlet_temperature = 16.5
|
||||||
|
# result in W/m2
|
||||||
|
domestic_hot_water_density = domestic_hot_water_peak_flow / 24 / 3.6 * 4184 \
|
||||||
|
* (domestic_hot_water_service_temperature -
|
||||||
|
average_domestic_hot_water_inlet_temperature)
|
||||||
|
|
||||||
occupancy = Occupancy(occupancy_density,
|
occupancy = Occupancy(occupancy_density,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
@ -145,6 +157,10 @@ class NrcanCatalog(Catalog):
|
||||||
hvac_availability,
|
hvac_availability,
|
||||||
heating_schedule,
|
heating_schedule,
|
||||||
cooling_schedule)
|
cooling_schedule)
|
||||||
|
domestic_hot_water = DomesticHotWater(domestic_hot_water_density,
|
||||||
|
domestic_hot_water_service_temperature,
|
||||||
|
domestic_hot_water_load_schedule)
|
||||||
|
|
||||||
hours_day = None
|
hours_day = None
|
||||||
days_year = None
|
days_year = None
|
||||||
usages.append(Usage(usage_type,
|
usages.append(Usage(usage_type,
|
||||||
|
@ -155,7 +171,8 @@ class NrcanCatalog(Catalog):
|
||||||
occupancy,
|
occupancy,
|
||||||
lighting,
|
lighting,
|
||||||
appliances,
|
appliances,
|
||||||
thermal_control))
|
thermal_control,
|
||||||
|
domestic_hot_water))
|
||||||
return usages
|
return usages
|
||||||
|
|
||||||
def names(self, category=None):
|
def names(self, category=None):
|
||||||
|
|
|
@ -19,7 +19,8 @@ class UsageHelper:
|
||||||
'Equipment': cte.APPLIANCES,
|
'Equipment': cte.APPLIANCES,
|
||||||
'Thermostat Setpoint Cooling': cte.COOLING_SET_POINT, # Compose 'Thermostat Setpoint' + 'Cooling'
|
'Thermostat Setpoint Cooling': cte.COOLING_SET_POINT, # Compose 'Thermostat Setpoint' + 'Cooling'
|
||||||
'Thermostat Setpoint Heating': cte.HEATING_SET_POINT, # Compose 'Thermostat Setpoint' + 'Heating'
|
'Thermostat Setpoint Heating': cte.HEATING_SET_POINT, # Compose 'Thermostat Setpoint' + 'Heating'
|
||||||
'Fan': cte.HVAC_AVAILABILITY
|
'Fan': cte.HVAC_AVAILABILITY,
|
||||||
|
'Service Water Heating': cte.DOMESTIC_HOT_WATER
|
||||||
}
|
}
|
||||||
_nrcan_data_type_to_hub_data_type = {
|
_nrcan_data_type_to_hub_data_type = {
|
||||||
'FRACTION': cte.FRACTION,
|
'FRACTION': cte.FRACTION,
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
"""
|
||||||
|
Domestic Hot Water module
|
||||||
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||||
|
Copyright © 2023 Concordia CERC group
|
||||||
|
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||||
|
"""
|
||||||
|
from typing import Union, List
|
||||||
|
from hub.city_model_structure.attributes.schedule import Schedule
|
||||||
|
|
||||||
|
|
||||||
|
class DomesticHotWater:
|
||||||
|
"""
|
||||||
|
DomesticHotWater class
|
||||||
|
"""
|
||||||
|
def __init__(self):
|
||||||
|
self._density = None
|
||||||
|
self._service_temperature = None
|
||||||
|
self._schedules = None
|
||||||
|
|
||||||
|
@property
|
||||||
|
def density(self) -> Union[None, float]:
|
||||||
|
"""
|
||||||
|
Get domestic hot water load density in Watts per m2
|
||||||
|
:return: None or float
|
||||||
|
"""
|
||||||
|
return self._density
|
||||||
|
|
||||||
|
@density.setter
|
||||||
|
def density(self, value):
|
||||||
|
"""
|
||||||
|
Set domestic hot water load density in Watts per m2
|
||||||
|
:param value: float
|
||||||
|
"""
|
||||||
|
if value is not None:
|
||||||
|
self._density = float(value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def service_temperature(self) -> Union[None, float]:
|
||||||
|
"""
|
||||||
|
Get service temperature in degrees Celsius
|
||||||
|
:return: None or float
|
||||||
|
"""
|
||||||
|
return self._service_temperature
|
||||||
|
|
||||||
|
@service_temperature.setter
|
||||||
|
def service_temperature(self, value):
|
||||||
|
"""
|
||||||
|
Set service temperature in degrees Celsius
|
||||||
|
:param value: float
|
||||||
|
"""
|
||||||
|
if value is not None:
|
||||||
|
self._service_temperature = float(value)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def schedules(self) -> Union[None, List[Schedule]]:
|
||||||
|
"""
|
||||||
|
Get schedules
|
||||||
|
dataType = fraction
|
||||||
|
:return: None or [Schedule]
|
||||||
|
"""
|
||||||
|
return self._schedules
|
||||||
|
|
||||||
|
@schedules.setter
|
||||||
|
def schedules(self, value):
|
||||||
|
"""
|
||||||
|
Set schedules
|
||||||
|
dataType = fraction
|
||||||
|
:param value: [Schedule]
|
||||||
|
"""
|
||||||
|
self._schedules = value
|
|
@ -15,6 +15,7 @@ from hub.city_model_structure.building_demand.appliances import Appliances
|
||||||
from hub.city_model_structure.building_demand.lighting import Lighting
|
from hub.city_model_structure.building_demand.lighting import Lighting
|
||||||
from hub.city_model_structure.building_demand.internal_gain import InternalGain
|
from hub.city_model_structure.building_demand.internal_gain import InternalGain
|
||||||
from hub.city_model_structure.building_demand.thermal_control import ThermalControl
|
from hub.city_model_structure.building_demand.thermal_control import ThermalControl
|
||||||
|
from hub.city_model_structure.building_demand.domestic_hot_water import DomesticHotWater
|
||||||
from hub.city_model_structure.attributes.schedule import Schedule
|
from hub.city_model_structure.attributes.schedule import Schedule
|
||||||
import hub.helpers.constants as cte
|
import hub.helpers.constants as cte
|
||||||
|
|
||||||
|
@ -53,6 +54,7 @@ class ThermalZone:
|
||||||
self._appliances = None
|
self._appliances = None
|
||||||
self._internal_gains = None
|
self._internal_gains = None
|
||||||
self._thermal_control = None
|
self._thermal_control = None
|
||||||
|
self._domestic_hot_water = None
|
||||||
self._usages = None
|
self._usages = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -590,6 +592,43 @@ class ThermalZone:
|
||||||
|
|
||||||
return self._thermal_control
|
return self._thermal_control
|
||||||
|
|
||||||
|
@property
|
||||||
|
def domestic_hot_water(self) -> Union[None, DomesticHotWater]:
|
||||||
|
"""
|
||||||
|
Get domestic hot water information of this thermal zone
|
||||||
|
:return: None or DomesticHotWater
|
||||||
|
"""
|
||||||
|
self._domestic_hot_water = DomesticHotWater()
|
||||||
|
_mean_peak_density_load = 0
|
||||||
|
_mean_service_temperature = 0
|
||||||
|
for usage in self.usages:
|
||||||
|
_mean_peak_density_load += usage.percentage * usage.domestic_hot_water.density
|
||||||
|
_mean_service_temperature += usage.percentage * usage.domestic_hot_water.service_temperature
|
||||||
|
self._domestic_hot_water.density = _mean_peak_density_load
|
||||||
|
self._domestic_hot_water.service_temperature = _mean_service_temperature
|
||||||
|
|
||||||
|
_domestic_hot_water_reference = self.usages[0].domestic_hot_water
|
||||||
|
if _domestic_hot_water_reference.schedules is not None:
|
||||||
|
_schedules = []
|
||||||
|
for i_schedule in range(0, len(_domestic_hot_water_reference.schedules)):
|
||||||
|
schedule = Schedule()
|
||||||
|
schedule.type = _domestic_hot_water_reference.schedules[i_schedule].type
|
||||||
|
schedule.day_types = _domestic_hot_water_reference.schedules[i_schedule].day_types
|
||||||
|
schedule.data_type = _domestic_hot_water_reference.schedules[i_schedule].data_type
|
||||||
|
schedule.time_step = _domestic_hot_water_reference.schedules[i_schedule].time_step
|
||||||
|
schedule.time_range = _domestic_hot_water_reference.schedules[i_schedule].time_range
|
||||||
|
|
||||||
|
new_values = []
|
||||||
|
for i_value in range(0, len(_domestic_hot_water_reference.schedules[i_schedule].values)):
|
||||||
|
_new_value = 0
|
||||||
|
for usage in self.usages:
|
||||||
|
_new_value += usage.percentage * usage.domestic_hot_water.schedules[i_schedule].values[i_value]
|
||||||
|
new_values.append(_new_value)
|
||||||
|
schedule.values = new_values
|
||||||
|
_schedules.append(schedule)
|
||||||
|
self._domestic_hot_water.schedules = _schedules
|
||||||
|
return self._domestic_hot_water
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def total_floor_area(self):
|
def total_floor_area(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -12,6 +12,7 @@ from hub.city_model_structure.building_demand.occupancy import Occupancy
|
||||||
from hub.city_model_structure.building_demand.lighting import Lighting
|
from hub.city_model_structure.building_demand.lighting import Lighting
|
||||||
from hub.city_model_structure.building_demand.appliances import Appliances
|
from hub.city_model_structure.building_demand.appliances import Appliances
|
||||||
from hub.city_model_structure.building_demand.thermal_control import ThermalControl
|
from hub.city_model_structure.building_demand.thermal_control import ThermalControl
|
||||||
|
from hub.city_model_structure.building_demand.domestic_hot_water import DomesticHotWater
|
||||||
from hub.city_model_structure.building_demand.internal_gain import InternalGain
|
from hub.city_model_structure.building_demand.internal_gain import InternalGain
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +32,7 @@ class Usage:
|
||||||
self._lighting = None
|
self._lighting = None
|
||||||
self._appliances = None
|
self._appliances = None
|
||||||
self._thermal_control = None
|
self._thermal_control = None
|
||||||
|
self._domestic_hot_water = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def id(self):
|
def id(self):
|
||||||
|
@ -236,7 +238,7 @@ class Usage:
|
||||||
@property
|
@property
|
||||||
def thermal_control(self) -> Union[None, ThermalControl]:
|
def thermal_control(self) -> Union[None, ThermalControl]:
|
||||||
"""
|
"""
|
||||||
Get thermal control of this thermal zone
|
Get thermal control information
|
||||||
:return: None or ThermalControl
|
:return: None or ThermalControl
|
||||||
"""
|
"""
|
||||||
return self._thermal_control
|
return self._thermal_control
|
||||||
|
@ -244,7 +246,23 @@ class Usage:
|
||||||
@thermal_control.setter
|
@thermal_control.setter
|
||||||
def thermal_control(self, value):
|
def thermal_control(self, value):
|
||||||
"""
|
"""
|
||||||
Set thermal control for this thermal zone
|
Set thermal control information
|
||||||
:param value: ThermalControl
|
:param value: ThermalControl
|
||||||
"""
|
"""
|
||||||
self._thermal_control = value
|
self._thermal_control = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def domestic_hot_water(self) -> Union[None, DomesticHotWater]:
|
||||||
|
"""
|
||||||
|
Get domestic hot water information
|
||||||
|
:return: None or ThermalControl
|
||||||
|
"""
|
||||||
|
return self._domestic_hot_water
|
||||||
|
|
||||||
|
@domestic_hot_water.setter
|
||||||
|
def domestic_hot_water(self, value):
|
||||||
|
"""
|
||||||
|
Set domestic hot water information
|
||||||
|
:return: None or ThermalControl
|
||||||
|
"""
|
||||||
|
self._domestic_hot_water = value
|
||||||
|
|
11
hub/data/energy_systems/nrcan.xml
Normal file
11
hub/data/energy_systems/nrcan.xml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<nrcan base_url="https://raw.githubusercontent.com/NREL/openstudio-standards/master/lib/openstudio-standards/standards/necb/ECMS/data/">
|
||||||
|
<boilers_location>boiler_set.json</boilers_location>
|
||||||
|
<chillers_location>chiller_set.json</chillers_location>
|
||||||
|
<curves_location>curves.json</curves_location>
|
||||||
|
<furnaces_location>furnace_set.json </furnaces_location>
|
||||||
|
<heat_pumps_location>heat_pumps.json</heat_pumps_location>
|
||||||
|
<domestic_hot_water_systems_location>shw_set.json</domestic_hot_water_systems_location>
|
||||||
|
<pvs_location>pv.json</pvs_location>
|
||||||
|
<air_conditioners_location>unitary_acs.json</air_conditioners_location>
|
||||||
|
</nrcan>
|
|
@ -137,6 +137,7 @@ HEATING_SET_POINT = 'HtgSetPt'
|
||||||
EQUIPMENT = 'Equipment'
|
EQUIPMENT = 'Equipment'
|
||||||
ACTIVITY = 'Activity'
|
ACTIVITY = 'Activity'
|
||||||
PEOPLE_ACTIVITY_LEVEL = 'People Activity Level'
|
PEOPLE_ACTIVITY_LEVEL = 'People Activity Level'
|
||||||
|
DOMESTIC_HOT_WATER = 'Domestic Hot Water'
|
||||||
|
|
||||||
# Geometry
|
# Geometry
|
||||||
EPSILON = 0.0000001
|
EPSILON = 0.0000001
|
||||||
|
|
|
@ -15,6 +15,7 @@ from hub.city_model_structure.building_demand.lighting import Lighting
|
||||||
from hub.city_model_structure.building_demand.occupancy import Occupancy
|
from hub.city_model_structure.building_demand.occupancy import Occupancy
|
||||||
from hub.city_model_structure.building_demand.appliances import Appliances
|
from hub.city_model_structure.building_demand.appliances import Appliances
|
||||||
from hub.city_model_structure.building_demand.thermal_control import ThermalControl
|
from hub.city_model_structure.building_demand.thermal_control import ThermalControl
|
||||||
|
from hub.city_model_structure.building_demand.domestic_hot_water import DomesticHotWater
|
||||||
from hub.city_model_structure.attributes.schedule import Schedule
|
from hub.city_model_structure.attributes.schedule import Schedule
|
||||||
from hub.city_model_structure.building_demand.internal_gain import InternalGain
|
from hub.city_model_structure.building_demand.internal_gain import InternalGain
|
||||||
from hub.catalog_factories.usage_catalog_factory import UsageCatalogFactory
|
from hub.catalog_factories.usage_catalog_factory import UsageCatalogFactory
|
||||||
|
@ -101,6 +102,11 @@ class ComnetUsageParameters:
|
||||||
_control.heating_set_point_schedules = archetype.thermal_control.heating_set_point_schedules
|
_control.heating_set_point_schedules = archetype.thermal_control.heating_set_point_schedules
|
||||||
_control.hvac_availability_schedules = archetype.thermal_control.hvac_availability_schedules
|
_control.hvac_availability_schedules = archetype.thermal_control.hvac_availability_schedules
|
||||||
usage.thermal_control = _control
|
usage.thermal_control = _control
|
||||||
|
_domestic_hot_water = DomesticHotWater()
|
||||||
|
_domestic_hot_water.density = archetype.domestic_hot_water.density
|
||||||
|
_domestic_hot_water.service_temperature = archetype.domestic_hot_water.service_temperature
|
||||||
|
_domestic_hot_water.schedules = archetype.domestic_hot_water.schedules
|
||||||
|
usage.domestic_hot_water = _domestic_hot_water
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _calculate_reduced_values_from_extended_library(usage, archetype):
|
def _calculate_reduced_values_from_extended_library(usage, archetype):
|
||||||
|
|
|
@ -14,6 +14,7 @@ from hub.city_model_structure.building_demand.lighting import Lighting
|
||||||
from hub.city_model_structure.building_demand.occupancy import Occupancy
|
from hub.city_model_structure.building_demand.occupancy import Occupancy
|
||||||
from hub.city_model_structure.building_demand.appliances import Appliances
|
from hub.city_model_structure.building_demand.appliances import Appliances
|
||||||
from hub.city_model_structure.building_demand.thermal_control import ThermalControl
|
from hub.city_model_structure.building_demand.thermal_control import ThermalControl
|
||||||
|
from hub.city_model_structure.building_demand.domestic_hot_water import DomesticHotWater
|
||||||
from hub.catalog_factories.usage_catalog_factory import UsageCatalogFactory
|
from hub.catalog_factories.usage_catalog_factory import UsageCatalogFactory
|
||||||
|
|
||||||
|
|
||||||
|
@ -111,6 +112,11 @@ class NrcanUsageParameters:
|
||||||
_control.heating_set_point_schedules = archetype.thermal_control.heating_set_point_schedules
|
_control.heating_set_point_schedules = archetype.thermal_control.heating_set_point_schedules
|
||||||
_control.hvac_availability_schedules = archetype.thermal_control.hvac_availability_schedules
|
_control.hvac_availability_schedules = archetype.thermal_control.hvac_availability_schedules
|
||||||
usage.thermal_control = _control
|
usage.thermal_control = _control
|
||||||
|
_domestic_hot_water = DomesticHotWater()
|
||||||
|
_domestic_hot_water.density = archetype.domestic_hot_water.density
|
||||||
|
_domestic_hot_water.service_temperature = archetype.domestic_hot_water.service_temperature
|
||||||
|
_domestic_hot_water.schedules = archetype.domestic_hot_water.schedules
|
||||||
|
usage.domestic_hot_water = _domestic_hot_water
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _assign_comnet_extra_values(usage, archetype):
|
def _assign_comnet_extra_values(usage, archetype):
|
||||||
|
|
|
@ -124,3 +124,7 @@ class TestUsageFactory(TestCase):
|
||||||
self.assertIsNotNone(appliances.schedules, 'appliances schedule is none')
|
self.assertIsNotNone(appliances.schedules, 'appliances schedule is none')
|
||||||
self.assertIsNotNone(usage.thermal_control.hvac_availability_schedules,
|
self.assertIsNotNone(usage.thermal_control.hvac_availability_schedules,
|
||||||
'control hvac availability is none')
|
'control hvac availability is none')
|
||||||
|
self.assertIsNotNone(usage.domestic_hot_water.density, 'domestic hot water density is none')
|
||||||
|
self.assertIsNotNone(usage.domestic_hot_water.service_temperature,
|
||||||
|
'domestic hot water service temperature is none')
|
||||||
|
self.assertIsNotNone(usage.domestic_hot_water.schedules, 'domestic hot water schedules is none')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user