honeybee-energy 1.116.106__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 (162) hide show
  1. honeybee_energy/__init__.py +24 -0
  2. honeybee_energy/__main__.py +4 -0
  3. honeybee_energy/_extend_honeybee.py +145 -0
  4. honeybee_energy/altnumber.py +21 -0
  5. honeybee_energy/baseline/__init__.py +2 -0
  6. honeybee_energy/baseline/create.py +608 -0
  7. honeybee_energy/baseline/data/__init__.py +1 -0
  8. honeybee_energy/baseline/data/constructions.csv +64 -0
  9. honeybee_energy/baseline/data/fen_ratios.csv +15 -0
  10. honeybee_energy/baseline/data/lpd_building.csv +21 -0
  11. honeybee_energy/baseline/data/pci_2016.csv +22 -0
  12. honeybee_energy/baseline/data/pci_2019.csv +22 -0
  13. honeybee_energy/baseline/data/pci_2022.csv +22 -0
  14. honeybee_energy/baseline/data/shw.csv +21 -0
  15. honeybee_energy/baseline/pci.py +512 -0
  16. honeybee_energy/baseline/result.py +371 -0
  17. honeybee_energy/boundarycondition.py +128 -0
  18. honeybee_energy/cli/__init__.py +69 -0
  19. honeybee_energy/cli/baseline.py +475 -0
  20. honeybee_energy/cli/edit.py +327 -0
  21. honeybee_energy/cli/lib.py +1154 -0
  22. honeybee_energy/cli/result.py +810 -0
  23. honeybee_energy/cli/setconfig.py +124 -0
  24. honeybee_energy/cli/settings.py +569 -0
  25. honeybee_energy/cli/simulate.py +380 -0
  26. honeybee_energy/cli/translate.py +1714 -0
  27. honeybee_energy/cli/validate.py +224 -0
  28. honeybee_energy/config.json +11 -0
  29. honeybee_energy/config.py +842 -0
  30. honeybee_energy/construction/__init__.py +1 -0
  31. honeybee_energy/construction/_base.py +374 -0
  32. honeybee_energy/construction/air.py +325 -0
  33. honeybee_energy/construction/dictutil.py +89 -0
  34. honeybee_energy/construction/dynamic.py +607 -0
  35. honeybee_energy/construction/opaque.py +460 -0
  36. honeybee_energy/construction/shade.py +319 -0
  37. honeybee_energy/construction/window.py +1096 -0
  38. honeybee_energy/construction/windowshade.py +847 -0
  39. honeybee_energy/constructionset.py +1655 -0
  40. honeybee_energy/dictutil.py +56 -0
  41. honeybee_energy/generator/__init__.py +5 -0
  42. honeybee_energy/generator/loadcenter.py +204 -0
  43. honeybee_energy/generator/pv.py +535 -0
  44. honeybee_energy/hvac/__init__.py +21 -0
  45. honeybee_energy/hvac/_base.py +124 -0
  46. honeybee_energy/hvac/_template.py +270 -0
  47. honeybee_energy/hvac/allair/__init__.py +22 -0
  48. honeybee_energy/hvac/allair/_base.py +349 -0
  49. honeybee_energy/hvac/allair/furnace.py +168 -0
  50. honeybee_energy/hvac/allair/psz.py +131 -0
  51. honeybee_energy/hvac/allair/ptac.py +163 -0
  52. honeybee_energy/hvac/allair/pvav.py +109 -0
  53. honeybee_energy/hvac/allair/vav.py +128 -0
  54. honeybee_energy/hvac/detailed.py +337 -0
  55. honeybee_energy/hvac/doas/__init__.py +28 -0
  56. honeybee_energy/hvac/doas/_base.py +345 -0
  57. honeybee_energy/hvac/doas/fcu.py +127 -0
  58. honeybee_energy/hvac/doas/radiant.py +329 -0
  59. honeybee_energy/hvac/doas/vrf.py +81 -0
  60. honeybee_energy/hvac/doas/wshp.py +91 -0
  61. honeybee_energy/hvac/heatcool/__init__.py +23 -0
  62. honeybee_energy/hvac/heatcool/_base.py +177 -0
  63. honeybee_energy/hvac/heatcool/baseboard.py +61 -0
  64. honeybee_energy/hvac/heatcool/evapcool.py +72 -0
  65. honeybee_energy/hvac/heatcool/fcu.py +92 -0
  66. honeybee_energy/hvac/heatcool/gasunit.py +53 -0
  67. honeybee_energy/hvac/heatcool/radiant.py +269 -0
  68. honeybee_energy/hvac/heatcool/residential.py +77 -0
  69. honeybee_energy/hvac/heatcool/vrf.py +54 -0
  70. honeybee_energy/hvac/heatcool/windowac.py +70 -0
  71. honeybee_energy/hvac/heatcool/wshp.py +62 -0
  72. honeybee_energy/hvac/idealair.py +699 -0
  73. honeybee_energy/internalmass.py +310 -0
  74. honeybee_energy/lib/__init__.py +1 -0
  75. honeybee_energy/lib/_loadconstructions.py +194 -0
  76. honeybee_energy/lib/_loadconstructionsets.py +117 -0
  77. honeybee_energy/lib/_loadmaterials.py +83 -0
  78. honeybee_energy/lib/_loadprogramtypes.py +125 -0
  79. honeybee_energy/lib/_loadschedules.py +87 -0
  80. honeybee_energy/lib/_loadtypelimits.py +64 -0
  81. honeybee_energy/lib/constructions.py +207 -0
  82. honeybee_energy/lib/constructionsets.py +95 -0
  83. honeybee_energy/lib/materials.py +67 -0
  84. honeybee_energy/lib/programtypes.py +125 -0
  85. honeybee_energy/lib/schedules.py +61 -0
  86. honeybee_energy/lib/scheduletypelimits.py +31 -0
  87. honeybee_energy/load/__init__.py +1 -0
  88. honeybee_energy/load/_base.py +190 -0
  89. honeybee_energy/load/daylight.py +397 -0
  90. honeybee_energy/load/dictutil.py +47 -0
  91. honeybee_energy/load/equipment.py +771 -0
  92. honeybee_energy/load/hotwater.py +543 -0
  93. honeybee_energy/load/infiltration.py +460 -0
  94. honeybee_energy/load/lighting.py +480 -0
  95. honeybee_energy/load/people.py +497 -0
  96. honeybee_energy/load/process.py +472 -0
  97. honeybee_energy/load/setpoint.py +816 -0
  98. honeybee_energy/load/ventilation.py +550 -0
  99. honeybee_energy/material/__init__.py +1 -0
  100. honeybee_energy/material/_base.py +166 -0
  101. honeybee_energy/material/dictutil.py +59 -0
  102. honeybee_energy/material/frame.py +367 -0
  103. honeybee_energy/material/gas.py +1087 -0
  104. honeybee_energy/material/glazing.py +854 -0
  105. honeybee_energy/material/opaque.py +1351 -0
  106. honeybee_energy/material/shade.py +1360 -0
  107. honeybee_energy/measure.py +472 -0
  108. honeybee_energy/programtype.py +723 -0
  109. honeybee_energy/properties/__init__.py +1 -0
  110. honeybee_energy/properties/aperture.py +333 -0
  111. honeybee_energy/properties/door.py +342 -0
  112. honeybee_energy/properties/extension.py +244 -0
  113. honeybee_energy/properties/face.py +274 -0
  114. honeybee_energy/properties/model.py +2640 -0
  115. honeybee_energy/properties/room.py +1747 -0
  116. honeybee_energy/properties/shade.py +314 -0
  117. honeybee_energy/properties/shademesh.py +262 -0
  118. honeybee_energy/reader.py +48 -0
  119. honeybee_energy/result/__init__.py +1 -0
  120. honeybee_energy/result/colorobj.py +648 -0
  121. honeybee_energy/result/emissions.py +290 -0
  122. honeybee_energy/result/err.py +101 -0
  123. honeybee_energy/result/eui.py +100 -0
  124. honeybee_energy/result/generation.py +160 -0
  125. honeybee_energy/result/loadbalance.py +890 -0
  126. honeybee_energy/result/match.py +202 -0
  127. honeybee_energy/result/osw.py +90 -0
  128. honeybee_energy/result/rdd.py +59 -0
  129. honeybee_energy/result/zsz.py +190 -0
  130. honeybee_energy/run.py +1577 -0
  131. honeybee_energy/schedule/__init__.py +1 -0
  132. honeybee_energy/schedule/day.py +626 -0
  133. honeybee_energy/schedule/dictutil.py +59 -0
  134. honeybee_energy/schedule/fixedinterval.py +1012 -0
  135. honeybee_energy/schedule/rule.py +619 -0
  136. honeybee_energy/schedule/ruleset.py +1867 -0
  137. honeybee_energy/schedule/typelimit.py +310 -0
  138. honeybee_energy/shw.py +315 -0
  139. honeybee_energy/simulation/__init__.py +1 -0
  140. honeybee_energy/simulation/control.py +214 -0
  141. honeybee_energy/simulation/daylightsaving.py +185 -0
  142. honeybee_energy/simulation/dictutil.py +51 -0
  143. honeybee_energy/simulation/output.py +646 -0
  144. honeybee_energy/simulation/parameter.py +606 -0
  145. honeybee_energy/simulation/runperiod.py +443 -0
  146. honeybee_energy/simulation/shadowcalculation.py +295 -0
  147. honeybee_energy/simulation/sizing.py +546 -0
  148. honeybee_energy/ventcool/__init__.py +5 -0
  149. honeybee_energy/ventcool/_crack_data.py +91 -0
  150. honeybee_energy/ventcool/afn.py +289 -0
  151. honeybee_energy/ventcool/control.py +269 -0
  152. honeybee_energy/ventcool/crack.py +126 -0
  153. honeybee_energy/ventcool/fan.py +493 -0
  154. honeybee_energy/ventcool/opening.py +365 -0
  155. honeybee_energy/ventcool/simulation.py +314 -0
  156. honeybee_energy/writer.py +1078 -0
  157. honeybee_energy-1.116.106.dist-info/METADATA +113 -0
  158. honeybee_energy-1.116.106.dist-info/RECORD +162 -0
  159. honeybee_energy-1.116.106.dist-info/WHEEL +5 -0
  160. honeybee_energy-1.116.106.dist-info/entry_points.txt +2 -0
  161. honeybee_energy-1.116.106.dist-info/licenses/LICENSE +661 -0
  162. honeybee_energy-1.116.106.dist-info/top_level.txt +1 -0
@@ -0,0 +1,325 @@
1
+ # coding=utf-8
2
+ """AirBoundary Construction."""
3
+ from __future__ import division
4
+
5
+ from ..schedule.dictutil import dict_to_schedule
6
+ from ..schedule.ruleset import ScheduleRuleset
7
+ from ..schedule.fixedinterval import ScheduleFixedInterval
8
+ from ..writer import generate_idf_string
9
+ from ..lib.schedules import always_on
10
+
11
+ from honeybee._lockable import lockable
12
+ from honeybee.typing import valid_ep_string, float_positive
13
+ from ..properties.extension import AirBoundaryConstructionProperties
14
+
15
+
16
+ @lockable
17
+ class AirBoundaryConstruction(object):
18
+ """Construction for Faces with an AirBoundary face type.
19
+
20
+ Args:
21
+ identifier: Text string for a unique Construction ID. Must be < 100 characters
22
+ and not contain any EnergyPlus special characters. This will be used to
23
+ identify the object across a model and in the exported IDF.
24
+ air_mixing_per_area: A positive number for the amount of air mixing
25
+ between Rooms across the air boundary surface [m3/s-m2].
26
+ Default: 0.1 [m3/s-m2]. This corresponds to average indoor air
27
+ speeds of 0.1 m/s (roughly 20 fpm), which is typical of what
28
+ would be induced by a HVAC system.
29
+ air_mixing_schedule: A fractional schedule for the air mixing schedule
30
+ across the construction.
31
+
32
+ Properties:
33
+ * identifier
34
+ * display_name
35
+ * air_mixing_per_area
36
+ * air_mixing_schedule
37
+ * user_data
38
+ * thickness
39
+ * properties
40
+ """
41
+
42
+ __slots__ = ('_identifier', '_display_name', '_air_mixing_per_area',
43
+ '_air_mixing_schedule', '_locked', '_user_data', '_properties')
44
+
45
+ def __init__(self, identifier, air_mixing_per_area=0.1,
46
+ air_mixing_schedule=always_on):
47
+ """Initialize AirBoundaryConstruction."""
48
+ self._locked = False # unlocked by default
49
+ self.identifier = identifier
50
+ self._display_name = None
51
+ self.air_mixing_per_area = air_mixing_per_area
52
+ self.air_mixing_schedule = air_mixing_schedule
53
+ self._user_data = None
54
+ self._properties = AirBoundaryConstructionProperties(self)
55
+
56
+ @property
57
+ def identifier(self):
58
+ """Get or set the text string for construction identifier."""
59
+ return self._identifier
60
+
61
+ @identifier.setter
62
+ def identifier(self, identifier):
63
+ self._identifier = valid_ep_string(identifier, 'construction identifier')
64
+
65
+ @property
66
+ def display_name(self):
67
+ """Get or set a string for the object name without any character restrictions.
68
+
69
+ If not set, this will be equal to the identifier.
70
+ """
71
+ if self._display_name is None:
72
+ return self._identifier
73
+ return self._display_name
74
+
75
+ @display_name.setter
76
+ def display_name(self, value):
77
+ if value is not None:
78
+ try:
79
+ value = str(value)
80
+ except UnicodeEncodeError: # Python 2 machine lacking the character set
81
+ pass # keep it as unicode
82
+ self._display_name = value
83
+
84
+ @property
85
+ def air_mixing_per_area(self):
86
+ """Get or set the air mixing per area across the AirBoundary in [m3/s-m2]."""
87
+ return self._air_mixing_per_area
88
+
89
+ @air_mixing_per_area.setter
90
+ def air_mixing_per_area(self, value):
91
+ self._air_mixing_per_area = float_positive(value, 'air mixing per area')
92
+
93
+ @property
94
+ def air_mixing_schedule(self):
95
+ """Get or set a fractional schedule for the air mixing schedule."""
96
+ return self._air_mixing_schedule
97
+
98
+ @air_mixing_schedule.setter
99
+ def air_mixing_schedule(self, value):
100
+ if value is not None:
101
+ assert isinstance(value, (ScheduleRuleset, ScheduleFixedInterval)), \
102
+ 'Expected schedule for air wall mixing schedule. ' \
103
+ 'Got {}.'.format(type(value))
104
+ if value.schedule_type_limit is not None:
105
+ assert value.schedule_type_limit.unit == 'fraction', 'Air mixing ' \
106
+ 'schedule should be fractional [Dimensionless]. Got a schedule ' \
107
+ 'of unit_type [{}].'.format(value.schedule_type_limit.unit_type)
108
+ value.lock() # lock editing in case schedule has multiple references
109
+ self._air_mixing_schedule = value
110
+ else:
111
+ self._air_mixing_schedule = always_on
112
+
113
+ @property
114
+ def user_data(self):
115
+ """Get or set an optional dictionary for additional meta data for this object.
116
+
117
+ This will be None until it has been set. All keys and values of this
118
+ dictionary should be of a standard Python type to ensure correct
119
+ serialization of the object to/from JSON (eg. str, float, int, list, dict)
120
+ """
121
+ return self._user_data
122
+
123
+ @user_data.setter
124
+ def user_data(self, value):
125
+ if value is not None:
126
+ assert isinstance(value, dict), 'Expected dictionary for honeybee_energy' \
127
+ 'object user_data. Got {}.'.format(type(value))
128
+ self._user_data = value
129
+
130
+ @property
131
+ def thickness(self):
132
+ """Thickness of the construction, always zero for air boundary construction."""
133
+ return 0
134
+
135
+ @property
136
+ def properties(self):
137
+ """Get the properties object for this construction."""
138
+ return self._properties
139
+
140
+ @classmethod
141
+ def from_dict(cls, data):
142
+ """Create a AirBoundaryConstruction from a dictionary.
143
+
144
+ Args:
145
+ data: A python dictionary in the following format
146
+
147
+ .. code-block:: python
148
+
149
+ {
150
+ "type": 'AirBoundaryConstruction',
151
+ "identifier": 'Generic Air Boundary Construction 020',
152
+ "display_name": 'Air Boundary',
153
+ "air_mixing_per_area": 0.2,
154
+ "air_mixing_schedule": {} # dictionary of a schedule
155
+ }
156
+ """
157
+ assert data['type'] == 'AirBoundaryConstruction', \
158
+ 'Expected AirBoundaryConstruction. Got {}.'.format(data['type'])
159
+ a_mix = data['air_mixing_per_area'] if 'air_mixing_per_area' in data else 0.1
160
+ if 'air_mixing_schedule' in data and data['air_mixing_schedule'] is not None:
161
+ a_sch = dict_to_schedule(data['air_mixing_schedule'])
162
+ else:
163
+ a_sch = always_on
164
+ new_obj = cls(data['identifier'], a_mix, a_sch)
165
+ if 'display_name' in data and data['display_name'] is not None:
166
+ new_obj.display_name = data['display_name']
167
+ if 'user_data' in data and data['user_data'] is not None:
168
+ new_obj.user_data = data['user_data']
169
+ if 'properties' in data and data['properties'] is not None:
170
+ new_obj._properties._load_extension_attr_from_dict(data['properties'])
171
+ return new_obj
172
+
173
+ @classmethod
174
+ def from_dict_abridged(cls, data, schedule_dict):
175
+ """Create a AirBoundaryConstruction from an abridged dictionary.
176
+
177
+ Args:
178
+ data: A AirBoundaryConstructionAbridged dictionary with the format below.
179
+ schedule_dict: A dictionary with schedule identifiers as keys and
180
+ honeybee schedule objects as values. These will be used to
181
+ assign the schedule to the AirBoundaryConstruction object.
182
+
183
+ .. code-block:: python
184
+
185
+ {
186
+ "type": 'AirBoundaryConstructionAbridged',
187
+ "identifier": 'Generic Air Boundary Construction',
188
+ "display_name": 'Air Boundary',
189
+ "air_mixing_schedule": "" # identifier of a schedule
190
+ }
191
+ """
192
+ assert data['type'] == 'AirBoundaryConstructionAbridged', \
193
+ 'Expected AirBoundaryConstructionAbridged. Got {}.'.format(data['type'])
194
+ a_mix = data['air_mixing_per_area'] if 'air_mixing_per_area' in data else 0.1
195
+ a_sch = schedule_dict[data['air_mixing_schedule']] if \
196
+ 'air_mixing_schedule' in data and data['air_mixing_schedule'] is not None \
197
+ and data['air_mixing_schedule'] != 'Always On' else always_on
198
+ new_obj = cls(data['identifier'], a_mix, a_sch)
199
+ if 'display_name' in data and data['display_name'] is not None:
200
+ new_obj.display_name = data['display_name']
201
+ if 'user_data' in data and data['user_data'] is not None:
202
+ new_obj.user_data = data['user_data']
203
+ return new_obj
204
+
205
+ def to_idf(self):
206
+ """IDF string for the Construction:AirBoundary of this object.
207
+
208
+ Note that the to_air_mixing_idf method must also be used to write air
209
+ mixing objects into the IDF for each Face that has the construction
210
+ assigned to it.
211
+
212
+ .. code-block:: shell
213
+
214
+ Construction:AirBoundary,
215
+ Air Wall, !- Name
216
+ SimpleMixing, !- Air Exchange Method
217
+ 0.5, !- Simple Mixing Air Changes per Hour {1/hr}
218
+ ; !- Simple Mixing Schedule Name
219
+ """
220
+ values = [self.identifier, 'None']
221
+ comments = ('construction name', 'air exchange method')
222
+ return generate_idf_string('Construction:AirBoundary', values, comments)
223
+
224
+ def to_air_mixing_idf(self, face, room_identifier):
225
+ """IDF string for the ZoneMixing of this object.
226
+
227
+ Args:
228
+ face: A Face object to which this construction is assigned. This
229
+ Face must have a parent Room.
230
+ room_identifier: A identifier for the Room to which the Face is adjacent.
231
+ """
232
+ flow_rate = face.area * self.air_mixing_per_area
233
+ values = ['{}_Mixing'.format(face.identifier), face.parent.identifier,
234
+ self.air_mixing_schedule.identifier, 'Flow/Zone',
235
+ flow_rate, '', '', '', room_identifier]
236
+ comments = ('name', 'zone name', 'schedule name', 'flow method', 'flow rate',
237
+ 'flow per floor area', 'flow per person', 'ach', 'source zone name')
238
+ return generate_idf_string('ZoneMixing', values, comments)
239
+
240
+ def to_cross_mixing_idf(self, face, room_identifier):
241
+ """IDF string for the ZoneMixing of this object.
242
+
243
+ Args:
244
+ face: A Face object to which this construction is assigned. This
245
+ Face must have a parent Room.
246
+ room_identifier: A identifier for the Room to which the Face is adjacent.
247
+ """
248
+ flow_rate = face.area * self.air_mixing_per_area
249
+ values = ['{}_CrossMixing'.format(face.identifier), face.parent.identifier,
250
+ self.air_mixing_schedule.identifier, 'Flow/Zone',
251
+ flow_rate, '', '', '', room_identifier]
252
+ comments = ('name', 'zone name', 'schedule name', 'flow method', 'flow rate',
253
+ 'flow per floor area', 'flow per person', 'ach', 'source zone name')
254
+ return generate_idf_string('ZoneCrossMixing', values, comments)
255
+
256
+ def to_dict(self, abridged=False):
257
+ """Air boundary construction dictionary representation."""
258
+ base = {'type': 'AirBoundaryConstruction'} if not \
259
+ abridged else {'type': 'AirBoundaryConstructionAbridged'}
260
+ base['identifier'] = self.identifier
261
+ base['air_mixing_per_area'] = self.air_mixing_per_area
262
+ base['air_mixing_schedule'] = self.air_mixing_schedule.identifier if abridged \
263
+ else self.air_mixing_schedule.to_dict()
264
+ if self._display_name is not None:
265
+ base['display_name'] = self.display_name
266
+ if self._user_data is not None:
267
+ base['user_data'] = self._user_data
268
+ prop_dict = self.properties.to_dict()
269
+ if prop_dict is not None:
270
+ base['properties'] = prop_dict
271
+ return base
272
+
273
+ def to_radiance_solar(self):
274
+ """Honeybee Radiance completely transparent material."""
275
+ return self._transparent_radiance_material()
276
+
277
+ def to_radiance_visible(self):
278
+ """Honeybee Radiance completely transparent material."""
279
+ return self._transparent_radiance_material()
280
+
281
+ @staticmethod
282
+ def _transparent_radiance_material():
283
+ """Get a transparent radiance material for the air boundary."""
284
+ try:
285
+ from honeybee_radiance.modifier.material import Trans
286
+ except ImportError as e:
287
+ raise ImportError('honeybee_radiance library must be installed to use '
288
+ 'to_radiance() method. {}'.format(e))
289
+ return Trans('air_boundary', 1, 1, 1, 0, 0, 1, 1)
290
+
291
+ def duplicate(self):
292
+ """Get a copy of this construction."""
293
+ return self.__copy__()
294
+
295
+ def __copy__(self):
296
+ new_con = AirBoundaryConstruction(
297
+ self.identifier, self._air_mixing_per_area, self._air_mixing_schedule)
298
+ new_con._display_name = self._display_name
299
+ new_con.user_data = None if self._user_data is None else self._user_data.copy()
300
+ new_con._properties._duplicate_extension_attr(self._properties)
301
+ return new_con
302
+
303
+ def __key(self):
304
+ """A tuple based on the object properties, useful for hashing."""
305
+ return (self._identifier, self._air_mixing_per_area,
306
+ hash(self._air_mixing_schedule))
307
+
308
+ def __hash__(self):
309
+ return hash(self.__key())
310
+
311
+ def __eq__(self, other):
312
+ return isinstance(other, AirBoundaryConstruction) and \
313
+ self.__key() == other.__key()
314
+
315
+ def __ne__(self, other):
316
+ return not self.__eq__(other)
317
+
318
+ def ToString(self):
319
+ """Overwrite .NET ToString."""
320
+ return self.__repr__()
321
+
322
+ def __repr__(self):
323
+ return 'AirBoundaryConstruction: {} [{} m3/s-m2] [schedule: {}]'.format(
324
+ self.display_name, round(self.air_mixing_per_area, 4),
325
+ self.air_mixing_schedule.display_name)
@@ -0,0 +1,89 @@
1
+ # coding=utf-8
2
+ """Utilities to convert construction dictionaries to Python objects."""
3
+ from honeybee_energy.construction.opaque import OpaqueConstruction
4
+ from honeybee_energy.construction.window import WindowConstruction
5
+ from honeybee_energy.construction.windowshade import WindowConstructionShade
6
+ from honeybee_energy.construction.dynamic import WindowConstructionDynamic
7
+ from honeybee_energy.construction.shade import ShadeConstruction
8
+ from honeybee_energy.construction.air import AirBoundaryConstruction
9
+
10
+
11
+ CONSTRUCTION_TYPES = \
12
+ ('OpaqueConstruction', 'WindowConstruction', 'WindowConstructionShade',
13
+ 'WindowConstructionDynamic', 'ShadeConstruction', 'AirBoundaryConstruction')
14
+
15
+
16
+ def dict_to_construction(constr_dict, raise_exception=True):
17
+ """Get a Python object of any Construction from a dictionary.
18
+
19
+ Args:
20
+ constr_dict: A dictionary of any Honeybee energy construction. Note
21
+ that this should be a non-abridged dictionary to be valid.
22
+ raise_exception: Boolean to note whether an excpetion should be raised
23
+ if the object is not identified as a construction. Default: True.
24
+
25
+ Returns:
26
+ A Python object derived from the input constr_dict.
27
+ """
28
+ try: # get the type key from the dictionary
29
+ constr_type = constr_dict['type']
30
+ except KeyError:
31
+ raise ValueError('Construction dictionary lacks required "type" key.')
32
+
33
+ if constr_type == 'OpaqueConstruction':
34
+ return OpaqueConstruction.from_dict(constr_dict)
35
+ elif constr_type == 'WindowConstruction':
36
+ return WindowConstruction.from_dict(constr_dict)
37
+ elif constr_type == 'WindowConstructionShade':
38
+ return WindowConstructionShade.from_dict(constr_dict)
39
+ elif constr_type == 'WindowConstructionDynamic':
40
+ return WindowConstructionDynamic.from_dict(constr_dict)
41
+ elif constr_type == 'ShadeConstruction':
42
+ return ShadeConstruction.from_dict(constr_dict)
43
+ elif constr_type == 'AirBoundaryConstruction':
44
+ return AirBoundaryConstruction.from_dict(constr_dict)
45
+ elif raise_exception:
46
+ raise ValueError(
47
+ '{} is not a recognized energy Construction type'.format(constr_type))
48
+
49
+
50
+ def dict_abridged_to_construction(constr_dict, materials, schedules,
51
+ raise_exception=True):
52
+ """Get a Python object of any Construction from an abridged dictionary.
53
+
54
+ Args:
55
+ constr_dict: An abridged dictionary of any Honeybee energy construction.
56
+ materials: Dictionary of all material objects that might be used in the
57
+ construction with the material identifiers as the keys.
58
+ schedules: Dictionary of all schedule objects that might be used in the
59
+ construction with the schedule identifiers as the keys.
60
+ raise_exception: Boolean to note whether an exception should be raised
61
+ if the object is not identified as a construction. Default: True.
62
+
63
+ Returns:
64
+ A Python object derived from the input constr_dict.
65
+ """
66
+ try: # get the type key from the dictionary
67
+ constr_type = constr_dict['type']
68
+ except KeyError:
69
+ raise ValueError('Construction dictionary lacks required "type" key.')
70
+
71
+ if constr_type == 'OpaqueConstructionAbridged':
72
+ return OpaqueConstruction.from_dict_abridged(constr_dict, materials)
73
+ elif constr_type == 'WindowConstructionAbridged':
74
+ return WindowConstruction.from_dict_abridged(constr_dict, materials)
75
+ elif constr_type == 'WindowConstructionShadeAbridged':
76
+ return WindowConstructionShade.from_dict_abridged(
77
+ constr_dict, materials, schedules)
78
+ elif constr_type == 'WindowConstructionDynamicAbridged':
79
+ return WindowConstructionDynamic.from_dict_abridged(
80
+ constr_dict, materials, schedules)
81
+ elif constr_type == 'ShadeConstruction':
82
+ return ShadeConstruction.from_dict(constr_dict)
83
+ elif constr_type == 'AirBoundaryConstructionAbridged':
84
+ return AirBoundaryConstruction.from_dict_abridged(constr_dict, schedules)
85
+ elif constr_type == 'AirBoundaryConstruction': # special case for ConstructionSet
86
+ return AirBoundaryConstruction.from_dict(constr_dict)
87
+ elif raise_exception:
88
+ raise ValueError(
89
+ '{} is not a recognized energy Construction type'.format(constr_type))