-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathspace_cfm_calc_many_points.py
66 lines (58 loc) · 2.21 KB
/
space_cfm_calc_many_points.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import random
import MakeSpaceTower
# import hypar
# Import the classes we'll need.
from aecSpace.aecColor import aecColor
from aecSpace.aecPoint import aecPoint
from aecSpace.aecSpace import aecSpace
from aecSpace.aecSpacer import aecSpacer
from aecSpace.aecSpaceGroup import aecSpaceGroup
from aecSpace.aecSpaceDrawOCC import aecSpaceDrawOCC
import itertools
from pathing.diffuserlayout import difflayout
#creating tower with multiple spaces per floors
#spaces = MakeSpaceTower.makeSpaceTower()
def Space_CFM_Calc(spaces):
#CFM per square foot dictionary
CFM_per_FloorArea = {
"Shaft":0,
"Office":1,
"Conference": 1.5,
"Bathroom":0.5,
"Lobby":1.25,
"Kitchen":3,
"Incubator":2.5,
"Elevator lobby":1.25,
"":0,
"Corridor":0.5
}
#get name, area, ceiling point location, calculate airflow
levels= []
space_prop_dict = []
for x in spaces:
for i, l in enumerate( difflayout(x):
cfmpersqft = CFM_per_FloorArea.get(x.name) #get cfm for room type from dictionary
area_converted = x.area*0.00001076391 #concert mm^2 to ft^2
cfm = area_converted * cfmpersqft #get cfm from cfm/sqft
cfm = round(cfm, -1) #round up cfm by 10
# print("calced CFM: ", cfm)
rounded_level = int(x.level)
space_prop_dict.append({"id":x.ID+"r"+str(i),"name":x.name, "area":area_converted, "location":l, "cfm":cfm, "level":rounded_level}) #get space properties
levels.append(rounded_level)
#print(space_prop_dict)
levels_set = set(levels) #round levels
shaft_space = space_prop_dict[-1]
del space_prop_dict[-1]
shaft_xy = shaft_space.get("location")
for x in levels_set:
space_prop_dict.append({"id":"Shaft"+str(x),"name":"Shaft", "area":0.5, "location":shaft_xy, "cfm":0.5, "level":x})
#group spaces by level
output = []
from operator import itemgetter
sorted_levels = sorted(space_prop_dict, key=itemgetter('level'))
for key, group in itertools.groupby(sorted_levels, key=lambda x:x['level']):
# print (key,)
#print (list(group))
output.append(list(group))
#print(output)
return output