OpenSimula 0.7.0__tar.gz → 0.7.1__tar.gz

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.
Files changed (60) hide show
  1. {opensimula-0.7.0 → opensimula-0.7.1}/PKG-INFO +1 -2
  2. {opensimula-0.7.0 → opensimula-0.7.1}/pyproject.toml +2 -3
  3. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/__init__.py +1 -2
  4. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/visual_3D/Environment_3D.py +29 -4
  5. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/visual_3D/Polygon_3D.py +21 -26
  6. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula.egg-info/PKG-INFO +1 -2
  7. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula.egg-info/requires.txt +0 -1
  8. {opensimula-0.7.0 → opensimula-0.7.1}/LICENSE +0 -0
  9. {opensimula-0.7.0 → opensimula-0.7.1}/README.md +0 -0
  10. {opensimula-0.7.0 → opensimula-0.7.1}/setup.cfg +0 -0
  11. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/Child.py +0 -0
  12. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/Component.py +0 -0
  13. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/Iterative_process.py +0 -0
  14. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/Message.py +0 -0
  15. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/Parameter_container.py +0 -0
  16. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/Parameters.py +0 -0
  17. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/Project.py +0 -0
  18. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/Simulation.py +0 -0
  19. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/Variable.py +0 -0
  20. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Building.py +0 -0
  21. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Building_surface.py +0 -0
  22. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Calculator.py +0 -0
  23. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Construction.py +0 -0
  24. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/DX_unit.py +0 -0
  25. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Day_schedule.py +0 -0
  26. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Fan.py +0 -0
  27. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/File_data.py +0 -0
  28. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/File_met.py +0 -0
  29. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Frame.py +0 -0
  30. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Glazing.py +0 -0
  31. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/HVAC_DX_system.py +0 -0
  32. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/HVAC_MZW_system.py +0 -0
  33. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/HVAC_SZW_system.py +0 -0
  34. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/HVAC_perfect_system.py +0 -0
  35. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Material.py +0 -0
  36. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Opening.py +0 -0
  37. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Opening_type.py +0 -0
  38. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Solar_surface.py +0 -0
  39. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Space.py +0 -0
  40. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Space_type.py +0 -0
  41. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Surface.py +0 -0
  42. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Test_component.py +0 -0
  43. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Water_coil.py +0 -0
  44. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Week_schedule.py +0 -0
  45. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/Year_schedule.py +0 -0
  46. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula/components/__init__.py +0 -0
  47. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula.egg-info/SOURCES.txt +0 -0
  48. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula.egg-info/dependency_links.txt +0 -0
  49. {opensimula-0.7.0 → opensimula-0.7.1}/src/opensimula.egg-info/top_level.txt +0 -0
  50. {opensimula-0.7.0 → opensimula-0.7.1}/test/test_Calculator.py +0 -0
  51. {opensimula-0.7.0 → opensimula-0.7.1}/test/test_Case_600FF.py +0 -0
  52. {opensimula-0.7.0 → opensimula-0.7.1}/test/test_Case_610.py +0 -0
  53. {opensimula-0.7.0 → opensimula-0.7.1}/test/test_Construction.py +0 -0
  54. {opensimula-0.7.0 → opensimula-0.7.1}/test/test_File_data.py +0 -0
  55. {opensimula-0.7.0 → opensimula-0.7.1}/test/test_File_met.py +0 -0
  56. {opensimula-0.7.0 → opensimula-0.7.1}/test/test_HVAC_DX_Equipment.py +0 -0
  57. {opensimula-0.7.0 → opensimula-0.7.1}/test/test_HVAC_DX_system.py +0 -0
  58. {opensimula-0.7.0 → opensimula-0.7.1}/test/test_Iterative_process.py +0 -0
  59. {opensimula-0.7.0 → opensimula-0.7.1}/test/test_Project.py +0 -0
  60. {opensimula-0.7.0 → opensimula-0.7.1}/test/test_Schedules.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opensimula
3
- Version: 0.7.0
3
+ Version: 0.7.1
4
4
  Summary: Component-based time simulation environment in Python
5
5
  Author-email: "Juan F. Coronel" <jfc@us.es>
6
6
  Requires-Python: >=3.12
@@ -18,7 +18,6 @@ Requires-Dist: psychrolib>=2.5.0
18
18
  Requires-Dist: scipy>=1.16.2
19
19
  Requires-Dist: shapely>=2.1.1
20
20
  Requires-Dist: tqdm>=4.67.1
21
- Requires-Dist: triangle>=20250106
22
21
  Requires-Dist: vedo>=2025.5.4
23
22
  Dynamic: license-file
24
23
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "opensimula"
3
- version = "0.7.0"
3
+ version = "0.7.1"
4
4
  requires-python = ">=3.12"
5
5
  authors = [
6
6
  { name="Juan F. Coronel", email="jfc@us.es" },
@@ -20,8 +20,7 @@ dependencies = [
20
20
  "scipy>=1.16.2",
21
21
  "shapely>=2.1.1",
22
22
  "tqdm>=4.67.1",
23
- "triangle>=20250106",
24
- "vedo>=2025.5.4",
23
+ "vedo>=2025.5.4",
25
24
  ]
26
25
 
27
26
  [dependency-groups]
@@ -5,5 +5,4 @@ opensimula is a Python Package for perform time simulations
5
5
  """
6
6
  from opensimula.Simulation import Simulation
7
7
  from opensimula.Iterative_process import Iterative_process
8
- from importlib.metadata import version
9
- VERSION = version("opensimula")
8
+ VERSION = "0.7.1"
@@ -132,6 +132,24 @@ class Environment_3D:
132
132
  lighting=dict(ambient=0.85, diffuse=0.5, specular=0.05),
133
133
  )
134
134
 
135
+ def _merge_outlines_to_plotly_(self, polygon_list):
136
+ """Merge outlines of multiple Polygon_3D into a single go.Scatter3d."""
137
+ import plotly.graph_objects as go
138
+ xs, ys, zs = [], [], []
139
+ for pol in polygon_list:
140
+ boundary = np.array(pol.polygon3D)
141
+ if len(boundary) == 0:
142
+ continue
143
+ xs.extend(list(boundary[:, 0]) + [boundary[0, 0], None])
144
+ ys.extend(list(boundary[:, 1]) + [boundary[0, 1], None])
145
+ zs.extend(list(boundary[:, 2]) + [boundary[0, 2], None])
146
+ return go.Scatter3d(
147
+ x=xs, y=ys, z=zs,
148
+ mode="lines",
149
+ line=dict(color="black", width=2),
150
+ showlegend=False, hoverinfo="skip",
151
+ )
152
+
135
153
  def _scene_bounds_(self, pols):
136
154
  """Return (xmin, xmax, ymin, ymax, zmin, zmax) for a list of Polygon_3D."""
137
155
  all_pts = np.concatenate([np.array(p.polygon3D) for p in pols if len(p.polygon3D) > 0], axis=0)
@@ -182,16 +200,19 @@ class Environment_3D:
182
200
  def _plotly_scene_layout_(self):
183
201
  import plotly.graph_objects as go
184
202
  axis_style = dict(
185
- showbackground=False,
203
+ showbackground=True,
204
+ backgroundcolor="rgb(220, 220, 220)",
186
205
  tickfont=dict(size=9, color="gray"),
187
206
  title_font=dict(size=10, color="gray"),
188
207
  )
189
208
  return go.Layout(
209
+ paper_bgcolor="rgb(235, 235, 235)",
190
210
  scene=dict(
191
211
  xaxis=dict(title="X [m]", **axis_style),
192
212
  yaxis=dict(title="Y [m]", **axis_style),
193
213
  zaxis=dict(title="Z [m]", **axis_style),
194
214
  aspectmode="data",
215
+ bgcolor="rgb(235, 235, 235)",
195
216
  ),
196
217
  margin=dict(l=0, r=0, t=0, b=0),
197
218
  showlegend=False,
@@ -256,15 +277,19 @@ class Environment_3D:
256
277
  # Build frames (sunny + shadow merged meshes update per frame)
257
278
  self.calculate_shadows(cosines[0], create_polygons=True)
258
279
  init_sunny = self._merge_to_plotly_(self.pol_sunny, "sunny")
280
+ init_sunny_outline = self._merge_outlines_to_plotly_(self.pol_sunny)
259
281
  init_shadow = self._merge_to_plotly_(self.pol_shadows, "shadow")
282
+ init_shadow_outline = self._merge_outlines_to_plotly_(self.pol_shadows)
260
283
 
261
284
  frames = []
262
285
  for i, (cos, text) in enumerate(zip(cosines, texts)):
263
286
  self.calculate_shadows(cos, create_polygons=True)
264
287
  frames.append(go.Frame(
265
288
  data=[self._merge_to_plotly_(self.pol_sunny, "sunny"),
266
- self._merge_to_plotly_(self.pol_shadows, "shadow")],
267
- traces=[n_static, n_static + 1],
289
+ self._merge_outlines_to_plotly_(self.pol_sunny),
290
+ self._merge_to_plotly_(self.pol_shadows, "shadow"),
291
+ self._merge_outlines_to_plotly_(self.pol_shadows)],
292
+ traces=[n_static, n_static + 1, n_static + 2, n_static + 3],
268
293
  name=str(i),
269
294
  layout=go.Layout(title_text=text),
270
295
  ))
@@ -296,7 +321,7 @@ class Environment_3D:
296
321
  )],
297
322
  )
298
323
  go.Figure(
299
- data=static_traces + [init_sunny, init_shadow],
324
+ data=static_traces + [init_sunny, init_sunny_outline, init_shadow, init_shadow_outline],
300
325
  layout=layout,
301
326
  frames=frames,
302
327
  ).show()
@@ -1,8 +1,8 @@
1
1
  import math
2
2
  import numpy as np
3
- from shapely.geometry import Polygon
3
+ from shapely.geometry import Polygon, MultiPoint
4
+ from shapely.ops import triangulate as shapely_triangulate
4
5
  import vedo
5
- from triangle import triangulate
6
6
 
7
7
  class Polygon_3D():
8
8
  def __init__(self, name, origin, azimuth, altitude, polygon2D, holes2D=[], color="white", opacity=1.0, visible=True,shading=True,calculate_shadows=True):
@@ -74,32 +74,27 @@ class Polygon_3D():
74
74
  return mesh
75
75
 
76
76
  def _triangulate_(self):
77
- def edge_idxs(nv):
78
- i = np.append(np.arange(nv), 0)
79
- return np.stack([i[:-1], i[1:]], axis=1)
77
+ all_verts = list(self.polygon2D)
78
+ for hole in self.holes2D:
79
+ all_verts.extend(hole)
80
80
 
81
- nv = 0
82
- verts, edges = [], []
83
- for loop in (self.polygon2D, *self.holes2D):
84
- verts.append(loop)
85
- edges.append(nv + edge_idxs(len(loop)))
86
- nv += len(loop)
81
+ tris = [t for t in shapely_triangulate(MultiPoint(all_verts))
82
+ if self.shapely_polygon.contains(t.centroid)]
87
83
 
88
- verts, edges = np.concatenate(verts), np.concatenate(edges)
89
- # Triangulate needs to know a single interior point for each hole
90
- holes = np.array([np.mean(h, axis=0) for h in self.holes2D])
91
- # Because triangulate is a wrapper around a C library the syntax is a little weird, 'p' here means planar straight line graph
92
- if self.has_holes():
93
- d = triangulate(dict(vertices=verts, segments=edges, holes=holes), opts='p')
94
- else:
95
- d = triangulate(dict(vertices=verts, segments=edges), opts='p')
96
- # Convert back
97
- v, f = d['vertices'], d['triangles']
98
- nv, nf = len(v), len(f)
99
- points = np.concatenate([v, np.zeros((nv, 1))], axis=1)
100
- # Creo que lo tengo que hacer en 2D y luego pasarlo a 3D
101
- #faces = np.concatenate([np.full((nf, 1), 3), f], axis=1).reshape(-1)
102
- return (self._convert_2D_to_3D_(points), f)
84
+ vert_map = {}
85
+ verts = []
86
+ faces = []
87
+ for tri in tris:
88
+ face = []
89
+ for c in list(tri.exterior.coords)[:-1]:
90
+ key = (round(c[0], 10), round(c[1], 10))
91
+ if key not in vert_map:
92
+ vert_map[key] = len(verts)
93
+ verts.append(c)
94
+ face.append(vert_map[key])
95
+ faces.append(face)
96
+
97
+ return (self._convert_2D_to_3D_(np.array(verts)), np.array(faces))
103
98
 
104
99
  def _are_vertices_counterclockwise_(self,puntos):
105
100
  # Se suma el primer punto al final para cerrar el polígono.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: opensimula
3
- Version: 0.7.0
3
+ Version: 0.7.1
4
4
  Summary: Component-based time simulation environment in Python
5
5
  Author-email: "Juan F. Coronel" <jfc@us.es>
6
6
  Requires-Python: >=3.12
@@ -18,7 +18,6 @@ Requires-Dist: psychrolib>=2.5.0
18
18
  Requires-Dist: scipy>=1.16.2
19
19
  Requires-Dist: shapely>=2.1.1
20
20
  Requires-Dist: tqdm>=4.67.1
21
- Requires-Dist: triangle>=20250106
22
21
  Requires-Dist: vedo>=2025.5.4
23
22
  Dynamic: license-file
24
23
 
@@ -10,5 +10,4 @@ psychrolib>=2.5.0
10
10
  scipy>=1.16.2
11
11
  shapely>=2.1.1
12
12
  tqdm>=4.67.1
13
- triangle>=20250106
14
13
  vedo>=2025.5.4
File without changes
File without changes
File without changes