ifctrano 0.1.8__py3-none-any.whl → 0.1.9__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ifctrano/exceptions.py CHANGED
@@ -14,5 +14,13 @@ class SpaceSurfaceAreaNullError(Exception):
14
14
  pass
15
15
 
16
16
 
17
+ class NoIfcSpaceFoundError(Exception):
18
+ pass
19
+
20
+
17
21
  class InvalidLibraryError(Exception):
18
22
  pass
23
+
24
+
25
+ class VectorWithNansError(Exception):
26
+ pass
ifctrano/main.py CHANGED
@@ -1,4 +1,6 @@
1
+ import shutil
1
2
  from pathlib import Path
3
+ from tempfile import TemporaryDirectory
2
4
  from typing import Annotated, get_args
3
5
 
4
6
  import typer
@@ -45,3 +47,29 @@ def create(
45
47
  modelica_model_path.write_text(modelica_model)
46
48
  progress.remove_task(task)
47
49
  print(f"{CHECKMARK} Model generated at {modelica_model_path}")
50
+
51
+
52
+ @app.command()
53
+ def verify() -> None:
54
+ verification_ifc = Path(__file__).parent / "example" / "verification.ifc"
55
+ with Progress(
56
+ SpinnerColumn(),
57
+ TextColumn("[progress.description]{task.description}"),
58
+ transient=True,
59
+ ) as progress, TemporaryDirectory() as temp_dir:
60
+ temp_ifc_file = Path(temp_dir) / verification_ifc.name
61
+ shutil.copy(verification_ifc, temp_ifc_file)
62
+ task = progress.add_task(
63
+ description="Trying to create a model from a test file...",
64
+ total=None,
65
+ )
66
+ building = Building.from_ifc(temp_ifc_file)
67
+ building.save_model()
68
+ if temp_ifc_file.parent.joinpath(f"{building.name}.mo").exists():
69
+ progress.remove_task(task)
70
+ print(f"{CHECKMARK} Model successfully created... your system is ready.")
71
+ else:
72
+ progress.remove_task(task)
73
+ print(
74
+ f"{CROSS_MARK} Model could not be created... please check your system."
75
+ )
@@ -8,10 +8,19 @@ import ifcopenshell.util.shape
8
8
  from ifcopenshell import entity_instance, file
9
9
  from pydantic import BaseModel, Field
10
10
  from trano.data_models.conversion import SpaceParameter # type: ignore
11
- from trano.elements import Space as TranoSpace, ExternalWall, Window, BaseWall # type: ignore
12
- from trano.elements.construction import Construction, Layer, Material # type: ignore
11
+ from trano.elements import Space as TranoSpace, ExternalWall, Window, BaseWall, ExternalDoor # type: ignore
12
+ from trano.elements.construction import ( # type: ignore
13
+ Construction,
14
+ Layer,
15
+ Material,
16
+ Glass,
17
+ GlassLayer,
18
+ GasLayer,
19
+ GlassMaterial,
20
+ Gas,
21
+ )
13
22
  from trano.elements.system import Occupancy # type: ignore
14
- from trano.elements.types import Azimuth, Tilt # type: ignore
23
+ from trano.elements.types import Tilt # type: ignore
15
24
 
16
25
  from ifctrano.base import (
17
26
  GlobalId,
@@ -19,6 +28,8 @@ from ifctrano.base import (
19
28
  BaseModelConfig,
20
29
  CommonSurface,
21
30
  ROUNDING_FACTOR,
31
+ CLASH_CLEARANCE,
32
+ Vector,
22
33
  )
23
34
  from ifctrano.bounding_box import OrientedBoundingBox
24
35
 
@@ -78,12 +89,8 @@ class Space(GlobalId):
78
89
  )
79
90
 
80
91
  def space_name(self) -> str:
81
- main_name = (
82
- remove_non_alphanumeric(self.name)
83
- if self.name
84
- else remove_non_alphanumeric(self.entity.GlobalId)
85
- )
86
- return f"space_{main_name}_{self.entity.GlobalId}"
92
+ main_name = f"{remove_non_alphanumeric(self.name)}_" if self.name else ""
93
+ return f"space_{main_name}{remove_non_alphanumeric(self.entity.GlobalId)}"
87
94
 
88
95
 
89
96
  material_1 = Material(
@@ -98,6 +105,34 @@ construction = Construction(
98
105
  Layer(material=material_1, thickness=0.18),
99
106
  ],
100
107
  )
108
+ id_100 = GlassMaterial(
109
+ name="id_100",
110
+ thermal_conductivity=1,
111
+ density=2500,
112
+ specific_heat_capacity=840,
113
+ solar_transmittance=[0.646],
114
+ solar_reflectance_outside_facing=[0.062],
115
+ solar_reflectance_room_facing=[0.063],
116
+ infrared_transmissivity=0,
117
+ infrared_absorptivity_outside_facing=0.84,
118
+ infrared_absorptivity_room_facing=0.84,
119
+ )
120
+
121
+ air = Gas(
122
+ name="Air",
123
+ thermal_conductivity=0.025,
124
+ density=1.2,
125
+ specific_heat_capacity=1005,
126
+ )
127
+ glass = Glass(
128
+ name="double_glazing",
129
+ u_value_frame=1.4,
130
+ layers=[
131
+ GlassLayer(thickness=0.003, material=id_100),
132
+ GasLayer(thickness=0.0127, material=air),
133
+ GlassLayer(thickness=0.003, material=id_100),
134
+ ],
135
+ )
101
136
 
102
137
 
103
138
  class SpaceBoundary(BaseModelConfig):
@@ -106,27 +141,44 @@ class SpaceBoundary(BaseModelConfig):
106
141
  common_surface: CommonSurface
107
142
  adjacent_spaces: List[Space] = Field(default_factory=list)
108
143
 
109
- def model_element(self, exclude_entities: List[str]) -> Optional[BaseWall]:
144
+ def boundary_name(self) -> str:
145
+ return f"{self.entity.is_a()}_{remove_non_alphanumeric(self.entity.GlobalId)}"
146
+
147
+ def model_element(
148
+ self, exclude_entities: List[str], north_axis: Vector
149
+ ) -> Optional[BaseWall]:
110
150
  if self.entity.GlobalId in exclude_entities:
111
151
  return None
152
+ azimuth = self.common_surface.orientation.angle(north_axis)
112
153
  if "wall" in self.entity.is_a().lower():
113
154
  return ExternalWall(
155
+ name=self.boundary_name(),
114
156
  surface=self.common_surface.area,
115
- azimuth=Azimuth.south,
157
+ azimuth=azimuth,
158
+ tilt=Tilt.wall,
159
+ construction=construction,
160
+ )
161
+ if "door" in self.entity.is_a().lower():
162
+ return ExternalDoor(
163
+ name=self.boundary_name(),
164
+ surface=self.common_surface.area,
165
+ azimuth=azimuth,
116
166
  tilt=Tilt.wall,
117
167
  construction=construction,
118
168
  )
119
169
  if "window" in self.entity.is_a().lower():
120
170
  return Window(
171
+ name=self.boundary_name(),
121
172
  surface=self.common_surface.area,
122
- azimuth=Azimuth.south,
173
+ azimuth=azimuth,
123
174
  tilt=Tilt.wall,
124
- construction=construction,
175
+ construction=glass,
125
176
  )
126
177
  if "roof" in self.entity.is_a().lower():
127
178
  return ExternalWall(
179
+ name=self.boundary_name(),
128
180
  surface=self.common_surface.area,
129
- azimuth=Azimuth.south,
181
+ azimuth=azimuth,
130
182
  tilt=Tilt.ceiling,
131
183
  construction=construction,
132
184
  )
@@ -158,7 +210,16 @@ class SpaceBoundaries(BaseModel):
158
210
  space: Space
159
211
  boundaries: List[SpaceBoundary] = Field(default_factory=list)
160
212
 
161
- def model(self, exclude_entities: List[str]) -> TranoSpace:
213
+ def model(
214
+ self, exclude_entities: List[str], north_axis: Vector
215
+ ) -> Optional[TranoSpace]:
216
+ external_boundaries = [
217
+ boundary.model_element(exclude_entities, north_axis)
218
+ for boundary in self.boundaries
219
+ if boundary.model_element(exclude_entities, north_axis)
220
+ ]
221
+ if not external_boundaries:
222
+ return None
162
223
  return TranoSpace(
163
224
  name=self.space.space_name(),
164
225
  occupancy=Occupancy(),
@@ -166,11 +227,7 @@ class SpaceBoundaries(BaseModel):
166
227
  floor_area=self.space.floor_area,
167
228
  average_room_height=self.space.average_room_height,
168
229
  ),
169
- external_boundaries=[
170
- boundary.model_element(exclude_entities)
171
- for boundary in self.boundaries
172
- if boundary.model_element(exclude_entities)
173
- ],
230
+ external_boundaries=external_boundaries,
174
231
  )
175
232
 
176
233
  @classmethod
@@ -188,7 +245,7 @@ class SpaceBoundaries(BaseModel):
188
245
  + ifcopenshell_file.by_type("IfcRoof")
189
246
  + ifcopenshell_file.by_type("IfcDoor")
190
247
  + ifcopenshell_file.by_type("IfcWindow"),
191
- clearance=0.1,
248
+ clearance=CLASH_CLEARANCE,
192
249
  )
193
250
  space_boundaries = []
194
251
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ifctrano
3
- Version: 0.1.8
3
+ Version: 0.1.9
4
4
  Summary: Package for generating building energy simulation model from IFC
5
5
  Home-page: https://github.com/andoludo/ifctrano
6
6
  License: GPL V3
@@ -22,7 +22,7 @@ Description-Content-Type: text/markdown
22
22
 
23
23
  # ifctrano - IFC to Energy Simulation Tool
24
24
 
25
- 📖 **Full Documentation:** 👉 [Trano Docs](https://andoludo.github.io/ifctrano/)
25
+ 📖 **Full Documentation:** 👉 [ifctrano Docs](https://andoludo.github.io/ifctrano/)
26
26
 
27
27
  ```bash
28
28
  pip install ifctrano
@@ -0,0 +1,13 @@
1
+ ifctrano/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ ifctrano/base.py,sha256=xpfZ27dZ5SZ5z2fz3N4GonkGWvXRYhMfOjoy94R4Yt8,5748
3
+ ifctrano/bounding_box.py,sha256=OnkOR3NOyVRFSdo0d9BeFm93ZU40TV_gQSxYHOEPCYE,9382
4
+ ifctrano/building.py,sha256=NoF0V5H_jDoyl0zkWPrSQa4xX0HIA23Kqu_TbH4Q56M,7134
5
+ ifctrano/example/verification.ifc,sha256=L6YRD_rny7IEB4myA7uCLO6eI-xXOn2jp_67lw3lUrE,128600
6
+ ifctrano/exceptions.py,sha256=1FQeuuq_lVZ4CawwewQvkE8OlDQwhBTbKfmc2FiZodo,431
7
+ ifctrano/main.py,sha256=5S2K0dvFd5k15nsomeDmLiIxFlqYdFr2hdepDFqf0Fs,2672
8
+ ifctrano/space_boundary.py,sha256=SxVXkBi8TNZfmPDFT-6epuewk8E9V1astVgcD3FT8ew,8617
9
+ ifctrano-0.1.9.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
10
+ ifctrano-0.1.9.dist-info/METADATA,sha256=EJUPwFbIeYTFV7Jo0nNRF4Vppzu0ihJg7eB3_KFYuF0,3003
11
+ ifctrano-0.1.9.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
12
+ ifctrano-0.1.9.dist-info/entry_points.txt,sha256=_2daDejazkphufyEu0m3lOeTio53WYmjol3KmSN0JM4,46
13
+ ifctrano-0.1.9.dist-info/RECORD,,
@@ -1,12 +0,0 @@
1
- ifctrano/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- ifctrano/base.py,sha256=VjGWioeysspdTrgofhykw0eh6n9UkaXHp5gvOSVJ4hY,4991
3
- ifctrano/bounding_box.py,sha256=G0FcqCNG-nBrUkA5Hw8wWqvJODxWUxOo_x8jrk63YAc,8983
4
- ifctrano/building.py,sha256=mrqMAtPWmTerLXdtFHTvGLxXI5bg23gqEftlquSMgtw,5129
5
- ifctrano/exceptions.py,sha256=_kdQ4BfNq6RijIeFEcDsKJliXDW_QHzfUhdhEE_I1V0,332
6
- ifctrano/main.py,sha256=m8SpF6s7543d5tr3hkL9FXGAYnEblk7-xM8xygiwl3o,1605
7
- ifctrano/space_boundary.py,sha256=4Mk6eEBcA6ard0YWf5uHnaHu1Ik75Ekzg106baAGzU4,7029
8
- ifctrano-0.1.8.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
9
- ifctrano-0.1.8.dist-info/METADATA,sha256=-wJb4lz-M2hjdzbTVrr-_Un9YHnqvIl3BiEe4IX5wGI,3000
10
- ifctrano-0.1.8.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
11
- ifctrano-0.1.8.dist-info/entry_points.txt,sha256=_2daDejazkphufyEu0m3lOeTio53WYmjol3KmSN0JM4,46
12
- ifctrano-0.1.8.dist-info/RECORD,,