Compare commits

..

No commits in common. "6c7f652390335ff171ed6a162514b053be717ce6" and "4ac9ccda816960d5158d70fc1428f79279566f81" have entirely different histories.

3 changed files with 10 additions and 89 deletions

View File

@ -19,8 +19,6 @@ from hub.city_model_structure.building_demand.domestic_hot_water import Domestic
from hub.city_model_structure.attributes.schedule import Schedule from hub.city_model_structure.attributes.schedule import Schedule
from hub.city_model_structure.building_demand.internal_gain import InternalGain from hub.city_model_structure.building_demand.internal_gain import InternalGain
from hub.catalog_factories.usage_catalog_factory import UsageCatalogFactory from hub.catalog_factories.usage_catalog_factory import UsageCatalogFactory
from hub.catalog_factories.construction_catalog_factory import ConstructionCatalogFactory
from hub.imports.construction.helpers.construction_helper import ConstructionHelper
class ComnetUsageParameters: class ComnetUsageParameters:
@ -75,13 +73,11 @@ class ComnetUsageParameters:
self._calculate_reduced_values_from_extended_library(usage, comnet_archetype_usages[i]) self._calculate_reduced_values_from_extended_library(usage, comnet_archetype_usages[i])
internal_zone_usages.append(usage) internal_zone_usages.append(usage)
else: else:
storeys_above_ground = building.storeys_above_ground if building.storeys_above_ground is None:
if storeys_above_ground is None: logging.error('Building %s no number of storeys assigned, ACH cannot be calculated for usage %s',
logging.error('Building %s no number of storeys assigned, ACH cannot be calculated for usage %s. ' building.name, usages)
'NRCAN construction data for the year %s is used to calculated number of storeys above ' continue
'ground', building.name, usages, building.year_of_construction) volume_per_area = building.volume / building.floor_area / building.storeys_above_ground
storeys_above_ground = self.average_storey_height_calculator(self._city, building)
volume_per_area = building.volume / building.floor_area / storeys_above_ground
for (j, mixed_usage) in enumerate(usages): for (j, mixed_usage) in enumerate(usages):
usage = Usage() usage = Usage()
usage.name = mixed_usage[-1] usage.name = mixed_usage[-1]
@ -265,37 +261,3 @@ class ComnetUsageParameters:
_mean_internal_gain.schedules = _schedules _mean_internal_gain.schedules = _schedules
return [_mean_internal_gain] return [_mean_internal_gain]
@staticmethod
def average_storey_height_calculator(city, building):
climate_zone = ConstructionHelper.city_to_nrcan_climate_zone(city.climate_reference_city)
nrcan_catalog = ConstructionCatalogFactory('nrcan').catalog
main_function = None
functions = building.function.split('_')
if len(functions) > 1:
maximum_percentage = 0
for function in functions:
percentage_and_function = function.split('-')
if float(percentage_and_function[0]) > maximum_percentage:
maximum_percentage = float(percentage_and_function[0])
main_function = percentage_and_function[-1]
else:
main_function = functions[-1]
if main_function not in Dictionaries().hub_function_to_nrcan_construction_function:
logging.error('Building %s has an unknown building function %s', building.name, main_function)
function = Dictionaries().hub_function_to_nrcan_construction_function[main_function]
construction_archetype = None
average_storey_height = None
nrcan_archetypes = nrcan_catalog.entries('archetypes')
for building_archetype in nrcan_archetypes:
construction_period_limits = building_archetype.construction_period.split('_')
if int(construction_period_limits[0]) <= int(building.year_of_construction) <= int(construction_period_limits[1]):
if str(function) == str(building_archetype.function) and climate_zone == str(building_archetype.climate_zone):
construction_archetype = building_archetype
average_storey_height = building_archetype.average_storey_height
if construction_archetype is None:
logging.error('Building %s has unknown construction archetype for building function: %s '
'[%s], building year of construction: %s and climate zone %s', building.name, function,
building.function, building.year_of_construction, climate_zone)
return average_storey_height

View File

@ -9,7 +9,6 @@ Project Collaborator Saeed Ranjbar saeed.ranjbar@concordia.ca
import logging import logging
import hub.helpers.constants as cte import hub.helpers.constants as cte
from hub.catalog_factories.construction_catalog_factory import ConstructionCatalogFactory
from hub.helpers.dictionaries import Dictionaries from hub.helpers.dictionaries import Dictionaries
from hub.city_model_structure.building_demand.usage import Usage from hub.city_model_structure.building_demand.usage import Usage
from hub.city_model_structure.building_demand.lighting import Lighting from hub.city_model_structure.building_demand.lighting import Lighting
@ -18,7 +17,6 @@ from hub.city_model_structure.building_demand.appliances import Appliances
from hub.city_model_structure.building_demand.thermal_control import ThermalControl from hub.city_model_structure.building_demand.thermal_control import ThermalControl
from hub.city_model_structure.building_demand.domestic_hot_water import DomesticHotWater from hub.city_model_structure.building_demand.domestic_hot_water import DomesticHotWater
from hub.catalog_factories.usage_catalog_factory import UsageCatalogFactory from hub.catalog_factories.usage_catalog_factory import UsageCatalogFactory
from hub.imports.construction.helpers.construction_helper import ConstructionHelper
class NrcanUsageParameters: class NrcanUsageParameters:
@ -84,14 +82,11 @@ class NrcanUsageParameters:
self._calculate_reduced_values_from_extended_library(usage, nrcan_archetype_usages[i]) self._calculate_reduced_values_from_extended_library(usage, nrcan_archetype_usages[i])
internal_zone_usages.append(usage) internal_zone_usages.append(usage)
else: else:
storeys_above_ground = building.storeys_above_ground if building.storeys_above_ground is None:
if storeys_above_ground is None: logging.error('Building %s no number of storeys assigned, ACH cannot be calculated for usage %s',
logging.error('Building %s no number of storeys assigned, ACH cannot be calculated for usage %s. ' building.name, usages)
'NRCAN construction data for the year %s is used to calculated number of storeys above '
'ground', building.name, usages, building.year_of_construction)
storeys_above_ground = self.average_storey_height_calculator(self._city, building)
continue continue
volume_per_area = building.volume / building.floor_area / storeys_above_ground volume_per_area = building.volume / building.floor_area / building.storeys_above_ground
for (j, mixed_usage) in enumerate(usages): for (j, mixed_usage) in enumerate(usages):
usage = Usage() usage = Usage()
usage.name = mixed_usage[-1] usage.name = mixed_usage[-1]
@ -222,39 +217,3 @@ class NrcanUsageParameters:
usage.thermal_control.mean_heating_set_point = max_heating_setpoint usage.thermal_control.mean_heating_set_point = max_heating_setpoint
usage.thermal_control.heating_set_back = min_heating_setpoint usage.thermal_control.heating_set_back = min_heating_setpoint
usage.thermal_control.mean_cooling_set_point = min_cooling_setpoint usage.thermal_control.mean_cooling_set_point = min_cooling_setpoint
@staticmethod
def average_storey_height_calculator(city, building):
climate_zone = ConstructionHelper.city_to_nrcan_climate_zone(city.climate_reference_city)
nrcan_catalog = ConstructionCatalogFactory('nrcan').catalog
main_function = None
functions = building.function.split('_')
if len(functions) > 1:
maximum_percentage = 0
for function in functions:
percentage_and_function = function.split('-')
if float(percentage_and_function[0]) > maximum_percentage:
maximum_percentage = float(percentage_and_function[0])
main_function = percentage_and_function[-1]
else:
main_function = functions[-1]
if main_function not in Dictionaries().hub_function_to_nrcan_construction_function:
logging.error('Building %s has an unknown building function %s', building.name, main_function)
function = Dictionaries().hub_function_to_nrcan_construction_function[main_function]
construction_archetype = None
average_storey_height = None
nrcan_archetypes = nrcan_catalog.entries('archetypes')
for building_archetype in nrcan_archetypes:
construction_period_limits = building_archetype.construction_period.split('_')
if int(construction_period_limits[0]) <= int(building.year_of_construction) <= int(construction_period_limits[1]):
if str(function) == str(building_archetype.function) and climate_zone == str(building_archetype.climate_zone):
construction_archetype = building_archetype
average_storey_height = building_archetype.average_storey_height
if construction_archetype is None:
logging.error('Building %s has unknown construction archetype for building function: %s '
'[%s], building year of construction: %s and climate zone %s', building.name, function,
building.function, building.year_of_construction, climate_zone)
return average_storey_height

View File

@ -83,7 +83,7 @@ class TestUsageFactory(TestCase):
city = self._get_citygml(file) city = self._get_citygml(file)
for building in city.buildings: for building in city.buildings:
building.function = Dictionaries().pluto_function_to_hub_function[building.function] building.function = Dictionaries().pluto_function_to_hub_function[building.function]
ConstructionFactory('nrcan', city).enrich()
UsageFactory('comnet', city).enrich() UsageFactory('comnet', city).enrich()
self._check_buildings(city) self._check_buildings(city)
for building in city.buildings: for building in city.buildings: