Skip to content

Commit afa33c5

Browse files
committed
fix(results): Return sDA as a percentage
1 parent db6a172 commit afa33c5

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed
-22 Bytes
Loading

honeybee_grasshopper_radiance/json/HB_Spatial_Daylight_Autonomy.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.9.0",
2+
"version": "1.9.1",
33
"nickname": "sDA",
44
"outputs": [
55
[
@@ -43,7 +43,7 @@
4343
}
4444
],
4545
"subcategory": "4 :: Results",
46-
"code": "\ntry:\n from ladybug_{{cad}}.togeometry import to_mesh3d\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, list_to_data_tree, \\\n data_tree_to_list\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # process the input values into a rokable format\n da_mtx = [item[-1] for item in data_tree_to_list(_DA)]\n _target_time_ = 50 if _target_time_ is None else _target_time_\n lb_meshes = [to_mesh3d(mesh) for mesh in mesh_]\n\n # determine whether each point passes or fails\n pass_fail = [[int(val > _target_time_) for val in grid] for grid in da_mtx]\n\n # compute spatial daylight autonomy from the pass/fail results\n if len(lb_meshes) == 0: # all sensors represent the same area\n sDA = [sum(pf_list) / len(pf_list) for pf_list in pass_fail]\n else: # weight the sensors based on the area of mesh faces\n sDA = []\n for i, mesh in enumerate(lb_meshes):\n m_area = mesh.area\n weights = [fa / m_area for fa in mesh.face_areas]\n sDA.append(sum(v * w for v, w in zip(pass_fail[i], weights)))\n\n pass_fail = list_to_data_tree(pass_fail) # convert matrix to data tree\n",
46+
"code": "\ntry:\n from ladybug_{{cad}}.togeometry import to_mesh3d\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs, list_to_data_tree, \\\n data_tree_to_list\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # process the input values into a rokable format\n da_mtx = [item[-1] for item in data_tree_to_list(_DA)]\n _target_time_ = 50 if _target_time_ is None else _target_time_\n lb_meshes = [to_mesh3d(mesh) for mesh in mesh_]\n\n # determine whether each point passes or fails\n pass_fail = [[int(val > _target_time_) for val in grid] for grid in da_mtx]\n\n # compute spatial daylight autonomy from the pass/fail results\n if len(lb_meshes) == 0: # all sensors represent the same area\n sDA = [round(sum(pf_list) / len(pf_list) * 100, 2) for pf_list in pass_fail]\n else: # weight the sensors based on the area of mesh faces\n sDA = []\n for i, mesh in enumerate(lb_meshes):\n m_area = mesh.area\n weights = [fa / m_area for fa in mesh.face_areas]\n sDA.append(round(sum(v * w for v, w in zip(pass_fail[i], weights)) * 100, 2))\n\n pass_fail = list_to_data_tree(pass_fail) # convert matrix to data tree\n",
4747
"category": "HB-Radiance",
4848
"name": "HB Spatial Daylight Autonomy",
4949
"description": "Calculate Spatial Daylight Autonomy (sDA) from lists of daylight autonomy values.\n_\nAs per IES-LM-83-12 Spatial Daylight Autonomy (sDA) is a metric describing\nannual sufficiency of ambient daylight levels in interior environments.\nIt is defined as the percent of an analysis area (the area where calcuations\nare performed -typically across an entire space) that meets a minimum\ndaylight illuminance level for a specified fraction of the operating hours\nper year. The sDA value is expressed as a percentage of area.\n_\nNote: This component will only output a LEED compliant sDA if you've run the\nsimulation with dynamic blinds and blind schedules as per the IES-LM-83-12\nstandard. If you are not using dynamic blinds, then this output is NOT LEED\ncompliant.\n-"

honeybee_grasshopper_radiance/src/HB Spatial Daylight Autonomy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747

4848
ghenv.Component.Name = 'HB Spatial Daylight Autonomy'
4949
ghenv.Component.NickName = 'sDA'
50-
ghenv.Component.Message = '1.9.0'
50+
ghenv.Component.Message = '1.9.1'
5151
ghenv.Component.Category = 'HB-Radiance'
5252
ghenv.Component.SubCategory = '4 :: Results'
5353
ghenv.Component.AdditionalHelpFromDocStrings = '1'
@@ -75,12 +75,12 @@
7575

7676
# compute spatial daylight autonomy from the pass/fail results
7777
if len(lb_meshes) == 0: # all sensors represent the same area
78-
sDA = [sum(pf_list) / len(pf_list) for pf_list in pass_fail]
78+
sDA = [round(sum(pf_list) / len(pf_list) * 100, 2) for pf_list in pass_fail]
7979
else: # weight the sensors based on the area of mesh faces
8080
sDA = []
8181
for i, mesh in enumerate(lb_meshes):
8282
m_area = mesh.area
8383
weights = [fa / m_area for fa in mesh.face_areas]
84-
sDA.append(sum(v * w for v, w in zip(pass_fail[i], weights)))
84+
sDA.append(round(sum(v * w for v, w in zip(pass_fail[i], weights)) * 100, 2))
8585

8686
pass_fail = list_to_data_tree(pass_fail) # convert matrix to data tree
Binary file not shown.

0 commit comments

Comments
 (0)