topologicpy 0.5.8__py3-none-any.whl → 6.0.0__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.
Files changed (94) hide show
  1. topologicpy/Aperture.py +72 -72
  2. topologicpy/Cell.py +2169 -2169
  3. topologicpy/CellComplex.py +1137 -1137
  4. topologicpy/Cluster.py +1288 -1280
  5. topologicpy/Color.py +423 -393
  6. topologicpy/Context.py +79 -79
  7. topologicpy/DGL.py +3213 -3136
  8. topologicpy/Dictionary.py +698 -695
  9. topologicpy/Edge.py +1187 -1187
  10. topologicpy/EnergyModel.py +1180 -1171
  11. topologicpy/Face.py +2141 -2141
  12. topologicpy/Graph.py +7768 -7700
  13. topologicpy/Grid.py +353 -353
  14. topologicpy/Helper.py +507 -507
  15. topologicpy/Honeybee.py +461 -461
  16. topologicpy/Matrix.py +271 -271
  17. topologicpy/Neo4j.py +521 -521
  18. topologicpy/Plotly.py +2 -2
  19. topologicpy/Polyskel.py +541 -541
  20. topologicpy/Shell.py +1768 -1768
  21. topologicpy/Speckle.py +508 -508
  22. topologicpy/Topology.py +7060 -6988
  23. topologicpy/Vector.py +905 -905
  24. topologicpy/Vertex.py +1585 -1585
  25. topologicpy/Wire.py +3050 -3050
  26. topologicpy/__init__.py +22 -38
  27. topologicpy/version.py +1 -0
  28. {topologicpy-0.5.8.dist-info → topologicpy-6.0.0.dist-info}/LICENSE +661 -704
  29. topologicpy-6.0.0.dist-info/METADATA +751 -0
  30. topologicpy-6.0.0.dist-info/RECORD +32 -0
  31. topologicpy/bin/linux/topologic/__init__.py +0 -2
  32. topologicpy/bin/linux/topologic/libTKBO-6bdf205d.so.7.7.0 +0 -0
  33. topologicpy/bin/linux/topologic/libTKBRep-2960a069.so.7.7.0 +0 -0
  34. topologicpy/bin/linux/topologic/libTKBool-c44b74bd.so.7.7.0 +0 -0
  35. topologicpy/bin/linux/topologic/libTKFillet-9a670ba0.so.7.7.0 +0 -0
  36. topologicpy/bin/linux/topologic/libTKG2d-8f31849e.so.7.7.0 +0 -0
  37. topologicpy/bin/linux/topologic/libTKG3d-4c6bce57.so.7.7.0 +0 -0
  38. topologicpy/bin/linux/topologic/libTKGeomAlgo-26066fd9.so.7.7.0 +0 -0
  39. topologicpy/bin/linux/topologic/libTKGeomBase-2116cabe.so.7.7.0 +0 -0
  40. topologicpy/bin/linux/topologic/libTKMath-72572fa8.so.7.7.0 +0 -0
  41. topologicpy/bin/linux/topologic/libTKMesh-2a060427.so.7.7.0 +0 -0
  42. topologicpy/bin/linux/topologic/libTKOffset-6cab68ff.so.7.7.0 +0 -0
  43. topologicpy/bin/linux/topologic/libTKPrim-eb1262b3.so.7.7.0 +0 -0
  44. topologicpy/bin/linux/topologic/libTKShHealing-e67e5cc7.so.7.7.0 +0 -0
  45. topologicpy/bin/linux/topologic/libTKTopAlgo-e4c96c33.so.7.7.0 +0 -0
  46. topologicpy/bin/linux/topologic/libTKernel-fb7fe3b7.so.7.7.0 +0 -0
  47. topologicpy/bin/linux/topologic/libgcc_s-32c1665e.so.1 +0 -0
  48. topologicpy/bin/linux/topologic/libstdc++-672d7b41.so.6.0.30 +0 -0
  49. topologicpy/bin/linux/topologic/topologic.cpython-310-x86_64-linux-gnu.so +0 -0
  50. topologicpy/bin/linux/topologic/topologic.cpython-311-x86_64-linux-gnu.so +0 -0
  51. topologicpy/bin/linux/topologic/topologic.cpython-38-x86_64-linux-gnu.so +0 -0
  52. topologicpy/bin/linux/topologic/topologic.cpython-39-x86_64-linux-gnu.so +0 -0
  53. topologicpy/bin/linux/topologic.libs/libTKBO-6bdf205d.so.7.7.0 +0 -0
  54. topologicpy/bin/linux/topologic.libs/libTKBRep-2960a069.so.7.7.0 +0 -0
  55. topologicpy/bin/linux/topologic.libs/libTKBool-c44b74bd.so.7.7.0 +0 -0
  56. topologicpy/bin/linux/topologic.libs/libTKFillet-9a670ba0.so.7.7.0 +0 -0
  57. topologicpy/bin/linux/topologic.libs/libTKG2d-8f31849e.so.7.7.0 +0 -0
  58. topologicpy/bin/linux/topologic.libs/libTKG3d-4c6bce57.so.7.7.0 +0 -0
  59. topologicpy/bin/linux/topologic.libs/libTKGeomAlgo-26066fd9.so.7.7.0 +0 -0
  60. topologicpy/bin/linux/topologic.libs/libTKGeomBase-2116cabe.so.7.7.0 +0 -0
  61. topologicpy/bin/linux/topologic.libs/libTKMath-72572fa8.so.7.7.0 +0 -0
  62. topologicpy/bin/linux/topologic.libs/libTKMesh-2a060427.so.7.7.0 +0 -0
  63. topologicpy/bin/linux/topologic.libs/libTKOffset-6cab68ff.so.7.7.0 +0 -0
  64. topologicpy/bin/linux/topologic.libs/libTKPrim-eb1262b3.so.7.7.0 +0 -0
  65. topologicpy/bin/linux/topologic.libs/libTKShHealing-e67e5cc7.so.7.7.0 +0 -0
  66. topologicpy/bin/linux/topologic.libs/libTKTopAlgo-e4c96c33.so.7.7.0 +0 -0
  67. topologicpy/bin/linux/topologic.libs/libTKernel-fb7fe3b7.so.7.7.0 +0 -0
  68. topologicpy/bin/linux/topologic.libs/libgcc_s-32c1665e.so.1 +0 -0
  69. topologicpy/bin/linux/topologic.libs/libstdc++-672d7b41.so.6.0.30 +0 -0
  70. topologicpy/bin/macos/topologic/__init__.py +0 -2
  71. topologicpy/bin/windows/topologic/TKBO-f6b191de.dll +0 -0
  72. topologicpy/bin/windows/topologic/TKBRep-e56a600e.dll +0 -0
  73. topologicpy/bin/windows/topologic/TKBool-7b8d47ae.dll +0 -0
  74. topologicpy/bin/windows/topologic/TKFillet-0ddbf0a8.dll +0 -0
  75. topologicpy/bin/windows/topologic/TKG2d-2e2dee3d.dll +0 -0
  76. topologicpy/bin/windows/topologic/TKG3d-6674513d.dll +0 -0
  77. topologicpy/bin/windows/topologic/TKGeomAlgo-d240e370.dll +0 -0
  78. topologicpy/bin/windows/topologic/TKGeomBase-df87aba5.dll +0 -0
  79. topologicpy/bin/windows/topologic/TKMath-45bd625a.dll +0 -0
  80. topologicpy/bin/windows/topologic/TKMesh-d6e826b1.dll +0 -0
  81. topologicpy/bin/windows/topologic/TKOffset-79b9cc94.dll +0 -0
  82. topologicpy/bin/windows/topologic/TKPrim-aa430a86.dll +0 -0
  83. topologicpy/bin/windows/topologic/TKShHealing-bb48be89.dll +0 -0
  84. topologicpy/bin/windows/topologic/TKTopAlgo-7d0d1e22.dll +0 -0
  85. topologicpy/bin/windows/topologic/TKernel-08c8cfbb.dll +0 -0
  86. topologicpy/bin/windows/topologic/__init__.py +0 -2
  87. topologicpy/bin/windows/topologic/topologic.cp310-win_amd64.pyd +0 -0
  88. topologicpy/bin/windows/topologic/topologic.cp311-win_amd64.pyd +0 -0
  89. topologicpy/bin/windows/topologic/topologic.cp38-win_amd64.pyd +0 -0
  90. topologicpy/bin/windows/topologic/topologic.cp39-win_amd64.pyd +0 -0
  91. topologicpy-0.5.8.dist-info/METADATA +0 -96
  92. topologicpy-0.5.8.dist-info/RECORD +0 -91
  93. {topologicpy-0.5.8.dist-info → topologicpy-6.0.0.dist-info}/WHEEL +0 -0
  94. {topologicpy-0.5.8.dist-info → topologicpy-6.0.0.dist-info}/top_level.txt +0 -0
topologicpy/Honeybee.py CHANGED
@@ -1,462 +1,462 @@
1
- # Copyright (C) 2024
2
- # Wassim Jabi <wassim.jabi@gmail.com>
3
- #
4
- # This program is free software: you can redistribute it and/or modify it under
5
- # the terms of the GNU Affero General Public License as published by the Free Software
6
- # Foundation, either version 3 of the License, or (at your option) any later
7
- # version.
8
- #
9
- # This program is distributed in the hope that it will be useful, but WITHOUT
10
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
- # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
12
- # details.
13
- #
14
- # You should have received a copy of the GNU Affero General Public License along with
15
- # this program. If not, see <https://www.gnu.org/licenses/>.
16
-
17
- import os
18
- import warnings
19
-
20
- try:
21
- import honeybee.facetype
22
- from honeybee.face import Face as HBFace
23
- from honeybee.model import Model as HBModel
24
- from honeybee.room import Room as HBRoom
25
- from honeybee.shade import Shade as HBShade
26
- from honeybee.aperture import Aperture as HBAperture
27
- from honeybee.door import Door as HBDoor
28
- except:
29
- print("Honeybee - Installing required honeybee library.")
30
- try:
31
- os.system("pip install honeybee")
32
- except:
33
- os.system("pip install honeybee --user")
34
- try:
35
- import honeybee.facetype
36
- from honeybee.face import Face as HBFace
37
- from honeybee.model import Model as HBModel
38
- from honeybee.room import Room as HBRoom
39
- from honeybee.shade import Shade as HBShade
40
- from honeybee.aperture import Aperture as HBAperture
41
- from honeybee.door import Door as HBDoor
42
- except:
43
- warnings.warn("Honeybee - ERROR: Could not import honeybee")
44
-
45
- try:
46
- import honeybee_energy.lib.constructionsets as constr_set_lib
47
- import honeybee_energy.lib.programtypes as prog_type_lib
48
- import honeybee_energy.lib.scheduletypelimits as schedule_types
49
- from honeybee_energy.schedule.ruleset import ScheduleRuleset
50
- from honeybee_energy.schedule.day import ScheduleDay
51
- from honeybee_energy.load.setpoint import Setpoint
52
- from honeybee_energy.load.hotwater import ServiceHotWater
53
- except:
54
- print("Honeybee - Installing required honeybee-energy library.")
55
- try:
56
- os.system("pip install -U honeybee-energy[standards]")
57
- except:
58
- os.system("pip install -U honeybee-energy[standards] --user")
59
- try:
60
- import honeybee_energy.lib.constructionsets as constr_set_lib
61
- import honeybee_energy.lib.programtypes as prog_type_lib
62
- import honeybee_energy.lib.scheduletypelimits as schedule_types
63
- from honeybee_energy.schedule.ruleset import ScheduleRuleset
64
- from honeybee_energy.schedule.day import ScheduleDay
65
- from honeybee_energy.load.setpoint import Setpoint
66
- from honeybee_energy.load.hotwater import ServiceHotWater
67
- except:
68
- warnings.warn("Honeybee - Error: Could not import honeybee-energy")
69
-
70
- try:
71
- from honeybee_radiance.sensorgrid import SensorGrid
72
- except:
73
- print("Honeybee - Installing required honeybee-radiance library.")
74
- try:
75
- os.system("pip install -U honeybee-radiance")
76
- except:
77
- os.system("pip install -U honeybee-radiance --user")
78
- try:
79
- from honeybee_radiance.sensorgrid import SensorGrid
80
- except:
81
- warnings.warn("Honeybee - Error: Could not import honeybee-radiance")
82
-
83
- try:
84
- from ladybug.dt import Time
85
- except:
86
- print("Honeybee - Installing required ladybug library.")
87
- try:
88
- os.system("pip install -U ladybug")
89
- except:
90
- os.system("pip install -U ladybug --user")
91
- try:
92
- from ladybug.dt import Time
93
- except:
94
- warnings.warn("Honeybee - Error: Could not import ladybug")
95
-
96
- try:
97
- from ladybug_geometry.geometry3d.face import Face3D
98
- from ladybug_geometry.geometry3d.pointvector import Point3D, Vector3D
99
- except:
100
- print("Honeybee - Installing required ladybug-geometry library.")
101
- try:
102
- os.system("pip install -U ladybug-geometry")
103
- except:
104
- os.system("pip install -U ladybug-geometry --user")
105
- try:
106
- from ladybug_geometry.geometry3d.face import Face3D
107
- from ladybug_geometry.geometry3d.pointvector import Point3D, Vector3D
108
- except:
109
- warnings.warn("Honeybee - Error: Could not import ladybug-geometry")
110
-
111
- import json
112
- import topologic
113
-
114
- class Honeybee:
115
- @staticmethod
116
- def ConstructionSetByIdentifier(id):
117
- """
118
- Returns the built-in construction set by the input identifying string.
119
-
120
- Parameters
121
- ----------
122
- id : str
123
- The construction set identifier.
124
-
125
- Returns
126
- -------
127
- HBConstructionSet
128
- The found built-in construction set.
129
-
130
- """
131
- return constr_set_lib.construction_set_by_identifier(id)
132
-
133
- @staticmethod
134
- def ConstructionSets():
135
- """
136
- Returns the list of built-in construction sets
137
-
138
- Returns
139
- -------
140
- list
141
- The list of built-in construction sets.
142
-
143
- """
144
- constrSets = []
145
- constrIdentifiers = list(constr_set_lib.CONSTRUCTION_SETS)
146
- for constrIdentifier in constrIdentifiers:
147
- constrSets.append(constr_set_lib.construction_set_by_identifier(constrIdentifier))
148
- return [constrSets, constrIdentifiers]
149
-
150
- @staticmethod
151
- def ExportToHBJSON(model, path, overwrite=False):
152
- """
153
- Exports the input HB Model to a file.
154
-
155
- Parameters
156
- ----------
157
- model : HBModel
158
- The input HB Model.
159
- path : str
160
- The location of the output file.
161
- overwrite : bool , optional
162
- If set to True this method overwrites any existing file. Otherwise, it won't. The default is False.
163
-
164
- Returns
165
- -------
166
- bool
167
- Returns True if the operation is successful. Returns False otherwise.
168
-
169
- """
170
- from os.path import exists
171
-
172
- # Make sure the file extension is .hbjson
173
- ext = path[len(path)-7:len(path)]
174
- if ext.lower() != ".hbjson":
175
- path = path+".hbjson"
176
-
177
- if not overwrite and exists(path):
178
- print("DGL.ExportToHBJSON - Error: a file already exists at the specified path and overwrite is set to False. Returning None.")
179
- return None
180
- f = None
181
- try:
182
- if overwrite == True:
183
- f = open(path, "w")
184
- else:
185
- f = open(path, "x") # Try to create a new File
186
- except:
187
- print("DGL.ExportToHBJSON - Error: Could not create a new file at the following location: "+path+". Returning None.")
188
- return None
189
- if (f):
190
- json.dump(model.to_dict(), f, indent=4)
191
- f.close()
192
- return True
193
- return False
194
-
195
- @staticmethod
196
- def ModelByTopology(tpBuilding,
197
- tpShadingFacesCluster = None,
198
- buildingName = "Generic_Building",
199
- defaultProgramIdentifier = "Generic Office Program",
200
- defaultConstructionSetIdentifier = "Default Generic Construction Set",
201
- coolingSetpoint = 25.0,
202
- heatingSetpoint = 20.0,
203
- humidifyingSetpoint = 30.0,
204
- dehumidifyingSetpoint = 55.0,
205
- roomNameKey = "TOPOLOGIC_name",
206
- roomTypeKey = "TOPOLOGIC_type",
207
- apertureTypeKey = "TOPOLOGIC_type",
208
- addSensorGrid = False):
209
- """
210
- Creates an HB Model from the input Topology.
211
-
212
- Parameters
213
- ----------
214
-
215
-
216
- Returns
217
- -------
218
- HBModel
219
- The created HB Model
220
-
221
- """
222
- from topologicpy.Vertex import Vertex
223
- from topologicpy.Wire import Wire
224
- from topologicpy.Face import Face
225
- from topologicpy.Cell import Cell
226
- from topologicpy.Aperture import Aperture
227
- from topologicpy.Topology import Topology
228
- from topologicpy.Dictionary import Dictionary
229
-
230
- def cellFloor(cell):
231
- faces = []
232
- _ = cell.Faces(None, faces)
233
- c = [x.CenterOfMass().Z() for x in faces]
234
- return round(min(c),2)
235
-
236
- def floorLevels(cells, min_difference):
237
- floors = [cellFloor(x) for x in cells]
238
- floors = list(set(floors)) #create a unique list
239
- floors.sort()
240
- returnList = []
241
- for aCell in cells:
242
- for floorNumber, aFloor in enumerate(floors):
243
- if abs(cellFloor(aCell) - aFloor) > min_difference:
244
- continue
245
- returnList.append("Floor"+str(floorNumber).zfill(2))
246
- break
247
- return returnList
248
-
249
- def getKeyName(d, keyName):
250
- if not d == None:
251
- keys = Dictionary.Keys(d)
252
- else:
253
- keys = []
254
- for key in keys:
255
- if key.lower() == keyName.lower():
256
- return key
257
- return None
258
-
259
- def createUniqueName(name, nameList, number):
260
- if not (name in nameList):
261
- return name
262
- elif not ((name+"_"+str(number)) in nameList):
263
- return name+"_"+str(number)
264
- else:
265
- return createUniqueName(name,nameList, number+1)
266
-
267
- if not isinstance(tpBuilding, topologic.Topology):
268
- return None
269
- rooms = []
270
- tpCells = []
271
- _ = tpBuilding.Cells(None, tpCells)
272
- # Sort cells by Z Levels
273
- tpCells.sort(key=lambda c: cellFloor(c), reverse=False)
274
- fl = floorLevels(tpCells, 2)
275
- spaceNames = []
276
- sensorGrids = []
277
- for spaceNumber, tpCell in enumerate(tpCells):
278
- tpDictionary = Topology.Dictionary(tpCell)
279
- tpCellName = None
280
- tpCellStory = None
281
- tpCellProgramIdentifier = None
282
- tpCellConstructionSetIdentifier = None
283
- tpCellConditioned = True
284
- if tpDictionary:
285
- keyName = getKeyName(tpDictionary, 'Story')
286
- try:
287
- tpCellStory = Dictionary.ValueAtKey(tpDictionary, keyName)
288
- if tpCellStory:
289
- tpCellStory = tpCellStory.replace(" ","_")
290
- except:
291
- tpCellStory = fl[spaceNumber]
292
- if roomNameKey:
293
- keyName = getKeyName(tpDictionary, roomNameKey)
294
- else:
295
- keyName = getKeyName(tpDictionary, 'Name')
296
- try:
297
- tpCellName = Dictionary.ValueAtKey(tpDictionary,keyName)
298
- if tpCellName:
299
- tpCellName = createUniqueName(tpCellName.replace(" ","_"), spaceNames, 1)
300
- except:
301
- tpCellName = tpCellStory+"_SPACE_"+(str(spaceNumber+1))
302
- if roomTypeKey:
303
- keyName = getKeyName(tpDictionary, roomTypeKey)
304
- try:
305
- tpCellProgramIdentifier = Dictionary.ValueAtKey(tpDictionary, keyName)
306
- if tpCellProgramIdentifier:
307
- program = prog_type_lib.program_type_by_identifier(tpCellProgramIdentifier)
308
- elif defaultProgramIdentifier:
309
- program = prog_type_lib.program_type_by_identifier(defaultProgramIdentifier)
310
- except:
311
- program = prog_type_lib.office_program #Default Office Program as a last resort
312
- keyName = getKeyName(tpDictionary, 'construction_set')
313
- try:
314
- tpCellConstructionSetIdentifier = Dictionary.ValueAtKey(tpDictionary, keyName)
315
- if tpCellConstructionSetIdentifier:
316
- constr_set = constr_set_lib.construction_set_by_identifier(tpCellConstructionSetIdentifier)
317
- elif defaultConstructionSetIdentifier:
318
- constr_set = constr_set_lib.construction_set_by_identifier(defaultConstructionSetIdentifier)
319
- except:
320
- constr_set = constr_set_lib.construction_set_by_identifier("Default Generic Construction Set")
321
- else:
322
- tpCellStory = fl[spaceNumber]
323
- tpCellName = tpCellStory+"_SPACE_"+(str(spaceNumber+1))
324
- program = prog_type_lib.office_program
325
- constr_set = constr_set_lib.construction_set_by_identifier("Default Generic Construction Set")
326
- spaceNames.append(tpCellName)
327
-
328
- tpCellFaces = []
329
- _ = tpCell.Faces(None, tpCellFaces)
330
- if tpCellFaces:
331
- hbRoomFaces = []
332
- for tpFaceNumber, tpCellFace in enumerate(tpCellFaces):
333
- tpCellFaceNormal = Face.NormalAtParameters(tpCellFace, 0.5, 0.5)
334
- hbRoomFacePoints = []
335
- tpFaceVertices = Wire.Vertices(Face.ExternalBoundary(tpCellFace))
336
- for tpVertex in tpFaceVertices:
337
- hbRoomFacePoints.append(Point3D(tpVertex.X(), tpVertex.Y(), tpVertex.Z()))
338
- hbRoomFace = HBFace(tpCellName+'_Face_'+str(tpFaceNumber+1), Face3D(hbRoomFacePoints))
339
- tpFaceApertures = []
340
- _ = tpCellFace.Apertures(tpFaceApertures)
341
- if tpFaceApertures:
342
- for tpFaceApertureNumber, tpFaceAperture in enumerate(tpFaceApertures):
343
- apertureTopology = Aperture.Topology(tpFaceAperture)
344
- tpFaceApertureDictionary = Topology.Dictionary(apertureTopology)
345
- if tpFaceApertureDictionary:
346
- apertureKeyName = getKeyName(tpFaceApertureDictionary, apertureTypeKey)
347
- tpFaceApertureType = Dictionary.ValueAtKey(tpFaceApertureDictionary,apertureKeyName)
348
- hbFaceAperturePoints = []
349
- tpFaceApertureVertices = []
350
- tpFaceApertureVertices = Wire.Vertices(Face.ExternalBoundary(apertureTopology))
351
- for tpFaceApertureVertex in tpFaceApertureVertices:
352
- hbFaceAperturePoints.append(Point3D(tpFaceApertureVertex.X(), tpFaceApertureVertex.Y(), tpFaceApertureVertex.Z()))
353
- if(tpFaceApertureType):
354
- if ("door" in tpFaceApertureType.lower()):
355
- hbFaceAperture = HBDoor(tpCellName+'_Face_'+str(tpFaceNumber+1)+'_Door_'+str(tpFaceApertureNumber), Face3D(hbFaceAperturePoints))
356
- else:
357
- hbFaceAperture = HBAperture(tpCellName+'_Face_'+str(tpFaceNumber+1)+'_Window_'+str(tpFaceApertureNumber), Face3D(hbFaceAperturePoints))
358
- else:
359
- hbFaceAperture = HBAperture(tpCellName+'_Face_'+str(tpFaceNumber+1)+'_Window_'+str(tpFaceApertureNumber), Face3D(hbFaceAperturePoints))
360
- hbRoomFace.add_aperture(hbFaceAperture)
361
- else:
362
- tpFaceDictionary = Topology.Dictionary(tpCellFace)
363
- if (abs(tpCellFaceNormal[2]) < 1e-6) and tpFaceDictionary: #It is a mostly vertical wall and has a dictionary
364
- apertureRatio = Dictionary.ValueAtKey(tpFaceDictionary,'apertureRatio')
365
- if apertureRatio:
366
- hbRoomFace.apertures_by_ratio(apertureRatio, tolerance=0.01)
367
- fType = honeybee.facetype.get_type_from_normal(Vector3D(tpCellFaceNormal[0],tpCellFaceNormal[1],tpCellFaceNormal[2]), roof_angle=30, floor_angle=150)
368
- hbRoomFace.type = fType
369
- hbRoomFaces.append(hbRoomFace)
370
- room = HBRoom(tpCellName, hbRoomFaces, 0.01, 1)
371
- if addSensorGrid:
372
- floor_mesh = room.generate_grid(0.5, 0.5, 1)
373
- sensorGrids.append(SensorGrid.from_mesh3d(tpCellName+"_SG", floor_mesh))
374
- heat_setpt = ScheduleRuleset.from_constant_value('Room Heating', heatingSetpoint, schedule_types.temperature)
375
- cool_setpt = ScheduleRuleset.from_constant_value('Room Cooling', coolingSetpoint, schedule_types.temperature)
376
- humidify_setpt = ScheduleRuleset.from_constant_value('Room Humidifying', humidifyingSetpoint, schedule_types.humidity)
377
- dehumidify_setpt = ScheduleRuleset.from_constant_value('Room Dehumidifying', dehumidifyingSetpoint, schedule_types.humidity)
378
- setpoint = Setpoint('Room Setpoint', heat_setpt, cool_setpt, humidify_setpt, dehumidify_setpt)
379
- simple_office = ScheduleDay('Simple Weekday', [0, 1, 0], [Time(0, 0), Time(9, 0), Time(17, 0)]) #Todo: Remove hardwired scheduleday
380
- schedule = ScheduleRuleset('Office Water Use', simple_office, None, schedule_types.fractional) #Todo: Remove hardwired schedule
381
- shw = ServiceHotWater('Office Hot Water', 0.1, schedule) #Todo: Remove hardwired schedule hot water
382
- room.properties.energy.program_type = program
383
- room.properties.energy.construction_set = constr_set
384
- room.properties.energy.add_default_ideal_air() #Ideal Air Exchange
385
- room.properties.energy.setpoint = setpoint #Heating/Cooling/Humidifying/Dehumidifying
386
- room.properties.energy.service_hot_water = shw #Service Hot Water
387
- if tpCellStory:
388
- room.story = tpCellStory
389
- rooms.append(room)
390
- HBRoom.solve_adjacency(rooms, 0.01)
391
-
392
- hbShades = []
393
- if(tpShadingFacesCluster):
394
- hbShades = []
395
- tpShadingFaces = Topology.SubTopologies(tpShadingFacesCluster, subTopologyType="face")
396
- for faceIndex, tpShadingFace in enumerate(tpShadingFaces):
397
- faceVertices = []
398
- faceVertices = Wire.Vertices(Face.ExternalBoundary(tpShadingFace))
399
- facePoints = []
400
- for aVertex in faceVertices:
401
- facePoints.append(Point3D(aVertex.X(), aVertex.Y(), aVertex.Z()))
402
- hbShadingFace = Face3D(facePoints, None, [])
403
- hbShade = HBShade("SHADINGSURFACE_" + str(faceIndex+1), hbShadingFace)
404
- hbShades.append(hbShade)
405
- model = HBModel(buildingName, rooms, orphaned_shades=hbShades)
406
- if addSensorGrid:
407
- model.properties.radiance.sensor_grids = []
408
- model.properties.radiance.add_sensor_grids(sensorGrids)
409
- return model
410
-
411
- @staticmethod
412
- def ProgramTypeByIdentifier(id):
413
- """
414
- Returns the program type by the input identifying string.
415
-
416
- Parameters
417
- ----------
418
- id : str
419
- The identifiying string.
420
-
421
- Returns
422
- -------
423
- HBProgram
424
- The found built-in program.
425
-
426
- """
427
- return prog_type_lib.program_type_by_identifier(id)
428
-
429
- @staticmethod
430
- def ProgramTypes():
431
- """
432
- Returns the list of available built-in program types.
433
-
434
- Returns
435
- -------
436
- list
437
- The list of available built-in program types.
438
-
439
- """
440
- progTypes = []
441
- progIdentifiers = list(prog_type_lib.PROGRAM_TYPES)
442
- for progIdentifier in progIdentifiers:
443
- progTypes.append(prog_type_lib.program_type_by_identifier(progIdentifier))
444
- return [progTypes, progIdentifiers]
445
-
446
- @staticmethod
447
- def String(model):
448
- """
449
- Returns the string representation of the input model.
450
-
451
- Parameters
452
- ----------
453
- model : HBModel
454
- The input HB Model.
455
-
456
- Returns
457
- -------
458
- dict
459
- A dictionary representing the input HB Model.
460
-
461
- """
1
+ # Copyright (C) 2024
2
+ # Wassim Jabi <wassim.jabi@gmail.com>
3
+ #
4
+ # This program is free software: you can redistribute it and/or modify it under
5
+ # the terms of the GNU Affero General Public License as published by the Free Software
6
+ # Foundation, either version 3 of the License, or (at your option) any later
7
+ # version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful, but WITHOUT
10
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11
+ # FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
12
+ # details.
13
+ #
14
+ # You should have received a copy of the GNU Affero General Public License along with
15
+ # this program. If not, see <https://www.gnu.org/licenses/>.
16
+
17
+ import os
18
+ import warnings
19
+
20
+ try:
21
+ import honeybee.facetype
22
+ from honeybee.face import Face as HBFace
23
+ from honeybee.model import Model as HBModel
24
+ from honeybee.room import Room as HBRoom
25
+ from honeybee.shade import Shade as HBShade
26
+ from honeybee.aperture import Aperture as HBAperture
27
+ from honeybee.door import Door as HBDoor
28
+ except:
29
+ print("Honeybee - Installing required honeybee library.")
30
+ try:
31
+ os.system("pip install honeybee")
32
+ except:
33
+ os.system("pip install honeybee --user")
34
+ try:
35
+ import honeybee.facetype
36
+ from honeybee.face import Face as HBFace
37
+ from honeybee.model import Model as HBModel
38
+ from honeybee.room import Room as HBRoom
39
+ from honeybee.shade import Shade as HBShade
40
+ from honeybee.aperture import Aperture as HBAperture
41
+ from honeybee.door import Door as HBDoor
42
+ except:
43
+ warnings.warn("Honeybee - ERROR: Could not import honeybee")
44
+
45
+ try:
46
+ import honeybee_energy.lib.constructionsets as constr_set_lib
47
+ import honeybee_energy.lib.programtypes as prog_type_lib
48
+ import honeybee_energy.lib.scheduletypelimits as schedule_types
49
+ from honeybee_energy.schedule.ruleset import ScheduleRuleset
50
+ from honeybee_energy.schedule.day import ScheduleDay
51
+ from honeybee_energy.load.setpoint import Setpoint
52
+ from honeybee_energy.load.hotwater import ServiceHotWater
53
+ except:
54
+ print("Honeybee - Installing required honeybee-energy library.")
55
+ try:
56
+ os.system("pip install -U honeybee-energy[standards]")
57
+ except:
58
+ os.system("pip install -U honeybee-energy[standards] --user")
59
+ try:
60
+ import honeybee_energy.lib.constructionsets as constr_set_lib
61
+ import honeybee_energy.lib.programtypes as prog_type_lib
62
+ import honeybee_energy.lib.scheduletypelimits as schedule_types
63
+ from honeybee_energy.schedule.ruleset import ScheduleRuleset
64
+ from honeybee_energy.schedule.day import ScheduleDay
65
+ from honeybee_energy.load.setpoint import Setpoint
66
+ from honeybee_energy.load.hotwater import ServiceHotWater
67
+ except:
68
+ warnings.warn("Honeybee - Error: Could not import honeybee-energy")
69
+
70
+ try:
71
+ from honeybee_radiance.sensorgrid import SensorGrid
72
+ except:
73
+ print("Honeybee - Installing required honeybee-radiance library.")
74
+ try:
75
+ os.system("pip install -U honeybee-radiance")
76
+ except:
77
+ os.system("pip install -U honeybee-radiance --user")
78
+ try:
79
+ from honeybee_radiance.sensorgrid import SensorGrid
80
+ except:
81
+ warnings.warn("Honeybee - Error: Could not import honeybee-radiance")
82
+
83
+ try:
84
+ from ladybug.dt import Time
85
+ except:
86
+ print("Honeybee - Installing required ladybug library.")
87
+ try:
88
+ os.system("pip install -U ladybug")
89
+ except:
90
+ os.system("pip install -U ladybug --user")
91
+ try:
92
+ from ladybug.dt import Time
93
+ except:
94
+ warnings.warn("Honeybee - Error: Could not import ladybug")
95
+
96
+ try:
97
+ from ladybug_geometry.geometry3d.face import Face3D
98
+ from ladybug_geometry.geometry3d.pointvector import Point3D, Vector3D
99
+ except:
100
+ print("Honeybee - Installing required ladybug-geometry library.")
101
+ try:
102
+ os.system("pip install -U ladybug-geometry")
103
+ except:
104
+ os.system("pip install -U ladybug-geometry --user")
105
+ try:
106
+ from ladybug_geometry.geometry3d.face import Face3D
107
+ from ladybug_geometry.geometry3d.pointvector import Point3D, Vector3D
108
+ except:
109
+ warnings.warn("Honeybee - Error: Could not import ladybug-geometry")
110
+
111
+ import json
112
+ import topologic_core as topologic
113
+
114
+ class Honeybee:
115
+ @staticmethod
116
+ def ConstructionSetByIdentifier(id):
117
+ """
118
+ Returns the built-in construction set by the input identifying string.
119
+
120
+ Parameters
121
+ ----------
122
+ id : str
123
+ The construction set identifier.
124
+
125
+ Returns
126
+ -------
127
+ HBConstructionSet
128
+ The found built-in construction set.
129
+
130
+ """
131
+ return constr_set_lib.construction_set_by_identifier(id)
132
+
133
+ @staticmethod
134
+ def ConstructionSets():
135
+ """
136
+ Returns the list of built-in construction sets
137
+
138
+ Returns
139
+ -------
140
+ list
141
+ The list of built-in construction sets.
142
+
143
+ """
144
+ constrSets = []
145
+ constrIdentifiers = list(constr_set_lib.CONSTRUCTION_SETS)
146
+ for constrIdentifier in constrIdentifiers:
147
+ constrSets.append(constr_set_lib.construction_set_by_identifier(constrIdentifier))
148
+ return [constrSets, constrIdentifiers]
149
+
150
+ @staticmethod
151
+ def ExportToHBJSON(model, path, overwrite=False):
152
+ """
153
+ Exports the input HB Model to a file.
154
+
155
+ Parameters
156
+ ----------
157
+ model : HBModel
158
+ The input HB Model.
159
+ path : str
160
+ The location of the output file.
161
+ overwrite : bool , optional
162
+ If set to True this method overwrites any existing file. Otherwise, it won't. The default is False.
163
+
164
+ Returns
165
+ -------
166
+ bool
167
+ Returns True if the operation is successful. Returns False otherwise.
168
+
169
+ """
170
+ from os.path import exists
171
+
172
+ # Make sure the file extension is .hbjson
173
+ ext = path[len(path)-7:len(path)]
174
+ if ext.lower() != ".hbjson":
175
+ path = path+".hbjson"
176
+
177
+ if not overwrite and exists(path):
178
+ print("DGL.ExportToHBJSON - Error: a file already exists at the specified path and overwrite is set to False. Returning None.")
179
+ return None
180
+ f = None
181
+ try:
182
+ if overwrite == True:
183
+ f = open(path, "w")
184
+ else:
185
+ f = open(path, "x") # Try to create a new File
186
+ except:
187
+ print("DGL.ExportToHBJSON - Error: Could not create a new file at the following location: "+path+". Returning None.")
188
+ return None
189
+ if (f):
190
+ json.dump(model.to_dict(), f, indent=4)
191
+ f.close()
192
+ return True
193
+ return False
194
+
195
+ @staticmethod
196
+ def ModelByTopology(tpBuilding,
197
+ tpShadingFacesCluster = None,
198
+ buildingName = "Generic_Building",
199
+ defaultProgramIdentifier = "Generic Office Program",
200
+ defaultConstructionSetIdentifier = "Default Generic Construction Set",
201
+ coolingSetpoint = 25.0,
202
+ heatingSetpoint = 20.0,
203
+ humidifyingSetpoint = 30.0,
204
+ dehumidifyingSetpoint = 55.0,
205
+ roomNameKey = "TOPOLOGIC_name",
206
+ roomTypeKey = "TOPOLOGIC_type",
207
+ apertureTypeKey = "TOPOLOGIC_type",
208
+ addSensorGrid = False):
209
+ """
210
+ Creates an HB Model from the input Topology.
211
+
212
+ Parameters
213
+ ----------
214
+
215
+
216
+ Returns
217
+ -------
218
+ HBModel
219
+ The created HB Model
220
+
221
+ """
222
+ from topologicpy.Vertex import Vertex
223
+ from topologicpy.Wire import Wire
224
+ from topologicpy.Face import Face
225
+ from topologicpy.Cell import Cell
226
+ from topologicpy.Aperture import Aperture
227
+ from topologicpy.Topology import Topology
228
+ from topologicpy.Dictionary import Dictionary
229
+
230
+ def cellFloor(cell):
231
+ faces = []
232
+ _ = cell.Faces(None, faces)
233
+ c = [x.CenterOfMass().Z() for x in faces]
234
+ return round(min(c),2)
235
+
236
+ def floorLevels(cells, min_difference):
237
+ floors = [cellFloor(x) for x in cells]
238
+ floors = list(set(floors)) #create a unique list
239
+ floors.sort()
240
+ returnList = []
241
+ for aCell in cells:
242
+ for floorNumber, aFloor in enumerate(floors):
243
+ if abs(cellFloor(aCell) - aFloor) > min_difference:
244
+ continue
245
+ returnList.append("Floor"+str(floorNumber).zfill(2))
246
+ break
247
+ return returnList
248
+
249
+ def getKeyName(d, keyName):
250
+ if not d == None:
251
+ keys = Dictionary.Keys(d)
252
+ else:
253
+ keys = []
254
+ for key in keys:
255
+ if key.lower() == keyName.lower():
256
+ return key
257
+ return None
258
+
259
+ def createUniqueName(name, nameList, number):
260
+ if not (name in nameList):
261
+ return name
262
+ elif not ((name+"_"+str(number)) in nameList):
263
+ return name+"_"+str(number)
264
+ else:
265
+ return createUniqueName(name,nameList, number+1)
266
+
267
+ if not isinstance(tpBuilding, topologic.Topology):
268
+ return None
269
+ rooms = []
270
+ tpCells = []
271
+ _ = tpBuilding.Cells(None, tpCells)
272
+ # Sort cells by Z Levels
273
+ tpCells.sort(key=lambda c: cellFloor(c), reverse=False)
274
+ fl = floorLevels(tpCells, 2)
275
+ spaceNames = []
276
+ sensorGrids = []
277
+ for spaceNumber, tpCell in enumerate(tpCells):
278
+ tpDictionary = Topology.Dictionary(tpCell)
279
+ tpCellName = None
280
+ tpCellStory = None
281
+ tpCellProgramIdentifier = None
282
+ tpCellConstructionSetIdentifier = None
283
+ tpCellConditioned = True
284
+ if tpDictionary:
285
+ keyName = getKeyName(tpDictionary, 'Story')
286
+ try:
287
+ tpCellStory = Dictionary.ValueAtKey(tpDictionary, keyName)
288
+ if tpCellStory:
289
+ tpCellStory = tpCellStory.replace(" ","_")
290
+ except:
291
+ tpCellStory = fl[spaceNumber]
292
+ if roomNameKey:
293
+ keyName = getKeyName(tpDictionary, roomNameKey)
294
+ else:
295
+ keyName = getKeyName(tpDictionary, 'Name')
296
+ try:
297
+ tpCellName = Dictionary.ValueAtKey(tpDictionary,keyName)
298
+ if tpCellName:
299
+ tpCellName = createUniqueName(tpCellName.replace(" ","_"), spaceNames, 1)
300
+ except:
301
+ tpCellName = tpCellStory+"_SPACE_"+(str(spaceNumber+1))
302
+ if roomTypeKey:
303
+ keyName = getKeyName(tpDictionary, roomTypeKey)
304
+ try:
305
+ tpCellProgramIdentifier = Dictionary.ValueAtKey(tpDictionary, keyName)
306
+ if tpCellProgramIdentifier:
307
+ program = prog_type_lib.program_type_by_identifier(tpCellProgramIdentifier)
308
+ elif defaultProgramIdentifier:
309
+ program = prog_type_lib.program_type_by_identifier(defaultProgramIdentifier)
310
+ except:
311
+ program = prog_type_lib.office_program #Default Office Program as a last resort
312
+ keyName = getKeyName(tpDictionary, 'construction_set')
313
+ try:
314
+ tpCellConstructionSetIdentifier = Dictionary.ValueAtKey(tpDictionary, keyName)
315
+ if tpCellConstructionSetIdentifier:
316
+ constr_set = constr_set_lib.construction_set_by_identifier(tpCellConstructionSetIdentifier)
317
+ elif defaultConstructionSetIdentifier:
318
+ constr_set = constr_set_lib.construction_set_by_identifier(defaultConstructionSetIdentifier)
319
+ except:
320
+ constr_set = constr_set_lib.construction_set_by_identifier("Default Generic Construction Set")
321
+ else:
322
+ tpCellStory = fl[spaceNumber]
323
+ tpCellName = tpCellStory+"_SPACE_"+(str(spaceNumber+1))
324
+ program = prog_type_lib.office_program
325
+ constr_set = constr_set_lib.construction_set_by_identifier("Default Generic Construction Set")
326
+ spaceNames.append(tpCellName)
327
+
328
+ tpCellFaces = []
329
+ _ = tpCell.Faces(None, tpCellFaces)
330
+ if tpCellFaces:
331
+ hbRoomFaces = []
332
+ for tpFaceNumber, tpCellFace in enumerate(tpCellFaces):
333
+ tpCellFaceNormal = Face.NormalAtParameters(tpCellFace, 0.5, 0.5)
334
+ hbRoomFacePoints = []
335
+ tpFaceVertices = Wire.Vertices(Face.ExternalBoundary(tpCellFace))
336
+ for tpVertex in tpFaceVertices:
337
+ hbRoomFacePoints.append(Point3D(tpVertex.X(), tpVertex.Y(), tpVertex.Z()))
338
+ hbRoomFace = HBFace(tpCellName+'_Face_'+str(tpFaceNumber+1), Face3D(hbRoomFacePoints))
339
+ tpFaceApertures = []
340
+ _ = tpCellFace.Apertures(tpFaceApertures)
341
+ if tpFaceApertures:
342
+ for tpFaceApertureNumber, tpFaceAperture in enumerate(tpFaceApertures):
343
+ apertureTopology = Aperture.Topology(tpFaceAperture)
344
+ tpFaceApertureDictionary = Topology.Dictionary(apertureTopology)
345
+ if tpFaceApertureDictionary:
346
+ apertureKeyName = getKeyName(tpFaceApertureDictionary, apertureTypeKey)
347
+ tpFaceApertureType = Dictionary.ValueAtKey(tpFaceApertureDictionary,apertureKeyName)
348
+ hbFaceAperturePoints = []
349
+ tpFaceApertureVertices = []
350
+ tpFaceApertureVertices = Wire.Vertices(Face.ExternalBoundary(apertureTopology))
351
+ for tpFaceApertureVertex in tpFaceApertureVertices:
352
+ hbFaceAperturePoints.append(Point3D(tpFaceApertureVertex.X(), tpFaceApertureVertex.Y(), tpFaceApertureVertex.Z()))
353
+ if(tpFaceApertureType):
354
+ if ("door" in tpFaceApertureType.lower()):
355
+ hbFaceAperture = HBDoor(tpCellName+'_Face_'+str(tpFaceNumber+1)+'_Door_'+str(tpFaceApertureNumber), Face3D(hbFaceAperturePoints))
356
+ else:
357
+ hbFaceAperture = HBAperture(tpCellName+'_Face_'+str(tpFaceNumber+1)+'_Window_'+str(tpFaceApertureNumber), Face3D(hbFaceAperturePoints))
358
+ else:
359
+ hbFaceAperture = HBAperture(tpCellName+'_Face_'+str(tpFaceNumber+1)+'_Window_'+str(tpFaceApertureNumber), Face3D(hbFaceAperturePoints))
360
+ hbRoomFace.add_aperture(hbFaceAperture)
361
+ else:
362
+ tpFaceDictionary = Topology.Dictionary(tpCellFace)
363
+ if (abs(tpCellFaceNormal[2]) < 1e-6) and tpFaceDictionary: #It is a mostly vertical wall and has a dictionary
364
+ apertureRatio = Dictionary.ValueAtKey(tpFaceDictionary,'apertureRatio')
365
+ if apertureRatio:
366
+ hbRoomFace.apertures_by_ratio(apertureRatio, tolerance=0.01)
367
+ fType = honeybee.facetype.get_type_from_normal(Vector3D(tpCellFaceNormal[0],tpCellFaceNormal[1],tpCellFaceNormal[2]), roof_angle=30, floor_angle=150)
368
+ hbRoomFace.type = fType
369
+ hbRoomFaces.append(hbRoomFace)
370
+ room = HBRoom(tpCellName, hbRoomFaces, 0.01, 1)
371
+ if addSensorGrid:
372
+ floor_mesh = room.generate_grid(0.5, 0.5, 1)
373
+ sensorGrids.append(SensorGrid.from_mesh3d(tpCellName+"_SG", floor_mesh))
374
+ heat_setpt = ScheduleRuleset.from_constant_value('Room Heating', heatingSetpoint, schedule_types.temperature)
375
+ cool_setpt = ScheduleRuleset.from_constant_value('Room Cooling', coolingSetpoint, schedule_types.temperature)
376
+ humidify_setpt = ScheduleRuleset.from_constant_value('Room Humidifying', humidifyingSetpoint, schedule_types.humidity)
377
+ dehumidify_setpt = ScheduleRuleset.from_constant_value('Room Dehumidifying', dehumidifyingSetpoint, schedule_types.humidity)
378
+ setpoint = Setpoint('Room Setpoint', heat_setpt, cool_setpt, humidify_setpt, dehumidify_setpt)
379
+ simple_office = ScheduleDay('Simple Weekday', [0, 1, 0], [Time(0, 0), Time(9, 0), Time(17, 0)]) #Todo: Remove hardwired scheduleday
380
+ schedule = ScheduleRuleset('Office Water Use', simple_office, None, schedule_types.fractional) #Todo: Remove hardwired schedule
381
+ shw = ServiceHotWater('Office Hot Water', 0.1, schedule) #Todo: Remove hardwired schedule hot water
382
+ room.properties.energy.program_type = program
383
+ room.properties.energy.construction_set = constr_set
384
+ room.properties.energy.add_default_ideal_air() #Ideal Air Exchange
385
+ room.properties.energy.setpoint = setpoint #Heating/Cooling/Humidifying/Dehumidifying
386
+ room.properties.energy.service_hot_water = shw #Service Hot Water
387
+ if tpCellStory:
388
+ room.story = tpCellStory
389
+ rooms.append(room)
390
+ HBRoom.solve_adjacency(rooms, 0.01)
391
+
392
+ hbShades = []
393
+ if(tpShadingFacesCluster):
394
+ hbShades = []
395
+ tpShadingFaces = Topology.SubTopologies(tpShadingFacesCluster, subTopologyType="face")
396
+ for faceIndex, tpShadingFace in enumerate(tpShadingFaces):
397
+ faceVertices = []
398
+ faceVertices = Wire.Vertices(Face.ExternalBoundary(tpShadingFace))
399
+ facePoints = []
400
+ for aVertex in faceVertices:
401
+ facePoints.append(Point3D(aVertex.X(), aVertex.Y(), aVertex.Z()))
402
+ hbShadingFace = Face3D(facePoints, None, [])
403
+ hbShade = HBShade("SHADINGSURFACE_" + str(faceIndex+1), hbShadingFace)
404
+ hbShades.append(hbShade)
405
+ model = HBModel(buildingName, rooms, orphaned_shades=hbShades)
406
+ if addSensorGrid:
407
+ model.properties.radiance.sensor_grids = []
408
+ model.properties.radiance.add_sensor_grids(sensorGrids)
409
+ return model
410
+
411
+ @staticmethod
412
+ def ProgramTypeByIdentifier(id):
413
+ """
414
+ Returns the program type by the input identifying string.
415
+
416
+ Parameters
417
+ ----------
418
+ id : str
419
+ The identifiying string.
420
+
421
+ Returns
422
+ -------
423
+ HBProgram
424
+ The found built-in program.
425
+
426
+ """
427
+ return prog_type_lib.program_type_by_identifier(id)
428
+
429
+ @staticmethod
430
+ def ProgramTypes():
431
+ """
432
+ Returns the list of available built-in program types.
433
+
434
+ Returns
435
+ -------
436
+ list
437
+ The list of available built-in program types.
438
+
439
+ """
440
+ progTypes = []
441
+ progIdentifiers = list(prog_type_lib.PROGRAM_TYPES)
442
+ for progIdentifier in progIdentifiers:
443
+ progTypes.append(prog_type_lib.program_type_by_identifier(progIdentifier))
444
+ return [progTypes, progIdentifiers]
445
+
446
+ @staticmethod
447
+ def String(model):
448
+ """
449
+ Returns the string representation of the input model.
450
+
451
+ Parameters
452
+ ----------
453
+ model : HBModel
454
+ The input HB Model.
455
+
456
+ Returns
457
+ -------
458
+ dict
459
+ A dictionary representing the input HB Model.
460
+
461
+ """
462
462
  return model.to_dict()