Skip to content

Commit a5bea01

Browse files
committed
check u_value for ifcWindow via ids works
1 parent 0d110ee commit a5bea01

File tree

2 files changed

+196
-0
lines changed

2 files changed

+196
-0
lines changed
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
import tempfile
2+
from pathlib import Path
3+
4+
import bim2sim
5+
from bim2sim import Project, ConsoleDecisionHandler, run_project
6+
from bim2sim.elements import bps_elements
7+
from bim2sim.utilities.common_functions import filter_elements
8+
from bim2sim.utilities.types import IFCDomain
9+
from bim2sim.elements.base_elements import Material
10+
from bim2sim.plugins.PluginIFCCheck.bim2sim_ifccheck import PluginIFCCheck
11+
12+
13+
def run_simple_project():
14+
"""Run a bim2sim project with the PluginIFCCheck
15+
16+
This exmaple is used while the development of the ifc check based on IDS
17+
task. After the development is finished, it can deleted or use as example
18+
for the usage of this task.
19+
"""
20+
# Create a temp directory for the project, feel free to use a "normal"
21+
# directory
22+
project_path = Path(tempfile.TemporaryDirectory(
23+
prefix='bim2sim_e1_checkifc').name)
24+
25+
# Set the ifc path to use and define which domain the IFC belongs to.
26+
# This is done via a dictionary, where the key is the domain and the value
27+
# the path to the IFC file. We are using an architecture domain IFC file
28+
# here from the FZK-Haus which is a simple IFC provided by KIT.
29+
# ifc_file = test_rsrc_path / 'ids/fail-a_minimal_ids_can_check_a_minimal_ifc_1_2.ifc'
30+
# test_rsrc_path = Path(__file__).parent.parent.parent.parent / 'resources'
31+
#
32+
# no error ifc file
33+
ifc_paths = {
34+
IFCDomain.arch:
35+
Path(bim2sim.__file__).parent.parent /
36+
'test/resources/arch/ifc/AC20-FZK-Haus.ifc',
37+
}
38+
#
39+
# ifc file with not fitting ifc version
40+
# ifc_paths = {
41+
# IFCDomain.arch:
42+
# Path(bim2sim.__file__).parent.parent.parent.parent /
43+
# '12_ifc_check_ids/AC20-FZK-Haus_NoneAndDoubleGUID2x3.ifc',
44+
# }
45+
46+
project = Project.create(
47+
project_path, ifc_paths, PluginIFCCheck)
48+
49+
# Next to the plugin that should be used we can do further configuration
50+
# by using the `sim_settings`. `sim_settings` are meant to configure the
51+
# creation of the simulation model and assign information before starting
52+
# the process. This can be either weather data files, default simulation
53+
# time of the created model but also what kind of enrichment should be used
54+
# or what elements are relevant for the simulation. For more information
55+
# please review the documentation for `sim_settings`.
56+
57+
# Let's assign a weather file first. This is currently needed, even if no
58+
# simulation is performed
59+
project.sim_settings.weather_file_path = (
60+
Path(bim2sim.__file__).parent.parent /
61+
'test/resources/weather_files/DEU_NW_Aachen.105010_TMYx.mos')
62+
63+
# assign an IDS file, which is needed to check the ifc file by ifctester
64+
# project.sim_settings.ids_file_path = (
65+
# Path(bim2sim.__file__).parent.parent /
66+
# 'test/resources/ids/fail-a_minimal_ids_can_check_a_minimal_ifc_1_2.ids'
67+
# )
68+
69+
project.sim_settings.ids_file_path = (
70+
Path(bim2sim.__file__).parent /
71+
'plugins/PluginIFCCheck/bim2sim_ifccheck/ifcWindow_props.ids'
72+
)
73+
74+
# Assign the enrichment for use conditions of thermal zones.
75+
76+
# bim2sim allows to enrich the use conditions, e.g. how many persons are
77+
# in a room at what times. For this we are using the data and profiles
78+
# provided by DIN 18599. To assign the correct enrichment to specific
79+
# rooms/thermal zones, we need to match these to the conditions provided
80+
# by DIN 18599. bim2sim automatically does some matching based on regular
81+
# expressions, translations, pre-configured mappings and the existing room
82+
# information in the IFC, but this doesn't cover all cases. Especially
83+
# if rooms are named "room 1" or similar and no further usage information
84+
# is provided by the IFC. In this case user input decisions will be
85+
# queried. To reduce these queries, we can set pre-configured .json files
86+
# to match the room names to usages via `sim_settings`.
87+
# The `sim_setting` `prj_custom_usages` allows to specify the path to the
88+
# .json file that holds the mapping.
89+
90+
# As the IFC we are using has an attic which is identified by its
91+
# IfcLongName and the commonUsages mapping as Living space. Let's assume
92+
# this attic is used as a private gym because our residents are quite fit
93+
# people. We can assign a different usage by simply creating a customUsages
94+
# file and assign the usage type "Exercise room" to the room type
95+
# "Galerie". We already stored the .json file under the test resources,
96+
# have a look at it.
97+
# In the next step we assign this file to the project by setting:
98+
project.sim_settings.prj_custom_usages = (Path(
99+
bim2sim.__file__).parent.parent / "test/resources/arch/custom_usages/"
100+
"customUsagesAC20-FZK-Haus.json")
101+
102+
# If we don't want to use the standard data for usage conditions, we
103+
# can change them. We created a project specific UseConditions file for
104+
# this in the test resources section. In this we assume that our residents
105+
# like to sleep at quite cold conditions of 16 °C. So we adjusted the
106+
# "heating_profile" entry. We leave the data for the other usages
107+
# untouched.
108+
109+
# Let's assign this use conditions file:
110+
project.sim_settings.prj_use_conditions = (Path(
111+
bim2sim.__file__).parent.parent / "test/resources/arch/custom_usages/"
112+
"UseConditionsAC20-FZK-Haus.json")
113+
114+
# By default bim2sim tries to calculate the heating profile based on given
115+
# information from the IFC. As the used IFC has information about the set
116+
# temperature, we need an additional `sim_setting` to force the overwrite
117+
# of the existing data in the IFC.
118+
project.sim_settings.setpoints_from_template = True
119+
120+
# Before we can run the project, we need to assign a DecisionHandler. To
121+
# understand this, we need to understand why we need such a handler.
122+
# Decisions in bim2sim are used to get user input whenever information in
123+
# the IFC are unclear. E.g. if the usage type of a room can't be
124+
# identified, we use a decision to query the user what usage the room has.
125+
# As we don't know at which point a decision comes up, we are using
126+
# generators and yield to iterate over them. If you want to understand
127+
# deeper how this works, have a look at the decision documentation.
128+
# For usage as console tool, we implemented the ConsoleDecisionHandler,
129+
# which we are going to assign in the next step.
130+
# There are multiple ways to run a project. One is to use the run_project()
131+
# function and assign which project to run and which decision handler to
132+
# use. In our case this is:
133+
run_project(project, ConsoleDecisionHandler())
134+
135+
# After the project is finished, we can review the results. As we don't
136+
# create any simulation model with the template Plugin, our results are
137+
# mainly the identified bim2sim elements and the enriched data in this
138+
# elements. Let's get the created bim2sim elements. Everything that is
139+
# created by the different tasks during the runtime is stored in the
140+
# playground state. The playground manages the different tasks and their
141+
# information. To get the bim2sim elements, we can simply get them from the
142+
# state with the following command:
143+
# b2s_elements = project.playground.state['elements']
144+
145+
# # Let's filter all ThermalZone entities, we can do this by a loop, or use
146+
# # a pre-build function of bim2sim:
147+
# all_thermal_zones = filter_elements(b2s_elements, 'ThermalZone')
148+
149+
# # Let's print some data about our zones and review the enriched data for
150+
# # our zones:
151+
# for tz in all_thermal_zones:
152+
# print('##########')
153+
# print(f"Name of the zone: {tz.name}")
154+
# print(f"Area of the zone: {tz.net_area}")
155+
# print(f"Volume of the zone: {tz.volume}")
156+
# print(f"Daily heating profile of the zone: {tz.heating_profile}")
157+
# print('##########')
158+
159+
# # We can see that our provided heating profiles are correctly taken into
160+
# # account. The enriched thermal zones now hold all information required for
161+
# # a building performance simulation. For complete examples with model
162+
# # creation and simulations please go the examples of the plugins.
163+
164+
165+
if __name__ == '__main__':
166+
run_simple_project()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<ids:ids xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://standards.buildingsmart.org/IDS http://standards.buildingsmart.org/IDS/1.0/ids.xsd" xmlns:ids="http://standards.buildingsmart.org/IDS">
2+
<!--edited with usBIM.IDSeditor 2.3.18.0 (http://www.accasoftware.com)-->
3+
<ids:info>
4+
<ids:title>IfcWindows_properties</ids:title>
5+
<ids:version>0.0.1</ids:version>
6+
<ids:author>fcudok@rom-technik.de</ids:author>
7+
<ids:date>2025-07-31</ids:date>
8+
</ids:info>
9+
<ids:specifications>
10+
<ids:specification ifcVersion="IFC4 IFC4X3_ADD2" name="properties of IfcWindows">
11+
<ids:applicability minOccurs="1" maxOccurs="unbounded">
12+
<ids:entity>
13+
<ids:name>
14+
<ids:simpleValue>IFCWINDOW</ids:simpleValue>
15+
</ids:name>
16+
</ids:entity>
17+
</ids:applicability>
18+
<ids:requirements>
19+
<ids:property cardinality="required">
20+
<ids:propertySet>
21+
<ids:simpleValue>Pset_WindowCommon</ids:simpleValue>
22+
</ids:propertySet>
23+
<ids:baseName>
24+
<ids:simpleValue>ThermalTransmittance</ids:simpleValue>
25+
</ids:baseName>
26+
</ids:property>
27+
</ids:requirements>
28+
</ids:specification>
29+
</ids:specifications>
30+
</ids:ids>

0 commit comments

Comments
 (0)