dragonfly-doe2 0.11.2__py2.py3-none-any.whl → 0.12.1__py2.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.
@@ -1,141 +0,0 @@
1
- """INP text blocks."""
2
-
3
- top_level = 'INPUT ..\n\n\n\n'
4
- spacer = '\n\n'
5
- sd_brk = '$ ---------------------------------------------------------\n'
6
- star_brk = '$ *********************************************************\n'
7
- star_blnk = '$ ** **\n'
8
-
9
-
10
- abort_diag = '{sd_brk}$ Abort, Diagnostics\n{sd_brk}{spacer}'.format(
11
- sd_brk=sd_brk, spacer=spacer)
12
- global_params = '{sd_brk}$ Global Parameters\n{sd_brk}{spacer}'.format(
13
- sd_brk=sd_brk, spacer=spacer)
14
- ttrpddh = '{sd_brk}$ Title, Run Periods, Design Days, Holidays\n{sd_brk}{spacer}'.format(
15
- sd_brk=sd_brk, spacer=spacer)
16
- comply = '{sd_brk}$ Compliance Data\n{sd_brk}{spacer}'.format(
17
- sd_brk=sd_brk, spacer=spacer)
18
- mats_layers = '{sd_brk}$ Materials / Layers / Constructions\n{sd_brk}{spacer}'.format(
19
- sd_brk=sd_brk, spacer=spacer)
20
- glzCode = '{sd_brk}$ Glass Type Codes\n{sd_brk}{spacer}'.format(
21
- sd_brk=sd_brk, spacer=spacer)
22
- glzTyp = '{sd_brk}$ Glass Types\n{sd_brk}{spacer}\n\n'.format(
23
- sd_brk=sd_brk, spacer=spacer) +\
24
- '"WT1" = GLASS-TYPE\n '\
25
- 'TYPE = GLASS-TYPE-CODE\n '\
26
- 'GLASS-TYPE-CODE = "2001"\n '\
27
- 'C-PRODUCT-TYPE = 0\n '\
28
- 'C-FRAME-TYPE = 0\n '\
29
- '..\n\n'
30
- WindowLayers = '{sd_brk}$ Window Layers\n{sd_brk}{spacer}'.format(
31
- sd_brk=sd_brk, spacer=spacer)
32
- iLikeLamp = '{sd_brk}$ Lamps / Luminaries / Lighting Systems\n{sd_brk}{spacer}'.format(
33
- sd_brk=sd_brk, spacer=spacer)
34
- daySch = '{sd_brk}$ Day Schedules\n{sd_brk}{spacer}'.format(
35
- sd_brk=sd_brk, spacer=spacer)
36
- weekSch = '{sd_brk}$ Week Schedules\n{sd_brk}{spacer}'.format(
37
- sd_brk=sd_brk, spacer=spacer)
38
- annualSch = '{sd_brk}$ Annual Schedules\n{sd_brk}{spacer}'.format(
39
- sd_brk=sd_brk, spacer=spacer)
40
- polygons = '{sd_brk}$ Polygons\n{sd_brk}{spacer}'.format(
41
- sd_brk=sd_brk, spacer=spacer)
42
- wallParams = spacer+'{sd_brk}$ Wall Parameters\n{sd_brk}{spacer}'.format(
43
- sd_brk=sd_brk, spacer=spacer)
44
- fix_bldg_shade = '{sd_brk}$ Fixed and Building Shades\n{sd_brk}{spacer}'.format(
45
- sd_brk=sd_brk, spacer=spacer)
46
- miscCost = '{sd_brk}$ Misc Cost Related Objects\n{sd_brk}{spacer}'.format(
47
- sd_brk=sd_brk, spacer=spacer)
48
-
49
-
50
- perfCurve = star_brk+star_blnk+'$ ** Performance Curves **\n'\
51
- + star_blnk+star_brk+spacer
52
- floorNspace = star_brk+star_blnk+'$ ** Floors / Spaces / Walls / Windows / Doors **\n'\
53
- + star_blnk+star_brk+spacer
54
- elecFuelMeter = spacer+star_brk+star_blnk + \
55
- '$ ** Electric & Fuel Meters **\n' + \
56
- star_blnk+star_brk+spacer
57
-
58
- elec_meter = '{sd_brk}$ Electric Meters\n{sd_brk}{spacer}'.format(
59
- sd_brk=sd_brk, spacer=spacer)
60
- fuel_meter = '{sd_brk}$ Fuel Meters\n{sd_brk}{spacer}'.format(
61
- sd_brk=sd_brk, spacer=spacer)
62
- master_meter = '{sd_brk}$ Master Meters\n{sd_brk}{spacer}'.format(
63
- sd_brk=sd_brk, spacer=spacer)
64
-
65
- hvac_circ_loop = star_brk+star_blnk+'$ ** HVAC Circulation Loops / Plant Equipment **\n'\
66
- + star_blnk+star_brk+spacer
67
-
68
- pumps = '{sd_brk}$ Pumps\n{sd_brk}{spacer}'.format(
69
- sd_brk=sd_brk, spacer=spacer)
70
- heat_exch = '{sd_brk}$ Heat Exchangers\n{sd_brk}{spacer}'.format(
71
- sd_brk=sd_brk, spacer=spacer)
72
- circ_loop = '{sd_brk}$ Circulation Loops\n{sd_brk}{spacer}'.format(
73
- sd_brk=sd_brk, spacer=spacer)
74
- chiller_objs = '{sd_brk}$ Chillers\n{sd_brk}{spacer}'.format(
75
- sd_brk=sd_brk, spacer=spacer)
76
- boiler_objs = '{sd_brk}$ Boilers\n{sd_brk}{spacer}'.format(
77
- sd_brk=sd_brk, spacer=spacer)
78
- dwh = '{sd_brk}$ Domestic Water Heaters\n{sd_brk}{spacer}'.format(
79
- sd_brk=sd_brk, spacer=spacer)
80
- heat_reject = '{sd_brk}$ Heat Rejection\n{sd_brk}{spacer}'.format(
81
- sd_brk=sd_brk,
82
- spacer=spacer)
83
- tower_free = '{sd_brk}$ Tower Free Cooling\n{sd_brk}{spacer}'.format(
84
- sd_brk=sd_brk, spacer=spacer)
85
- pvmod = '{sd_brk}$ Photovoltaic Modules\n{sd_brk}{spacer}'.format(
86
- sd_brk=sd_brk, spacer=spacer)
87
- elecgen = '{sd_brk}$ Electric Generators\n{sd_brk}{spacer}'.format(
88
- sd_brk=sd_brk, spacer=spacer)
89
- thermal_store = '{sd_brk}$ Thermal Storage\n{sd_brk}{spacer}'.format(
90
- sd_brk=sd_brk, spacer=spacer)
91
- ground_loop_hx = '{sd_brk}$ Ground Loop Heat Exchangers\n{sd_brk}{spacer}'.format(
92
- sd_brk=sd_brk, spacer=spacer)
93
- comp_dhw_res = sd_brk + \
94
- '$ Compliance DHW (residential dwelling units)\n' + \
95
- sd_brk+spacer
96
-
97
- steam_cld_mtr = star_brk+star_blnk+'$ ** Steam & Chilled Water Meters **\n'\
98
- + star_blnk+star_brk+spacer
99
-
100
- steam_mtr = '{sd_brk}$ Steam Meters\n{sd_brk}{spacer}'.format(
101
- sd_brk=sd_brk, spacer=spacer)
102
- chill_meter = '{sd_brk}$ Chilled Water Meters\n{sd_brk}{spacer}'.format(
103
- sd_brk=sd_brk, spacer=spacer)
104
-
105
- hvac_sys_zone = star_brk+star_blnk+'$ ** HVAC Systems / Zones **\n'\
106
- + star_blnk+star_brk+spacer
107
-
108
- misc_meter_hvac = star_brk+star_blnk+'$ ** Metering & Misc HVAC **\n'\
109
- + star_blnk+star_brk+spacer
110
-
111
- equip_controls = '{sd_brk}$ Equipment Controls\n{sd_brk}{spacer}'.format(
112
- sd_brk=sd_brk, spacer=spacer)
113
- load_manage = '{sd_brk}$ Load Management\n{sd_brk}{spacer}'.format(
114
- sd_brk=sd_brk, spacer=spacer)
115
-
116
- big_util_rate = star_brk+star_blnk+'$ ** Utility Rates **\n'\
117
- + star_blnk+star_brk+spacer
118
-
119
- ratchets = '{sd_brk}$ Ratchets\n{sd_brk}{spacer}'.format(
120
- sd_brk=sd_brk, spacer=spacer)
121
- block_charge = '{sd_brk}$ Block Charges\n{sd_brk}{spacer}'.format(
122
- sd_brk=sd_brk, spacer=spacer)
123
- small_util_rate = '{sd_brk}$ Utility Rates\n{sd_brk}{spacer}'.format(
124
- sd_brk=sd_brk, spacer=spacer)
125
-
126
- output_reporting = star_brk+star_blnk+'$ ** Output Reporting **\n'\
127
- + star_blnk+star_brk+spacer
128
-
129
- loads_non_hrly = '{sd_brk}$ Loads Non-Hourly Reporting\n{sd_brk}{spacer}'.format(
130
- sd_brk=sd_brk, spacer=spacer)
131
- sys_non_hrly = '{sd_brk}$ Systems Non-Hourly Reporting\n{sd_brk}{spacer}'.format(
132
- sd_brk=sd_brk, spacer=spacer)
133
- plant_non_hrly = '{sd_brk}$ Plant Non-Hourly Reporting\n{sd_brk}{spacer}'.format(
134
- sd_brk=sd_brk, spacer=spacer)
135
- econ_non_hrly = '{sd_brk}$ Economics Non-Hourly Reporting\n{sd_brk}{spacer}'.format(
136
- sd_brk=sd_brk, spacer=spacer)
137
- hourly_rep = '{sd_brk}$ Hourly Reporting\n{sd_brk}{spacer}'.format(
138
- sd_brk=sd_brk, spacer=spacer)
139
-
140
- the_end = '{sd_brk}$ THE END\n{sd_brk}'.format(
141
- sd_brk=sd_brk) + '\nEND ..\nCOMPUTE ..\nSTOP ..\n'
@@ -1,32 +0,0 @@
1
- """Compliance Data."""
2
-
3
-
4
- class ComplianceData(object):
5
-
6
- permit_scope = 0
7
- proj_name = 'sample_project'
8
- bldg_type = 32
9
- cons_phase = 0
10
- nr_dhw_incl = 1
11
- code_version = 1
12
- num_floors = 1
13
- bldg_type_901 = 32
14
-
15
- def __init__(self):
16
- super(ComplianceData, self).__init__()
17
-
18
- def to_inp(self):
19
- """Return compliance data as an inp string."""
20
- return '"Compliance Data" = COMPLIANCE\n' \
21
- ' C-PERMIT-SCOPE = {permit_scope}\n'.format(permit_scope=self.permit_scope) + \
22
- ' C-PROJ-NAME = *{proj_name}*\n'.format(proj_name=self.proj_name) + \
23
- ' C-BUILDING-TYPE = {bldg_type}\n'.format(bldg_type=self.bldg_type) + \
24
- ' C-CONS-PHASE = {cons_phase}\n'.format(cons_phase=self.cons_phase) + \
25
- ' C-NR-DHW-INCL = {nr_dhw_incl}\n'.format(nr_dhw_incl=self.nr_dhw_incl) + \
26
- ' C-CODE-VERSION = {code_version}\n'.format(code_version=self.code_version) + \
27
- ' C-901-NUM-FLRS = {num_floors}\n'.format(num_floors=self.num_floors) + \
28
- ' C-901-BLDG-TYPE = {bldg_type_901}\n'.format(bldg_type_901=self.bldg_type_901) + \
29
- ' ..'
30
-
31
- def __repr__(self):
32
- return self.to_inp()
@@ -1,115 +0,0 @@
1
- from dataclasses import dataclass
2
- from enum import unique
3
- from typing import List
4
-
5
- from honeybee_energy.construction.opaque import OpaqueConstruction as OpConstr
6
-
7
- from .material import Material
8
- from . import blocks as fb
9
- from .utils import short_name
10
-
11
-
12
- @dataclass
13
- class Construction:
14
- name: str
15
- materials: List[Material]
16
- absorptance: float
17
- roughness: int
18
-
19
- @classmethod
20
- def from_hb_construction(cls, construction: OpConstr):
21
- """Create inp construction from HB construction."""
22
- roughdict = {'VeryRough': 1, 'Rough': 2, 'MediumRough': 3,
23
- 'MediumSmooth': 4, 'Smooth': 5, 'VerySmooth': 6}
24
- if not isinstance(construction, OpConstr):
25
- # this should raise an error but for now I leave it to print until we
26
- # support a handful number of types
27
- print(
28
- f'Unsupported Construction type: {type(construction)}.\n'
29
- 'Please be patient as more features and capabilities are implemented.'
30
- )
31
- return cls(construction.display_name, [], 0, 0)
32
-
33
- materials = [
34
- Material.from_hb_material(material) for material in construction.materials
35
- ]
36
- absorptance = construction.materials[0].solar_absorptance
37
- roughness = roughdict[construction.materials[0].roughness]
38
-
39
- cons_name = short_name(construction.display_name, 30)
40
-
41
- return cls(cons_name, materials, absorptance, roughness)
42
-
43
- def to_inp(self, include_materials=True):
44
-
45
- # temporary solution not return values for unsupported construction types
46
- if not self.materials:
47
- return ''
48
-
49
- if include_materials:
50
- block = ['\n'.join(material.to_inp() for material in self.materials)]
51
- else:
52
- block = []
53
-
54
- materials = '\n '.join(f'"{material.name}",'
55
- for material in self.materials)
56
-
57
- layers_name = f'"{self.name}_l"'
58
- construction = f'{layers_name} = LAYERS\n' \
59
- f' MATERIAL = (\n {materials[:-1]}\n )\n' \
60
- ' ..\n\n' \
61
- f'"{self.name}_c" = CONSTRUCTION\n' \
62
- ' TYPE = LAYERS\n' \
63
- f' ABSORPTANCE = {self.absorptance}\n' \
64
- f' ROUGHNESS = {self.roughness}\n' \
65
- f' LAYERS = {layers_name}\n' \
66
- ' ..\n'
67
- block.append(construction)
68
-
69
- return '\n\n'.join(block)
70
-
71
- def __repr__(self) -> str:
72
- return self.to_inp()
73
-
74
-
75
- @dataclass
76
- class ConstructionCollection:
77
- """Construction object. Contains, materials and layers for *.inp file.
78
-
79
- Returns:
80
- $ Materials / Layers / Constructions *.inp block
81
- """
82
- constructions: List[Construction]
83
-
84
- @classmethod
85
- def from_hb_constructions(cls, constructions: List[OpConstr]):
86
- unique_constructions = {
87
- construction.display_name: construction for construction in constructions
88
- }.values()
89
-
90
- constructions = [
91
- Construction.from_hb_construction(construction)
92
- for construction in unique_constructions
93
- ]
94
- return cls(constructions)
95
-
96
- def to_inp(self):
97
-
98
- block = [fb.mats_layers]
99
-
100
- # collect all the materials and ensure to only include the unique ones
101
- materials = set(
102
- mat.to_inp()
103
- for construction in self.constructions
104
- for mat in construction.materials
105
- )
106
- block.append('\n\n'.join(materials))
107
-
108
- # add constructions - layers are created as part of each construction definition
109
- for construction in self.constructions:
110
- block.append(construction.to_inp(include_materials=False))
111
-
112
- return '\n'.join(block)
113
-
114
- def __repr__(self):
115
- return self.to_inp()
@@ -1,406 +0,0 @@
1
- from dragonfly.room2d import Room2D
2
- from dragonfly.story import Story
3
- from dataclasses import dataclass
4
- from typing import List
5
- from .utils import short_name, lower_left_properties
6
- from dragonfly.windowparameter import RectangularWindows
7
- from honeybee_energy.construction.window import WindowConstruction
8
-
9
-
10
- @dataclass
11
- class Slab:
12
- """Object for 'floor' surface.
13
-
14
- Init method(s):
15
- 1. from_room(name, construction, type_adjacency).
16
- note: temp naming conv: intent is for at space class level to
17
- check if is_ground_contact == True; do SpaceFloor init.
18
-
19
- Args:
20
- name: space name. (is joined with _floor_{n}).
21
- construction: display_name of the floor's construction
22
- type_adjacency: for now 'BOTTOM' only.
23
-
24
- Example:
25
- .. code-block:: f#
26
-
27
- "Flr (G.1.U1)" = UNDERGROUND-WALL
28
- CONSTRUCTION = "UFCons (G.1.U2)"
29
- LOCATION = BOTTOM
30
- ..
31
- """
32
- name: str
33
- construction: str
34
- type_adjacency: str = 'BOTTOM'
35
-
36
- @classmethod
37
- def from_room(
38
- cls, name: str, construction: str, type_adjacency: str = 'BOTTOM'):
39
- return cls(name=name, construction=construction, type_adjacency=type_adjacency)
40
-
41
- def to_inp(self):
42
- return f'"{self.name}_grnd_flr" = UNDERGROUND-WALL\n' \
43
- f' CONSTRUCTION = "{self.construction}_c"\n' \
44
- f' LOCATION = {self.type_adjacency}\n ..'
45
-
46
- def __repr__(self) -> str:
47
- return self.to_inp()
48
-
49
-
50
- @dataclass
51
- class RoofCeiling:
52
- # TODO: Need to add "what's on the other side" for interior adj ceilings.
53
- # TODO: refer to df intesect/solve adj's adj info
54
- # ! Currently will only provide exterior roof for roofs with no internal adj's
55
- # ? if not needed full interior detailing: Need to add to solve adj: story<->story solve adj
56
- """Object for roof/ceiling inputs.
57
-
58
- Init method(s):
59
- 1. from_room(name, construction, type_adjacency, next_to=None)
60
-
61
- Args:
62
- name: space name. (is joind with _roof_{n}).
63
- construction: display_name of roof_ceiling's constr.
64
- next_to: *optional* WIP for interior ceilings adjacent space ID#!WIP
65
- Example:
66
-
67
- .. code-block:: f#
68
-
69
- "Roof (G.2.E9)" = EXTERIOR-WALL
70
- CONSTRUCTION = "Roof Construction"
71
- LOCATION = TOP
72
- ..
73
- "Ceiling (G.1.I1)" = INTERIOR-WALL
74
- NEXT-TO = "Plnm (G.2)"
75
- CONSTRUCTION = "Ceilg Construction"
76
- LOCATION = TOP
77
- ..
78
- """
79
- name: str
80
- construction: str
81
- next_to: str = None
82
-
83
- @classmethod
84
- def from_room(cls, room: Room2D):
85
- name = room.display_name
86
- construction = room.properties.energy.construction_set.roof_ceiling_set.exterior_construction.display_name
87
- return cls(name, construction)
88
-
89
- def to_inp(self):
90
- return f'"{self.name}_roof" = EXTERIOR-WALL\n' \
91
- f' CONSTRUCTION = "{self.construction}_c"\n' \
92
- f' LOCATION = TOP\n ..'
93
-
94
- def __repr__(self) -> str:
95
- return self.to_inp()
96
-
97
-
98
- @dataclass
99
- class Window:
100
- """*.inp Window object.
101
-
102
- Args:
103
- name: display name of the room2d, to be added to, creating a unique displayname.
104
- location: the index/n of the window in the set of windows hosted by the wall
105
- segment.
106
- x: window origin pt.x coord.
107
- y: window origin pt.y coord.
108
- width: window width.
109
- height: window height.
110
-
111
- Example:
112
- .. code-block:: f#
113
-
114
- rmOne_wndw_0_wall1 = WINDOW
115
- X = 0.6830601092896195
116
- Y = 2.6229508196721314
117
- WIDTH = 9.562841530054643
118
- HEIGHT = 6.557377049180327
119
- GLASS-TYPE = WT1
120
- ..
121
- """
122
- name: str
123
- location: int
124
- x: float
125
- y: float
126
- width: float
127
- height: float
128
- glass_type: str
129
-
130
- def to_inp(self):
131
- shortened_name = short_name(f'{self.name}_w{self.location}', 32)
132
- return f'"{shortened_name}" = WINDOW\n ' \
133
- f'X = {self.x}\n ' \
134
- f'Y = {self.y}\n ' \
135
- f'WIDTH = {self.width}\n ' \
136
- f'HEIGHT = {self.height}\n '\
137
- f'GLASS-TYPE = "{short_name(self.glass_type, 32)}"\n ..\n'
138
-
139
- def __repr__(self) -> str:
140
- return self.to_inp()
141
-
142
-
143
- @dataclass
144
- class WindowSet:
145
- """ An internal object comprising all of the windows hosted by a wall segment.
146
-
147
- Init methods(s):
148
- from_params(name, location, rectangular_window_params).
149
-
150
- Args:
151
- name: the display name of the room2d hosting the wall the windowset belongs to.
152
- location: the index of the room2D's wall segment hosting the window set. for use on
153
- creating unique identifier name for each window.
154
- windows: list of Window objects comprising the window set.
155
-
156
-
157
- """
158
- name: str
159
- location: int
160
- windows: List[Window]
161
- glass_type: None
162
-
163
- @classmethod
164
- def from_params(cls, name: str, location: int,
165
- rectangular_window_params: list, glass_type):
166
-
167
- origins = [(orig.x, orig.y) for orig in rectangular_window_params.origins]
168
- widths = rectangular_window_params.widths
169
- heights = rectangular_window_params.heights
170
- glass_type = short_name(glass_type, 32)
171
-
172
- windows = []
173
- for i, (org, w, h) in enumerate(zip(origins, widths, heights)):
174
- windows.append(
175
- Window(
176
- f'{name}_wndw_{i}', location + 1, org[0],
177
- org[1],
178
- w, h,
179
- glass_type))
180
- return cls(name=name, location=location + 1, windows=windows,
181
- glass_type=glass_type)
182
-
183
- def to_inp(self):
184
- return '\n'.join([wndw.to_inp() for wndw in self.windows])
185
-
186
- def __repr__(self) -> str:
187
- return self.to_inp()
188
-
189
-
190
- @dataclass
191
- class Wall:
192
- """*.inp Wall object.
193
-
194
- Init method(s):
195
- 1. from_room_seg(name, location, construction)
196
-
197
- Args:
198
- name: space name. (is joined with _wall_{n}).
199
- location: vertice of space poly anchoring the wall.
200
- construction: display_name of construction wall is comprised of.
201
-
202
- Example:
203
-
204
- .. code-block:: f#
205
-
206
- "simple_example_dfb_Floor1_Room1 Wall_1" = EXTERIOR-WALL
207
- CONSTRUCTION = "EWall Construction"
208
- LOCATION = SPACE-V1
209
- ..
210
-
211
- """
212
- name: str
213
- location: int
214
- construction: str
215
- windows: RectangularWindows = None
216
- window_constr: WindowConstruction = None
217
-
218
- @classmethod
219
- def from_room_seg(cls, name: str, location: int, construction: str,
220
- windows: None, window_constr: None):
221
- indexed_id = location + 1
222
-
223
- # shorten the name to ensure we don't create duplicate names with truncated id
224
- name = short_name(f'{name}_Wall_{indexed_id}', 32)
225
-
226
- return cls(name, indexed_id, construction, windows, window_constr)
227
-
228
- def to_inp(self):
229
- wallstr = f'"{self.name}" = EXTERIOR-WALL\n' \
230
- f' CONSTRUCTION = "{self.construction}_c"\n' \
231
- f' LOCATION = SPACE-V{self.location}\n ..'
232
-
233
- if self.windows is not None:
234
- window_set = WindowSet.from_params(
235
- self.name, self.location, self.windows, self.window_constr)
236
- wall_set = [wallstr]
237
- wall_set.append(window_set.to_inp())
238
- return '\n'.join(wall_set)
239
- else:
240
- return wallstr
241
-
242
- def __repr__(self) -> str:
243
- return self.to_inp()
244
-
245
-
246
- @dataclass
247
- class Space:
248
- """The Space Object.
249
- Each Room2D has a Space obj. This obj contains windows, walls, doors
250
- data.
251
-
252
- Init method(s):
253
- 1. from_room(room: Room2D)
254
- Args:
255
- name: room.display_name.
256
- activity: room program.display_name.
257
- walls: List[of Wall(objects)]
258
-
259
- Example:
260
-
261
- .. code-block:: f#
262
-
263
- "simple_example_dfb_Floor1_Room1" = SPACE
264
- SHAPE = POLYGON
265
- POLYGON = "simple_example_dfb_Floor1_Room1 Plg"
266
- C-ACTIVITY-DESC = *Generic Office Program*
267
- ..
268
- "simple_example_dfb_Floor1_Room1 Wall_1" = EXTERIOR-WALL
269
- CONSTRUCTION = "EWall Construction"
270
- LOCATION = SPACE-V1
271
- ..
272
- "simple_example_dfb_Floor1_Room1 Wall_2" = EXTERIOR-WALL
273
- CONSTRUCTION = "EWall Construction"
274
- LOCATION = SPACE-V2
275
- ..
276
-
277
- """
278
- name: str
279
- activity: str
280
- walls: List[Wall]
281
- slab: Slab = None
282
- roof: RoofCeiling = None
283
-
284
- @classmethod
285
- def from_room(cls, room: Room2D):
286
- if not isinstance(room, Room2D):
287
- raise ValueError(
288
- f'Unsupported Type: {type(room)}.\n'
289
- 'Expected dragonfly.room2d.Room2D'
290
- )
291
- wall_constr_name = short_name(
292
- room.properties.energy.construction_set.wall_set.exterior_construction.display_name, 30)
293
- name = room.display_name
294
-
295
- low_l_props = lower_left_properties(room)
296
- bcs = low_l_props[1]
297
- wndw_paras = low_l_props[2]
298
- wndw_constr = low_l_props[3]
299
-
300
- walls = []
301
- for i, (bc, window_param) in enumerate(zip(bcs, wndw_paras)):
302
- if str(bc) in list(['Outdoors', 'Ground']):
303
- walls.append(
304
- Wall.from_room_seg(
305
- name, i, wall_constr_name, window_param, wndw_constr))
306
-
307
- slab = None if room.is_ground_contact != True else Slab.from_room(name, short_name(
308
- room.properties.energy.construction_set.floor_set.ground_construction.display_name, 30))
309
-
310
- roof = None if room.is_top_exposed != True else RoofCeiling.from_room(room)
311
-
312
- return cls(
313
- name=room.display_name,
314
- activity=room.properties.energy.program_type.display_name, walls=walls,
315
- slab=slab, roof=roof)
316
-
317
- def to_inp(self):
318
- space_walls = '\n'.join(wall.to_inp() for wall in self.walls)
319
- space_block = f'"{self.name}" = SPACE\n' \
320
- f' SHAPE = POLYGON\n' \
321
- f' POLYGON = "{self.name} Plg"\n' \
322
- f' C-ACTIVITY-DESC = *{self.activity}*\n ..\n'
323
- blocks = [space_block, space_walls]
324
- if self.slab:
325
- blocks.append(self.slab.to_inp())
326
- if self.roof:
327
- blocks.append(self.roof.to_inp())
328
- return '\n'.join(blocks)
329
-
330
- def __repr__(self) -> str:
331
- return self.to_inp()
332
-
333
-
334
- @dataclass
335
- class Floor:
336
- """The *.inp 'Floor' object, contains spaces and space meta-data.
337
- Init method(s):
338
- 1. from_story(story: Story).
339
- Args:
340
- name: Story display_name.
341
- floor_z: the height of the floor poly centroid from ground level.
342
- floor_height: the floor-to-floor height of the rooms within the story.
343
- This is a single input for eQuest, all rooms in story share this value.
344
-
345
- Example:
346
-
347
- .. code-block:: f#
348
-
349
- "simple_example_dfb_Floor1" = FLOOR
350
- Z = 0.0
351
- POLYGON = "simple_example_dfb_Floor1 Floor Plg"
352
- SHAPE = POLYGON
353
- FLOOR-HEIGHT = 10.0
354
- C-DIAGRAM-DATA = *simple_example_dfb_Floor1 UI DiagData*
355
- ..
356
- "simple_example_dfb_Floor1_Room1" = SPACE
357
- SHAPE = POLYGON
358
- POLYGON = "simple_example_dfb_Floor1_Room1 Plg"
359
- C-ACTIVITY-DESC = *Generic Office Program*
360
- ..
361
- "simple_example_dfb_Floor1_Room1 Wall_1" = EXTERIOR-WALL
362
- CONSTRUCTION = "EWall Construction"
363
- LOCATION = SPACE-V1
364
- ..
365
-
366
- """
367
- name: str
368
- floor_z: float
369
- floor_height: float
370
- spaces: List[Space]
371
-
372
- @classmethod
373
- def from_story(cls, story: Story):
374
- if not isinstance(story, Story):
375
- raise ValueError(
376
- f'Unsupported type: {type(story)}\n'
377
- 'Expected dragonfly.story.Story'
378
- )
379
- spaces = [Space.from_room(room) for room in story.room_2ds]
380
- # a hack to handle cases that floor height is not set for a floor
381
- # this will not work for stories that have rooms in different levels
382
- floor_height = story.floor_height or story.room_2ds[0].floor_height
383
- floor_to_floor_height = story.floor_to_floor_height
384
- if floor_height != story.floor_height:
385
- # this is file coming from Revit and we need to adjust the floor_to_floor
386
- # height that is calculated by Dragonfly
387
- floor_to_floor_height -= floor_height
388
-
389
- return cls(
390
- story.display_name, floor_height,
391
- floor_to_floor_height, spaces
392
- )
393
- # TODO: Add the clustering features into here
394
-
395
- def to_inp(self):
396
- flr_str = f'"{self.name}" = FLOOR\n' \
397
- f' Z = {self.floor_z}\n' \
398
- f' POLYGON = "{self.name} Plg"\n' \
399
- f' SHAPE = POLYGON\n' \
400
- f' FLOOR-HEIGHT = {self.floor_height}\n' \
401
- f' C-DIAGRAM-DATA = *{self.name} UI DiagData*\n ..\n'
402
- flr_spcs = '\n'.join(spc.to_inp() for spc in self.spaces)
403
- return '\n'.join([flr_str, flr_spcs])
404
-
405
- def __repr__(self) -> str:
406
- return self.to_inp()