Merge branch 'retrofit_project' into systems_catalog

# Conflicts:
#	hub/city_model_structure/building_demand/surface.py
#	hub/exports/building_energy/idf.py
#	hub/imports/results/simplified_radiosity_algorithm.py
This commit is contained in:
Pilar Monsalvete 2023-05-29 12:16:29 -04:00
commit e704143333
152 changed files with 1284 additions and 326075 deletions

View File

@ -90,7 +90,7 @@ pylint --rcfile=pylintrc myfile.py
Before any pull request, the code must been manually and automatically tested to ensure at least some quality minimum. There are a few practices for unit tests that we believe are important, so we encourage you to follow it. Before any pull request, the code must been manually and automatically tested to ensure at least some quality minimum. There are a few practices for unit tests that we believe are important, so we encourage you to follow it.
* The test should be self-contained, which implies that your tests will prepare and clean up everything before and after the test execution. * The test should be cls-contained, which implies that your tests will prepare and clean up everything before and after the test execution.
* We encourage you to create if possible functional tests that cover the complete workflow of the implemented functionality. * We encourage you to create if possible functional tests that cover the complete workflow of the implemented functionality.
* Maximize your code coverage by ensuring that you are testing as much of your code as possible. * Maximize your code coverage by ensuring that you are testing as much of your code as possible.

View File

@ -58,7 +58,7 @@ section in persistence/README.md file.
as shown below: as shown below:
```python ```python
from hub.exports.db_factory import DBFactory from hub.persistence.db_control import DBFactory
from pathlib import Path from pathlib import Path
dotenv_path = (Path(__file__).parent / '.env').resolve() dotenv_path = (Path(__file__).parent / '.env').resolve()

View File

@ -48,11 +48,11 @@ Use properties whenever it is possible. Encapsulate the access to all the calcul
```python ```python
@property @property
def object_attribute(self): def object_attribute(cls):
if self._object_attribute is None: if cls._object_attribute is None:
self._object_attribute = ... cls._object_attribute = ...
... ...
return self._object_attribute return cls._object_attribute
``` ```
@ -61,12 +61,12 @@ And like in the following example for read and write properties:
```python ```python
@property @property
def object_changeable_attribute(self): def object_changeable_attribute(cls):
return self._object_changeable_attribute return cls._object_changeable_attribute
@object_changeable_attribute.setter @object_changeable_attribute.setter
def object_changeable_attribute(self, value): def object_changeable_attribute(cls, value):
self._object_changeable_attribute = value cls._object_changeable_attribute = value
``` ```
@ -75,11 +75,11 @@ If your method or attribute returns a complex object, use type hints as in this
```python ```python
@property @property
def complex_object(self) -> ComplexObject: def complex_object(cls) -> ComplexObject:
return self._object_changeable_attribute return cls._object_changeable_attribute
def new_complex_object(self, first_param, second_param) -> ComplexObject: def new_complex_object(cls, first_param, second_param) -> ComplexObject:
other_needed_property = self.other_needed_property other_needed_property = cls.other_needed_property
return ComplexObject(first_param, second_param, other_needed_property) return ComplexObject(first_param, second_param, other_needed_property)
``` ```
@ -89,11 +89,11 @@ Always access your variable through the method and avoid to access directly.
```python ```python
@property @property
def object_attribute(self): def object_attribute(cls):
return self._object_attribute return cls._object_attribute
def operation(self, first_param, second_param): def operation(cls, first_param, second_param):
return self.object_attribute * 2 return cls.object_attribute * 2
``` ```
@ -110,23 +110,23 @@ All public classes, properties, and methods must have code comments. Code commen
MyClass class perform models class operations MyClass class perform models class operations
""" """
def __init__(self): def __init__(cls):
@property @property
def object_attribute(self): def object_attribute(cls):
""" """
Get my class object attribute Get my class object attribute
:return: int :return: int
""" """
return self._object_attribute return cls._object_attribute
def operation(self, first_param, second_param): def operation(cls, first_param, second_param):
""" """
Multiplies object_attribute by two Multiplies object_attribute by two
:return: int :return: int
""" """
return self.object_attribute * 2 return cls.object_attribute * 2
``` ```
@ -135,20 +135,20 @@ Comments at getters and setters always start with Get and Set, and identity the
```python ```python
@property @property
def object_attribute(self): def object_attribute(cls):
""" """
Get object attribute Get object attribute
:return: int :return: int
""" """
return self._object_attribute return cls._object_attribute
@object_attribute.setter @object_attribute.setter
def object_attribute(self, value): def object_attribute(cls, value):
""" """
Set object attribute Set object attribute
:param value: int :param value: int
""" """
self._object_attribute = value cls._object_attribute = value
``` ```
@ -157,12 +157,12 @@ Attributes with known units should be explicit in method's comment.
```python ```python
@property @property
def distance(self): def distance(cls):
""" """
My class distance in meters My class distance in meters
:return: float :return: float
""" """
return self._distance return cls._distance
``` ```
#### To do's. #### To do's.

View File

@ -112,16 +112,19 @@ class NrelCatalog(Catalog):
function = archetype['@building_type'] function = archetype['@building_type']
name = f"{function} {archetype['@climate_zone']} {archetype['@reference_standard']}" name = f"{function} {archetype['@climate_zone']} {archetype['@reference_standard']}"
climate_zone = archetype['@climate_zone'] climate_zone = archetype['@climate_zone']
construction_period = \ construction_period = ConstructionHelper().reference_standard_to_construction_period[
ConstructionHelper().reference_standard_to_construction_period[archetype['@reference_standard']] archetype['@reference_standard']
]
average_storey_height = float(archetype['average_storey_height']['#text']) average_storey_height = float(archetype['average_storey_height']['#text'])
thermal_capacity = float(archetype['thermal_capacity']['#text']) * 1000 thermal_capacity = float(archetype['thermal_capacity']['#text']) * 1000
extra_loses_due_to_thermal_bridges = float(archetype['extra_loses_due_to_thermal_bridges']['#text']) extra_loses_due_to_thermal_bridges = float(archetype['extra_loses_due_to_thermal_bridges']['#text'])
indirect_heated_ratio = float(archetype['indirect_heated_ratio']['#text']) indirect_heated_ratio = float(archetype['indirect_heated_ratio']['#text'])
infiltration_rate_for_ventilation_system_off = \ infiltration_rate_for_ventilation_system_off = float(
float(archetype['infiltration_rate_for_ventilation_system_off']['#text']) archetype['infiltration_rate_for_ventilation_system_off']['#text']
infiltration_rate_for_ventilation_system_on = \ )
float(archetype['infiltration_rate_for_ventilation_system_on']['#text']) infiltration_rate_for_ventilation_system_on = float(
archetype['infiltration_rate_for_ventilation_system_on']['#text']
)
archetype_constructions = [] archetype_constructions = []
for archetype_construction in archetype['constructions']['construction']: for archetype_construction in archetype['constructions']['construction']:

View File

@ -4,26 +4,22 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
""" """
import logging
from pathlib import Path from pathlib import Path
from typing import TypeVar from typing import TypeVar
from hub.catalog_factories.construction.nrel_catalog import NrelCatalog from hub.catalog_factories.construction.nrel_catalog import NrelCatalog
from hub.hub_logger import logger
from hub.helpers.utils import validate_import_export_type from hub.helpers.utils import validate_import_export_type
from hub.catalog_factories.construction.nrcan_catalog import NrcanCatalog from hub.catalog_factories.construction.nrcan_catalog import NrcanCatalog
Catalog = TypeVar('Catalog') Catalog = TypeVar('Catalog')
class ConstructionCatalogFactory: class ConstructionCatalogFactory:
def __init__(self, file_type, base_path=None): def __init__(self, handler, base_path=None):
if base_path is None: if base_path is None:
base_path = Path(Path(__file__).parent.parent / 'data/construction') base_path = Path(Path(__file__).parent.parent / 'data/construction')
self._catalog_type = '_' + file_type.lower() self._handler = '_' + handler.lower()
class_funcs = validate_import_export_type(ConstructionCatalogFactory) validate_import_export_type(ConstructionCatalogFactory, handler)
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 self._path = base_path
@property @property
@ -46,4 +42,4 @@ class ConstructionCatalogFactory:
Enrich the city given to the class using the class given handler Enrich the city given to the class using the class given handler
:return: Catalog :return: Catalog
""" """
return getattr(self, self._catalog_type, lambda: None) return getattr(self, self._handler, lambda: None)

View File

@ -15,7 +15,6 @@ from hub.catalog_factories.data_models.cost.item_description import ItemDescript
from hub.catalog_factories.data_models.cost.operational_cost import OperationalCost from hub.catalog_factories.data_models.cost.operational_cost import OperationalCost
from hub.catalog_factories.data_models.cost.fuel import Fuel from hub.catalog_factories.data_models.cost.fuel import Fuel
from hub.catalog_factories.data_models.cost.income import Income from hub.catalog_factories.data_models.cost.income import Income
from hub.catalog_factories.data_models.cost.cost_helper import CostHelper
class MontrealCustomCatalog(Catalog): class MontrealCustomCatalog(Catalog):
@ -53,7 +52,6 @@ class MontrealCustomCatalog(Catalog):
def _get_capital_costs(self, entry): def _get_capital_costs(self, entry):
general_chapters = [] general_chapters = []
chapters_titles = CostHelper().chapters_in_lod1
shell = entry['B_shell'] shell = entry['B_shell']
items_list = [] items_list = []
item_type = 'B10_superstructure' item_type = 'B10_superstructure'
@ -125,9 +123,9 @@ class MontrealCustomCatalog(Catalog):
for archetype in archetypes: for archetype in archetypes:
function = archetype['@function'] function = archetype['@function']
municipality = archetype['@municipality'] municipality = archetype['@municipality']
country = 'CA'#archetype['@country'] country = archetype['@country']
lod = 0 #float(archetype['@lod']) lod = float(archetype['@lod'])
currency = 'CAD'#archetype['currency'] currency = archetype['currency']
capital_cost = self._get_capital_costs(archetype['capital_cost']) capital_cost = self._get_capital_costs(archetype['capital_cost'])
operational_cost = self._get_operational_costs(archetype['operational_cost']) operational_cost = self._get_operational_costs(archetype['operational_cost'])
end_of_life_cost = float(archetype['end_of_life_cost']['#text']) end_of_life_cost = float(archetype['end_of_life_cost']['#text'])

View File

@ -64,4 +64,3 @@ class Construction:
:return: Window :return: Window
""" """
return self._window return self._window

View File

@ -1,48 +0,0 @@
"""
Cost helper
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import hub.helpers.constants as cte
from typing import Dict
class CostHelper:
"""
Cost helper class
"""
_costs_units = {
'currency/m2': cte.CURRENCY_PER_SQM,
'currency/m3': cte.CURRENCY_PER_CBM,
'currency/kW': cte.CURRENCY_PER_KW,
'currency/kWh': cte.CURRENCY_PER_KWH,
'currency/month': cte.CURRENCY_PER_MONTH,
'currency/l': cte.CURRENCY_PER_LITRE,
'currency/kg': cte.CURRENCY_PER_KG,
'currency/(m3/h)': cte.CURRENCY_PER_CBM_PER_HOUR,
'%': cte.PERCENTAGE
}
_chapters_in_lod1 = {
'B_shell': cte.SUPERSTRUCTURE,
'D_services': cte.ENVELOPE,
'Z_allowances_overhead_profit': cte.ALLOWANCES_OVERHEAD_PROFIT
}
@property
def costs_units(self) -> Dict:
"""
List of supported costs units
:return: dict
"""
return self._costs_units
@property
def chapters_in_lod1(self) -> Dict:
"""
List of chapters included in lod 1
:return: dict
"""
return self._chapters_in_lod1

View File

@ -32,4 +32,3 @@ class Content:
All soils in the catalog All soils in the catalog
""" """
return self._soils return self._soils

View File

@ -5,10 +5,10 @@ Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
""" """
from hub.catalog_factories.data_models.greenery.plant import Plant as libs_plant from hub.catalog_factories.data_models.greenery.plant import Plant as hub_plant
class PlantPercentage(libs_plant): class PlantPercentage(hub_plant):
def __init__(self, percentage, plant_category, plant): def __init__(self, percentage, plant_category, plant):
super().__init__(plant_category, plant) super().__init__(plant_category, plant)

View File

@ -2,7 +2,7 @@
Usage catalog domestic hot water Usage catalog domestic hot water
SPDX - License - Identifier: LGPL - 3.0 - or -later SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group Copyright © 2023 Concordia CERC group
Project Coder Pilar Monsalvete Álvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
from typing import Union, List from typing import Union, List

View File

@ -2,7 +2,7 @@
Usage catalog occupancy Usage catalog occupancy
SPDX - License - Identifier: LGPL - 3.0 - or -later SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez Morote Guillermo.GutierrezMorote@concordia.ca Project Coder Guille Gutierrez Guillermo.GutierrezMorote@concordia.ca
""" """
from typing import Union, List from typing import Union, List

View File

@ -73,4 +73,3 @@ class Schedule:
:return: None or [str] :return: None or [str]
""" """
return self._day_types return self._day_types

View File

@ -18,8 +18,7 @@ class ThermalControl:
hvac_availability_schedules, hvac_availability_schedules,
heating_set_point_schedules, heating_set_point_schedules,
cooling_set_point_schedules): cooling_set_point_schedules):
#todo: eliminate negative value
deltaTsetpoint=0
self._mean_heating_set_point = mean_heating_set_point self._mean_heating_set_point = mean_heating_set_point
self._heating_set_back = heating_set_back self._heating_set_back = heating_set_back
self._mean_cooling_set_point = mean_cooling_set_point self._mean_cooling_set_point = mean_cooling_set_point

View File

@ -29,7 +29,6 @@ class Usage:
self._days_year = days_year self._days_year = days_year
self._mechanical_air_change = mechanical_air_change self._mechanical_air_change = mechanical_air_change
self._ventilation_rate = ventilation_rate self._ventilation_rate = ventilation_rate
# classes
self._occupancy = occupancy self._occupancy = occupancy
self._lighting = lighting self._lighting = lighting
self._appliances = appliances self._appliances = appliances

View File

@ -4,25 +4,21 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Álvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Álvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
import logging
from pathlib import Path from pathlib import Path
from typing import TypeVar from typing import TypeVar
from hub.catalog_factories.energy_systems.montreal_custom_catalog import MontrealCustomCatalog from hub.catalog_factories.energy_systems.montreal_custom_catalog import MontrealCustomCatalog
from hub.hub_logger import logger
from hub.helpers.utils import validate_import_export_type from hub.helpers.utils import validate_import_export_type
Catalog = TypeVar('Catalog') Catalog = TypeVar('Catalog')
class EnergySystemsCatalogFactory: class EnergySystemsCatalogFactory:
def __init__(self, file_type, base_path=None): def __init__(self, handler, base_path=None):
if base_path is None: if base_path is None:
base_path = Path(Path(__file__).parent.parent / 'data/energy_systems') base_path = Path(Path(__file__).parent.parent / 'data/energy_systems')
self._catalog_type = '_' + file_type.lower() self._handler = '_' + handler.lower()
class_funcs = validate_import_export_type(EnergySystemsCatalogFactory) validate_import_export_type(EnergySystemsCatalogFactory, handler)
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 self._path = base_path
@property @property
@ -38,4 +34,4 @@ class EnergySystemsCatalogFactory:
Enrich the city given to the class using the class given handler Enrich the city given to the class using the class given handler
:return: Catalog :return: Catalog
""" """
return getattr(self, self._catalog_type, lambda: None) return getattr(self, self._handler, lambda: None)

View File

@ -45,7 +45,7 @@ class GreeneryCatalog(Catalog):
if plant.name == plant_percentage.plant.name: if plant.name == plant_percentage.plant.name:
plant_category = plant.category plant_category = plant.category
break break
plant_percentages.append(libs_pp(plant_percentage.percentage,plant_category, plant_percentage.plant)) plant_percentages.append(libs_pp(plant_percentage.percentage, plant_category, plant_percentage.plant))
vegetations.append(libs_vegetation(name, vegetation, plant_percentages)) vegetations.append(libs_vegetation(name, vegetation, plant_percentages))
plants = [] plants = []
for plant_category in catalog_data.plantCategories: for plant_category in catalog_data.plantCategories:

View File

@ -4,11 +4,11 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
""" """
import logging
from pathlib import Path from pathlib import Path
from typing import TypeVar from typing import TypeVar
from hub.catalog_factories.greenery.greenery_catalog import GreeneryCatalog from hub.catalog_factories.greenery.greenery_catalog import GreeneryCatalog
from hub.hub_logger import logger
from hub.helpers.utils import validate_import_export_type from hub.helpers.utils import validate_import_export_type
Catalog = TypeVar('Catalog') Catalog = TypeVar('Catalog')
@ -17,15 +17,11 @@ class GreeneryCatalogFactory:
""" """
GreeneryCatalogFactory class GreeneryCatalogFactory class
""" """
def __init__(self, file_type, base_path=None): def __init__(self, handler, base_path=None):
if base_path is None: if base_path is None:
base_path = Path(Path(__file__).parent.parent / 'data/greenery') base_path = Path(Path(__file__).parent.parent / 'data/greenery')
self._catalog_type = '_' + file_type.lower() self._handler = '_' + handler.lower()
class_funcs = validate_import_export_type(GreeneryCatalogFactory) class_funcs = validate_import_export_type(GreeneryCatalogFactory, handler)
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 self._path = base_path
@property @property
@ -42,4 +38,4 @@ class GreeneryCatalogFactory:
Enrich the city given to the class using the class given handler Enrich the city given to the class using the class given handler
:return: Catalog :return: Catalog
""" """
return getattr(self, self._catalog_type, lambda: None) return getattr(self, self._handler, lambda: None)

View File

@ -4,6 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
""" """
import io
from typing import Dict from typing import Dict
import pandas as pd import pandas as pd
@ -129,8 +130,12 @@ class ComnetCatalog(Catalog):
for usage_name in comnet_usages: for usage_name in comnet_usages:
if usage_name == 'C-13 Data Center': if usage_name == 'C-13 Data Center':
continue continue
_extracted_data = pd.read_excel(self._comnet_schedules_path, sheet_name=comnet_usages[usage_name], with open(self._comnet_schedules_path, 'rb') as xls:
skiprows=[0, 1, 2, 3], nrows=39, usecols="A:AA") _extracted_data = pd.read_excel(
io.BytesIO(xls.read()),
sheet_name=comnet_usages[usage_name],
skiprows=[0, 1, 2, 3], nrows=39, usecols="A:AA"
)
_schedules = {} _schedules = {}
for row in range(0, 39, 3): for row in range(0, 39, 3):
_schedule_values = {} _schedule_values = {}
@ -166,9 +171,13 @@ class ComnetCatalog(Catalog):
:return : Dict :return : Dict
""" """
number_usage_types = 33 number_usage_types = 33
xl_file = pd.ExcelFile(self._comnet_archetypes_path) with open(self._comnet_archetypes_path, 'rb') as xls:
file_data = pd.read_excel(xl_file, sheet_name="Modeling Data", skiprows=[0, 1, 2, 24], _extracted_data = pd.read_excel(
nrows=number_usage_types, usecols="A:AB") io.BytesIO(xls.read()),
sheet_name="Modeling Data",
skiprows=[0, 1, 2, 24],
nrows=number_usage_types, usecols="A:AB"
)
lighting_data = {} lighting_data = {}
plug_loads_data = {} plug_loads_data = {}
@ -178,7 +187,7 @@ class ComnetCatalog(Catalog):
process_data = {} process_data = {}
schedules_key = {} schedules_key = {}
for j in range(0, number_usage_types-1): for j in range(0, number_usage_types-1):
usage_parameters = file_data.iloc[j] usage_parameters = _extracted_data.iloc[j]
usage_type = usage_parameters[0] usage_type = usage_parameters[0]
lighting_data[usage_type] = usage_parameters[1:6].values.tolist() lighting_data[usage_type] = usage_parameters[1:6].values.tolist()
plug_loads_data[usage_type] = usage_parameters[8:13].values.tolist() plug_loads_data[usage_type] = usage_parameters[8:13].values.tolist()

View File

@ -94,8 +94,7 @@ class NrcanCatalog(Catalog):
# W/m2 # W/m2
appliances_density = space_type['electric_equipment_per_area_w_per_m2'] appliances_density = space_type['electric_equipment_per_area_w_per_m2']
# peak flow in gallons/h/m2 # peak flow in gallons/h/m2
domestic_hot_water_peak_flow = space_type['service_water_heating_peak_flow_per_area'] \ domestic_hot_water_peak_flow = space_type['service_water_heating_peak_flow_per_area'] * cte.GALLONS_TO_QUBIC_METERS / cte.HOUR_TO_SECONDS
* cte.GALLONS_TO_QUBIC_METERS / cte.HOUR_TO_SECONDS
space_types_dictionary[usage_type] = {'occupancy_per_area': occupancy_density, space_types_dictionary[usage_type] = {'occupancy_per_area': occupancy_density,
'lighting_per_area': lighting_density, 'lighting_per_area': lighting_density,
'electric_equipment_per_area': appliances_density, 'electric_equipment_per_area': appliances_density,
@ -132,8 +131,9 @@ class NrcanCatalog(Catalog):
# cfm/ft2 to m3/m2.s # cfm/ft2 to m3/m2.s
ventilation_rate = space_type['ventilation_per_area'] / (cte.METERS_TO_FEET * cte.MINUTES_TO_SECONDS) ventilation_rate = space_type['ventilation_per_area'] / (cte.METERS_TO_FEET * cte.MINUTES_TO_SECONDS)
# cfm/person to m3/m2.s # cfm/person to m3/m2.s
ventilation_rate += space_type['ventilation_per_person'] / (pow(cte.METERS_TO_FEET, 3) * cte.MINUTES_TO_SECONDS)\ ventilation_rate += space_type['ventilation_per_person'] / (
* occupancy_density pow(cte.METERS_TO_FEET, 3) * cte.MINUTES_TO_SECONDS
) * occupancy_density
lighting_radiative_fraction = space_type['lighting_fraction_radiant'] lighting_radiative_fraction = space_type['lighting_fraction_radiant']
lighting_convective_fraction = 0 lighting_convective_fraction = 0

View File

@ -17,8 +17,8 @@ class UsageHelper:
'Lighting': cte.LIGHTING, 'Lighting': cte.LIGHTING,
'Occupancy': cte.OCCUPANCY, 'Occupancy': cte.OCCUPANCY,
'Equipment': cte.APPLIANCES, 'Equipment': cte.APPLIANCES,
'Thermostat Setpoint Cooling': cte.COOLING_SET_POINT, # Compose 'Thermostat Setpoint' + 'Cooling' 'Thermostat Setpoint Cooling': cte.COOLING_SET_POINT,
'Thermostat Setpoint Heating': cte.HEATING_SET_POINT, # Compose 'Thermostat Setpoint' + 'Heating' 'Thermostat Setpoint Heating': cte.HEATING_SET_POINT,
'Fan': cte.HVAC_AVAILABILITY, 'Fan': cte.HVAC_AVAILABILITY,
'Service Water Heating': cte.DOMESTIC_HOT_WATER 'Service Water Heating': cte.DOMESTIC_HOT_WATER
} }

View File

@ -4,26 +4,22 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
""" """
import logging
from pathlib import Path from pathlib import Path
from typing import TypeVar from typing import TypeVar
from hub.catalog_factories.usage.comnet_catalog import ComnetCatalog from hub.catalog_factories.usage.comnet_catalog import ComnetCatalog
from hub.catalog_factories.usage.nrcan_catalog import NrcanCatalog from hub.catalog_factories.usage.nrcan_catalog import NrcanCatalog
from hub.hub_logger import logger
from hub.helpers.utils import validate_import_export_type from hub.helpers.utils import validate_import_export_type
Catalog = TypeVar('Catalog') Catalog = TypeVar('Catalog')
class UsageCatalogFactory: class UsageCatalogFactory:
def __init__(self, file_type, base_path=None): def __init__(self, handler, base_path=None):
if base_path is None: if base_path is None:
base_path = Path(Path(__file__).parent.parent / 'data/usage') base_path = Path(Path(__file__).parent.parent / 'data/usage')
self._catalog_type = '_' + file_type.lower() self._catalog_type = '_' + handler.lower()
class_funcs = validate_import_export_type(UsageCatalogFactory) validate_import_export_type(UsageCatalogFactory, handler)
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 self._path = base_path
@property @property

View File

@ -6,10 +6,10 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
from __future__ import annotations from __future__ import annotations
import logging
import math import math
import sys import sys
from typing import List from typing import List
from hub.hub_logger import logger
import numpy as np import numpy as np
from trimesh import Trimesh from trimesh import Trimesh
import trimesh.intersections import trimesh.intersections
@ -246,7 +246,9 @@ class Polygon:
polygon = shapley_polygon(coordinates) polygon = shapley_polygon(coordinates)
try: try:
vertices_2d, faces = trimesh.creation.triangulate_polygon(polygon, engine='triangle') vertices_2d, faces = trimesh.creation.triangulate_polygon(polygon, engine='triangle')
mesh = Trimesh(vertices=vertices, faces=faces) mesh = Trimesh(vertices=vertices, faces=faces)
# check orientation # check orientation
@ -262,12 +264,10 @@ class Polygon:
new_face.append(face[len(face)-i-1]) new_face.append(face[len(face)-i-1])
new_faces.append(new_face) new_faces.append(new_face)
mesh = Trimesh(vertices=vertices, faces=new_faces) mesh = Trimesh(vertices=vertices, faces=new_faces)
return mesh return mesh
except ValueError: except ValueError:
logger.error(f'Not able to triangulate polygon\n') logging.error(f'Not able to triangulate polygon\n')
sys.stderr.write(f'Not able to triangulate polygon\n')
_vertices = [[0, 0, 0], [0, 0, 1], [0, 1, 0]] _vertices = [[0, 0, 0], [0, 0, 1], [0, 1, 0]]
_faces = [[0, 1, 2]] _faces = [[0, 1, 2]]
return Trimesh(vertices=_vertices, faces=_faces) return Trimesh(vertices=_vertices, faces=_faces)

View File

@ -92,7 +92,6 @@ class Polyhedron:
points = polygon.coordinates points = polygon.coordinates
if len(points) != 3: if len(points) != 3:
sub_polygons = polygon.triangles sub_polygons = polygon.triangles
# todo: I modified this! To be checked @Guille
if len(sub_polygons) >= 1: if len(sub_polygons) >= 1:
for sub_polygon in sub_polygons: for sub_polygon in sub_polygons:
face = [] face = []

View File

@ -6,20 +6,20 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
import sys import logging
from typing import List, Union from typing import List, Union
import numpy as np import numpy as np
import pandas as pd import pandas as pd
from hub.hub_logger import logger
import hub.helpers.constants as cte import hub.helpers.constants as cte
from hub.helpers.peak_loads import PeakLoads from hub.city_model_structure.attributes.polyhedron import Polyhedron
from hub.city_model_structure.building_demand.surface import Surface
from hub.city_model_structure.city_object import CityObject
from hub.city_model_structure.building_demand.household import Household from hub.city_model_structure.building_demand.household import Household
from hub.city_model_structure.building_demand.internal_zone import InternalZone from hub.city_model_structure.building_demand.internal_zone import InternalZone
from hub.city_model_structure.attributes.polyhedron import Polyhedron from hub.city_model_structure.building_demand.surface import Surface
from hub.city_model_structure.city_object import CityObject
from hub.city_model_structure.energy_systems.energy_system import EnergySystem from hub.city_model_structure.energy_systems.energy_system import EnergySystem
from hub.helpers.peak_loads import PeakLoads
class Building(CityObject): class Building(CityObject):
@ -83,8 +83,7 @@ class Building(CityObject):
elif surface.type == cte.INTERIOR_SLAB: elif surface.type == cte.INTERIOR_SLAB:
self._interior_slabs.append(surface) self._interior_slabs.append(surface)
else: else:
logger.error(f'Building {self.name} [alias {self.alias}] has an unexpected surface type {surface.type}.\n') logging.error(f'Building {self.name} [alias {self.alias}] has an unexpected surface type {surface.type}.\n')
sys.stderr.write(f'Building {self.name} [alias {self.alias}] has an unexpected surface type {surface.type}.\n')
@property @property
def shell(self) -> Polyhedron: def shell(self) -> Polyhedron:
@ -374,13 +373,13 @@ class Building(CityObject):
results = {} results = {}
if cte.HOUR in self.heating: if cte.HOUR in self.heating:
monthly_values = PeakLoads().\ monthly_values = PeakLoads().\
peak_loads_from_hourly(self.heating[cte.HOUR][next(iter(self.heating[cte.HOUR]))].values) peak_loads_from_hourly(self.heating[cte.HOUR][next(iter(self.heating[cte.HOUR]))])
else: else:
monthly_values = PeakLoads(self).heating_peak_loads_from_methodology monthly_values = PeakLoads(self).heating_peak_loads_from_methodology
if monthly_values is None: if monthly_values is None:
return None return None
results[cte.MONTH] = pd.DataFrame(monthly_values, columns=['heating peak loads']) results[cte.MONTH] = pd.DataFrame(monthly_values, columns=[cte.HEATING_PEAK_LOAD])
results[cte.YEAR] = pd.DataFrame([max(monthly_values)], columns=['heating peak loads']) results[cte.YEAR] = pd.DataFrame([max(monthly_values)], columns=[cte.HEATING_PEAK_LOAD])
return results return results
@property @property
@ -390,16 +389,14 @@ class Building(CityObject):
:return: dict{DataFrame(float)} :return: dict{DataFrame(float)}
""" """
results = {} results = {}
monthly_values = None
if cte.HOUR in self.cooling: if cte.HOUR in self.cooling:
# todo: .values???????? Like heating
monthly_values = PeakLoads().peak_loads_from_hourly(self.cooling[cte.HOUR][next(iter(self.cooling[cte.HOUR]))]) monthly_values = PeakLoads().peak_loads_from_hourly(self.cooling[cte.HOUR][next(iter(self.cooling[cte.HOUR]))])
else: else:
monthly_values = PeakLoads(self).cooling_peak_loads_from_methodology monthly_values = PeakLoads(self).cooling_peak_loads_from_methodology
if monthly_values is None: if monthly_values is None:
return None return None
results[cte.MONTH] = pd.DataFrame(monthly_values, columns=['cooling peak loads']) results[cte.MONTH] = pd.DataFrame(monthly_values, columns=[cte.COOLING_PEAK_LOAD])
results[cte.YEAR] = pd.DataFrame([max(monthly_values)], columns=['cooling peak loads']) results[cte.YEAR] = pd.DataFrame([max(monthly_values)], columns=[cte.COOLING_PEAK_LOAD])
return results return results
@property @property
@ -495,6 +492,8 @@ class Building(CityObject):
""" """
_usage = '' _usage = ''
for internal_zone in self.internal_zones: for internal_zone in self.internal_zones:
if internal_zone.usages is None:
continue
for usage in internal_zone.usages: for usage in internal_zone.usages:
_usage = f'{_usage}{usage.name}_{usage.percentage} ' _usage = f'{_usage}{usage.name}_{usage.percentage} '
return _usage.rstrip() return _usage.rstrip()

View File

@ -355,7 +355,7 @@ class Surface:
@property @property
def solar_collectors_area_reduction_factor(self): def solar_collectors_area_reduction_factor(self):
""" """
Get factor area collector per surface area if set or calculate using Romero Rodríguez, L. et al (2017) model if not Get factor area collector per surface area if set or calculate using Romero Rodriguez, L. et al (2017) model if not
:return: float :return: float
""" """
if self._solar_collectors_area_reduction_factor is None: if self._solar_collectors_area_reduction_factor is None:
@ -372,8 +372,9 @@ class Surface:
_construction_restriction = 0.9 _construction_restriction = 0.9
_separation_of_panels = 0.9 _separation_of_panels = 0.9
_shadow_between_panels = 1 _shadow_between_panels = 1
self._solar_collectors_area_reduction_factor = _protected_building_restriction * _construction_restriction \ self._solar_collectors_area_reduction_factor = (
* _separation_of_panels * _shadow_between_panels _protected_building_restriction * _construction_restriction * _separation_of_panels * _shadow_between_panels
)
return self._solar_collectors_area_reduction_factor return self._solar_collectors_area_reduction_factor
@solar_collectors_area_reduction_factor.setter @solar_collectors_area_reduction_factor.setter

View File

@ -363,12 +363,15 @@ class ThermalZone:
return None return None
_lighting_density += usage.percentage * usage.lighting.density _lighting_density += usage.percentage * usage.lighting.density
if usage.lighting.convective_fraction is not None: if usage.lighting.convective_fraction is not None:
_convective_part += usage.percentage * usage.lighting.density \ _convective_part += (
* usage.lighting.convective_fraction usage.percentage * usage.lighting.density * usage.lighting.convective_fraction
_radiative_part += usage.percentage * usage.lighting.density \ )
* usage.lighting.radiative_fraction _radiative_part += (
_latent_part += usage.percentage * usage.lighting.density \ usage.percentage * usage.lighting.density * usage.lighting.radiative_fraction
* usage.lighting.latent_fraction )
_latent_part += (
usage.percentage * usage.lighting.density * usage.lighting.latent_fraction
)
self._lighting.density = _lighting_density self._lighting.density = _lighting_density
if _lighting_density > 0: if _lighting_density > 0:
self._lighting.convective_fraction = _convective_part / _lighting_density self._lighting.convective_fraction = _convective_part / _lighting_density
@ -421,12 +424,15 @@ class ThermalZone:
return None return None
_appliances_density += usage.percentage * usage.appliances.density _appliances_density += usage.percentage * usage.appliances.density
if usage.appliances.convective_fraction is not None: if usage.appliances.convective_fraction is not None:
_convective_part += usage.percentage * usage.appliances.density \ _convective_part += (
* usage.appliances.convective_fraction usage.percentage * usage.appliances.density * usage.appliances.convective_fraction
_radiative_part += usage.percentage * usage.appliances.density \ )
* usage.appliances.radiative_fraction _radiative_part += (
_latent_part += usage.percentage * usage.appliances.density \ usage.percentage * usage.appliances.density * usage.appliances.radiative_fraction
* usage.appliances.latent_fraction )
_latent_part += (
usage.percentage * usage.appliances.density * usage.appliances.latent_fraction
)
self._appliances.density = _appliances_density self._appliances.density = _appliances_density
if _appliances_density > 0: if _appliances_density > 0:
self._appliances.convective_fraction = _convective_part / _appliances_density self._appliances.convective_fraction = _convective_part / _appliances_density
@ -486,12 +492,15 @@ class ThermalZone:
for usage in self.usages: for usage in self.usages:
for internal_gain in usage.internal_gains: for internal_gain in usage.internal_gains:
_average_internal_gain += internal_gain.average_internal_gain * usage.percentage _average_internal_gain += internal_gain.average_internal_gain * usage.percentage
_convective_fraction += internal_gain.average_internal_gain * usage.percentage \ _convective_fraction += (
* internal_gain.convective_fraction internal_gain.average_internal_gain * usage.percentage * internal_gain.convective_fraction
_radiative_fraction += internal_gain.average_internal_gain * usage.percentage \ )
* internal_gain.radiative_fraction _radiative_fraction += (
_latent_fraction += internal_gain.average_internal_gain * usage.percentage \ internal_gain.average_internal_gain * usage.percentage * internal_gain.radiative_fraction
* internal_gain.latent_fraction )
_latent_fraction += (
internal_gain.average_internal_gain * usage.percentage * internal_gain.latent_fraction
)
for usage in self.usages: for usage in self.usages:
for internal_gain in usage.internal_gains: for internal_gain in usage.internal_gains:
if internal_gain.schedules is None: if internal_gain.schedules is None:

View File

@ -21,15 +21,13 @@ from hub.city_model_structure.building import Building
from hub.city_model_structure.city_object import CityObject from hub.city_model_structure.city_object import CityObject
from hub.city_model_structure.city_objects_cluster import CityObjectsCluster from hub.city_model_structure.city_objects_cluster import CityObjectsCluster
from hub.city_model_structure.buildings_cluster import BuildingsCluster from hub.city_model_structure.buildings_cluster import BuildingsCluster
from hub.city_model_structure.fuel import Fuel
from hub.city_model_structure.iot.station import Station from hub.city_model_structure.iot.station import Station
from hub.city_model_structure.level_of_detail import LevelOfDetail from hub.city_model_structure.level_of_detail import LevelOfDetail
from hub.city_model_structure.machine import Machine
from hub.city_model_structure.parts_consisting_building import PartsConsistingBuilding from hub.city_model_structure.parts_consisting_building import PartsConsistingBuilding
from hub.helpers.geometry_helper import GeometryHelper from hub.helpers.geometry_helper import GeometryHelper
from hub.helpers.location import Location from hub.helpers.location import Location
from hub.city_model_structure.energy_system import EnergySystem from hub.city_model_structure.energy_system import EnergySystem
from hub.city_model_structure.lca_material import LcaMaterial
import pandas as pd import pandas as pd
@ -65,22 +63,6 @@ class City:
self._energy_systems_connection_table = None self._energy_systems_connection_table = None
self._generic_energy_systems = None self._generic_energy_systems = None
@property
def fuels(self) -> [Fuel]:
return self._fuels
@fuels.setter
def fuels(self, value):
self._fuels = value
@property
def machines(self) -> [Machine]:
return self._machines
@machines.setter
def machines(self, value):
self._machines = value
def _get_location(self) -> Location: def _get_location(self) -> Location:
if self._location is None: if self._location is None:
gps = pyproj.CRS('EPSG:4326') # LatLon with WGS84 datum used by GPS units and Google Earth gps = pyproj.CRS('EPSG:4326') # LatLon with WGS84 datum used by GPS units and Google Earth
@ -423,31 +405,6 @@ class City:
else: else:
raise NotImplementedError raise NotImplementedError
@property
def lca_materials(self) -> Union[List[LcaMaterial], None]:
"""
Get life cycle materials for the city
:return: [LcaMaterial] or
"""
return self._lca_materials
@lca_materials.setter
def lca_materials(self, value):
"""
Set life cycle materials for the city
"""
self._lca_materials = value
def lca_material(self, lca_id) -> Union[LcaMaterial, None]:
"""
Get the lca material matching the given Id
:return: LcaMaterial or None
"""
for lca_material in self.lca_materials:
if str(lca_material.id) == str(lca_id):
return lca_material
return None
@property @property
def copy(self) -> City: def copy(self) -> City:
""" """

View File

@ -5,12 +5,11 @@ Copyright © 2023 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
from typing import Union, List from typing import Union
from hub.city_model_structure.energy_systems.generic_generation_system import GenericGenerationSystem
from hub.city_model_structure.energy_systems.generic_distribution_system import GenericDistributionSystem from hub.city_model_structure.energy_systems.generic_distribution_system import GenericDistributionSystem
from hub.city_model_structure.energy_systems.generic_emission_system import GenericEmissionSystem from hub.city_model_structure.energy_systems.generic_emission_system import GenericEmissionSystem
from hub.city_model_structure.city_object import CityObject from hub.city_model_structure.energy_systems.generic_generation_system import GenericGenerationSystem
class GenericEnergySystem: class GenericEnergySystem:

View File

@ -1,45 +0,0 @@
"""
ConstructionFactory (before PhysicsFactory) retrieve the specific construction module for the given region
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Atiya atiya.atiya@mail.concordia.ca
"""
class Fuel:
def __init__(self, fuel_id, name, carbon_emission_factor, unit):
self._fuel_id = fuel_id
self._name = name
self._carbon_emission_factor = carbon_emission_factor
self._unit = unit
@property
def id(self) -> int:
"""
Get fuel id
:return: int
"""
return self._fuel_id
@property
def name(self) -> str:
"""
Get fuel name
:return: str
"""
return self._name
@property
def carbon_emission_factor(self) -> float:
"""
Get fuel carbon emission factor
:return: float
"""
return self._carbon_emission_factor
@property
def unit(self) -> str:
"""
Get fuel units
:return: str
"""
return self._unit

View File

@ -19,7 +19,7 @@ class Station:
def id(self): def id(self):
""" """
Get the station id a random uuid will be assigned if no ID was provided to the constructor Get the station id a random uuid will be assigned if no ID was provided to the constructor
:return: Id :return: ID
""" """
if self._id is None: if self._id is None:
self._id = uuid.uuid4() self._id = uuid.uuid4()

View File

@ -1,242 +0,0 @@
"""
LCA Material module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder atiya.atiya@mail.concordia.ca
"""
from typing import Union
class LcaMaterial:
def __init__(self):
self._id = None
self._type = None
self._name = None
self._density = None
self._density_unit = None
self._embodied_carbon = None
self._embodied_carbon_unit = None
self._recycling_ratio = None
self._company_recycling_ratio = None
self._onsite_recycling_ratio = None
self._landfilling_ratio = None
self._cost = None
self._cost_unit = None
@property
def id(self):
"""
Get material id
:return: int
"""
return self._id
@id.setter
def id(self, value):
"""
Set material id
:param value: int
"""
self._id = int(value)
@property
def type(self):
"""
Get material type
:return: str
"""
return self._type
@type.setter
def type(self, value):
"""
Set material type
:param value: string
"""
self._type = str(value)
@property
def name(self):
"""
Get material name
:return: str
"""
return self._name
@name.setter
def name(self, value):
"""
Set material name
:param value: string
"""
self._name = str(value)
@property
def density(self) -> Union[None, float]:
"""
Get material density in kg/m3
:return: None or float
"""
return self._density
@density.setter
def density(self, value):
"""
Set material density
:param value: float
"""
if value is not None:
self._density = float(value)
@property
def density_unit(self) -> Union[None, str]:
"""
Get material density unit
:return: None or string
"""
return self._density_unit
@density_unit.setter
def density_unit(self, value):
"""
Set material density unit
:param value: string
"""
if value is not None:
self._density_unit = str(value)
@property
def embodied_carbon(self) -> Union[None, float]:
"""
Get material embodied carbon
:return: None or float
"""
return self._embodied_carbon
@embodied_carbon.setter
def embodied_carbon(self, value):
"""
Set material embodied carbon
:param value: float
"""
if value is not None:
self._embodied_carbon = float(value)
@property
def embodied_carbon_unit(self) -> Union[None, str]:
"""
Get material embodied carbon unit
:return: None or string
"""
return self._embodied_carbon
@embodied_carbon_unit.setter
def embodied_carbon_unit(self, value):
"""
Set material embodied carbon unit
:param value: string
"""
if value is not None:
self._embodied_carbon_unit = str(value)
@property
def recycling_ratio(self) -> Union[None, float]:
"""
Get material recycling ratio
:return: None or float
"""
return self._recycling_ratio
@recycling_ratio.setter
def recycling_ratio(self, value):
"""
Set material recycling ratio
:param value: float
"""
if value is not None:
self._recycling_ratio = float(value)
@property
def onsite_recycling_ratio(self) -> Union[None, float]:
"""
Get material onsite recycling ratio
:return: None or float
"""
return self._onsite_recycling_ratio
@onsite_recycling_ratio.setter
def onsite_recycling_ratio(self, value):
"""
Set material onsite recycling ratio
:param value: float
"""
if value is not None:
self._onsite_recycling_ratio = float(value)
@property
def company_recycling_ratio(self) -> Union[None, float]:
"""
Get material company recycling ratio
:return: None or float
"""
return self._company_recycling_ratio
@company_recycling_ratio.setter
def company_recycling_ratio(self, value):
"""
Set material company recycling ratio
:param value: float
"""
if value is not None:
self._company_recycling_ratio = float(value)
@property
def landfilling_ratio(self) -> Union[None, float]:
"""
Get material landfilling ratio
:return: None or float
"""
return self._landfilling_ratio
@landfilling_ratio.setter
def landfilling_ratio(self, value):
"""
Set material landfilling ratio
:param value: float
"""
if value is not None:
self._landfilling_ratio = float(value)
@property
def cost(self) -> Union[None, float]:
"""
Get material cost
:return: None or float
"""
return self._cost
@cost.setter
def cost(self, value):
"""
Set material cost
:param value: float
"""
if value is not None:
self._cost = float(value)
@property
def cost_unit(self) -> Union[None, str]:
"""
Get material cost unit
:return: None or string
"""
return self._cost_unit
@cost_unit.setter
def cost_unit(self, value):
"""
Set material cost unit
:param value: string
"""
if value is not None:
self._cost_unit = float(value)

View File

@ -1,87 +0,0 @@
"""
LifeCycleAssessment retrieve the specific Life Cycle Assessment module for the given region
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Atiya atiya.atiya@mail.concordia.ca
"""
class Machine:
"""
Machine class
"""
def __init__(self, machine_id, name, work_efficiency, work_efficiency_unit, energy_consumption_rate,
energy_consumption_unit, carbon_emission_factor, carbon_emission_unit):
self._machine_id = machine_id
self._name = name
self._work_efficiency = work_efficiency
self._work_efficiency_unit = work_efficiency_unit
self._energy_consumption_rate = energy_consumption_rate
self._energy_consumption_unit = energy_consumption_unit
self._carbon_emission_factor = carbon_emission_factor
self._carbon_emission_unit = carbon_emission_unit
@property
def id(self) -> int:
"""
Get machine id
:return: int
"""
return self._machine_id
@property
def name(self) -> str:
"""
Get machine name
:return: str
"""
return self._name
@property
def work_efficiency(self) -> float:
"""
Get machine work efficiency
:return: float
"""
return self._work_efficiency
@property
def work_efficiency_unit(self) -> str:
"""
Get machine work efficiency unit
:return: str
"""
return self._work_efficiency_unit
@property
def energy_consumption_rate(self) -> float:
"""
Get energy consumption rate
:return: float
"""
return self._energy_consumption_rate
@property
def energy_consumption_unit(self) -> str:
"""
Get energy consumption unit
:return: str
"""
return self._energy_consumption_unit
@property
def carbon_emission_factor(self) -> float:
"""
Get carbon emission factor
:return: float
"""
return self._carbon_emission_factor
@property
def carbon_emission_unit(self) -> str:
"""
Get carbon emission unit
:return: str
"""
return self._carbon_emission_unit

View File

@ -1,68 +0,0 @@
"""
LifeCycleAssessment retrieve the specific Life Cycle Assessment module for the given region
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Atiya atiya.atiya@mail.concordia.ca
"""
class Vehicle:
"""
Vehicle class
"""
def __init__(self, vehicle_id, name, fuel_consumption_rate, fuel_consumption_unit, carbon_emission_factor,
carbon_emission_factor_unit):
self._vehicle_id = vehicle_id
self._name = name
self._fuel_consumption_rate = fuel_consumption_rate
self._fuel_consumption_unit = fuel_consumption_unit
self._carbon_emission_factor = carbon_emission_factor
self._carbon_emission_factor_unit = carbon_emission_factor_unit
@property
def id(self) -> int:
"""
Get vehicle id
:return: int
"""
return self._vehicle_id
@property
def name(self) -> str:
"""
Get vehicle name
:return: str
"""
return self._name
@property
def fuel_consumption_rate(self) -> float:
"""
Get vehicle fuel consumption rate
:return: float
"""
return self._fuel_consumption_rate
@property
def fuel_consumption_unit(self) -> str:
"""
Get fuel consumption unit
:return: str
"""
return self._fuel_consumption_unit
@property
def carbon_emission_factor(self) -> float:
"""
Get vehicle carbon emission factor
:return: float
"""
return self._carbon_emission_factor
@property
def carbon_emission_factor_unit(self) -> str:
"""
Get carbon emission units
:return: str
"""
return self._carbon_emission_factor_unit

View File

@ -1,166 +0,0 @@
<archetypes>
<archetype function="residential" municipality="montreal" currency="CAD">
<capital_cost>
<ASubstructure>
<A10sub_structural cost_unit="currency/m2"> 15.89 </A10sub_structural>
<A20structural cost_unit="currency/m3"> 215.90 </A20structural>
</ASubstructure>
<BShell>
<B10superstructure>
<reposition cost_unit="currency/m2"> 0 </reposition>
<initial_investment cost_unit="currency/m2"> 0 </initial_investment>
<lifetime_equipment lifetime="years"> 50 </lifetime_equipment>
</B10superstructure>
<B20envelope>
<B2010opaquewalls>
<reposition cost_unit="currency/m2"> 304 </reposition>
<initial_investment cost_unit="currency/m2"> 304 </initial_investment>
<lifetime_equipment lifetime="years"> 50 </lifetime_equipment>
</B2010opaquewalls>
<B2020transparent>
<reposition cost_unit="currency/m2"> 857.14 </reposition>
<initial_investment cost_unit="currency/m2"> 857.14 </initial_investment>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</B2020transparent>
</B20envelope>
<B30roofing>
<B3010opaqueroof>
<reposition cost_unit="currency/m2"> 118 </reposition>
<initial_investment cost_unit="currency/m2"> 118 </initial_investment>
<lifetime_equipment lifetime="years"> 50 </lifetime_equipment>
</B3010opaqueroof>
<B3020transparentroof>
<reposition cost_unit="currency/m2"> 857.14 </reposition>
<initial_investment cost_unit="currency/m2"> 857.14 </initial_investment>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</B3020transparentroof>
</B30roofing>
</BShell>
<CInteriors>
<C10Interiorconstruction>
<reposition cost_unit="currency/m2"> 0 </reposition>
<initial_investment cost_unit="currency/m2"> 0 </initial_investment>
<lifetime_equipment lifetime="years"> 50 </lifetime_equipment>
</C10Interiorconstruction>
<C20Stairs>
<reposition cost_unit="currency/m2"> 0 </reposition>
<initial_investment cost_unit="currency/m2"> 0 </initial_investment>
<lifetime_equipment lifetime="years"> 50 </lifetime_equipment>
</C20Stairs>
<C30Interiorfinishes>
<C3010Walls>
<reposition cost_unit="currency/m2"> 50 </reposition>
<initial_investment cost_unit="currency/m2"> 50 </initial_investment>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</C3010Walls>
<C3020Floors>
<reposition cost_unit="currency/m2"> 62 </reposition>
<initial_investment cost_unit="currency/m2"> 62 </initial_investment>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</C3020Floors>
<C3030Ceilings>
<reposition cost_unit="currency/m2"> 70 </reposition>
<initial_investment cost_unit="currency/m2"> 70 </initial_investment>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</C3030Ceilings>
</C30Interiorfinishes>
</CInteriors>
<DServices>
<D10Conveying cost_unit="currency/m2"> 0 </D10Conveying>
<D20Plumbing cost_unit="currency/m2"> 100 </D20Plumbing>
<D30HVAC>
<D3010EnergySupply>
<D301010photovoltaic_system>
<initial_investment cost_unit="currency/m2"> 800 </initial_investment>
<reposition cost_unit="currency/m2"> 800 </reposition>
<lifetime_equipment lifetime="years"> 25 </lifetime_equipment>
</D301010photovoltaic_system>
</D3010EnergySupply>
<D3020Heatgeneratingsystems>
<initial_investment cost_unit="currency/kW"> 622.86 </initial_investment>
<reposition cost_unit="currency/kW"> 622.86 </reposition>
<lifetime_equipment lifetime="years"> 25 </lifetime_equipment>
</D3020Heatgeneratingsystems>
<D3030Coolinggenerationsystems>
<initial_investment cost_unit="currency/kW"> 622.86 </initial_investment>
<reposition cost_unit="currency/kW"> 622.86 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3030Coolinggenerationsystems>
<D3040Distributionsystems>
<initial_investment cost_unit="currency/kW"> 0 </initial_investment>
<reposition cost_unit="currency/kW"> 0 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3040Distributionsystems>
<D3060Controlsandinstrumentation>
<initial_investment cost_unit="currency/kW"> 0 </initial_investment>
<reposition cost_unit="currency/kW"> 0 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3060Controlsandinstrumentation>
<D3080OtherHVAC_AHU>
<initial_investment cost_unit="currency/kW"> 47.62 </initial_investment>
<reposition cost_unit="currency/kW"> 47.62 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3080OtherHVAC_AHU>
</D30HVAC>
<D50Electrical>
<D5010Electricalservicesanddistribution>
<initial_investment cost_unit="currency/m2"> 171.43 </initial_investment>
<reposition cost_unit="currency/m2"> 171.43 </reposition>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</D5010Electricalservicesanddistribution>
<D5020Lightingandbranchwiring>
<initial_investment cost_unit="currency/kW"> 139 </initial_investment>
<reposition cost_unit="currency/kW"> 139 </reposition>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</D5020Lightingandbranchwiring>
</D50Electrical>
</DServices>
<EEquimentsandfurnishing>
<E10Equipments>
<initial_investment cost_unit="currency/m2"> 0 </initial_investment>
<reposition cost_unit="currency/m2"> 0 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</E10Equipments>
<E10Furnishing>
<initial_investment cost_unit="currency/m2"> 0 </initial_investment>
<reposition cost_unit="currency/m2"> 0 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</E10Furnishing>
</EEquimentsandfurnishing>
<engineer cost_unit="%"> 2.5 </engineer>
</capital_cost>
<operational_cost>
<fuel fuel_type="electricity">
<fixed>
<fixed_monthly cost_unit="currency/month"> 0 </fixed_monthly>
<fixed_power cost_unit="currency/kW"> 0 </fixed_power>
</fixed>
<variable cost_unit="currency/kWh"> 5.6 </variable>
</fuel>
<maintenance>
<heating_equipment cost_unit="currency/kW"> 40 </heating_equipment>
<cooling_equipment cost_unit="currency/kW"> 40 </cooling_equipment>
<general_hvac_equipment cost_unit="currency/(m3/h)"> 0.05 </general_hvac_equipment>
<photovoltaic_system cost_unit="currency/m2"> 1 </photovoltaic_system>
<other_systems cost_unit="currency/m2"> 4.6 </other_systems>
</maintenance>
<CO2_cost cost_unit="currency/kgCO2"> 30 </CO2_cost>
</operational_cost>
<end_of_life_cost cost_unit="currency/m2"> 6.3 </end_of_life_cost>
<incomes>
<subsidies>
<construction_subsidy cost_unit="%"> 2 </construction_subsidy>
<hvac_subsidy cost_unit="%"> 1.5 </hvac_subsidy>
<photovoltaic_subsidy cost_unit="%"> 3.6 </photovoltaic_subsidy>
</subsidies>
<energy_exports>
<electricity cost_unit="currency/kWh"> hourlydatatable </electricity>
<heat cost_unit="currency/kWh"> 0 </heat>
</energy_exports>
<tax_reductions>
<reductions_taxes cost_unit="%"> 2 </reductions_taxes>
</tax_reductions>
<CO2_income cost_unit="currency/kgCO2exported"> 0 </CO2_income>
</incomes>
</archetype>
</archetypes>

View File

@ -1,212 +0,0 @@
<archetypes>
<archetype function="residential" municipality="montreal" currency="CAD">
<capital_cost>
<B_Shell>
<B10_superstructure>
<refurbishment_cost_basement cost_unit="currency/m2"> 0 </refurbishment_cost_basement>
</B10_superstructure>
<B20_envelope>
<B2010_opaquewalls>
<refurbishment_cost cost_unit="currency/m2"> 304 </refurbishment_cost>
</B2010_opaquewalls>
<B2020_transparent>
<refurbishment_cost cost_unit="currency/m2"> 857.14 </refurbishment_cost>
</B2020_transparent>
</B20_envelope>
<B30_roofing>
<B3010_opaqueroof>
<refurbishment_cost cost_unit="currency/m2"> 118 </refurbishment_cost>
</B3010_opaqueroof>
</B30_roofing>
</B_Shell>
<D_Services>
<D30_HVAC>
<D3010_EnergySupply>
<D301010_Photovoltaic_system>
<initial_investment cost_unit="currency/m2"> 800 </initial_investment>
<reposition cost_unit="currency/m2"> 800 </reposition>
<lifetime_equipment lifetime="years"> 25 </lifetime_equipment>
</D301010_Photovoltaic_system>
</D3010_EnergySupply>
<D3020_Heat_generating_systems>
<investment_cost cost_unit="currency/kW"> 622.86 </investment_cost>
<reposition cost_unit="currency/kW"> 622.86 </reposition>
<lifetime_equipment lifetime="years"> 25 </lifetime_equipment>
</D3020_Heat_generating_systems>
<D3030_Cooling_generation_systems>
<investment_cost cost_unit="currency/kW"> 622.86 </investment_cost>
<reposition cost_unit="currency/kW"> 622.86 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3030_Cooling_generation_systems>
<D3040_Distributionsystems>
<investment_cost cost_unit="currency/kW"> 0 </investment_cost>
<reposition cost_unit="currency/kW"> 0 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3040_Distributionsystems>
<D3080_OtherHVAC_AHU>
<investment_cost cost_unit="currency/kW"> 47.62 </investment_cost>
<reposition cost_unit="currency/kW"> 47.62 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3080_OtherHVAC_AHU>
</D30_HVAC>
<D50_Electrical>
<D5020Lightingandbranchwiring>
<refurbishmentcost cost_unit="currency/kW"> 139 </refurbishmentcost>
<reposition cost_unit="currency/kW"> 139 </reposition>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</D5020Lightingandbranchwiring>
</D50_Electrical>
</D_Services>
<Z_Allowances_overhead_profit>
<Z10_Design_allowance cost_unit="%"> 2.5 </Z10_Design_allowance>
<Z10_Overhead_and_profit cost_unit="%"> 14 </Z10_Overhead_and_profit>
</Z_Allowances_overhead_profit>
</capital_cost>
<operational_cost>
<fuel fuel_type="electricity">
<fixed>
<fixed_monthly cost_unit="currency/month"> 12.27 </fixed_monthly>
<fixed_power cost_unit="currency/month*kW"> 0 </fixed_power>
</fixed>
<variable cost_unit="currency/kWh"> 0.075 </variable>
</fuel>
<fuel fuel_type="gas">
<fixed>
<fixed_monthly cost_unit="currency/month"> 17.71 </fixed_monthly>
</fixed>
<variable cost_unit="currency/kWh"> 0.640 </variable>
</fuel>
<fuel fuel_type="diesel">
<variable cost_unit="currency/l"> 1.2 </variable>
</fuel>
<fuel fuel_type="biomass">
<variable cost_unit="currency/kg"> 0.09 </variable>
</fuel>
<maintenance>
<heating_equipment cost_unit="currency/kW"> 40 </heating_equipment>
<cooling_equipment cost_unit="currency/kW"> 40 </cooling_equipment>
<photovoltaic_system cost_unit="currency/m2"> 1 </photovoltaic_system>
</maintenance>
<CO2_cost cost_unit="currency/kgCO2"> 30 </CO2_cost>
</operational_cost>
<end_of_life_cost cost_unit="currency/m2"> 6.3 </end_of_life_cost>
<incomes>
<subsidies>
<construction_subsidy cost_unit="%"> 2 </construction_subsidy>
<hvac_subsidy cost_unit="%"> 1.5 </hvac_subsidy>
<photovoltaic_subsidy cost_unit="%"> 3.6 </photovoltaic_subsidy>
</subsidies>
<energy_exports>
<electricity cost_unit="currency/kWh"> 0 </electricity>
</energy_exports>
<tax_reductions>
<reductions_taxes cost_unit="%"> 2 </reductions_taxes>
</tax_reductions>
</incomes>
</archetype>
<archetype function="non-residential" municipality="montreal" currency="CAD">
<capital_cost>
<B_Shell>
<B10_superstructure>
<refurbishmentcostbasement cost_unit="currency/m2"> 0 </refurbishmentcostbasement>
</B10_superstructure>
<B20_envelope>
<B2010_opaque_walls>
<refurbishmentcost cost_unit="currency/m2"> 304 </refurbishmentcost>
</B2010_opaque_walls>
<B2020_transparent>
<refurbishmentcost cost_unit="currency/m2"> 857.14 </refurbishmentcost>
</B2020_transparent>
</B20_envelope>
<B30_roofing>
<B3010_opaqueroof>
<refurbishmentcost cost_unit="currency/m2"> 118 </refurbishmentcost>
</B3010_opaqueroof>
</B30_roofing>
</B_Shell>
<D_Services>
<D30_HVAC>
<D3010EnergySupply>
<D301010photovoltaic_system>
<initial_investment cost_unit="currency/m2"> 800 </initial_investment>
<reposition cost_unit="currency/m2"> 800 </reposition>
<lifetime_equipment lifetime="years"> 25 </lifetime_equipment>
</D301010photovoltaic_system>
</D3010EnergySupply>
<D3020Heatgeneratingsystems>
<investment_cost cost_unit="currency/kW"> 622.86 </investment_cost>
<reposition cost_unit="currency/kW"> 622.86 </reposition>
<lifetime_equipment lifetime="years"> 25 </lifetime_equipment>
</D3020Heatgeneratingsystems>
<D3030_Cooling_generation_systems>
<investment_cost cost_unit="currency/kW"> 622.86 </investment_cost>
<reposition cost_unit="currency/kW"> 622.86 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3030_Cooling_generation_systems>
<D3040_Distribution_systems>
<refurbishmentcost cost_unit="currency/m2"> 0 </refurbishmentcost>
<reposition cost_unit="currency/kW"> 0 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3040_Distribution_systems>
<D3080_Other_HVAC_AHU>
<investment_cost cost_unit="currency/kW"> 47.62 </investment_cost>
<reposition cost_unit="currency/kW"> 47.62 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3080_Other_HVAC_AHU>
</D30_HVAC>
<D50_Electrical>
<D5020_Lighting_and_branch_wiring>
<refurbishmentcost cost_unit="currency/kW"> 139 </refurbishmentcost>
<reposition cost_unit="currency/kW"> 139 </reposition>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</D5020_Lighting_and_branch_wiring>
</D50_Electrical>
</D_Services>
<Z_Allowances_overhead_profit>
<Z10_Design_allowance cost_unit="%"> 6 </Z10_Design_allowance>
<Z20_Overhead_profit cost_unit="%"> 14 </Z20_Overhead_profit>
</Z_Allowances_overhead_profit>
</capital_cost>
<operational_cost>
<fuel fuel_type="electricity">
<fixed>
<fixed_monthly cost_unit="currency/month"> 12.27 </fixed_monthly>
<fixed_power cost_unit="currency/(month*kW)"> 0 </fixed_power>
</fixed>
<variable cost_unit="currency/kWh"> 0.075 </variable>
</fuel>
<fuel fuel_type="gas">
<fixed>
<fixed_monthly cost_unit="currency/month"> 17.71 </fixed_monthly>
</fixed>
<variable cost_unit="currency/m3"> 0.640 </variable>
</fuel>
<fuel fuel_type="diesel">
<variable cost_unit="currency/l"> 1.2 </variable>
</fuel>
<fuel fuel_type="biomass">
<variable cost_unit="currency/kg"> 0.09 </variable>
</fuel>
<maintenance>
<heating_equipment cost_unit="currency/kW"> 40 </heating_equipment>
<cooling_equipment cost_unit="currency/kW"> 40 </cooling_equipment>
<photovoltaic_system cost_unit="currency/m2"> 1 </photovoltaic_system>
</maintenance>
<CO2_cost cost_unit="currency/kgCO2"> 30 </CO2_cost>
</operational_cost>
<end_of_life_cost cost_unit="currency/m2"> 6.3 </end_of_life_cost>
<incomes>
<subsidies>
<construction_subsidy cost_unit="%"> 2 </construction_subsidy>
<hvac_subsidy cost_unit="%"> 1.5 </hvac_subsidy>
<photovoltaic_subsidy cost_unit="%"> 3.6 </photovoltaic_subsidy>
</subsidies>
<energy_exports>
<electricity cost_unit="currency/kWh"> 0 </electricity>
</energy_exports>
<tax_reductions>
<reductions_taxes cost_unit="%"> 2 </reductions_taxes>
</tax_reductions>
</incomes>
</archetype>
</archetypes>

View File

@ -1,178 +0,0 @@
<archetypes>
<archetype function="residential" municipality="montreal" currency="CAD">
<capital_cost>
<ASubstructure>
<A10sub_structural cost_unit="currency/m2"> 15.89 </A10sub_structural>
<A20structural cost_unit="currency/m3"> 215.90 </A20structural>
</ASubstructure>
<BShell>
<B10superstructure>
<reposition cost_unit="currency/m2"> 0 </reposition>
<initial_investment cost_unit="currency/m2"> 0 </initial_investment>
<lifetime_equipment lifetime="years"> 50 </lifetime_equipment>
</B10superstructure>
<B20envelope>
<B2010opaquewalls>
<reposition cost_unit="currency/m2"> 304 </reposition>
<initial_investment cost_unit="currency/m2"> 304 </initial_investment>
<lifetime_equipment lifetime="years"> 50 </lifetime_equipment>
</B2010opaquewalls>
<B2020transparent>
<reposition cost_unit="currency/m2"> 857.14 </reposition>
<initial_investment cost_unit="currency/m2"> 857.14 </initial_investment>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</B2020transparent>
</B20envelope>
<B30roofing>
<B3010opaqueroof>
<reposition cost_unit="currency/m2"> 118 </reposition>
<initial_investment cost_unit="currency/m2"> 118 </initial_investment>
<lifetime_equipment lifetime="years"> 50 </lifetime_equipment>
</B3010opaqueroof>
<B3020transparentroof>
<reposition cost_unit="currency/m2"> 857.14 </reposition>
<initial_investment cost_unit="currency/m2"> 857.14 </initial_investment>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</B3020transparentroof>
</B30roofing>
</BShell>
<CInteriors>
<C10Interiorconstruction>
<reposition cost_unit="currency/m2"> 0 </reposition>
<initial_investment cost_unit="currency/m2"> 0 </initial_investment>
<lifetime_equipment lifetime="years"> 50 </lifetime_equipment>
</C10Interiorconstruction>
<C20Stairs>
<reposition cost_unit="currency/m2"> 0 </reposition>
<initial_investment cost_unit="currency/m2"> 0 </initial_investment>
<lifetime_equipment lifetime="years"> 50 </lifetime_equipment>
</C20Stairs>
<C30Interiorfinishes>
<C3010Walls>
<reposition cost_unit="currency/m2"> 50 </reposition>
<initial_investment cost_unit="currency/m2"> 50 </initial_investment>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</C3010Walls>
<C3020Floors>
<reposition cost_unit="currency/m2"> 62 </reposition>
<initial_investment cost_unit="currency/m2"> 62 </initial_investment>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</C3020Floors>
<C3030Ceilings>
<reposition cost_unit="currency/m2"> 70 </reposition>
<initial_investment cost_unit="currency/m2"> 70 </initial_investment>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</C3030Ceilings>
</C30Interiorfinishes>
</CInteriors>
<DServices>
<D10Conveying cost_unit="currency/m2"> 0 </D10Conveying>
<D20Plumbing cost_unit="currency/m2"> 100 </D20Plumbing>
<D30HVAC>
<D3010EnergySupply>
<D301010photovoltaic_system>
<initial_investment cost_unit="currency/m2"> 800 </initial_investment>
<reposition cost_unit="currency/m2"> 800 </reposition>
<lifetime_equipment lifetime="years"> 25 </lifetime_equipment>
</D301010photovoltaic_system>
</D3010EnergySupply>
<D3020Heatgeneratingsystems>
<initial_investment cost_unit="currency/kW"> 622.86 </initial_investment>
<reposition cost_unit="currency/kW"> 622.86 </reposition>
<lifetime_equipment lifetime="years"> 25 </lifetime_equipment>
</D3020Heatgeneratingsystems>
<D3030Coolinggenerationsystems>
<initial_investment cost_unit="currency/kW"> 622.86 </initial_investment>
<reposition cost_unit="currency/kW"> 622.86 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3030Coolinggenerationsystems>
<D3040Distributionsystems>
<initial_investment cost_unit="currency/kW"> 0 </initial_investment>
<reposition cost_unit="currency/kW"> 0 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3040Distributionsystems>
<D3060Controlsandinstrumentation>
<initial_investment cost_unit="currency/kW"> 0 </initial_investment>
<reposition cost_unit="currency/kW"> 0 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3060Controlsandinstrumentation>
<D3080OtherHVAC_AHU>
<initial_investment cost_unit="currency/kW"> 47.62 </initial_investment>
<reposition cost_unit="currency/kW"> 47.62 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</D3080OtherHVAC_AHU>
</D30HVAC>
<D50Electrical>
<D5010Electricalservicesanddistribution>
<initial_investment cost_unit="currency/m2"> 171.43 </initial_investment>
<reposition cost_unit="currency/m2"> 171.43 </reposition>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</D5010Electricalservicesanddistribution>
<D5020Lightingandbranchwiring>
<initial_investment cost_unit="currency/kW"> 139 </initial_investment>
<reposition cost_unit="currency/kW"> 139 </reposition>
<lifetime_equipment lifetime="years"> 20 </lifetime_equipment>
</D5020Lightingandbranchwiring>
</D50Electrical>
</DServices>
<EEquimentsandfurnishing>
<E10Equipments>
<initial_investment cost_unit="currency/m2"> 0 </initial_investment>
<reposition cost_unit="currency/m2"> 0 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</E10Equipments>
<E10Furnishing>
<initial_investment cost_unit="currency/m2"> 0 </initial_investment>
<reposition cost_unit="currency/m2"> 0 </reposition>
<lifetime_equipment lifetime="years"> 15 </lifetime_equipment>
</E10Furnishing>
</EEquimentsandfurnishing>
<engineer cost_unit="%"> 2.5 </engineer>
</capital_cost>
<operational_cost>
<fuel fuel_type="electricity">
<fixed>
<fixed_monthly cost_unit="currency/month"> 12.27 </fixed_monthly>
</fixed>
<variable_base cost_unit="currency/kWh"> hourlydatatable1 </variable_base>
<variable_peak cost_unit="currency/kWh"> hourlydatatable2 </variable_peak>
</fuel>
<fuel fuel_type="gaz">
<fixed>
<fixed_monthly cost_unit="currency/month"> 17.71 </fixed_monthly>
</fixed>
<variable cost_unit="currency/m3"> 0.640 </variable>
</fuel>
<fuel fuel_type="diesel">
<variable cost_unit="currency/l"> 1.2 </variable>
</fuel>
<fuel fuel_type="biomass">
<variable cost_unit="currency/kg"> 0.09 </variable>
</fuel>
<maintenance>
<heating_equipment cost_unit="currency/kW"> 40 </heating_equipment>
<cooling_equipment cost_unit="currency/kW"> 40 </cooling_equipment>
<general_hvac_equipment cost_unit="currency/(m3/h)"> 0.05 </general_hvac_equipment>
<photovoltaic_system cost_unit="currency/m2"> 1 </photovoltaic_system>
<other_systems cost_unit="currency/m2"> 4.6 </other_systems>
</maintenance>
<CO2_cost cost_unit="currency/kgCO2"> 30 </CO2_cost>
</operational_cost>
<end_of_life_cost cost_unit="currency/m2"> 6.3 </end_of_life_cost>
<incomes>
<subsidies>
<construction_subsidy cost_unit="%"> 2 </construction_subsidy>
<hvac_subsidy cost_unit="%"> 1.5 </hvac_subsidy>
<photovoltaic_subsidy cost_unit="%"> 3.6 </photovoltaic_subsidy>
</subsidies>
<energy_exports>
<electricity cost_unit="currency/kWh"> hourlydatatable </electricity>
<heat cost_unit="currency/kWh"> 0 </heat>
</energy_exports>
<tax_reductions>
<reductions_taxes cost_unit="%"> 2 </reductions_taxes>
</tax_reductions>
<CO2_income cost_unit="currency/kgCO2exported"> 0 </CO2_income>
</incomes>
</archetype>
</archetypes>

View File

@ -97,7 +97,7 @@ P 40
B 41 CONST B 41 CONST
P 41 P 41
$HPDisactivationTemperature % Constant value $HPDeactivationTemperature % Constant value
B 42 CONST B 42 CONST
P 42 P 42

View File

@ -97,7 +97,7 @@ P 30
B 31 CONST B 31 CONST
P 31 P 31
$HPDisactivationTemperature % Constant value $HPDeactivationTemperature % Constant value
B 32 CONST B 32 CONST
P 32 P 32

View File

@ -339,7 +339,7 @@ P 142
B 143 CONST B 143 CONST
P 143 P 143
$HPDisactivationTemperature % Constant value $HPDeactivationTemperature % Constant value
B 144 CONST B 144 CONST
P 144 P 144

View File

@ -303,7 +303,7 @@ P 106
B 107 CONST B 107 CONST
P 107 P 107
$HPDisactivationTemperature % Constant value $HPDeactivationTemperature % Constant value
B 108 CONST B 108 CONST
P 108 P 108

View File

@ -1,559 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<library name="LCA">
<fuels>
<fuel id="1" name="Black_coal">
<carbon_emission_factor unit="kgCO2/ kWh">0.32</carbon_emission_factor>
</fuel>
<fuel id="2" name="Brown_coal">
<carbon_emission_factor unit="kgCO2/ kWh">0.4</carbon_emission_factor>
</fuel>
<fuel id="3" name="Brown_coal_briquette">
<carbon_emission_factor unit="kgCO2/ kWh">0.4</carbon_emission_factor>
</fuel>
<fuel id="4" name="Brown_coal_coke">
<carbon_emission_factor unit="kgCO2/ kWh">0.5</carbon_emission_factor>
</fuel>
<fuel id="5" name="CNG">
<carbon_emission_factor unit="kgCO2/ kWh">0.18</carbon_emission_factor>
</fuel>
<fuel id="6" name="Coal_coke">
<carbon_emission_factor unit="kgCO2/ kWh">0.39</carbon_emission_factor>
</fuel>
<fuel id="7" name="Crude_oil">
<carbon_emission_factor unit="kgCO2/ kWh">0.27</carbon_emission_factor>
</fuel>
<fuel id="8" name="Diesel_Machine">
<carbon_emission_factor unit="kgCO2/ liter">4.16</carbon_emission_factor>
</fuel>
<fuel id="9" name="Diesel_Vehicle">
<carbon_emission_factor unit="kgCO2/ liter">2.24</carbon_emission_factor>
</fuel>
<fuel id="10" name="Ethane">
<carbon_emission_factor unit="kgCO2/ kWh">0.2</carbon_emission_factor>
</fuel>
<fuel id="11" name="Fuel_oil">
<carbon_emission_factor unit="kgCO2/ liter">3.19</carbon_emission_factor>
</fuel>
<fuel id="12" name="Gas_flared">
<carbon_emission_factor unit="kgCO2/ kg">3.53</carbon_emission_factor>
</fuel>
<fuel id="13" name="Kerosene">
<carbon_emission_factor unit="kgCO2/ kWh">0.27</carbon_emission_factor>
</fuel>
<fuel id="14" name="LNG">
<carbon_emission_factor unit="kgCO2/ kWh">0.21</carbon_emission_factor>
</fuel>
<fuel id="15" name="LPG">
<carbon_emission_factor unit="kgCO2/ liter">1.69</carbon_emission_factor>
</fuel>
<fuel id="16" name="Natural_gas">
<carbon_emission_factor unit="kgCO2/ kWh">0.21</carbon_emission_factor>
</fuel>
<fuel id="17" name="Petroleum_coke">
<carbon_emission_factor unit="kgCO2/ kWh">0.35</carbon_emission_factor>
</fuel>
<fuel id="18" name="UNG">
<carbon_emission_factor unit="kgCO2/ kWh">0.18</carbon_emission_factor>
</fuel>
<fuel id="19" name="Biodiesel">
<carbon_emission_factor unit="kgCO2/ liter">0.81</carbon_emission_factor>
</fuel>
<fuel id="20" name="Bioethanol">
<carbon_emission_factor unit="kgCO2/ kg">1.21</carbon_emission_factor>
</fuel>
<fuel id="21" name="Biogas">
<carbon_emission_factor unit="kgCO2/ kg">1.61</carbon_emission_factor>
</fuel>
<fuel id="22" name="Biomass">
<carbon_emission_factor unit="kgCO2/ kg">0.11</carbon_emission_factor>
</fuel>
<fuel id="23" name="Methanol">
<carbon_emission_factor unit="kgCO2/ kg">0.3</carbon_emission_factor>
</fuel>
<fuel id="24" name="Petrol_eightyfive_ethanol">
<carbon_emission_factor unit="kgCO2/ kg">1.16</carbon_emission_factor>
</fuel>
<fuel id="25" name="Steam">
<carbon_emission_factor unit="kgCO2/ kg">0.61</carbon_emission_factor>
</fuel>
</fuels>
<machines>
<machine id="1" name="Rock_drill">
<work_efficiency unit="h/m3">0.347</work_efficiency>
<energy_consumption_rate unit="kWh/h">16.5</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kWh">0.918</carbon_emission_factor>
</machine>
<machine id="2" name="Hydraulic_hammer">
<work_efficiency unit="h/m3">0.033</work_efficiency>
<energy_consumption_rate unit="kg_fuel/h">25.2</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kg_fuel">4.16 </carbon_emission_factor>
</machine>
<machine id="3" name="Crawler_bulldozer">
<work_efficiency unit="h/m3">0.027</work_efficiency>
<energy_consumption_rate unit="kg_fuel/h3">16.8</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kg_fuel">2.239</carbon_emission_factor>
</machine>
<machine id="4" name="Crawler_excavator">
<work_efficiency unit="h/m3">0.023</work_efficiency>
<energy_consumption_rate unit="kg_fuel/h">16.8</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kg_fuel">2.239</carbon_emission_factor>
</machine>
<machine id="5" name="Crawler_hydraulic_rock_crusher">
<work_efficiency unit="h/m3">0.109</work_efficiency>
<energy_consumption_rate unit="kg_fuel/h">25.2</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kg_fuel">2.239</carbon_emission_factor>
</machine>
<machine id="6" name="Mobile_recycling_equipment">
<work_efficiency unit="h/ton">0.003</work_efficiency>
<energy_consumption_rate unit="kg_fuel/h">16.4</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kg_fuel">4.16</carbon_emission_factor>
</machine>
<machine id="7" name="Vibration_feeder">
<work_efficiency unit="h/ton">0.002</work_efficiency>
<energy_consumption_rate unit="kWh/h">11</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kWh">0.918</carbon_emission_factor>
</machine>
<machine id="8" name="Jaw_crusher">
<work_efficiency unit="h/ton">0.002</work_efficiency>
<energy_consumption_rate unit="kWh/h">90</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kWh">0.918</carbon_emission_factor>
</machine>
<machine id="9" name="Electromagnetic_separator">
<work_efficiency unit="h/ton">0.002</work_efficiency>
<energy_consumption_rate unit="kWh/h">10</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kWh">0.918</carbon_emission_factor>
</machine>
<machine id="10" name="Wind_sorting_machine">
<work_efficiency unit="h/ton">0.002</work_efficiency>
<energy_consumption_rate unit="kWh/h">11</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kWh">0.918</carbon_emission_factor>
</machine>
<machine id="11" name="Impact_crusher">
<work_efficiency unit="h/ton">0.002</work_efficiency>
<energy_consumption_rate unit="kWh/h">132</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kWh">0.918</carbon_emission_factor>
</machine>
<machine id="12" name="Double_circular_vibrating_plug">
<work_efficiency unit=" h/ton ">0.002</work_efficiency>
<energy_consumption_rate unit="kWh/h">15</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kW">0.918</carbon_emission_factor>
</machine>
<machine id="13" name="Spiral_sand_washing_machine">
<work_efficiency unit="h/ton">0.002</work_efficiency>
<energy_consumption_rate unit="kWh/h">5.5</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kWh">0.918</carbon_emission_factor>
</machine>
<machine id="14" name="Conveyor_belts">
<work_efficiency unit="h/ton">0.002</work_efficiency>
<energy_consumption_rate unit="kWh/h">22.5</energy_consumption_rate>
<carbon_emission_factor unit="kgCO2/kWh">0.918</carbon_emission_factor>
</machine>
</machines>
<vehicles>
<vehicle id="1" name="Freight_lorry_18_ton">
<fuel_consumption_rate unit="kg_fuel/ton.km">0.0123</fuel_consumption_rate>
<carbon_emission_factor unit="kgCO2/kg_fuel">2.239</carbon_emission_factor>
</vehicle>
<vehicle id="2" name="Freight_train">
<fuel_consumption_rate unit="kWh/ton.km">0.042</fuel_consumption_rate>
<carbon_emission_factor unit="kgCO2/kWh">0.918</carbon_emission_factor>
</vehicle>
<vehicle id="3" name="Freight_ship">
<fuel_consumption_rate unit="kWh/ton.km">0.01</fuel_consumption_rate>
<carbon_emission_factor unit="kgCO2/kWh">1.00000</carbon_emission_factor>
</vehicle>
<vehicle id="4" name="Freight_Air">
<fuel_consumption_rate unit="kWh/ton.km">1.3</fuel_consumption_rate>
<carbon_emission_factor unit="kgCO2/kWh">1.00000</carbon_emission_factor>
</vehicle>
</vehicles>
<building_materials>
<material type="brick" id="1" name="clay brick">
<density unit="ton/m3">1.8</density>
<embodied_carbon unit="kgCO2/ton">560</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0.3</onsite_recycling_ratio>
<company_recycling_ratio>0.7</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="brick" id="2" name="light clay brick">
<density unit="ton/m3">1.2</density>
<embodied_carbon unit="kgCO2/ton">310</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0.3</onsite_recycling_ratio>
<company_recycling_ratio>0.7</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="brick" id="3" name="refractory">
<density unit="ton/m3">2</density>
<embodied_carbon unit="kgCO2/ton">3080</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0.3</onsite_recycling_ratio>
<company_recycling_ratio>0.7</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="brick" id="4" name="sand-lime brick">
<density unit="ton/m3">1.4</density>
<embodied_carbon unit="kgCO2/ton">300</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0.3</onsite_recycling_ratio>
<company_recycling_ratio>0.7</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="concrete" id="5" name="light weight expanded clay">
<density unit="ton/m3">1.6</density>
<embodied_carbon unit="kgCO2/ton">900</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="concrete" id="6" name="lightweight Expanded perlite">
<density unit="ton/m3">1.6</density>
<embodied_carbon unit="kgCO2/ton">2340</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="concrete" id="7" name="lightweight expanded vermiculite">
<density unit="ton/m3">1.6</density>
<embodied_carbon unit="kgCO2/ton">1570</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="concrete" id="8" name="lightweight polystyrene">
<density unit="ton/m3">1.4</density>
<embodied_carbon unit="kgCO2/ton">1840</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="concrete" id="9" name="lightweight pumice">
<density unit="ton/m3">1.3</density>
<embodied_carbon unit="kgCO2/ton">410</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="concrete" id="10" name="concrete 20 MPa">
<density unit="ton/m3">2.3</density>
<embodied_carbon unit="kgCO2/ton">160</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="concrete" id="11" name="concrete 25 MPa">
<density unit="ton/m3">2.3</density>
<embodied_carbon unit="kgCO2/ton">170</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="concrete" id="12" name="concrete 30-32 MPa">
<density unit="ton/m3">2.3</density>
<embodied_carbon unit="kgCO2/ton">230</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="concrete" id="13" name="concrete 35 MPae">
<density unit="ton/m3">2.4</density>
<embodied_carbon unit="kgCO2/ton">240</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="concrete" id="14" name="concrete 50 MPa">
<density unit="ton/m3">2.4</density>
<embodied_carbon unit="kgCO2/ton">280</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="concrete" id="15" name="concrete block">
<density unit="ton/m3">2.3</density>
<embodied_carbon unit="kgCO2/ton">170</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="concrete" id="16" name="concrete roof tile">
<density unit="ton/m3">1.2</density>
<embodied_carbon unit="kgCO2/ton">440</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="glass" id="17" name="flat glass, coated">
<density unit="ton/m3">2.58</density>
<embodied_carbon unit="kgCO2/ton">2660</embodied_carbon>
<recycling_ratio>0.95</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.05</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="glass" id="18" name="glass fibre">
<density unit="ton/m3">2.58</density>
<embodied_carbon unit="kgCO2/ton">5260</embodied_carbon>
<recycling_ratio>0.95</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.05</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="insulation" id="19" name="cellulose fibre">
<density unit="ton/m3">0.06</density>
<embodied_carbon unit="kgCO2/ton">1760</embodied_carbon>
<recycling_ratio>0.9</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.1</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="insulation" id="20" name="cork slab">
<density unit="ton/m3">0.122</density>
<embodied_carbon unit="kgCO2/ton">3080</embodied_carbon>
<recycling_ratio>0.9</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.1</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="insulation" id="21" name="polystyren foam">
<density unit="ton/m3">0.028</density>
<embodied_carbon unit="kgCO2/ton">3180</embodied_carbon>
<recycling_ratio>0.9</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.1</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="insulation" id="22" name="polystyrene 10% recycled">
<density unit="ton/m3">0.024</density>
<embodied_carbon unit="kgCO2/ton">5140</embodied_carbon>
<recycling_ratio>0.9</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.1</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="insulation" id="23" name="stone wool">
<density unit="ton/m3">0.1</density>
<embodied_carbon unit="kgCO2/ton">6040</embodied_carbon>
<recycling_ratio>0.9</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.1</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="insulation" id="24" name="foam glass">
<density unit="ton/m3">0.3</density>
<embodied_carbon unit="kgCO2/ton">5380</embodied_carbon>
<recycling_ratio>0.9</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.1</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="insulation" id="25" name="glass wool mat">
<density unit="ton/m3">0.032</density>
<embodied_carbon unit="kgCO2/ton">2150</embodied_carbon>
<recycling_ratio>0.9</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.1</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="wood" id="26" name="fiberboard, hard">
<density unit="ton/m3">0.9</density>
<embodied_carbon unit="kgCO2/ton">3420</embodied_carbon>
<recycling_ratio>0.6</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.4</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="wood" id="27" name="three layerd laminated board">
<density unit="ton/m3">0.7</density>
<embodied_carbon unit="kgCO2/ton">1430</embodied_carbon>
<recycling_ratio>0.6</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.4</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="wood" id="28" name="fibreboard, soft">
<density unit="ton/m3">0.65</density>
<embodied_carbon unit="kgCO2/ton">2780</embodied_carbon>
<recycling_ratio>0.6</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.4</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="wood" id="29" name="plywood">
<density unit="ton/m3">0.72</density>
<embodied_carbon unit="kgCO2/ton">2190</embodied_carbon>
<recycling_ratio>0.6</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.4</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="covering" id="30" name="acrylic filler">
<density unit="ton/m3">1.43</density>
<embodied_carbon unit="kgCO2/ton">1070</embodied_carbon>
<recycling_ratio>0</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>0</company_recycling_ratio>
<landfilling_ratio>1</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="covering" id="31" name="anhydrite floor">
<density unit="ton/m3">1.43</density>
<embodied_carbon unit="kgCO2/ton">240</embodied_carbon>
<recycling_ratio>0</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>0</company_recycling_ratio>
<landfilling_ratio>1</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="covering" id="32" name="base plaster">
<density unit="ton/m3">1.43</density>
<embodied_carbon unit="kgCO2/ton">430</embodied_carbon>
<recycling_ratio>0</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>0</company_recycling_ratio>
<landfilling_ratio>1</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="covering" id="33" name="cement cast plaster floor">
<density unit="ton/m3">1.43</density>
<embodied_carbon unit="kgCO2/ton">340</embodied_carbon>
<recycling_ratio>0</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>0</company_recycling_ratio>
<landfilling_ratio>1</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="covering" id="34" name="cement tile">
<density unit="ton/m3">1.2</density>
<embodied_carbon unit="kgCO2/ton">440</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="covering" id="35" name="ceramic tile">
<density unit="ton/m3">2.1</density>
<embodied_carbon unit="kgCO2/ton">1410</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="covering" id="36" name="clay plaster">
<density unit="ton/m3">1.43</density>
<embodied_carbon unit="kgCO2/ton">250</embodied_carbon>
<recycling_ratio>0</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>0</company_recycling_ratio>
<landfilling_ratio>1</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="covering" id="37" name="fiber cement corrugated slab">
<density unit="ton/m3">1.44</density>
<embodied_carbon unit="kgCO2/ton">1480</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="covering" id="38" name="fiber cement facing tile">
<density unit="ton/m3">1.44</density>
<embodied_carbon unit="kgCO2/ton">2220</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="wood" id="39" name="gypsum fibreboard">
<density unit="ton/m3">1.27</density>
<embodied_carbon unit="kgCO2/ton">3960</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="covering" id="40" name="gypsum plaster board">
<density unit="ton/m3">1.15</density>
<embodied_carbon unit="kgCO2/ton">760</embodied_carbon>
<recycling_ratio>0.8</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.2</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="metal" id="41" name="steel">
<density unit="ton/m3">8</density>
<embodied_carbon unit="kgCO2/ton">3160</embodied_carbon>
<recycling_ratio> 0.98</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.02</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="metal" id="42" name="aluminium">
<density unit="ton/m3">2.7</density>
<embodied_carbon unit="kgCO2/ton">5370</embodied_carbon>
<recycling_ratio> 0.98</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.02</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
<material type="metal" id="43" name="reinforcing steel">
<density unit="ton/m3">7.85</density>
<embodied_carbon unit="kgCO2/ton">3910</embodied_carbon>
<recycling_ratio> 0.98</recycling_ratio>
<onsite_recycling_ratio>0</onsite_recycling_ratio>
<company_recycling_ratio>1</company_recycling_ratio>
<landfilling_ratio>0.02</landfilling_ratio>
<cost unit="CAD">0.1</cost>
</material>
</building_materials>
</library>

View File

@ -1,83 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<archetypes reference_library_building_type="DOE">
<archetypes ID="0" building_type="high-rise apartment" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_OfficeSmall_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="1" building_type="midrise apartment" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_ApartmentMidRise_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="2" building_type="hospital" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_Hospital_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="3" building_type="large hotel" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_HotelLarge_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="4" building_type="small hotel" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_HotelSmall_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="5" building_type="large office" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_OfficeLarge_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="6" building_type="medium office" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_OfficeMedium_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="7" building_type="small office" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_OfficeSmall_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="8" building_type="outpatient healthcare" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_OutPatientHealthCare_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="9" building_type="quick service restaurant" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_RestaurantFastFood_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="10" building_type="full service restaurant" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_RestaurantSitDown_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="11" building_type="stand-alone-retail" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_RetailStandalone_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="12" building_type="strip mall" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_RetailStripmall_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="13" building_type="primary school" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_SchoolPrimary_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="14" building_type="secondary school" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_SchoolSecondary_STD2019_Rochester.idf</path>
</idf>
</archetypes>
<archetypes ID="15" building_type="warehouse" reference_standard="ASHRAE 90.1-2019" climate_zone="ASHRAE_2009:6A">
<idf>
<path>idf_files/ASHRAE901_Warehouse_STD2019_Rochester.idf</path>
</idf>
</archetypes>
</archetypes>

View File

@ -1,8 +0,0 @@
{
"sensors": [
{ "city_object" : "EV",
"sensors": ["TOTKWCH3.IC","TOTKWEV.IC","COMPTEUR.SQD.017.IC:POWER 3P", "COMPTEUR.SQD.B1.IC:POWER 3P",
"COMPTEUR.SQD.B2.IC:POWER 3P"]
}
]
}

View File

@ -1,10 +0,0 @@
{
"sensors": [
{ "city_object" : "GM",
"sensors": ["MDICOR.GM"]
},
{ "city_object" : "GM_MB_EV",
"sensors": ["TOTAL.GAZ.MOIS.ENCS.IC"]
}
]
}

View File

@ -1,7 +0,0 @@
{
"sensors": [
{ "city_object" : "EV",
"sensors": ["MTX-017.IC", "MTACBT.IC","MTRCBT.IC"]
}
]
}

View File

@ -391,7 +391,7 @@ class EnergyAde:
'@gml:id': f'GML_{uuid.uuid4()}', '@gml:id': f'GML_{uuid.uuid4()}',
'gml:name': f'{thermal_boundary.construction_name}', 'gml:name': f'{thermal_boundary.construction_name}',
'energy:thermalBoundaryType': thermal_boundary.type, 'energy:thermalBoundaryType': thermal_boundary.type,
'energy:azumuth': { 'energy:azimuth': {
'@uom': 'rad', '@uom': 'rad',
'#text': f'{thermal_boundary.parent_surface.azimuth}' '#text': f'{thermal_boundary.parent_surface.azimuth}'
}, },

View File

@ -4,7 +4,7 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Guille Guillermo.GutierrezMorote@concordia.ca Project Coder Guille Guillermo.GutierrezMorote@concordia.ca
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
Oriol Gavaldà Torrellas oriol.gavalda@concordia.ca Oriol Gavalda Torrellas oriol.gavalda@concordia.ca
""" """
import copy import copy
from pathlib import Path from pathlib import Path
@ -150,6 +150,7 @@ class Idf:
Solar_Absorptance=layer.material.solar_absorptance, Solar_Absorptance=layer.material.solar_absorptance,
Visible_Absorptance=layer.material.visible_absorptance Visible_Absorptance=layer.material.visible_absorptance
) )
@staticmethod @staticmethod
def _create_infiltration_schedules(thermal_zone): def _create_infiltration_schedules(thermal_zone):
_infiltration_schedules = [] _infiltration_schedules = []
@ -291,10 +292,10 @@ class Idf:
return self._add_standard_compact_hourly_schedule(usage, schedule_type, new_schedules) return self._add_standard_compact_hourly_schedule(usage, schedule_type, new_schedules)
def _add_construction(self, thermal_boundary): def _add_construction(self, thermal_boundary):
vegetation_name = f'{thermal_boundary.construction_name}_{thermal_boundary.parent_surface.vegetation.name}'
for construction in self._idf.idfobjects[self._CONSTRUCTION]: for construction in self._idf.idfobjects[self._CONSTRUCTION]:
if thermal_boundary.parent_surface.vegetation is not None: if thermal_boundary.parent_surface.vegetation is not None:
if construction.Name == f'{thermal_boundary.construction_name}_' \ if construction.Name == vegetation_name:
f'{thermal_boundary.parent_surface.vegetation.name}':
return return
else: else:
if construction.Name == thermal_boundary.construction_name: if construction.Name == thermal_boundary.construction_name:
@ -310,7 +311,7 @@ class Idf:
layers = thermal_boundary.layers layers = thermal_boundary.layers
# The constructions should have at least one layer # The constructions should have at least one layer
if thermal_boundary.parent_surface.vegetation is not None: if thermal_boundary.parent_surface.vegetation is not None:
_kwargs = {'Name': f'{thermal_boundary.construction_name}_{thermal_boundary.parent_surface.vegetation.name}', _kwargs = {'Name': vegetation_name,
'Outside_Layer': thermal_boundary.parent_surface.vegetation.name} 'Outside_Layer': thermal_boundary.parent_surface.vegetation.name}
for i in range(0, len(layers) - 1): for i in range(0, len(layers) - 1):
_kwargs[f'Layer_{i + 2}'] = layers[i].material.name _kwargs[f'Layer_{i + 2}'] = layers[i].material.name
@ -348,12 +349,12 @@ class Idf:
for thermostat in self._idf.idfobjects[self._THERMOSTAT]: for thermostat in self._idf.idfobjects[self._THERMOSTAT]:
if thermostat.Name == thermostat_name: if thermostat.Name == thermostat_name:
return thermostat return thermostat
return self._idf.newidfobject(self._THERMOSTAT, return self._idf.newidfobject(
self._THERMOSTAT,
Name=thermostat_name, Name=thermostat_name,
Heating_Setpoint_Schedule_Name= Heating_Setpoint_Schedule_Name=f'Heating thermostat schedules {thermal_zone.usage_name}',
f'Heating thermostat schedules {thermal_zone.usage_name}', Cooling_Setpoint_Schedule_Name=f'Cooling thermostat schedules {thermal_zone.usage_name}'
Cooling_Setpoint_Schedule_Name= )
f'Cooling thermostat schedules {thermal_zone.usage_name}')
def _add_heating_system(self, thermal_zone, zone_name): def _add_heating_system(self, thermal_zone, zone_name):
for air_system in self._idf.idfobjects[self._IDEAL_LOAD_AIR_SYSTEM]: for air_system in self._idf.idfobjects[self._IDEAL_LOAD_AIR_SYSTEM]:
@ -370,8 +371,7 @@ class Idf:
def _add_occupancy(self, thermal_zone, zone_name): def _add_occupancy(self, thermal_zone, zone_name):
number_of_people = thermal_zone.occupancy.occupancy_density * thermal_zone.total_floor_area number_of_people = thermal_zone.occupancy.occupancy_density * thermal_zone.total_floor_area
fraction_radiant = 0 fraction_radiant = 0
total_sensible = thermal_zone.occupancy.sensible_radiative_internal_gain + \ total_sensible = thermal_zone.occupancy.sensible_radiative_internal_gain + thermal_zone.occupancy.sensible_convective_internal_gain
thermal_zone.occupancy.sensible_convective_internal_gain
if total_sensible != 0: if total_sensible != 0:
fraction_radiant = thermal_zone.occupancy.sensible_radiative_internal_gain / total_sensible fraction_radiant = thermal_zone.occupancy.sensible_radiative_internal_gain / total_sensible
@ -427,9 +427,9 @@ class Idf:
for zone in self._idf.idfobjects["ZONE"]: for zone in self._idf.idfobjects["ZONE"]:
if zone.Name == f'{zone_name}_infiltration': if zone.Name == f'{zone_name}_infiltration':
return return
schedule = f'Ventilation schedules {thermal_zone.usage_name}' schedule = f'Infiltration schedules {thermal_zone.usage_name}'
#if schedule not in self._idf.idfobjects[self._HOURLY_SCHEDULE]: if schedule not in self._idf.idfobjects[self._HOURLY_SCHEDULE]:
# return return
self._idf.newidfobject(self._INFILTRATION, self._idf.newidfobject(self._INFILTRATION,
Name=f'{zone_name}_infiltration', Name=f'{zone_name}_infiltration',
Zone_or_ZoneList_Name=zone_name, Zone_or_ZoneList_Name=zone_name,
@ -716,8 +716,8 @@ class Idf:
glazing = window_construction['Outside_Layer'] glazing = window_construction['Outside_Layer']
for material in self._idf.idfobjects[self._WINDOW_MATERIAL_SIMPLE]: for material in self._idf.idfobjects[self._WINDOW_MATERIAL_SIMPLE]:
if material['Name'] == glazing: if material['Name'] == glazing:
if material['UFactor'] == opening.overall_u_value and \ if material['UFactor'] == opening.overall_u_value and material[
material['Solar_Heat_Gain_Coefficient'] == opening.g_value: 'Solar_Heat_Gain_Coefficient'] == opening.g_value:
return True return True
return False return False
@ -737,7 +737,8 @@ class Idf:
leaf_reflectivity += plant.percentage * plant.leaf_reflectivity leaf_reflectivity += plant.percentage * plant.leaf_reflectivity
leaf_emissivity += plant.percentage * plant.leaf_emissivity leaf_emissivity += plant.percentage * plant.leaf_emissivity
minimal_stomatal_resistance += plant.percentage * plant.minimal_stomatal_resistance minimal_stomatal_resistance += plant.percentage * plant.minimal_stomatal_resistance
self._idf.newidfobject(self._MATERIAL_ROOFVEGETATION, self._idf.newidfobject(
self._MATERIAL_ROOFVEGETATION,
Name=vegetation.name, Name=vegetation.name,
Height_of_Plants=height, Height_of_Plants=height,
Leaf_Area_Index=leaf_area_index, Leaf_Area_Index=leaf_area_index,
@ -753,10 +754,8 @@ class Idf:
Thermal_Absorptance=soil.thermal_absorptance, Thermal_Absorptance=soil.thermal_absorptance,
Solar_Absorptance=soil.solar_absorptance, Solar_Absorptance=soil.solar_absorptance,
Visible_Absorptance=soil.visible_absorptance, Visible_Absorptance=soil.visible_absorptance,
Saturation_Volumetric_Moisture_Content_of_the_Soil_Layer= Saturation_Volumetric_Moisture_Content_of_the_Soil_Layer=soil.saturation_volumetric_moisture_content,
soil.saturation_volumetric_moisture_content, Residual_Volumetric_Moisture_Content_of_the_Soil_Layer=soil.residual_volumetric_moisture_content,
Residual_Volumetric_Moisture_Content_of_the_Soil_Layer= Initial_Volumetric_Moisture_Content_of_the_Soil_Layer=soil.initial_volumetric_moisture_content,
soil.residual_volumetric_moisture_content, Moisture_Diffusion_Calculation_Method=self._SIMPLE
Initial_Volumetric_Moisture_Content_of_the_Soil_Layer= )
soil.initial_volumetric_moisture_content,
Moisture_Diffusion_Calculation_Method=self._SIMPLE)

View File

@ -5,14 +5,13 @@ Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
import numpy as np import logging
from pathlib import Path from pathlib import Path
import sys
from hub.hub_logger import logger
from hub.exports.formats.insel import Insel import numpy as np
from hub.imports.weather.helpers.weather import Weather
import hub.helpers.constants as cte import hub.helpers.constants as cte
from hub.imports.weather.helpers.weather import Weather
_CONSTRUCTION_CODE = { _CONSTRUCTION_CODE = {
cte.WALL: '1', cte.WALL: '1',
@ -27,10 +26,12 @@ _CONSTRUCTION_CODE = {
_NUMBER_DAYS_PER_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] _NUMBER_DAYS_PER_MONTH = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
class InselMonthlyEnergyBalance(Insel): class InselMonthlyEnergyBalance:
def __init__(self, city, path, radiation_calculation_method='sra', weather_format='epw'): def __init__(self, city, path, radiation_calculation_method='sra', weather_format='epw'):
super().__init__(city, path) self._city = city
self._path = path
self._results = None
self._radiation_calculation_method = radiation_calculation_method self._radiation_calculation_method = radiation_calculation_method
self._weather_format = weather_format self._weather_format = weather_format
self._contents = [] self._contents = []
@ -43,16 +44,24 @@ class InselMonthlyEnergyBalance(Insel):
if building.internal_zones is not None: if building.internal_zones is not None:
for internal_zone in building.internal_zones: for internal_zone in building.internal_zones:
if internal_zone.thermal_zones is None: if internal_zone.thermal_zones is None:
logger.error(f'Building {building.name} has missing values. ' logging.error(f'Building {building.name} has missing values. Monthly Energy Balance cannot be processed\n')
f'Monthly Energy Balance cannot be processed\n')
sys.stderr.write(f'Building {building.name} has missing values. '
f'Monthly Energy Balance cannot be processed\n')
break break
self._contents.append( self._contents.append(
self._generate_meb_template(building, output_path, self._radiation_calculation_method,self._weather_format) self._generate_meb_template(building, output_path, self._radiation_calculation_method, self._weather_format)
) )
self._export() self._export()
@staticmethod
def _add_block(file, block_number, block_type, inputs='', parameters=''):
file += "S " + str(block_number) + " " + block_type + "\n"
for block_input in inputs:
file += str(block_input) + "\n"
if len(parameters) > 0:
file += "P " + str(block_number) + "\n"
for block_parameter in parameters:
file += str(block_parameter) + "\n"
return file
def _export(self): def _export(self):
for i_file, content in enumerate(self._contents): for i_file, content in enumerate(self._contents):
file_name = self._insel_files_paths[i_file] file_name = self._insel_files_paths[i_file]
@ -75,11 +84,11 @@ class InselMonthlyEnergyBalance(Insel):
if levels_of_detail.usage < 1: if levels_of_detail.usage < 1:
raise Exception(f'Level of detail of usage = {levels_of_detail.usage}. Required minimum level 1') raise Exception(f'Level of detail of usage = {levels_of_detail.usage}. Required minimum level 1')
if levels_of_detail.weather is None: if levels_of_detail.weather is None:
raise Exception(f'Level of detail of usage not assigned') raise Exception(f'Level of detail of weather not assigned')
if levels_of_detail.weather < 1: if levels_of_detail.weather < 1:
raise Exception(f'Level of detail of weather = {levels_of_detail.weather}. Required minimum level 1') raise Exception(f'Level of detail of weather = {levels_of_detail.weather}. Required minimum level 1')
if levels_of_detail.surface_radiation is None: if levels_of_detail.surface_radiation is None:
raise Exception(f'Level of detail of usage not assigned') raise Exception(f'Level of detail of surface radiation not assigned')
if levels_of_detail.surface_radiation < 1: if levels_of_detail.surface_radiation < 1:
raise Exception(f'Level of detail of surface radiation = {levels_of_detail.surface_radiation}. ' raise Exception(f'Level of detail of surface radiation = {levels_of_detail.surface_radiation}. '
f'Required minimum level 1') f'Required minimum level 1')
@ -89,7 +98,7 @@ class InselMonthlyEnergyBalance(Insel):
file = "" file = ""
i_block = 1 i_block = 1
parameters = ["1", "12", "1"] parameters = ["1", "12", "1"]
file = Insel._add_block(file, i_block, 'DO', parameters=parameters) file = InselMonthlyEnergyBalance._add_block(file, i_block, 'DO', parameters=parameters)
i_block = 4 i_block = 4
inputs = ["1.1", "20.1", "21.1"] inputs = ["1.1", "20.1", "21.1"]
@ -220,7 +229,7 @@ class InselMonthlyEnergyBalance(Insel):
else: else:
parameters.append(0.0) parameters.append(0.0)
file = Insel._add_block(file, i_block, 'd18599', inputs=inputs, parameters=parameters) file = InselMonthlyEnergyBalance._add_block(file, i_block, 'd18599', inputs=inputs, parameters=parameters)
i_block = 20 i_block = 20
inputs = ['1'] inputs = ['1']
@ -231,7 +240,7 @@ class InselMonthlyEnergyBalance(Insel):
for i in range(0, len(external_temperature)): for i in range(0, len(external_temperature)):
parameters.append(f'{i + 1} {external_temperature.at[i, weather_format]}') parameters.append(f'{i + 1} {external_temperature.at[i, weather_format]}')
file = Insel._add_block(file, i_block, 'polyg', inputs=inputs, parameters=parameters) file = InselMonthlyEnergyBalance._add_block(file, i_block, 'polyg', inputs=inputs, parameters=parameters)
i_block = 21 i_block = 21
inputs = ['1'] inputs = ['1']
@ -241,7 +250,7 @@ class InselMonthlyEnergyBalance(Insel):
for i, temperature in enumerate(sky_temperature): for i, temperature in enumerate(sky_temperature):
parameters.append(f'{i + 1} {temperature}') parameters.append(f'{i + 1} {temperature}')
file = Insel._add_block(file, i_block, 'polyg', inputs=inputs, parameters=parameters) file = InselMonthlyEnergyBalance._add_block(file, i_block, 'polyg', inputs=inputs, parameters=parameters)
for i, surface in enumerate(surfaces): for i, surface in enumerate(surfaces):
i_block = 101 + i i_block = 101 + i
@ -260,17 +269,17 @@ class InselMonthlyEnergyBalance(Insel):
for j in range(0, 12): for j in range(0, 12):
parameters.append(f'{j + 1} 0.0') parameters.append(f'{j + 1} 0.0')
file = Insel._add_block(file, i_block, 'polyg', inputs=inputs, parameters=parameters) file = InselMonthlyEnergyBalance._add_block(file, i_block, 'polyg', inputs=inputs, parameters=parameters)
i_block = 300 + len(surfaces) i_block = 300 + len(surfaces)
inputs = ['4.1', '4.2'] inputs = ['4.1', '4.2']
file = Insel._add_block(file, i_block, 'cum', inputs=inputs) file = InselMonthlyEnergyBalance._add_block(file, i_block, 'cum', inputs=inputs)
in_1 = f'{i_block}.1' in_1 = f'{i_block}.1'
in_2 = f'{i_block}.2' in_2 = f'{i_block}.2'
i_block = 303 + len(surfaces) i_block = 303 + len(surfaces)
inputs = [in_1, in_2] inputs = [in_1, in_2]
file = Insel._add_block(file, i_block, 'atend', inputs=inputs) file = InselMonthlyEnergyBalance._add_block(file, i_block, 'atend', inputs=inputs)
i_block = 310 + len(surfaces) i_block = 310 + len(surfaces)
inputs = ['4.1', '4.2'] inputs = ['4.1', '4.2']
@ -278,6 +287,6 @@ class InselMonthlyEnergyBalance(Insel):
'0 % Suppress FNQ inputs', '0 % Suppress FNQ inputs',
f"'{str(insel_outputs_path)}' % File name", f"'{str(insel_outputs_path)}' % File name",
"'*' % Fortran format"] "'*' % Fortran format"]
file = Insel._add_block(file, i_block, 'WRITE', inputs=inputs, parameters=parameters) file = InselMonthlyEnergyBalance._add_block(file, i_block, 'WRITE', inputs=inputs, parameters=parameters)
return file return file

View File

@ -1,106 +0,0 @@
"""
DBFactory performs read related operations
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project CoderPeter Yefi peteryefi@gmail.com
"""
import json
from typing import Union, Dict
from hub.persistence import City
from hub.persistence import Application
from hub.persistence import User
from hub.persistence import CityObject
from hub.persistence import SimulationResults
class DBFactory:
"""
DBFactory class
"""
def __init__(self, db_name, app_env, dotenv_path):
self._city = City(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path)
self._application = Application(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path)
self._user = User(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path)
self._city_object = CityObject(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path)
self._simulation_results = SimulationResults(db_name=db_name, dotenv_path=dotenv_path, app_env=app_env)
def application_info(self, application_uuid) -> Union[Application, None]:
"""
Retrieve the application info for the given uuid
:param application_uuid: the uuid for the application
:return: Application or None
"""
return self._application.get_by_uuid(application_uuid)
def user_info(self, name, password, application_id):
"""
Retrieve the user info for the given name and password and application_id
:param name: the user name
:param password: the user password
:param application_id: the application id
:return: User or None
"""
return self._user.get_by_name_application_id_and_password(name, password, application_id)
def user_login(self, name, password, application_uuid):
"""
Retrieve the user info
:param name: the user name
:param password: the user password
:param application_uuid: the application uuid
:return: User or None
"""
return self._user.get_by_name_application_uuid_and_password(name, password, application_uuid)
def cities_by_user_and_application(self, user_id, application_id) -> [City]:
"""
Retrieve the cities belonging to the user and the application
:param user_id: User id
:param application_id: Application id
:return: [City]
"""
return self._city.get_by_user_id_and_application_id(user_id, application_id)
def building_info(self, name, city_id) -> Union[CityObject, None]:
"""
Retrieve the building info
:param name: Building name
:param city_id: City Id
:return: CityObject or None
"""
return self._city_object.get_by_name_and_city(name, city_id)
def results(self, user_id, application_id, cities, result_names=None) -> Dict:
"""
Retrieve the simulation results for the given cities
:param user_id: the user id owning the results
:param application_id: the application id owning the results
:param cities: dictionary containing the city and building names for the results
:param result_names: if given, filter the results to the selected names
"""
if result_names is None:
result_names = []
results = {}
for city in cities['cities']:
city_name = next(iter(city))
result_set = self._city.get_by_user_id_application_id_and_name(user_id, application_id, city_name)
if result_set is None:
continue
city_id = result_set.id
results[city_name] = []
for building_name in city[city_name]:
if self._city_object.get_by_name_and_city(building_name, city_id) is None:
continue
city_object_id = self._city_object.get_by_name_and_city(building_name, city_id).id
_ = self._simulation_results.get_simulation_results_by_city_id_city_object_id_and_names(
city_id,
city_object_id,
result_names)
for value in _:
values = json.loads(value.values)
values["building"] = building_name
results[city_name].append(values)
return results

View File

@ -5,26 +5,22 @@ Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de uribarri pilar.monsalvete@concordia.ca
""" """
import logging
from pathlib import Path from pathlib import Path
from hub.exports.building_energy.energy_ade import EnergyAde from hub.exports.building_energy.energy_ade import EnergyAde
from hub.exports.building_energy.idf import Idf from hub.exports.building_energy.idf import Idf
from hub.exports.building_energy.insel.insel_monthly_energy_balance import InselMonthlyEnergyBalance from hub.exports.building_energy.insel.insel_monthly_energy_balance import InselMonthlyEnergyBalance
from hub.helpers.utils import validate_import_export_type from hub.helpers.utils import validate_import_export_type
from hub.hub_logger import logger
class EnergyBuildingsExportsFactory: class EnergyBuildingsExportsFactory:
""" """
Energy Buildings exports factory class Energy Buildings exports factory class
""" """
def __init__(self, export_type, city, path, target_buildings=None): def __init__(self, handler, city, path, target_buildings=None):
self._city = city self._city = city
self._export_type = '_' + export_type.lower() self._export_type = '_' + handler.lower()
class_funcs = validate_import_export_type(EnergyBuildingsExportsFactory) validate_import_export_type(EnergyBuildingsExportsFactory, handler)
if self._export_type not in class_funcs:
err_msg = f"Wrong import type [{self._export_type}]. Valid functions include {class_funcs}"
logger.error(err_msg)
raise Exception(err_msg)
if isinstance(path, str): if isinstance(path, str):
path = Path(path) path = Path(path)
self._path = path self._path = path
@ -43,7 +39,7 @@ class EnergyBuildingsExportsFactory:
""" """
Export the city to Energy+ idf format Export the city to Energy+ idf format
When target_buildings is set, only those will be calculated and their energy consumption output, non adjacent When target_buildings is set, only those will be calculated and their energy consumption output, non-adjacent
buildings will be considered shading objects and adjacent buildings will be considered adiabatic. buildings will be considered shading objects and adjacent buildings will be considered adiabatic.
Adjacent buildings are provided they will be considered heated so energy plus calculations are more precise but Adjacent buildings are provided they will be considered heated so energy plus calculations are more precise but

View File

@ -31,10 +31,10 @@ class AirSourceHPExport(HeatPumpExport):
def _extract_model_coff(self, hp_model: str, data_type='heat') -> Union[List, None]: def _extract_model_coff(self, hp_model: str, data_type='heat') -> Union[List, None]:
""" """
Extracts heat pump coefficient data for a specific Extracts heat pump coefficient data for a specific
model. e.g 012, 140 model. e.g. 012, 140
:param hp_model: the model type :param hp_model: the model type
:param data_type: indicates whether we're extracting cooling :param data_type: indicates whether we're extracting cooling
or heating perfarmcn coefficients or heating performance coefficients
:return: :return:
""" """
for energy_system in self._city.energy_systems: for energy_system in self._city.energy_systems:
@ -56,5 +56,5 @@ class AirSourceHPExport(HeatPumpExport):
insel should run for heat or cooling performance insel should run for heat or cooling performance
:return: :return:
""" """
capacity_coeff = self._extract_model_coff(hp_model, data_type) capacity_coefficient = self._extract_model_coff(hp_model, data_type)
return super(AirSourceHPExport, self)._run_insel(user_input, capacity_coeff, 'air_source.insel') return super(AirSourceHPExport, self)._run_insel(user_input, capacity_coefficient, 'air_source.insel')

View File

@ -5,11 +5,11 @@ Copyright © 2022 Concordia CERC group
Project Coder Peter Yefi peteryefi@gmail.com Project Coder Peter Yefi peteryefi@gmail.com
""" """
import os import os
import logging
from typing import List, Union, Dict from typing import List, Union, Dict
import yaml import yaml
from string import Template from string import Template
import pandas as pd import pandas as pd
from hub.hub_logger import logger
class HeatPumpExport: class HeatPumpExport:
@ -29,17 +29,17 @@ class HeatPumpExport:
self._base_path = base_path self._base_path = base_path
self._output_path = output_path self._output_path = output_path
def _run_insel(self, user_input: Dict, capacity_coeff: List, filename: str) -> Union[Dict, None]: def _run_insel(self, user_input: Dict, capacity_coefficient: List, filename: str) -> Union[Dict, None]:
""" """
Runs insel and write the necessary files Runs insel and write the necessary files
:param user_input: a dictionary containing the user :param user_input: a dictionary containing the user
values necessary to run insel values necessary to run insel
:param capacity_coeff: a list containing capacity coefficients :param capacity_coefficient: a list containing capacity coefficients
:param filename: the name of the insel file to be created :param filename: the name of the insel file to be created
:return: :return:
""" """
self._input_data = user_input self._input_data = user_input
self._update_input_data_with_coff(capacity_coeff) self._update_input_data_with_coff(capacity_coefficient)
# update input data with constants # update input data with constants
self._update_input_data_with_constants() self._update_input_data_with_constants()
# update input data with input and output files for insel # update input data with input and output files for insel
@ -57,15 +57,14 @@ class HeatPumpExport:
insel_file_handler.write(insel_template) insel_file_handler.write(insel_template)
# Now run insel # Now run insel
self._delete_existing_output_files() self._delete_existing_output_files()
logger.info(f'Running Insel with user input: {user_input} and coefficients {capacity_coeff}') logging.info(f'Running Insel with user input: {user_input} and coefficients {capacity_coefficient}')
os.system('insel {}'.format(insel_file)) os.system('insel {}'.format(insel_file))
# Writer headers to csv output files generated by insel # Writer headers to csv output files generated by insel
self._write_insel_output_headers() self._write_insel_output_headers()
# User output # User output
return self._get_user_out_put() return self._get_user_out_put()
except IOError as err: except IOError as err:
print("I/O exception: {}".format(str(err))) logging.error(f'An I/O error occurred while running insel: {str(err)}')
logger.error(f'An I/O error occurred while running insel: {str(err)}')
finally: finally:
insel_file_handler.close() insel_file_handler.close()
insel_template_handler.close() insel_template_handler.close()
@ -185,16 +184,16 @@ class HeatPumpExport:
self._input_data[key] = value self._input_data[key] = value
# compute water to water HP specific values # compute water to water HP specific values
if 55 <= self._input_data['HPSupTemp'] <= 60: if 55 <= self._input_data['HPSupTemp'] <= 60:
self._input_data["HPDisactivationTemperature"] = self._input_data["HPSupTemp"] - 5 self._input_data["HPDeactivationTemperature"] = self._input_data["HPSupTemp"] - 5
self._input_data["HPReactivationTemperature"] = self._input_data["HPSupTemp"] - 18 self._input_data["HPReactivationTemperature"] = self._input_data["HPSupTemp"] - 18
elif 50 <= self._input_data["HPSupTemp"] < 55: elif 50 <= self._input_data["HPSupTemp"] < 55:
self._input_data["HPDisactivationTemperature"] = self._input_data["HPSupTemp"] - 5 self._input_data["HPDeactivationTemperature"] = self._input_data["HPSupTemp"] - 5
self._input_data["HPReactivationTemperature"] = self._input_data["HPSupTemp"] - 13 self._input_data["HPReactivationTemperature"] = self._input_data["HPSupTemp"] - 13
elif 45 <= self._input_data["HPSupTemp"] < 50: elif 45 <= self._input_data["HPSupTemp"] < 50:
self._input_data["HPDisactivationTemperature"] = self._input_data["HPSupTemp"] - 3 self._input_data["HPDeactivationTemperature"] = self._input_data["HPSupTemp"] - 3
self._input_data["HPReactivationTemperature"] = self._input_data["HPSupTemp"] - 8 self._input_data["HPReactivationTemperature"] = self._input_data["HPSupTemp"] - 8
elif 35 <= self._input_data["HPSupTemp"] < 40: elif 35 <= self._input_data["HPSupTemp"] < 40:
self._input_data["HPDisactivationTemperature"] = self._input_data["HPSupTemp"] - 2 self._input_data["HPDeactivationTemperature"] = self._input_data["HPSupTemp"] - 2
self._input_data["HPReactivationTemperature"] = self._input_data["HPSupTemp"] - 4 self._input_data["HPReactivationTemperature"] = self._input_data["HPSupTemp"] - 4
# compute maximum demand. todo: This should come from catalog in the future # compute maximum demand. todo: This should come from catalog in the future
@ -203,29 +202,29 @@ class HeatPumpExport:
self._input_data["TESCapacity"] = self._input_data["HoursOfStorageAtMaxDemand"] * (max_demand * 3.6) / ( self._input_data["TESCapacity"] = self._input_data["HoursOfStorageAtMaxDemand"] * (max_demand * 3.6) / (
(self._input_data["Cp"] / 1000) * self._input_data["TemperatureDifference"]) (self._input_data["Cp"] / 1000) * self._input_data["TemperatureDifference"])
def _update_input_data_with_coff(self, a_coeff: List): def _update_input_data_with_coff(self, a_coefficient: List):
""" """
Updates the user data with coefficients derived from imports Updates the user data with coefficients derived from imports
:param a_coeff: insel a coefficient values :param a_coefficient: insel a coefficient values
Meaning of a is in the models for air source heat pump Meaning of a coefficient is in the models for air source heat pump
and water to water source heat pump and water to water source heat pump
:return: :return:
""" """
self._input_data["a1"] = a_coeff[0] self._input_data["a1"] = a_coefficient[0]
self._input_data["a2"] = a_coeff[1] self._input_data["a2"] = a_coefficient[1]
self._input_data["a3"] = a_coeff[2] self._input_data["a3"] = a_coefficient[2]
self._input_data["a4"] = a_coeff[3] self._input_data["a4"] = a_coefficient[3]
self._input_data["a5"] = a_coeff[4] self._input_data["a5"] = a_coefficient[4]
self._input_data["a6"] = a_coeff[5] self._input_data["a6"] = a_coefficient[5]
# additional coefficients for water to water source # additional coefficients for water to water source
if self._water_temp is not None: if self._water_temp is not None:
self._input_data["a7"] = a_coeff[6] self._input_data["a7"] = a_coefficient[6]
self._input_data["a8"] = a_coeff[7] self._input_data["a8"] = a_coefficient[7]
self._input_data["a9"] = a_coeff[8] self._input_data["a9"] = a_coefficient[8]
self._input_data["a10"] = a_coeff[9] self._input_data["a10"] = a_coefficient[9]
self._input_data["a11"] = a_coeff[10] self._input_data["a11"] = a_coefficient[10]
def _get_user_out_put(self) -> Union[Dict, None]: def _get_user_out_put(self) -> Union[Dict, None]:
""" """

View File

@ -29,10 +29,10 @@ class WaterToWaterHPExport(HeatPumpExport):
super().__init__(base_path=base_path, city=city, output_path=output_path, template=template_path, super().__init__(base_path=base_path, city=city, output_path=output_path, template=template_path,
demand_path=demand_path, water_temp=water_temp) demand_path=demand_path, water_temp=water_temp)
def _extract_model_coff(self, hp_model: str) -> Union[List, None]: def _extract_model_coefficient(self, hp_model: str) -> Union[List, None]:
""" """
Extracts heat pump coefficient data for a specific Extracts heat pump coefficient data for a specific
model. e.g ClimateMaster 156 kW, etc model. e.g. ClimateMaster 156 kW, etc.
:param hp_model: the model type :param hp_model: the model type
:return: :return:
""" """
@ -51,5 +51,5 @@ class WaterToWaterHPExport(HeatPumpExport):
pump model to be used e.g. 012, 015 pump model to be used e.g. 012, 015
:return: :return:
""" """
pow_demand_coeff = self._extract_model_coff(hp_model) pow_demand_coefficient = self._extract_model_coefficient(hp_model)
return super(WaterToWaterHPExport, self)._run_insel(user_input, pow_demand_coeff, 'w2w.insel') return super(WaterToWaterHPExport, self)._run_insel(user_input, pow_demand_coefficient, 'w2w.insel')

View File

@ -15,47 +15,48 @@ class EnergySystemsExportFactory:
Exports factory class for energy systems Exports factory class for energy systems
""" """
def __init__(self, city, user_input, hp_model, output_path, sim_type=0, data_type='heat', base_path=None, def __init__(self, city, handler, hp_model, output_path, sim_type=0, data_type='heat', base_path=None,
demand_path=None): demand_path=None):
""" """
:param city: the city object :param city: the city object
:param user_input: user provided input from UI :param handler: user provided input from UI
:param hp_model: the heat pump model to run :param hp_model: the heat pump model to run
:param output_path: the file to hold simulation results :param output_path: the file to hold simulation results
:param sim_type: the simulation type, 0 for series 1 for parallel :param sim_type: the simulation type, 0 for series 1 for parallel
:param data_type: indicates whether cooling or heating data is used :param data_type: indicates whether cooling or heating data is used
:param base_path: the data directory of energy systems :param base_path: the data directory of energy systems
:param demand_path: path to hourly energy dempand file :param demand_path: path to hourly energy demand file
""" """
self._city = city self._city = city
if base_path is None: if base_path is None:
base_path = Path(Path(__file__).parent.parent / 'data/energy_systems') base_path = Path(Path(__file__).parent.parent / 'data/energy_systems')
self._base_path = base_path self._base_path = base_path
self._user_input = user_input self._handler = handler
self._hp_model = hp_model self._hp_model = hp_model
self._data_type = data_type self._data_type = data_type
self._output_path = output_path self._output_path = output_path
self._sim_type = sim_type self._sim_type = sim_type
self._demand_path = demand_path self._demand_path = demand_path
self._source = None
def _export_heat_pump(self, source): def _export_heat_pump(self):
""" """
Exports heat pump performance data as coefficients Exports heat pump performance data as coefficients
of some objective function of some objective function
:return: None :return: None
""" """
if source == 'air': if self._source == 'air':
return AirSourceHPExport(self._base_path, self._city, self._output_path, self._sim_type, self._demand_path)\ return AirSourceHPExport(self._base_path, self._city, self._output_path, self._sim_type, self._demand_path)\
.execute_insel(self._user_input, self._hp_model, self._data_type) .execute_insel(self._handler, self._hp_model, self._data_type)
elif source == 'water': elif self._source == 'water':
return WaterToWaterHPExport(self._base_path, self._city, self._output_path, self._sim_type, self._demand_path)\ return WaterToWaterHPExport(self._base_path, self._city, self._output_path, self._sim_type, self._demand_path)\
.execute_insel(self._user_input, self._hp_model) .execute_insel(self._handler, self._hp_model)
def export(self, source='air'): def export(self, source='air'):
""" """
Export the city given to the class using the given export type handler Export the city given to the class using the given export type handler
:return: None :return: None
""" """
return getattr(self, '_export_heat_pump', lambda: None)(source) self._source = source
return getattr(self, '_export_heat_pump', lambda: None)()

View File

@ -5,11 +5,11 @@ Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
""" """
import logging
from pathlib import Path from pathlib import Path
from hub.exports.formats.obj import Obj from hub.exports.formats.obj import Obj
from hub.exports.formats.simplified_radiosity_algorithm import SimplifiedRadiosityAlgorithm from hub.exports.formats.simplified_radiosity_algorithm import SimplifiedRadiosityAlgorithm
from hub.exports.formats.stl import Stl from hub.exports.formats.stl import Stl
from hub.hub_logger import logger
from hub.helpers.utils import validate_import_export_type from hub.helpers.utils import validate_import_export_type
@ -17,18 +17,14 @@ class ExportsFactory:
""" """
Exports factory class Exports factory class
""" """
def __init__(self, export_type, city, path, def __init__(self, handler, city, path,
target_buildings=None, target_buildings=None,
adjacent_buildings=None, adjacent_buildings=None,
weather_file=None, weather_file=None,
weather_format=None): weather_format=None):
self._city = city self._city = city
self._export_type = '_' + export_type.lower() self._handler = '_' + handler.lower()
class_funcs = validate_import_export_type(ExportsFactory) validate_import_export_type(ExportsFactory, handler)
if self._export_type not in class_funcs:
err_msg = f"Wrong export type [{self._export_type}]. Valid functions include {class_funcs}"
logger.error(err_msg)
raise Exception(err_msg)
if isinstance(path, str): if isinstance(path, str):
path = Path(path) path = Path(path)
self._path = path self._path = path
@ -82,11 +78,4 @@ class ExportsFactory:
Export the city given to the class using the given export type handler Export the city given to the class using the given export type handler
:return: None :return: None
""" """
return getattr(self, self._export_type, lambda: None) return getattr(self, self._handler, lambda: None)
def export_debug(self):
"""
Export the city given to the class using the given export type handler
:return: None
"""
return Obj(self._city, self._path)

View File

@ -1,29 +0,0 @@
"""
Insel export models to insel format
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
from abc import ABC
class Insel(ABC):
def __init__(self, city, path):
self._city = city
self._path = path
self._results = None
@staticmethod
def _add_block(file, block_number, block_type, inputs='', parameters=''):
file += "S " + str(block_number) + " " + block_type + "\n"
for block_input in inputs:
file += str(block_input) + "\n"
if len(parameters) > 0:
file += "P " + str(block_number) + "\n"
for block_parameter in parameters:
file += str(block_parameter) + "\n"
return file
def _export(self):
raise NotImplementedError

View File

@ -71,9 +71,8 @@ class SimplifiedRadiosityAlgorithm:
else: else:
i = (total_days + day - 1) * 24 + hour - 1 i = (total_days + day - 1) * 24 + hour - 1
representative_building = self._city.buildings[0] representative_building = self._city.buildings[0]
content += str(day) + ' ' + str(month) + ' ' + str(hour) + ' ' \ content += f'{day} {month} {hour} {representative_building.global_horizontal[cte.HOUR].epw[i]} ' \
+ str(representative_building.global_horizontal[cte.HOUR].epw[i]) + ' ' \ f'{representative_building.beam[cte.HOUR].epw[i]}\n'
+ str(representative_building.beam[cte.HOUR].epw[i]) + '\n'
with open(file, "w") as file: with open(file, "w") as file:
file.write(content) file.write(content)

View File

@ -1,33 +0,0 @@
"""
User performs user related crud operations
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project CoderPeter Yefi peteryefi@gmail.com
"""
from hub.persistence import User
class UserFactory:
"""
UserFactory class
"""
def __init__(self, db_name, app_env, dotenv_path):
self._user_repo = User(db_name=db_name, app_env=app_env, dotenv_path=dotenv_path)
def login_user(self, name: str, password: str, application_id: int):
"""
Retrieve a single city from postgres
:param name: the email of the user
:param password: the password of the user
:param application_id: the id of the application accessing hub
"""
return self._user_repo.get_by_name_application_and_password(name, password, application_id)
def get_by_name_and_application(self, name: str, application: int):
"""
Retrieve a single user
:param name: user name
:param application: application accessing hub
"""
return self._user_repo.get_by_name_and_application(name, application)

View File

@ -6,7 +6,6 @@ Project Coder Peter Yefi peteryefi@gmail.com
""" """
import bcrypt import bcrypt
import re
class Auth(object): class Auth(object):
@ -29,8 +28,3 @@ class Auth(object):
:return: :return:
""" """
return bcrypt.checkpw(password.encode('utf-8'), hashed_password.encode('utf-8')) return bcrypt.checkpw(password.encode('utf-8'), hashed_password.encode('utf-8'))

View File

@ -204,7 +204,8 @@ MIN_FLOAT = float('-inf')
# Tools # Tools
SRA = 'sra' SRA = 'sra'
INSEL_MEB = 'insel meb' INSEL_MEB = 'insel meb'
PEAK_LOAD = 'peak load' COOLING_PEAK_LOAD = f'cooling peak load'
HEATING_PEAK_LOAD = f'heating peak load'
# Costs units # Costs units
CURRENCY_PER_SQM = 'currency/m2' CURRENCY_PER_SQM = 'currency/m2'

View File

@ -557,6 +557,7 @@ class MontrealFunctionToHubFunction:
'4316': cte.WAREHOUSE, '4316': cte.WAREHOUSE,
'6592': cte.OFFICE_AND_ADMINISTRATION, '6592': cte.OFFICE_AND_ADMINISTRATION,
'3971': cte.INDUSTRY, '3971': cte.INDUSTRY,
'3972': cte.INDUSTRY,
'2694': cte.INDUSTRY, '2694': cte.INDUSTRY,
'3882': cte.INDUSTRY, '3882': cte.INDUSTRY,
'3119': cte.INDUSTRY, '3119': cte.INDUSTRY,

View File

@ -115,4 +115,3 @@ class Dictionaries:
:return: dict :return: dict
""" """
return HubFunctionToMontrealCustomCostsFunction().dictionary return HubFunctionToMontrealCustomCostsFunction().dictionary

View File

@ -12,6 +12,7 @@ import numpy as np
from PIL import Image from PIL import Image
from trimesh import Trimesh from trimesh import Trimesh
from trimesh import intersections from trimesh import intersections
from typing import Dict
from hub.city_model_structure.attributes.polygon import Polygon from hub.city_model_structure.attributes.polygon import Polygon
from hub.city_model_structure.attributes.polyhedron import Polyhedron from hub.city_model_structure.attributes.polyhedron import Polyhedron
@ -25,10 +26,16 @@ class MapPoint:
@property @property
def x(self): def x(self):
"""
Get X Coordinate
"""
return self._x return self._x
@property @property
def y(self): def y(self):
"""
Get Y Coordinate
"""
return self._y return self._y
def __str__(self): def __str__(self):
@ -57,6 +64,10 @@ class GeometryHelper:
@staticmethod @staticmethod
def factor(): def factor():
"""
Set minimap resolution
:return: None
"""
return 0.5 return 0.5
def __init__(self, delta=0, area_delta=0): def __init__(self, delta=0, area_delta=0):
@ -65,18 +76,24 @@ class GeometryHelper:
@staticmethod @staticmethod
def coordinate_to_map_point(coordinate, city): def coordinate_to_map_point(coordinate, city):
"""
Transform a real world coordinate to a minimap one
:param coordinate: real world coordinate
:param city: current city
:return: None
"""
factor = GeometryHelper.factor() factor = GeometryHelper.factor()
return MapPoint(((coordinate[0] - city.lower_corner[0]) * factor), ((coordinate[1] - city.lower_corner[1]) * factor)) return MapPoint(
((coordinate[0] - city.lower_corner[0]) * factor), ((coordinate[1] - city.lower_corner[1]) * factor)
)
@staticmethod @staticmethod
def city_mapping(city, building_names=None, plot=False): def city_mapping(city, building_names=None, plot=False) -> Dict:
""" """
:param city: city to be mapped
Returns a shared_information dictionary like :param building_names: list of building names to be mapped or None
{ :param plot: True if minimap image should be displayed
"building_name" : [{line: 0 coordinate_1: [x,y,z], coordinate_2:[x, y, z], points: 0}] :return: shared_information dictionary
}
""" """
lines_information = {} lines_information = {}
if building_names is None: if building_names is None:
@ -185,7 +202,8 @@ class GeometryHelper:
@staticmethod @staticmethod
def segment_list_to_trimesh(lines) -> Trimesh: def segment_list_to_trimesh(lines) -> Trimesh:
""" """
Transform a list of segments into a Trimesh :param lines: lines
:return: Transform a list of segments into a Trimesh
""" """
# todo: trimesh has a method for this # todo: trimesh has a method for this
line_points = [lines[0][0], lines[0][1]] line_points = [lines[0][0], lines[0][1]]
@ -238,7 +256,7 @@ class GeometryHelper:
:return: [Trimesh] :return: [Trimesh]
""" """
# The first mesh returns the positive side of the plane and the second the negative side. # The first mesh returns the positive side of the plane and the second the negative side.
# If the plane does not divide the mesh (i.e. it does not touch it or it is coplanar with one or more faces), # If the plane does not divide the mesh (i.e. it does not touch it, or it is coplanar with one or more faces),
# then it returns only the original mesh. # then it returns only the original mesh.
# todo: review split method in https://github.com/mikedh/trimesh/issues/235, # todo: review split method in https://github.com/mikedh/trimesh/issues/235,
# once triangulate_polygon in Polygon class is solved # once triangulate_polygon in Polygon class is solved
@ -265,6 +283,9 @@ class GeometryHelper:
def get_location(latitude, longitude) -> Location: def get_location(latitude, longitude) -> Location:
""" """
Get Location from latitude and longitude Get Location from latitude and longitude
:param latitude: Latitude
:param longitude: Longitude
:return: Location
""" """
_data_path = Path(Path(__file__).parent.parent / 'data/geolocation/cities15000.txt').resolve() _data_path = Path(Path(__file__).parent.parent / 'data/geolocation/cities15000.txt').resolve()
latitude = float(latitude) latitude = float(latitude)

View File

@ -5,7 +5,6 @@ Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
import hub.helpers.constants as cte import hub.helpers.constants as cte
@ -13,6 +12,7 @@ class LoadsCalculation:
""" """
LoadsCalculation class LoadsCalculation class
""" """
def __init__(self, building): def __init__(self, building):
self._building = building self._building = building
@ -28,13 +28,16 @@ class LoadsCalculation:
else: else:
external_temperature = ambient_temperature external_temperature = ambient_temperature
load_transmitted_opaque += thermal_boundary.u_value * thermal_boundary.opaque_area \ load_transmitted_opaque += (
* (internal_temperature - external_temperature) thermal_boundary.u_value * thermal_boundary.opaque_area * (internal_temperature - external_temperature)
)
for thermal_opening in thermal_boundary.thermal_openings: for thermal_opening in thermal_boundary.thermal_openings:
load_transmitted_transparent += thermal_opening.overall_u_value \ load_transmitted_transparent += thermal_opening.overall_u_value \
* (internal_temperature - external_temperature) * (internal_temperature - external_temperature)
load_transmitted_opaque += thermal_zone.additional_thermal_bridge_u_value * thermal_zone.footprint_area \ load_transmitted_opaque += (
* (internal_temperature - ambient_temperature) thermal_zone.additional_thermal_bridge_u_value * thermal_zone.footprint_area *
(internal_temperature - ambient_temperature)
)
load_transmitted = load_transmitted_opaque + load_transmitted_transparent load_transmitted = load_transmitted_opaque + load_transmitted_transparent
return load_transmitted return load_transmitted
@ -46,9 +49,10 @@ class LoadsCalculation:
* thermal_zone.volume / cte.HOUR_TO_MINUTES / cte.MINUTES_TO_SECONDS \ * thermal_zone.volume / cte.HOUR_TO_MINUTES / cte.MINUTES_TO_SECONDS \
* (internal_temperature - ambient_temperature) * (internal_temperature - ambient_temperature)
load_infiltration_sensible = cte.AIR_DENSITY * cte.AIR_HEAT_CAPACITY * thermal_zone.infiltration_rate_system_off \ load_infiltration_sensible = (
* thermal_zone.volume / cte.HOUR_TO_MINUTES / cte.MINUTES_TO_SECONDS \ cte.AIR_DENSITY * cte.AIR_HEAT_CAPACITY * thermal_zone.infiltration_rate_system_off * thermal_zone.volume /
* (internal_temperature - ambient_temperature) cte.HOUR_TO_MINUTES / cte.MINUTES_TO_SECONDS * (internal_temperature - ambient_temperature)
)
load_ventilation = load_renovation_sensible + load_infiltration_sensible load_ventilation = load_renovation_sensible + load_infiltration_sensible
@ -97,12 +101,14 @@ class LoadsCalculation:
cooling_load_occupancy_sensible += (thermal_zone.occupancy.sensible_convective_internal_gain cooling_load_occupancy_sensible += (thermal_zone.occupancy.sensible_convective_internal_gain
+ thermal_zone.occupancy.sensible_radiative_internal_gain) \ + thermal_zone.occupancy.sensible_radiative_internal_gain) \
* thermal_zone.footprint_area * thermal_zone.footprint_area
cooling_load_lighting += (thermal_zone.lighting.density * thermal_zone.lighting.convective_fraction cooling_load_lighting += (
+ thermal_zone.lighting.density * thermal_zone.lighting.radiative_fraction) \ thermal_zone.lighting.density * thermal_zone.lighting.convective_fraction + thermal_zone.lighting.density *
* thermal_zone.footprint_area thermal_zone.lighting.radiative_fraction
cooling_load_equipment_sensible += (thermal_zone.appliances.density * thermal_zone.appliances.convective_fraction ) * thermal_zone.footprint_area
+ thermal_zone.appliances.density * thermal_zone.appliances.radiative_fraction) \ cooling_load_equipment_sensible += (
* thermal_zone.footprint_area thermal_zone.appliances.density * thermal_zone.appliances.convective_fraction +
thermal_zone.appliances.density * thermal_zone.appliances.radiative_fraction
) * thermal_zone.footprint_area
internal_load = cooling_load_occupancy_sensible + cooling_load_lighting + cooling_load_equipment_sensible internal_load = cooling_load_occupancy_sensible + cooling_load_lighting + cooling_load_equipment_sensible
return internal_load return internal_load
@ -113,6 +119,7 @@ class LoadsCalculation:
for thermal_boundary in thermal_zone.thermal_boundaries: for thermal_boundary in thermal_zone.thermal_boundaries:
for thermal_opening in thermal_boundary.thermal_openings: for thermal_opening in thermal_boundary.thermal_openings:
radiation = thermal_boundary.parent_surface.global_irradiance[cte.HOUR][irradiance_format][hour] radiation = thermal_boundary.parent_surface.global_irradiance[cte.HOUR][irradiance_format][hour]
cooling_load_radiation += thermal_opening.area * (1 - thermal_opening.frame_ratio) * thermal_opening.g_value \ cooling_load_radiation += (
* radiation thermal_opening.area * (1 - thermal_opening.frame_ratio) * thermal_opening.g_value * radiation
)
return cooling_load_radiation return cooling_load_radiation

View File

@ -4,15 +4,19 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group Copyright © 2023 Concordia CERC group
Project Coder Peter Yefi peteryefi@gmail.com Project Coder Peter Yefi peteryefi@gmail.com
""" """
import logging
def validate_import_export_type(cls_name: type): def validate_import_export_type(cls_name: type, handler: str):
""" """
Retrieves all the function names in a class which are property types (decoration) Retrieves all the function names in a class which are property types (decoration)
and normal functions and normal functions
:param cls_name: the class name :param cls_name: the class name
:return: [str], a list of functions in the class :param handler: import export handler
:return: None
""" """
return [func for func in dir(cls_name) functions = [function[1:] for function in dir(cls_name) if (type(getattr(cls_name, function)) is property or callable(getattr(cls_name, function))) and function in cls_name.__dict__ and function[0] == '_' and function != '__init__']
if (type(getattr(cls_name, func)) is property or callable(getattr(cls_name, func))) if handler.lower() not in functions:
and func in cls_name.__dict__ and func[0] == '_' and func != '__init__'] error_message = f'Wrong import type [{handler}]. Valid functions include {functions}'
logging.error(error_message)
raise Exception(error_message)

View File

@ -1,46 +0,0 @@
"""
Yearly from daily schedules module
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 calendar as cal
import hub.helpers.constants as cte
from hub.city_model_structure.attributes.schedule import Schedule
class YearlyFromDailySchedules:
"""
YearlyFromDailySchedules class
"""
def __init__(self, daily_schedules, year):
self._daily_schedules = daily_schedules
self._year = year
@property
def yearly_schedule(self) -> Schedule:
"""
Creates a yearly schedule out of a set of daily schedules
:return: Schedule
"""
yearly_schedule = Schedule()
weekly_schedules = [0, 0, 0, 0, 0, 0, 0]
day_types = dict({cte.MONDAY: 0, cte.TUESDAY: 1, cte.WEDNESDAY: 2, cte.THURSDAY: 3,
cte.FRIDAY: 4, cte.SATURDAY: 5, cte.SUNDAY: 6})
for daily_schedule in self._daily_schedules:
for day_type in daily_schedule.day_types:
weekly_schedules[day_types[day_type]] = daily_schedule.values
values = []
for month in range(1, 13):
_, number_days = cal.monthrange(self._year, month)
for day in range(1, number_days+1):
week_day = cal.weekday(self._year, month, day)
values.extend(weekly_schedules[week_day])
yearly_schedule.type = self._daily_schedules[0].type
yearly_schedule.data_type = self._daily_schedules[0].data_type
yearly_schedule.time_range = cte.YEAR
yearly_schedule.time_step = cte.HOUR
yearly_schedule.values = values
return yearly_schedule

View File

@ -1,31 +0,0 @@
import logging as logger
from pathlib import Path
import os
import sys
def get_logger(file_logger=False):
"""
Returns a logging object
:param file_logger: a boolean to indicate the kind of logging
object to return, true (default) means a file logger is required
:return:
"""
log_format = "%(asctime)s:%(levelname)s:{%(pathname)s:%(funcName)s:%(lineno)d} - %(message)s"
if file_logger:
log_dir = (Path(__file__).parent.parent / 'logs').resolve()
log_file = (log_dir / 'hub.log').resolve()
try:
if not os.path.isfile(log_file):
if not os.path.exists(log_dir):
os.mkdir(log_dir)
with open(log_file, 'x'):
pass
logger.basicConfig(filename=log_file, format=log_format, level=logger.DEBUG)
return logger
except IOError as err:
print(f'I/O exception: {err}')
else:
logger.getLogger().addHandler(logger.StreamHandler(stream=sys.stdout))
logger.getLogger().setLevel(logger.DEBUG)
return logger.getLogger()

View File

@ -84,6 +84,8 @@ class ConstructionHelper:
:param city: str :param city: str
:return: str :return: str
""" """
reference_city = ConstructionHelper.city_to_reference_city(city)
if reference_city not in ConstructionHelper._reference_city_to_nrel_climate_zone.keys():
reference_city = 'Baltimore' reference_city = 'Baltimore'
return ConstructionHelper._reference_city_to_nrel_climate_zone[reference_city] return ConstructionHelper._reference_city_to_nrel_climate_zone[reference_city]

View File

@ -4,18 +4,18 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
import datetime
import sys
import math import math
import numpy as np import sys
from typing import List from typing import List
from hub.helpers import constants as cte import numpy as np
from hub.city_model_structure.attributes.polygon import Polygon
from hub.city_model_structure.attributes.point import Point from hub.city_model_structure.attributes.point import Point
from hub.city_model_structure.attributes.polygon import Polygon
from hub.city_model_structure.building_demand.storey import Storey from hub.city_model_structure.building_demand.storey import Storey
from hub.city_model_structure.building_demand.surface import Surface from hub.city_model_structure.building_demand.surface import Surface
from hub.city_model_structure.building_demand.thermal_zone import ThermalZone from hub.city_model_structure.building_demand.thermal_zone import ThermalZone
from hub.helpers import constants as cte
class StoreysGeneration: class StoreysGeneration:

View File

@ -5,10 +5,8 @@ Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
import logging
import math import math
import sys
from hub.hub_logger import logger
import hub.helpers.constants as cte import hub.helpers.constants as cte
from hub.catalog_factories.construction_catalog_factory import ConstructionCatalogFactory from hub.catalog_factories.construction_catalog_factory import ConstructionCatalogFactory
@ -23,6 +21,7 @@ class NrcanPhysicsParameters:
""" """
NrcanPhysicsParameters class NrcanPhysicsParameters class
""" """
def __init__(self, city, divide_in_storeys=False): def __init__(self, city, divide_in_storeys=False):
self._city = city self._city = city
self._divide_in_storeys = divide_in_storeys self._divide_in_storeys = divide_in_storeys
@ -35,17 +34,16 @@ class NrcanPhysicsParameters:
city = self._city city = self._city
nrcan_catalog = ConstructionCatalogFactory('nrcan').catalog nrcan_catalog = ConstructionCatalogFactory('nrcan').catalog
for building in city.buildings: for building in city.buildings:
if building.function not in Dictionaries().hub_function_to_nrcan_construction_function.keys():
logging.error(f'Building {building.name} has an unknown building function {building.function}\n')
continue
function = Dictionaries().hub_function_to_nrcan_construction_function[building.function] function = Dictionaries().hub_function_to_nrcan_construction_function[building.function]
try: try:
archetype = self._search_archetype(nrcan_catalog, function, building.year_of_construction, self._climate_zone) archetype = self._search_archetype(nrcan_catalog, function, building.year_of_construction, self._climate_zone)
except KeyError: except KeyError:
logger.error(f'Building {building.name} has unknown construction archetype for building function: ' logging.error(f'Building {building.name} has unknown construction archetype for building function: {function} '
f'{function} [{building.function}], building year of construction: {building.year_of_construction} ' f'[{building.function}], building year of construction: {building.year_of_construction} '
f'and climate zone {self._climate_zone}\n')
sys.stderr.write(f'Building {building.name} has unknown construction archetype for building function: '
f'{function} [{building.function}], '
f'building year of construction: {building.year_of_construction} '
f'and climate zone {self._climate_zone}\n') f'and climate zone {self._climate_zone}\n')
continue continue
@ -78,8 +76,7 @@ class NrcanPhysicsParameters:
for building_archetype in nrcan_archetypes: for building_archetype in nrcan_archetypes:
construction_period_limits = building_archetype.construction_period.split('_') construction_period_limits = building_archetype.construction_period.split('_')
if int(construction_period_limits[0]) <= int(year_of_construction) <= int(construction_period_limits[1]): if int(construction_period_limits[0]) <= int(year_of_construction) <= int(construction_period_limits[1]):
if (str(function) == str(building_archetype.function)) and \ if str(function) == str(building_archetype.function) and climate_zone == str(building_archetype.climate_zone):
(climate_zone == str(building_archetype.climate_zone)):
return building_archetype return building_archetype
raise KeyError('archetype not found') raise KeyError('archetype not found')

View File

@ -5,9 +5,8 @@ Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
import sys import logging
from hub.hub_logger import get_logger
from hub.catalog_factories.construction_catalog_factory import ConstructionCatalogFactory from hub.catalog_factories.construction_catalog_factory import ConstructionCatalogFactory
from hub.city_model_structure.building_demand.layer import Layer from hub.city_model_structure.building_demand.layer import Layer
from hub.city_model_structure.building_demand.material import Material from hub.city_model_structure.building_demand.material import Material
@ -15,8 +14,6 @@ from hub.helpers.dictionaries import Dictionaries
from hub.imports.construction.helpers.construction_helper import ConstructionHelper from hub.imports.construction.helpers.construction_helper import ConstructionHelper
from hub.imports.construction.helpers.storeys_generation import StoreysGeneration from hub.imports.construction.helpers.storeys_generation import StoreysGeneration
logger = get_logger()
class NrelPhysicsParameters: class NrelPhysicsParameters:
""" """
@ -35,21 +32,21 @@ class NrelPhysicsParameters:
city = self._city city = self._city
nrel_catalog = ConstructionCatalogFactory('nrel').catalog nrel_catalog = ConstructionCatalogFactory('nrel').catalog
for building in city.buildings: for building in city.buildings:
if building.function not in Dictionaries().hub_function_to_nrel_construction_function.keys():
logging.error(f'Building {building.name} has unknown function [{building.function}]')
continue
if building.function not in Dictionaries().hub_function_to_nrel_construction_function.keys():
logging.error(f'Building {building.name} has unknown function {building.function}\n')
continue
function = Dictionaries().hub_function_to_nrel_construction_function[building.function] function = Dictionaries().hub_function_to_nrel_construction_function[building.function]
try: try:
archetype = self._search_archetype(nrel_catalog, function, building.year_of_construction, archetype = self._search_archetype(nrel_catalog, function, building.year_of_construction, self._climate_zone)
self._climate_zone)
except KeyError: except KeyError:
logger.error(f'Building {building.name} has unknown construction archetype for building function: ' logging.error(f'Building {building.name} has unknown construction archetype for building function: {function} '
f'{function} [{building.function}], building year of construction: {building.year_of_construction} ' f'[{building.function}], building year of construction: {building.year_of_construction}'
f'and climate zone {self._climate_zone}\n') f' and climate zone {self._climate_zone}\n')
sys.stderr.write(f'Building {building.name} has unknown construction archetype for building function: '
f'{function} [{building.function}], '
f'building year of construction: {building.year_of_construction} '
f'and climate zone {self._climate_zone}\n')
continue continue
# if building has no thermal zones defined from geometry, and the building will be divided in storeys, # if building has no thermal zones defined from geometry, and the building will be divided in storeys,
# one thermal zone per storey is assigned # one thermal zone per storey is assigned
if len(building.internal_zones) == 1: if len(building.internal_zones) == 1:
@ -81,8 +78,7 @@ class NrelPhysicsParameters:
if construction_period_limits[1] == 'PRESENT': if construction_period_limits[1] == 'PRESENT':
construction_period_limits[1] = 3000 construction_period_limits[1] = 3000
if int(construction_period_limits[0]) <= int(year_of_construction) < int(construction_period_limits[1]): if int(construction_period_limits[0]) <= int(year_of_construction) < int(construction_period_limits[1]):
if (str(function) == str(building_archetype.function)) and \ if str(function) == str(building_archetype.function) and climate_zone == str(building_archetype.climate_zone):
(climate_zone == str(building_archetype.climate_zone)):
return building_archetype return building_archetype
raise KeyError('archetype not found') raise KeyError('archetype not found')

View File

@ -6,12 +6,9 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
from hub.hub_logger import get_logger
from hub.helpers.utils import validate_import_export_type from hub.helpers.utils import validate_import_export_type
from hub.imports.construction.nrel_physics_parameters import NrelPhysicsParameters
from hub.imports.construction.nrcan_physics_parameters import NrcanPhysicsParameters from hub.imports.construction.nrcan_physics_parameters import NrcanPhysicsParameters
from hub.imports.construction.nrel_physics_parameters import NrelPhysicsParameters
logger = get_logger()
class ConstructionFactory: class ConstructionFactory:
@ -19,12 +16,8 @@ class ConstructionFactory:
ConstructionFactory class ConstructionFactory class
""" """
def __init__(self, handler, city): def __init__(self, handler, city):
self._handler = '_' + handler.lower().replace(' ', '_') self._handler = '_' + handler.lower()
class_funcs = validate_import_export_type(ConstructionFactory) validate_import_export_type(ConstructionFactory, handler)
if self._handler not in class_funcs:
err_msg = f"Wrong import type [{self._handler}]. Valid functions include {class_funcs}"
logger.error(err_msg)
raise Exception(err_msg)
self._city = city self._city = city
def _nrel(self): def _nrel(self):
@ -51,10 +44,3 @@ class ConstructionFactory:
:return: None :return: None
""" """
getattr(self, self._handler, lambda: None)() getattr(self, self._handler, lambda: None)()
def enrich_debug(self):
"""
Enrich the city given to the class using the class given handler
:return: None
"""
NrelPhysicsParameters(self._city).enrich_buildings()

View File

@ -1,81 +0,0 @@
"""
DBFactory performs database create, delete and update operations
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project CoderPeter Yefi peteryefi@gmail.com
"""
from hub.city_model_structure.city import City
from hub.persistence import City as CityRepository
from hub.persistence import SimulationResults
from hub.persistence import Application
class DBFactory:
"""
DBFactory class
"""
def __init__(self, db_name, dotenv_path, app_env):
self._city_repository = CityRepository(db_name=db_name, dotenv_path=dotenv_path, app_env=app_env)
self._simulation_results = SimulationResults(db_name=db_name, dotenv_path=dotenv_path, app_env=app_env)
self._application = Application(db_name=db_name, dotenv_path=dotenv_path, app_env=app_env)
def persist_city(self, city: City, pickle_path, application_id: int, user_id: int):
"""
Persist city into postgres database
:param city: City to be stored
:param pickle_path: Path to save the pickle file
:param application_id: Application id owning this city
:param user_id: User who create the city
"""
return self._city_repository.insert(city, pickle_path, application_id, user_id)
def update_city(self, city_id, city):
"""
Update an existing city in postgres database
:param city_id: the id of the city to update
:param city: the updated city object
"""
return self._city_repository.update(city_id, city)
def persist_application(self, name: str, description: str, application_uuid: str):
"""
Creates an application
:param name: name of application
:param description: the description of the application
:param application_uuid: the uuid of the application to be created
"""
return self._application.insert(name, description, application_uuid)
def update_application(self, name: str, description: str, application_uuid: str):
"""
Update an application
:param name: name of application
:param description: the description of the application
:param application_uuid: the uuid of the application to be created
"""
return self._application.update(application_uuid, name, description)
def delete_city(self, city_id):
"""
Deletes a single city from postgres
:param city_id: the id of the city to get
"""
self._city_repository.delete(city_id)
def delete_application(self, application_uuid):
"""
Deletes a single application from postgres
:param application_uuid: the id of the application to get
"""
self._application.delete(application_uuid)
def add_simulation_results(self, name, values, city_id=None, city_object_id=None):
"""
Add simulation results to the city or to the city_object
:param name: simulation and simulation engine name
:param values: simulation values in json format
:param city_id: city id or None
:param city_object_id: city object id or None
"""
self._simulation_results.insert(name, values, city_id, city_object_id)

View File

@ -5,6 +5,7 @@ Copyright © 2022 Concordia CERC group
Project Coder Peter Yefi peteryefi@gmail.comCode Project Coder Peter Yefi peteryefi@gmail.comCode
contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca contributor Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
import io
import pandas as pd import pandas as pd
from typing import Dict from typing import Dict
@ -31,22 +32,19 @@ class AirSourceHeatPumpParameters:
into a dictionary into a dictionary
:return : Dict :return : Dict
""" """
xl_file = pd.ExcelFile(self._base_path) with open(self._base_path, 'rb') as xls:
xl_file = pd.read_excel(io.BytesIO(xls.read()), sheet_name=None)
heat_pump_dfs = {sheet_name: xl_file.parse(sheet_name)
for sheet_name in xl_file.sheet_names}
cooling_data = {} cooling_data = {}
heating_data = {} heating_data = {}
for sheet, dataframe in heat_pump_dfs.items(): for sheet, dataframe in xl_file.items():
if 'Summary' in sheet: if 'Summary' in sheet:
continue continue
# Remove nan rows and columns and extract cooling and heating data # Remove nan rows and columns and extract cooling and heating data
# for each sheet # for each sheet
df = heat_pump_dfs[sheet].dropna(axis=1, how='all') df = xl_file[sheet].dropna(axis=1, how='all')
cooling_df = df.iloc[4:34, 0:8] cooling_df = df.iloc[4:34, 0:8]
heating_df = df.iloc[4:29, 8:20] heating_df = df.iloc[4:29, 8:20]
@ -91,8 +89,8 @@ class AirSourceHeatPumpParameters:
def _extract_heat_pump_data(heat_pump_capacity_data: Dict) -> [List, List]: def _extract_heat_pump_data(heat_pump_capacity_data: Dict) -> [List, List]:
""" """
Fetches a list of metric based data for heat pump for various temperature, Fetches a list of metric based data for heat pump for various temperature,
eg. cooling capacity data for 12 capacity heat pump e.g. cooling capacity data for 12 capacity heat pump
for 6,7,8,9,10 and 11 degree celsius for 6,7,8,9,10 and 11 degree Celsius
:param heat_pump_capacity_data: the heat pump capacity data from the :param heat_pump_capacity_data: the heat pump capacity data from the
which the metric specific data is fetched: {List} which the metric specific data is fetched: {List}
:return: List :return: List
@ -108,7 +106,7 @@ class AirSourceHeatPumpParameters:
""" """
Compute heat output and electrical demand coefficients Compute heat output and electrical demand coefficients
from heating and cooling performance data from heating and cooling performance data
:param heat_pump_data: a list of heat pump data. eg. cooling capacity :param heat_pump_data: a list of heat pump data. e.g. cooling capacity
:param data_type: string to indicate if data is cooling performance data :param data_type: string to indicate if data is cooling performance data
or heating performance data or heating performance data
:return: Tuple[Dict, Dict] :return: Tuple[Dict, Dict]

View File

@ -4,15 +4,14 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group Copyright © 2023 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
import logging
import sys
from pandas import DataFrame from pandas import DataFrame
from hub.hub_logger import logger
from hub.catalog_factories.energy_systems_catalog_factory import EnergySystemsCatalogFactory from hub.catalog_factories.energy_systems_catalog_factory import EnergySystemsCatalogFactory
from hub.city_model_structure.energy_systems.generic_distribution_system import GenericDistributionSystem
from hub.city_model_structure.energy_systems.generic_energy_system import GenericEnergySystem from hub.city_model_structure.energy_systems.generic_energy_system import GenericEnergySystem
from hub.city_model_structure.energy_systems.generic_generation_system import GenericGenerationSystem from hub.city_model_structure.energy_systems.generic_generation_system import GenericGenerationSystem
from hub.city_model_structure.energy_systems.generic_distribution_system import GenericDistributionSystem
from hub.helpers.dictionaries import Dictionaries from hub.helpers.dictionaries import Dictionaries
@ -44,9 +43,7 @@ class MontrealCustomEnergySystemParameters:
try: try:
archetype = self._search_archetypes(montreal_custom_catalog, archetype_name) archetype = self._search_archetypes(montreal_custom_catalog, archetype_name)
except KeyError: except KeyError:
logger.error(f'Building {building.name} has unknown energy system archetype for system name: {archetype_name}') logging.error(f'Building {building.name} has unknown energy system archetype for system name: {archetype_name}')
sys.stderr.write(f'Building {building.name} has unknown energy system archetype '
f'for system name: {archetype_name}')
continue continue
building_systems = [] building_systems = []

View File

@ -5,14 +5,16 @@ Copyright © 2022 Concordia CERC group
Project Coder Peter Yefi peteryefi@gmail.com Project Coder Peter Yefi peteryefi@gmail.com
""" """
import pandas as pd
from typing import Dict from typing import Dict
from hub.city_model_structure.energy_systems.water_to_water_hp import WaterToWaterHP
from hub.city_model_structure.energy_system import EnergySystem
from scipy.optimize import curve_fit
import numpy as np
from typing import List from typing import List
import numpy as np
import pandas as pd
from scipy.optimize import curve_fit
from hub.city_model_structure.energy_system import EnergySystem
from hub.city_model_structure.energy_systems.water_to_water_hp import WaterToWaterHP
class WaterToWaterHPParameters: class WaterToWaterHPParameters:
""" """
@ -24,11 +26,7 @@ class WaterToWaterHPParameters:
self._base_path = (base_path / 'heat_pumps/water_to_water.xlsx') self._base_path = (base_path / 'heat_pumps/water_to_water.xlsx')
def _read_file(self) -> Dict: def _read_file(self) -> Dict:
""" # todo: this method is keeping the excel file open and should be either corrected or removed
reads xlsx file containing water to water heat pump information
into a dictionary
:return : Dict
"""
xl_file = pd.ExcelFile(self._base_path) xl_file = pd.ExcelFile(self._base_path)
heat_pump_dfs = {sheet_name: xl_file.parse(sheet_name) heat_pump_dfs = {sheet_name: xl_file.parse(sheet_name)
for sheet_name in xl_file.sheet_names} for sheet_name in xl_file.sheet_names}
@ -146,8 +144,9 @@ class WaterToWaterHPParameters:
demand = [i / j for i, j in zip(heat_pump_data['tc'], heat_pump_data['pd'])] demand = [i / j for i, j in zip(heat_pump_data['tc'], heat_pump_data['pd'])]
# Compute heat output coefficients # Compute heat output coefficients
popt, _ = curve_fit(self._objective_function, [heat_pump_data['ewt'], heat_pump_data['lwt'], heat_pump_data['fr']], popt, _ = curve_fit(
demand) self._objective_function, [heat_pump_data['ewt'], heat_pump_data['lwt'], heat_pump_data['fr']], demand
)
return popt.tolist() return popt.tolist()
@staticmethod @staticmethod

View File

@ -6,13 +6,11 @@ Project Coder Pilar Monsalvete pilar.monsalvete@concordi.
Code contributors: Peter Yefi peteryefi@gmail.com Code contributors: Peter Yefi peteryefi@gmail.com
""" """
from pathlib import Path from pathlib import Path
from hub.imports.energy_systems.air_source_hp_parameters import AirSourceHeatPumpParameters
from hub.imports.energy_systems.water_to_water_hp_parameters import WaterToWaterHPParameters
from hub.helpers.utils import validate_import_export_type
from hub.hub_logger import get_logger
from hub.imports.energy_systems.montreal_custom_energy_system_parameters import MontrealCustomEnergySystemParameters
logger = get_logger() from hub.helpers.utils import validate_import_export_type
from hub.imports.energy_systems.air_source_hp_parameters import AirSourceHeatPumpParameters
from hub.imports.energy_systems.montreal_custom_energy_system_parameters import MontrealCustomEnergySystemParameters
from hub.imports.energy_systems.water_to_water_hp_parameters import WaterToWaterHPParameters
class EnergySystemsFactory: class EnergySystemsFactory:
@ -23,12 +21,8 @@ class EnergySystemsFactory:
def __init__(self, handler, city, base_path=None): def __init__(self, handler, city, base_path=None):
if base_path is None: if base_path is None:
base_path = Path(Path(__file__).parent.parent / 'data/energy_systems') base_path = Path(Path(__file__).parent.parent / 'data/energy_systems')
self._handler = '_' + handler.lower().replace(' ', '_') self._handler = '_' + handler.lower()
class_funcs = validate_import_export_type(EnergySystemsFactory) validate_import_export_type(EnergySystemsFactory, handler)
if self._handler not in class_funcs:
err_msg = f"Wrong import type. Valid functions include {class_funcs}"
logger.error(err_msg)
raise Exception(err_msg)
self._city = city self._city = city
self._base_path = base_path self._base_path = base_path

View File

@ -4,18 +4,15 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
""" """
import geopandas import geopandas
from hub.city_model_structure.city import City from hub.city_model_structure.city import City
from hub.helpers.utils import validate_import_export_type
from hub.imports.geometry.citygml import CityGml from hub.imports.geometry.citygml import CityGml
from hub.imports.geometry.geojson import Geojson
from hub.imports.geometry.gpandas import GPandas
from hub.imports.geometry.obj import Obj from hub.imports.geometry.obj import Obj
from hub.imports.geometry.rhino import Rhino from hub.imports.geometry.rhino import Rhino
from hub.imports.geometry.gpandas import GPandas
from hub.imports.geometry.geojson import Geojson
from hub.helpers.utils import validate_import_export_type
from hub.hub_logger import get_logger
logger = get_logger()
class GeometryFactory: class GeometryFactory:
@ -31,11 +28,7 @@ class GeometryFactory:
function_field=None, function_field=None,
function_to_hub=None): function_to_hub=None):
self._file_type = '_' + file_type.lower() self._file_type = '_' + file_type.lower()
class_funcs = validate_import_export_type(GeometryFactory) validate_import_export_type(GeometryFactory, file_type)
if self._file_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 = path self._path = path
self._data_frame = data_frame self._data_frame = data_frame
self._name_field = name_field self._name_field = name_field

View File

@ -1,25 +0,0 @@
"""
CityGml module parses citygml_classes files and import the geometry into the city model structure
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Atiya atiya.atiya@mail.concordia.ca
"""
import xmltodict
from pathlib import Path
from hub.city_model_structure.fuel import Fuel
class LcaFuel:
def __init__(self, city, base_path):
self._city = city
self._base_path = base_path
self._lca = None
def enrich(self):
self._city.fuels = []
path = Path(self._base_path / 'lca_data.xml').resolve()
with open(path) as xml:
self._lca = xmltodict.parse(xml.read())
for fuel in self._lca["library"]["fuels"]['fuel']:
self._city.fuels.append(Fuel(fuel['@id'], fuel['@name'], fuel['carbon_emission_factor']['#text'],
fuel['carbon_emission_factor']['@unit']))

View File

@ -1,30 +0,0 @@
"""
CityGml module parses citygml_classes files and import the geometry into the city model structure
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Atiya atiya.atiya@mail.concordia.ca
"""
import xmltodict
from pathlib import Path
from hub.city_model_structure.machine import Machine
class LcaMachine:
def __init__(self, city, base_path):
self._city = city
self._base_path = base_path
self._lca = None
def enrich(self):
self._city.machines = []
path = Path(self._base_path / 'lca_data.xml').resolve()
with open(path) as xml:
self._lca = xmltodict.parse(xml.read())
for machine in self._lca["library"]["machines"]['machine']:
self._city.machines.append(Machine(machine['@id'], machine['@name'], machine['work_efficiency']['#text'],
machine['work_efficiency']['@unit'],
machine['energy_consumption_rate']['#text'],
machine['energy_consumption_rate']['@unit'],
machine['carbon_emission_factor']['#text'],
machine['carbon_emission_factor']['@unit']))

View File

@ -1,41 +0,0 @@
"""
CityGml module parses citygml_classes files and import the geometry into the city model structure
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Atiya atiya.atiya@mail.concordia.ca
"""
import xmltodict
from pathlib import Path
from hub.city_model_structure.lca_material import LcaMaterial as LMaterial
class LcaMaterial:
def __init__(self, city, base_path):
self._city = city
self._base_path = base_path
self._lca = None
def enrich(self):
self._city.lca_materials = []
path = Path(self._base_path / 'lca_data.xml').resolve()
with open(path) as xml:
self._lca = xmltodict.parse(xml.read())
for material in self._lca["library"]["building_materials"]['material']:
_material = LMaterial()
_material.type = material['@type']
_material.id = material['@id']
_material.name = material['@name']
_material.density = material['density']['#text']
_material.density_unit = material['density']['@unit']
_material.embodied_carbon = material['embodied_carbon']['#text']
_material.embodied_carbon_unit = material['embodied_carbon']['@unit']
_material.recycling_ratio = material['recycling_ratio']
_material.onsite_recycling_ratio = material['onsite_recycling_ratio']
_material.company_recycling_ratio = material['company_recycling_ratio']
_material.landfilling_ratio = material['landfilling_ratio']
_material.cost = material['cost']['#text']
_material._cost_unit = material['cost']['@unit']
self._city.lca_materials.append(_material)

Some files were not shown because too many files have changed in this diff Show More