Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove zoningSetup LOD setting and instead add two more ZoningCriteri… #758

Merged
merged 7 commits into from
Dec 10, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ def test_regression_DigitalHub_SB89(self):
"""Test DigitalHub IFC, includes regression test."""
ifc_names = {IFCDomain.arch: 'FM_ARC_DigitalHub_with_SB89.ifc'}
project = self.create_project(ifc_names, 'comfort')
project.sim_settings.zoning_setup = LOD.full
project.sim_settings.create_external_elements = True
project.sim_settings.cooling = True
project.sim_settings.construction_class_windows = \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ def test_regression_AC20_FZK_Haus(self):
ifc_names = {IFCDomain.arch: 'AC20-FZK-Haus.ifc'}
project = self.create_project(ifc_names, 'energyplus')
project.sim_settings.create_external_elements = True
project.sim_settings.zoning_setup = LOD.full
project.sim_settings.cooling = True
project.sim_settings.split_bounds = True
project.sim_settings.add_shadings = True
Expand All @@ -174,7 +173,6 @@ def test_regression_DigitalHub_SB89(self):
"""Test DigitalHub IFC, includes regression test."""
ifc_names = {IFCDomain.arch: 'FM_ARC_DigitalHub_with_SB89.ifc'}
project = self.create_project(ifc_names, 'energyplus')
project.sim_settings.zoning_setup = LOD.full
project.sim_settings.create_external_elements = True
project.sim_settings.cooling = True
project.sim_settings.construction_class_windows = \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ def run_example_simple_building_teaser():
# specify simulation settings (please have a look at the documentation of
# all under concepts/sim_settings
# combine spaces to thermal zones based on their usage
project.sim_settings.zoning_setup = LOD.full
project.sim_settings.zoning_criteria = ZoningCriteria.usage
project.sim_settings.zoning_criteria = ZoningCriteria.individual_spaces
# use cooling
project.sim_settings.cooling = True
# use set points for heating and cooling from templates
Expand All @@ -52,7 +51,8 @@ def run_example_simple_building_teaser():
Path(bim2sim.__file__).parent.parent /
'test/resources/weather_files/DEU_NW_Aachen.105010_TMYx.mos')
# Run a simulation directly with dymola after model creation
project.sim_settings.dymola_simulation = False
project.sim_settings.dymola_simulation = True
project.sim_settings.create_plots = True
# Select results to output:
project.sim_settings.sim_results = [
"heat_demand_total", "cool_demand_total",
Expand All @@ -62,9 +62,6 @@ def run_example_simple_building_teaser():
"operative_temp_rooms", "air_temp_rooms", "air_temp_out",
"infiltration_rooms"
]
# FZK Haus has correct IFC typings but faulty SB internal/external
# information
project.sim_settings.fix_type_mismatches_with_sb = True

# run the project with the ConsoleDecisionHandler. This allows interactive
# input to answer upcoming decisions during the model creation process
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def run_example_complex_building_teaser():
# specify simulation settings (please have a look at the documentation of
# all under concepts/sim_settings
# combine spaces to thermal zones based on their usage
project.sim_settings.zoning_setup = LOD.medium
project.sim_settings.zoning_criteria = ZoningCriteria.usage
# use cooling
project.sim_settings.cooling = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ def visualize_zoning_of_complex_building():

# we use LOD.medium that means that zones are merged based on
# zoning_criteria sim_setting
project.sim_settings.zoning_setup = LOD.medium

# We don't need a full bim2sim run with simulation to demonstrate this, so
# we will just run the needed tasks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ def run_serialize_teaser_project_example():



project.sim_settings.zoning_setup = LOD.medium
project.sim_settings.zoning_criteria = ZoningCriteria.usage
# use cooling
project.sim_settings.cooling = False
Expand Down
81 changes: 64 additions & 17 deletions bim2sim/plugins/PluginTEASER/bim2sim_teaser/sim_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,89 @@ class TEASERSimSettings(BuildingSimSettings):

This class defines the simulation settings for the TEASER Plugin. It
inherits all choices from the BuildingSimulation settings. TEASER
specific settings are added here..
specific settings are added here.
"""
sim_results = ChoiceSetting(
default=[
"heat_demand_total", "cool_demand_total",
"heat_demand_rooms", "cool_demand_rooms",
"heat_energy_total", "cool_energy_total",
"heat_energy_rooms", "cool_energy_rooms",
"air_temp_out", "operative_temp_rooms", "air_temp_rooms",
"internal_gains_machines_rooms", "internal_gains_persons_rooms",
"internal_gains_lights_rooms", "n_persons_rooms",
"infiltration_rooms", "mech_ventilation_rooms",
"heat_set_rooms", "cool_set_rooms", "cpu_time"

zoning_setup = ChoiceSetting(
default=LOD.low,
],
choices={
LOD.low: 'All IfcSpaces of the building will be merged into '
'one thermal zone.',
LOD.medium: 'IfcSpaces of the building will be merged together'
' based on selected zoning criteria.',
LOD.full: 'Every IfcSpace will be a separate thermal zone'
"heat_demand_total":
"Total heating demand (power) as time series data",
"cool_demand_total":
"Total cooling demand (power) as time series data",
"heat_demand_rooms":
"Zone based heating demand (power) as time series data",
"cool_demand_rooms":
"Zone based cooling demand (power) as time series data",
"heat_energy_total":
"Total heating energy as time series data",
"cool_energy_total":
"Total cooling energy as time series data",
"heat_energy_rooms":
"Zone based heating energy as time series data",
"cool_energy_rooms":
"Zone cooling heating energy as time series data",
"air_temp_out":
"Outdoor air temperature as time series data",
"operative_temp_rooms":
"Zone based operative temperature as time series data",
"air_temp_rooms":
"Zone based indoor air temperature as time series data",
"internal_gains_machines_rooms":
"Internal gains through machines in W as time series data",
"internal_gains_persons_rooms":
"Internal gains through persons in W as time series data",
"internal_gains_lights_rooms":
"Internal gains through lights in W as time series data",
"n_persons_rooms":
"Total amount of occupying persons as time series data",
"infiltration_rooms":
"Infiltration into room in 1/h as time series data",
"mech_ventilation_rooms":
"Mechanical ventilation flow in m³/h as time series data",
"heat_set_rooms":
"Heating set point in °C time series data",
"cool_set_rooms":
"Cooling set point in °C time series data",
"cpu_time": "Computational time taken for simulation."
},
description='Select the criteria based on which thermal zones will '
'be aggreated.',
for_frontend=True
multiple_choice=True,
)

zoning_criteria = ChoiceSetting(
default=ZoningCriteria.usage,
default=ZoningCriteria.individual_spaces,
choices={
ZoningCriteria.external:
'Group all thermal zones that have contact to the exterior'
' together and all thermal zones that do not have contact to'
' exterior.',
ZoningCriteria.external_orientation:
'Like external, but takes orientation '
'(North, east, south, west)'
'(North, East, South, West)'
' into account as well',
ZoningCriteria.usage:
'Group all thermal zones that have the same usage.',
ZoningCriteria.external_orientation_usage:
'Combines the prior options.',
'Combines grouping based on exterior contact, '
'orientation, and usage.',
ZoningCriteria.all_criteria:
'Uses all prior options and adds glass percentage of the rooms'
' as additional criteria and only groups rooms if they are'
' adjacent to each other.'
'Uses all criteria including exterior contact, orientation, '
'usage, glass percentage, and only groups physically adjacent '
'rooms.',
ZoningCriteria.individual_spaces:
'Creates individual thermal zones for each space.',
ZoningCriteria.combined_single_zone:
'Combines all spaces into a single thermal zone.'
},
for_frontend=True
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from bim2sim.elements.mapping.units import ureg
from bim2sim.utilities.common_functions import filter_elements

# Important: if these are adjusted, also adjust export_vars in ExportTEASER
bim2sim_teaser_mapping_base = {
"multizonePostProcessing.PHeaterSum": "heat_demand_total",
"multizonePostProcessing.PHeater[numZones]": "heat_demand_rooms",
Expand Down Expand Up @@ -33,7 +34,8 @@
"multizone.zone[numZones].ventCont.y": "infiltration_rooms",
"multizone.zone[numZones].ventRate": "mech_ventilation_rooms",
"tableTSet.y[numZones]": "heat_set_rooms",
"tableTSetCool.y[numZones]": "cool_set_rooms"
"tableTSetCool.y[numZones]": "cool_set_rooms",
"CPUtime": "cpu_time"
}

# bim2sim_teaser_indirect_mapping = {
Expand All @@ -56,6 +58,7 @@
"heat_set": ureg.kelvin,
"cool_set": ureg.kelvin,
"internal_gains": ureg.watt,
"cpu_time": ureg.second
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import contextlib

from bim2sim.tasks.base import ITask
from bim2sim.plugins.PluginTEASER.bim2sim_teaser.task.create_result_df import \
bim2sim_teaser_mapping_base, CreateResultDF


class ExportTEASER(ITask):
Expand All @@ -22,12 +24,60 @@ def run(self, teaser_prj):
"""
self.logger.info("Starting export TEASER model to Modelica")

# Important: if these are adjusted, also adjust sim_setting sim_results
# and bim2sim_teaser_mapping_base in CreateResultDF
export_vars = {
"HeatingDemands": [
"*multizone.PHeater*",
"*multizonePostProcessing.PHeater*",
'multizonePostProcessing.PHeaterSum',
'*multizonePostProcessing.WHeater*',
'multizonePostProcessing.WHeaterSum',
],
"CoolingDemands": [
'*multizone.PCooler*',
'*multizonePostProcessing.PCooler*',
'*multizonePostProcessing.PCoolerSum',
'*multizonePostProcessing.WCooler*',
'multizonePostProcessing.WCoolerSum',
],
"Temperatures": [
'weaDat.weaBus.TDryBul',
'*multizone.TAir*',
'*multizonePostProcessing.TAir*',
'multizonePostProcessing.TAirMean',
'multizonePostProcessing.TOperativeMean',
'*multizonePostProcessing.TOperativeAverageCalc.u*'
],
'AHU': [
'multizonePostProcessing.WHeatAHU',
'multizonePostProcessing.WCoolAHU',
'multizonePostProcessing.WElAHU',
],
'InternalGains': [
'*multizonePostProcessing.QIntGains_flow*'
],
'VentilationInfiltration': [
'multizone.zone*.ventRate',
'multizone.zone*.ventCont.y'
],
'SetTemperatures': [
'tableTSet.y*',
'tableTSetCool.y*',
],
'CPU': [
'CPUtime'
]
}

# silence output via redirect_stdout to not mess with bim2sim logs
with open(os.devnull, 'w') as devnull:
with contextlib.redirect_stdout(devnull):
teaser_prj.export_aixlib(
path=self.paths.export / 'TEASER' / 'Model',
use_postprocessing_calc=True,
report=True)
report=True,
export_vars=export_vars
)

self.logger.info("Successfully created simulation model with TEASER.")
17 changes: 5 additions & 12 deletions bim2sim/plugins/PluginTEASER/test/integration/test_teaser.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ def test_run_kitoffice_spaces_medium_layers_low(self):
"""Run project with AC20-Institute-Var-2.ifc"""
ifc_names = {IFCDomain.arch: 'AC20-Institute-Var-2.ifc'}
project = self.create_project(ifc_names, 'TEASER')
project.sim_settings.zoning_setup = LOD.medium
project.sim_settings.zoning_criteria = ZoningCriteria.all_criteria
answers = (2015,)
handler = DebugDecisionHandler(answers)
Expand All @@ -42,7 +41,6 @@ def test_DH_spaces_medium_material_low(self):
"""Test DigitalHub IFC"""
ifc_names = {IFCDomain.arch: 'FM_ARC_DigitalHub_with_SB_neu.ifc'}
project = self.create_project(ifc_names, 'TEASER')
project.sim_settings.zoning_setup = LOD.medium
project.sim_settings.zoning_criteria = ZoningCriteria.all_criteria
project.sim_settings.prj_use_conditions = Path(
bim2sim.__file__).parent.parent / \
Expand All @@ -64,7 +62,7 @@ def test_run_kitfzkhaus_spaces_low_layers_low(self):
"""Run project with AC20-FZK-Haus.ifc"""
ifc_names = {IFCDomain.arch: 'AC20-FZK-Haus.ifc'}
project = self.create_project(ifc_names, 'TEASER')
project.sim_settings.zoning_setup = LOD.low
project.sim_settings.zoning_criteria = ZoningCriteria.combined_single_zone
answers = ()
handler = DebugDecisionHandler(answers)
for decision, answer in handler.decision_answer_mapping(project.run()):
Expand All @@ -77,7 +75,7 @@ def test_ERC_Full(self):
"""Test ERC Main Building"""
ifc_names = {IFCDomain.arch: 'ERC_Mainbuilding_Arch.ifc'}
project = self.create_project(ifc_names, 'TEASER')
project.sim_settings.zoning_setup = LOD.full
project.sim_settings.zoning_criteria = ZoningCriteria.individual_spaces
project.sim_settings.layers_and_materials = LOD.full
answers = ("Kitchen in non-residential buildings",
"Library - reading room",
Expand All @@ -99,7 +97,6 @@ def test_ERC_Medium(self):
"""Test ERC Main Building"""
ifc_names = {IFCDomain.arch: 'ERC_Mainbuilding_Arch.ifc'}
project = self.create_project(ifc_names, 'TEASER')
project.sim_settings.zoning_setup = LOD.medium
project.sim_settings.zoning_criteria = ZoningCriteria.all_criteria
answers = ()
handler = DebugDecisionHandler(answers)
Expand All @@ -125,7 +122,6 @@ def test_run_kitfzkhaus_spaces_medium_layers_low(self):
"""Run project with AC20-FZK-Haus.ifc"""
ifc_names = {IFCDomain.arch: 'AC20-FZK-Haus.ifc'}
project = self.create_project(ifc_names, 'TEASER')
project.sim_settings.zoning_setup = LOD.medium
project.sim_settings.zoning_criteria = ZoningCriteria.all_criteria
answers = ()
handler = DebugDecisionHandler(answers)
Expand All @@ -139,7 +135,6 @@ def test_run_kitfzkhaus_spaces_medium_layers_full(self):
"""Run project with AC20-FZK-Haus.ifc"""
ifc_names = {IFCDomain.arch: 'AC20-FZK-Haus.ifc'}
project = self.create_project(ifc_names, 'TEASER')
project.sim_settings.zoning_setup = LOD.medium
project.sim_settings.layers_and_materials = LOD.full
project.sim_settings.zoning_criteria = ZoningCriteria.all_criteria
answers = ('vertical_core_brick_700',
Expand All @@ -155,7 +150,6 @@ def test_run_kitoffice_spaces_medium_layers_full(self):
"""Run project with AC20-Institute-Var-2.ifc"""
ifc_names = {IFCDomain.arch: 'AC20-Institute-Var-2.ifc'}
project = self.create_project(ifc_names, 'TEASER')
project.sim_settings.zoning_setup = LOD.medium
project.sim_settings.layers_and_materials = LOD.full
project.sim_settings.zoning_criteria = ZoningCriteria.all_criteria
answers = (2015, 'concrete_CEM_II_BS325R_wz05', 'clay_brick',
Expand All @@ -172,7 +166,7 @@ def test_run_kitfzkhaus_spaces_full_layers_full(self):
ifc_names = {IFCDomain.arch: 'AC20-FZK-Haus.ifc'}
project = self.create_project(ifc_names, 'TEASER')
project.sim_settings.layers_and_materials = LOD.full
project.sim_settings.zoning_setup = LOD.full = LOD.full
project.sim_settings.zoningCriteria = ZoningCriteria.individual_spaces
answers = (True, 'solid_brick_h', True, 'hardwood', True,
'Concrete_DK', True, 'Light_Concrete_DK',
'heavy', 1, 'Door', 1, 'Brick', 'solid_brick_h', 'EnEv',
Expand All @@ -188,7 +182,7 @@ def test_run_kitoffice_spaces_full_layers_full(self):
"""Run project with AC20-Institute-Var-2.ifc"""
ifc_names = {IFCDomain.arch: 'AC20-Institute-Var-2.ifc'}
project = self.create_project(ifc_names, 'TEASER')
project.sim_settings.zoning_setup = LOD.full
project.sim_settings.zoning_criteria = ZoningCriteria.individual_spaces
project.sim_settings.layers_and_materials = LOD.full
answers = ('Glas', True, 'glas_generic', 500, 1.5, 0.2,
True, 'air_layer', 'sandstone', True, 'lime_sandstone_1',
Expand All @@ -208,7 +202,7 @@ def test_live_decisions(self):
ifc_names = {IFCDomain.arch: 'AC20-FZK-Haus.ifc'}
# ifc_names = {IFCDomain.arch: 'AC20-Institute-Var-2.ifc'
project = self.create_project(ifc_names, 'TEASER')
project.sim_settings.zoning_setup = LOD.full
project.sim_settings.zoning_criteria = ZoningCriteria.individual_spaces
# answers = ('Glas', True, 'generic', 500, 1.5, 0.2,
# True, 'air_layer_DK', 'sandstone', True, 'lime',
# 'lime_sandstone_1', True, 'aluminium', 0.1, True,
Expand All @@ -230,7 +224,6 @@ def test_run_kitfzkhaus_spaces_medium_layers_full_no_translator(self):
"""Run project with AC20-FZK-Haus.ifc"""
ifc_names = {IFCDomain.arch: 'AC20-FZK-Haus.ifc'}
project = self.create_project(ifc_names, 'TEASER')
project.sim_settings.zoning_setup = LOD.medium
project.sim_settings.layers_and_materials = LOD.full
project.sim_settings.zoning_criteria = ZoningCriteria.all_criteria
answers = ('Kitchen - preparations, storage', True,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ def create_regression_results_FZKHaus(self):
"""Create fresh regression results for the AC20-FZK-Haus.ifc"""
ifc_names = {IFCDomain.arch: 'AC20-FZK-Haus.ifc'}
project = self.create_project(ifc_names, 'TEASER')
# FZK Haus as correct IFC types but wrong SB external/internal
# information
project.sim_settings.fix_type_mismatches_with_sb = False
answers = ()
handler = DebugDecisionHandler(answers)
for decision, answer in handler.decision_answer_mapping(project.run()):
Expand Down
Loading