honeybee-grasshopper-radiance 1.35.1__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.
- honeybee_grasshopper_radiance/__init__.py +7 -0
- honeybee_grasshopper_radiance/src/HB Adjust HDR.py +107 -0
- honeybee_grasshopper_radiance/src/HB Ambient Resolution.py +63 -0
- honeybee_grasshopper_radiance/src/HB Annual Average Values.py +205 -0
- honeybee_grasshopper_radiance/src/HB Annual Cumulative Values.py +191 -0
- honeybee_grasshopper_radiance/src/HB Annual Daylight Metrics.py +209 -0
- honeybee_grasshopper_radiance/src/HB Annual Daylight.py +153 -0
- honeybee_grasshopper_radiance/src/HB Annual Glare Metrics.py +137 -0
- honeybee_grasshopper_radiance/src/HB Annual Irradiance.py +112 -0
- honeybee_grasshopper_radiance/src/HB Annual Peak Values.py +224 -0
- honeybee_grasshopper_radiance/src/HB Annual Results to Data.py +246 -0
- honeybee_grasshopper_radiance/src/HB Annual Sunlight Exposure.py +147 -0
- honeybee_grasshopper_radiance/src/HB Aperture Group Schedule.py +69 -0
- honeybee_grasshopper_radiance/src/HB Apply Face Modifier.py +107 -0
- honeybee_grasshopper_radiance/src/HB Apply ModifierSet.py +71 -0
- honeybee_grasshopper_radiance/src/HB Apply Shade Modifier.py +110 -0
- honeybee_grasshopper_radiance/src/HB Apply Window Modifier.py +120 -0
- honeybee_grasshopper_radiance/src/HB Assign Grids and Views.py +58 -0
- honeybee_grasshopper_radiance/src/HB Automatic Aperture Group.py +100 -0
- honeybee_grasshopper_radiance/src/HB BSDF Modifier.py +78 -0
- honeybee_grasshopper_radiance/src/HB CIE Standard Sky.py +75 -0
- honeybee_grasshopper_radiance/src/HB Certain Illuminance.py +41 -0
- honeybee_grasshopper_radiance/src/HB Check Scene.py +208 -0
- honeybee_grasshopper_radiance/src/HB Climatebased Sky.py +75 -0
- honeybee_grasshopper_radiance/src/HB Cumulative Radiation.py +98 -0
- honeybee_grasshopper_radiance/src/HB Custom Sky.py +74 -0
- honeybee_grasshopper_radiance/src/HB Daylight Control Schedule.py +211 -0
- honeybee_grasshopper_radiance/src/HB Daylight Factor.py +82 -0
- honeybee_grasshopper_radiance/src/HB Deconstruct Modifier.py +47 -0
- honeybee_grasshopper_radiance/src/HB Deconstruct ModifierSet Interior.py +67 -0
- honeybee_grasshopper_radiance/src/HB Deconstruct ModifierSet.py +80 -0
- honeybee_grasshopper_radiance/src/HB Deconstruct Wea.py +44 -0
- honeybee_grasshopper_radiance/src/HB Direct Sun Hours.py +88 -0
- honeybee_grasshopper_radiance/src/HB Dynamic Aperture Group.py +90 -0
- honeybee_grasshopper_radiance/src/HB Dynamic Shade Group.py +95 -0
- honeybee_grasshopper_radiance/src/HB Dynamic State Geometry.py +68 -0
- honeybee_grasshopper_radiance/src/HB Dynamic State.py +44 -0
- honeybee_grasshopper_radiance/src/HB Exterior Modifier Subset.py +68 -0
- honeybee_grasshopper_radiance/src/HB Extract HDR.py +225 -0
- honeybee_grasshopper_radiance/src/HB False Color.py +246 -0
- honeybee_grasshopper_radiance/src/HB Get Dynamic Groups.py +57 -0
- honeybee_grasshopper_radiance/src/HB Get Grids and Views.py +82 -0
- honeybee_grasshopper_radiance/src/HB Glare Postprocess.py +225 -0
- honeybee_grasshopper_radiance/src/HB Glass Modifier 3.py +62 -0
- honeybee_grasshopper_radiance/src/HB Glass Modifier.py +58 -0
- honeybee_grasshopper_radiance/src/HB HDR to GIF.py +72 -0
- honeybee_grasshopper_radiance/src/HB Imageless Annual Glare.py +108 -0
- honeybee_grasshopper_radiance/src/HB Interior Modifier Subset.py +83 -0
- honeybee_grasshopper_radiance/src/HB Metal Modifier 3.py +70 -0
- honeybee_grasshopper_radiance/src/HB Metal Modifier.py +68 -0
- honeybee_grasshopper_radiance/src/HB Mirror Modifier 3.py +56 -0
- honeybee_grasshopper_radiance/src/HB Mirror Modifier.py +55 -0
- honeybee_grasshopper_radiance/src/HB Model to Rad Folder.py +75 -0
- honeybee_grasshopper_radiance/src/HB ModifierSet.py +127 -0
- honeybee_grasshopper_radiance/src/HB Opaque Modifier 3.py +68 -0
- honeybee_grasshopper_radiance/src/HB Opaque Modifier.py +67 -0
- honeybee_grasshopper_radiance/src/HB Point-In-Time Grid-Based.py +93 -0
- honeybee_grasshopper_radiance/src/HB Point-In-Time View-Based.py +127 -0
- honeybee_grasshopper_radiance/src/HB Radial Grid from Rooms.py +160 -0
- honeybee_grasshopper_radiance/src/HB Radial Sensor Grid.py +99 -0
- honeybee_grasshopper_radiance/src/HB Radiance Parameter.py +163 -0
- honeybee_grasshopper_radiance/src/HB Search Modifier Sets.py +58 -0
- honeybee_grasshopper_radiance/src/HB Search Modifiers.py +58 -0
- honeybee_grasshopper_radiance/src/HB Section Plane View.py +69 -0
- honeybee_grasshopper_radiance/src/HB Sensor Grid from Apertures.py +153 -0
- honeybee_grasshopper_radiance/src/HB Sensor Grid from Faces.py +147 -0
- honeybee_grasshopper_radiance/src/HB Sensor Grid from Rooms.py +210 -0
- honeybee_grasshopper_radiance/src/HB Sensor Grid.py +82 -0
- honeybee_grasshopper_radiance/src/HB Shade Modifier Subset.py +62 -0
- honeybee_grasshopper_radiance/src/HB Sky View.py +86 -0
- honeybee_grasshopper_radiance/src/HB Spatial Daylight Autonomy.py +86 -0
- honeybee_grasshopper_radiance/src/HB Subface Modifier Subset.py +90 -0
- honeybee_grasshopper_radiance/src/HB Translucent Modifier 3.py +77 -0
- honeybee_grasshopper_radiance/src/HB Translucent Modifier.py +77 -0
- honeybee_grasshopper_radiance/src/HB View from Viewport.py +85 -0
- honeybee_grasshopper_radiance/src/HB View.py +96 -0
- honeybee_grasshopper_radiance/src/HB Visualize Sky.py +141 -0
- honeybee_grasshopper_radiance/src/HB Wea From Clear Sky.py +61 -0
- honeybee_grasshopper_radiance/src/HB Wea From EPW.py +50 -0
- honeybee_grasshopper_radiance/src/HB Wea From Tau Clear Sky.py +56 -0
- honeybee_grasshopper_radiance/src/HB Wea from Zhang-Huang.py +63 -0
- honeybee_grasshopper_radiance/src/__init__.py +1 -0
- honeybee_grasshopper_radiance/user_objects/HB Adjust HDR.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Ambient Resolution.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Average Values.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Cumulative Values.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Daylight Metrics.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Daylight.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Glare Metrics.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Irradiance.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Peak Values.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Results to Data.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Annual Sunlight Exposure.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Aperture Group Schedule.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Apply Face Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Apply ModifierSet.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Apply Shade Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Apply Window Modifier.ghuser +0 -0
- Views.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Automatic Aperture Group.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB BSDF Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB CIE Standard Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Certain Illuminance.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Check Scene.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Climatebased Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Cumulative Radiation.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Custom Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Daylight Control Schedule.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Daylight Factor.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Deconstruct Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Deconstruct ModifierSet Interior.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Deconstruct ModifierSet.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Deconstruct Wea.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Direct Sun Hours.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Dynamic Aperture Group.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Dynamic Shade Group.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Dynamic State Geometry.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Dynamic State.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Exterior Modifier Subset.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Extract HDR.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Face Radiance Attributes.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB False Color.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Get Dynamic Groups.ghuser +0 -0
- Views.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Glare Postprocess.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Glass Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Glass Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB HDR to GIF.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Imageless Annual Glare.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Interior Modifier Subset.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Metal Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Metal Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Mirror Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Mirror Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Model to Rad Folder.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB ModifierSet.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Opaque Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Opaque Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Point-In-Time Grid-Based.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Point-In-Time View-Based.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Radial Grid from Rooms.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Radial Sensor Grid.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Radiance Parameter.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Room Radiance Attributes.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Search Modifier Sets.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Search Modifiers.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Section Plane View.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sensor Grid from Apertures.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sensor Grid from Faces.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sensor Grid from Rooms.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sensor Grid.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Shade Modifier Subset.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Sky View.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Spatial Daylight Autonomy.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Subface Modifier Subset.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Translucent Modifier 3.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Translucent Modifier.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB View from Viewport.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB View.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Visualize Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Wea From Clear Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Wea From EPW.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Wea From Tau Clear Sky.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/HB Wea from Zhang-Huang.ghuser +0 -0
- honeybee_grasshopper_radiance/user_objects/__init__.py +1 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/METADATA +64 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/RECORD +170 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/WHEEL +5 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/licenses/LICENSE +661 -0
- honeybee_grasshopper_radiance-1.35.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
# Honeybee: A Plugin for Environmental Analysis (GPL)
|
|
2
|
+
# This file is part of Honeybee.
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2025, Ladybug Tools.
|
|
5
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
6
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
7
|
+
#
|
|
8
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
Calculate Annual Daylight Metrics from a result (.ill) files.
|
|
12
|
+
|
|
13
|
+
-
|
|
14
|
+
Args:
|
|
15
|
+
_results: An list of annual Radiance result files from the "HB Annual Daylight"
|
|
16
|
+
component (containing the .ill files and the sun-up-hours.txt).
|
|
17
|
+
This can also be just the path to the folder containing these
|
|
18
|
+
result files.
|
|
19
|
+
dyn_sch_: Optional dynamic Aperture Group Schedules from the "HB Aperture Group
|
|
20
|
+
Schedule" component, which will be used to customize the behavior
|
|
21
|
+
of any dyanmic aperture geometry in the output metrics. If unsupplied,
|
|
22
|
+
all dynamic aperture groups will be in their default state in for
|
|
23
|
+
the output metrics.
|
|
24
|
+
_occ_sch_: An annual occupancy schedule as a Ladybug Data Collection or a HB-Energy
|
|
25
|
+
schedule object. This can also be the identifier of a schedule in
|
|
26
|
+
your HB-Energy schedule library. Any value in this schedule that is
|
|
27
|
+
0.1 or above will be considered occupied. If None, a schedule from
|
|
28
|
+
8AM to 6PM on all days will be used.
|
|
29
|
+
_threshold_: Threshhold for daylight autonomy (DA) in lux (default: 300).
|
|
30
|
+
_min_max_: A list for min, max illuminacne thresholds for useful daylight illuminance
|
|
31
|
+
in lux. (Default: (100, 3000)).
|
|
32
|
+
grid_filter_: The name of a grid or a pattern to filter the grids. For instance,
|
|
33
|
+
first_floor_* will simulate only the sensor grids that have an
|
|
34
|
+
identifier that starts with first_floor_. By default all the grids
|
|
35
|
+
will be processed.
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
report: Reports, errors, warnings, etc.
|
|
39
|
+
DA: Daylight autonomy results in percent. DA is the percentage of occupied hours
|
|
40
|
+
that each sensor recieves equal or more than the illuminance threshold.
|
|
41
|
+
Each value is for a different sensor of the grid. These can be plugged
|
|
42
|
+
into the "LB Spatial Heatmap" component along with meshes of the sensor
|
|
43
|
+
grids to visualize results. These can also be connected to the "HB
|
|
44
|
+
Spatial Daylight Autonomy" component to compute spatial daylight
|
|
45
|
+
autonomy for each grid.
|
|
46
|
+
cDA: Continuous daylight autonomy results in percent. cDA is similar to DA except
|
|
47
|
+
that values below the illuminance threshold can still count partially
|
|
48
|
+
towards the final percentage. Each value is for a different
|
|
49
|
+
sensor of the grid. These can be plugged into the "LB Spatial Heatmap"
|
|
50
|
+
component along with meshes of the sensor grids to visualize results.
|
|
51
|
+
UDI: Useful daylight illuminance results in percent. UDI is the percentage of time
|
|
52
|
+
that illuminace falls between minimum and maximum thresholds. Each value
|
|
53
|
+
is for a different sensor of the grid. These can be plugged into the
|
|
54
|
+
"LB Spatial Heatmap" component along with meshes of the sensor grids
|
|
55
|
+
to visualize results.
|
|
56
|
+
UDI_low: Results for the percent of time that is below the lower threshold
|
|
57
|
+
of useful daylight illuminance in percent. Each value is for a different
|
|
58
|
+
sensor of the grid. These can be plugged into the "LB Spatial Heatmap"
|
|
59
|
+
component along with meshes of the sensor grids to visualize results.
|
|
60
|
+
UDI_up: Results for the percent of time that is above the upper threshold
|
|
61
|
+
of useful daylight illuminance in percent. Each value is for a different
|
|
62
|
+
sensor of the grid. These can be plugged into the "LB Spatial Heatmap"
|
|
63
|
+
component along with meshes of the sensor grids to visualize results.
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
ghenv.Component.Name = "HB Annual Daylight Metrics"
|
|
67
|
+
ghenv.Component.NickName = 'DaylightMetrics'
|
|
68
|
+
ghenv.Component.Message = '1.9.0'
|
|
69
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
70
|
+
ghenv.Component.SubCategory = '4 :: Results'
|
|
71
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '1'
|
|
72
|
+
|
|
73
|
+
import os
|
|
74
|
+
import subprocess
|
|
75
|
+
|
|
76
|
+
try:
|
|
77
|
+
from ladybug.datacollection import BaseCollection
|
|
78
|
+
from ladybug.futil import write_to_file
|
|
79
|
+
except ImportError as e:
|
|
80
|
+
raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))
|
|
81
|
+
|
|
82
|
+
try:
|
|
83
|
+
from honeybee.config import folders
|
|
84
|
+
except ImportError as e:
|
|
85
|
+
raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))
|
|
86
|
+
|
|
87
|
+
try:
|
|
88
|
+
from honeybee_radiance.postprocess.annualdaylight import metrics_from_folder
|
|
89
|
+
except ImportError as e:
|
|
90
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
91
|
+
|
|
92
|
+
try:
|
|
93
|
+
from honeybee_radiance_postprocess.dynamic import DynamicSchedule
|
|
94
|
+
except ImportError as e:
|
|
95
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
96
|
+
|
|
97
|
+
try:
|
|
98
|
+
from honeybee_energy.lib.schedules import schedule_by_identifier
|
|
99
|
+
except ImportError as e: # honeybee schedule library is not available
|
|
100
|
+
schedule_by_identifier = None
|
|
101
|
+
|
|
102
|
+
try:
|
|
103
|
+
from pollination_handlers.outputs.daylight import read_da_from_folder, \
|
|
104
|
+
read_cda_from_folder, read_udi_from_folder
|
|
105
|
+
except ImportError as e:
|
|
106
|
+
raise ImportError('\nFailed to import pollination_handlers:\n\t{}'.format(e))
|
|
107
|
+
|
|
108
|
+
try:
|
|
109
|
+
from ladybug_rhino.grasshopper import all_required_inputs, list_to_data_tree, \
|
|
110
|
+
give_warning
|
|
111
|
+
except ImportError as e:
|
|
112
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
if all_required_inputs(ghenv.Component):
|
|
116
|
+
# set default values for the thresholds and the grid filter
|
|
117
|
+
grid_filter_ = '*' if grid_filter_ is None else grid_filter_
|
|
118
|
+
_threshold_ = _threshold_ if _threshold_ else 300
|
|
119
|
+
if len(_min_max_) != 0:
|
|
120
|
+
assert len(_min_max_), 'Expected two values for _min_max_.'
|
|
121
|
+
min_t = _min_max_[0]
|
|
122
|
+
max_t = _min_max_[1]
|
|
123
|
+
else:
|
|
124
|
+
min_t = 100
|
|
125
|
+
max_t = 3000
|
|
126
|
+
|
|
127
|
+
# process the schedule
|
|
128
|
+
if _occ_sch_ is None:
|
|
129
|
+
schedule = None
|
|
130
|
+
elif isinstance(_occ_sch_, BaseCollection):
|
|
131
|
+
schedule = _occ_sch_.values
|
|
132
|
+
elif isinstance(_occ_sch_, str):
|
|
133
|
+
if schedule_by_identifier is not None:
|
|
134
|
+
try:
|
|
135
|
+
schedule = schedule_by_identifier(_occ_sch_).values()
|
|
136
|
+
except TypeError: # it's probably a ScheduleFixedInterval
|
|
137
|
+
schedule = schedule_by_identifier(_occ_sch_).values
|
|
138
|
+
else:
|
|
139
|
+
raise ValueError('honeybee-energy must be installed to reference '
|
|
140
|
+
'occupancy schedules by identifier.')
|
|
141
|
+
else: # assume that it is a honeybee schedule object
|
|
142
|
+
try:
|
|
143
|
+
schedule = _occ_sch_.values()
|
|
144
|
+
except TypeError: # it's probably a ScheduleFixedInterval
|
|
145
|
+
schedule = _occ_sch_.values
|
|
146
|
+
if schedule is not None:
|
|
147
|
+
bin_schedule = []
|
|
148
|
+
for val in schedule:
|
|
149
|
+
bin_val = 1 if val >= 0.1 else 0
|
|
150
|
+
bin_schedule.append(bin_val)
|
|
151
|
+
schedule = bin_schedule
|
|
152
|
+
|
|
153
|
+
# compute the annual metrics
|
|
154
|
+
res_folder = os.path.dirname(_results[0]) if os.path.isfile(_results[0]) \
|
|
155
|
+
else _results[0]
|
|
156
|
+
if os.path.isdir(os.path.join(res_folder, '__static_apertures__')) or \
|
|
157
|
+
os.path.isfile(os.path.join(res_folder, 'grid_states.json')):
|
|
158
|
+
cmds = [
|
|
159
|
+
folders.python_exe_path, '-m', 'honeybee_radiance_postprocess',
|
|
160
|
+
'post-process', 'annual-daylight', res_folder, '-sf', 'metrics',
|
|
161
|
+
'-t', str(_threshold_), '-lt', str(min_t), '-ut', str(max_t)
|
|
162
|
+
]
|
|
163
|
+
if grid_filter_ != '*':
|
|
164
|
+
cmds.extend(['--grids-filter', grid_filter_])
|
|
165
|
+
if len(dyn_sch_) != 0:
|
|
166
|
+
if os.path.isfile(os.path.join(res_folder, 'grid_states.json')):
|
|
167
|
+
dyn_sch = dyn_sch_[0] if isinstance(dyn_sch_[0], DynamicSchedule) else \
|
|
168
|
+
DynamicSchedule.from_group_schedules(dyn_sch_)
|
|
169
|
+
dyn_sch_file = dyn_sch.to_json(folder=res_folder)
|
|
170
|
+
cmds.extend(['--states', dyn_sch_file])
|
|
171
|
+
else:
|
|
172
|
+
msg = 'No dynamic aperture groups were found in the Model.\n' \
|
|
173
|
+
'The input dynamic schedules will be ignored.'
|
|
174
|
+
print(msg)
|
|
175
|
+
give_warning(ghenv.Component, msg)
|
|
176
|
+
if schedule is not None:
|
|
177
|
+
sch_str = '\n'.join(str(h) for h in schedule)
|
|
178
|
+
sch_file = os.path.join(res_folder, 'schedule.txt')
|
|
179
|
+
write_to_file(sch_file, sch_str)
|
|
180
|
+
cmds.extend(['--schedule', sch_file])
|
|
181
|
+
use_shell = True if os.name == 'nt' else False
|
|
182
|
+
custom_env = os.environ.copy()
|
|
183
|
+
custom_env['PYTHONHOME'] = ''
|
|
184
|
+
process = subprocess.Popen(
|
|
185
|
+
cmds, cwd=res_folder, shell=use_shell, env=custom_env,
|
|
186
|
+
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
187
|
+
stdout = process.communicate() # wait for the process to finish
|
|
188
|
+
if stdout[-1] != '':
|
|
189
|
+
print(stdout[-1])
|
|
190
|
+
raise ValueError('Failed to compute annual daylight metrics.')
|
|
191
|
+
metric_dir = os.path.join(res_folder, 'metrics')
|
|
192
|
+
DA = list_to_data_tree(read_da_from_folder(os.path.join(metric_dir, 'da')))
|
|
193
|
+
cDA = list_to_data_tree(read_cda_from_folder(os.path.join(metric_dir, 'cda')))
|
|
194
|
+
UDI = list_to_data_tree(read_udi_from_folder(os.path.join(metric_dir, 'udi')))
|
|
195
|
+
UDI_low = list_to_data_tree(read_udi_from_folder(os.path.join(metric_dir, 'udi_lower')))
|
|
196
|
+
UDI_up = list_to_data_tree(read_udi_from_folder(os.path.join(metric_dir, 'udi_upper')))
|
|
197
|
+
else:
|
|
198
|
+
if len(dyn_sch_) != 0:
|
|
199
|
+
msg = 'Dynamic Schedules are currently only supported for Annual Daylight ' \
|
|
200
|
+
'simulations.\nThe input schedules will be ignored.'
|
|
201
|
+
print(msg)
|
|
202
|
+
give_warning(ghenv.Component, msg)
|
|
203
|
+
DA, cDA, UDI_low, UDI, UDI_up = metrics_from_folder(
|
|
204
|
+
res_folder, schedule, _threshold_, min_t, max_t, grid_filter_)
|
|
205
|
+
DA = list_to_data_tree(DA)
|
|
206
|
+
cDA = list_to_data_tree(cDA)
|
|
207
|
+
UDI = list_to_data_tree(UDI)
|
|
208
|
+
UDI_low = list_to_data_tree(UDI_low)
|
|
209
|
+
UDI_up = list_to_data_tree(UDI_up)
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# Honeybee: A Plugin for Environmental Analysis (GPL)
|
|
2
|
+
# This file is part of Honeybee.
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2025, Ladybug Tools.
|
|
5
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
6
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
7
|
+
#
|
|
8
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
Run an annual daylight study for a Honeybee model to compute hourly illuminance
|
|
12
|
+
for each sensor in a model's sensor grids.
|
|
13
|
+
_
|
|
14
|
+
By default, this recipe uses an enhanced 2-phase method, which accurately models
|
|
15
|
+
direct sun by tracing rays from each sensor to the solar position at each hour
|
|
16
|
+
of the calculation. This makes the result suitable for computing Annual Sun
|
|
17
|
+
Exposure (ASE) and for modeling the effects of dynamic shades and apertures.
|
|
18
|
+
_
|
|
19
|
+
When the enhanced_ option is set to False, a standard 2-phase method for simulation,
|
|
20
|
+
which is much faster because it simply determines the relationship between each
|
|
21
|
+
sensor and sky patch and then multiplies the value of each sky patch at each
|
|
22
|
+
hour by the relationship coefficient. However, this means that the direct sun
|
|
23
|
+
is spread out across a few sky patches, making it unsuitable for ASE.
|
|
24
|
+
_
|
|
25
|
+
The resulting illuminance is used to compute the following metrics:
|
|
26
|
+
_
|
|
27
|
+
* Daylight Autonomy (DA) - The percentage of occupied hours that each sensor
|
|
28
|
+
recieves more than the illuminance threshold.
|
|
29
|
+
* Continuous Daylight Autonomy (cDA) - Similar to DA except that values below the
|
|
30
|
+
illuminance threshold can still count partially towards the final percentage.
|
|
31
|
+
* Useful Daylight Illuminance (UDI) - The percentage of occupied hours that
|
|
32
|
+
illuminace falls between minimum and maximum thresholds
|
|
33
|
+
|
|
34
|
+
-
|
|
35
|
+
Args:
|
|
36
|
+
_model: A Honeybee Model for which Annual Daylight will be simulated.
|
|
37
|
+
Note that this model must have grids assigned to it.
|
|
38
|
+
_wea: A Wea object produced from the Wea components that are under the Light
|
|
39
|
+
Sources tab. This can also be the path to a .wea or a .epw file.
|
|
40
|
+
Note that the Wea must have a timestep of 1 to be used with this
|
|
41
|
+
recipe.
|
|
42
|
+
north_: A number between -360 and 360 for the counterclockwise difference
|
|
43
|
+
between the North and the positive Y-axis in degrees. This can
|
|
44
|
+
also be Vector for the direction to North. (Default: 0).
|
|
45
|
+
_thresholds_: A string to change the threshold for daylight autonomy and useful
|
|
46
|
+
daylight illuminance. Valid keys are -t for daylight autonomy threshold,
|
|
47
|
+
-lt for the lower threshold for useful daylight illuminance and
|
|
48
|
+
-ut for the upper threshold. The order of the keys is not important
|
|
49
|
+
and you can include one or all of them. For instance if you only want
|
|
50
|
+
to change the upper threshold to 2000 lux you should use -ut 2000
|
|
51
|
+
as the input. (Default: -t 300 -lt 100 -ut 3000).
|
|
52
|
+
_schedule_: An annual occupancy schedule, either as a Ladybug Hourly Continuous
|
|
53
|
+
Data Collection or a HB-Energy schedule object. This can also be the
|
|
54
|
+
path to a CSV file with 8760 rows or the identifier of a schedule in
|
|
55
|
+
the honeybee-energy schedule library. Any value in this schedule
|
|
56
|
+
that is 0.1 or above will be considered occupied. If not provided,
|
|
57
|
+
a default schedule that runs from 8 AM to 6 PM on all days will be used.
|
|
58
|
+
grid_filter_: Text for a grid identifer or a pattern to filter the sensor grids of
|
|
59
|
+
the model that are simulated. For instance, first_floor_* will simulate
|
|
60
|
+
only the sensor grids that have an identifier that starts with
|
|
61
|
+
first_floor_. By default, all grids in the model will be simulated.
|
|
62
|
+
radiance_par_: Text for the radiance parameters to be used for ray
|
|
63
|
+
tracing. (Default: -ab 2 -ad 5000 -lw 2e-05).
|
|
64
|
+
enhanced_: Boolean to note whether an enhanced version of the 2-phase ray tracing
|
|
65
|
+
simulation should be used, which will more accurately account for
|
|
66
|
+
direct sun at each time step. If False, only a 2-phase daylight
|
|
67
|
+
coefficient calculation with sky patches will be used, which is
|
|
68
|
+
much faster but spreads the direct sun out across a few sky
|
|
69
|
+
patches, making it unsuitable for ASE. (Default: True).
|
|
70
|
+
run_settings_: Settings from the "HB Recipe Settings" component that specify
|
|
71
|
+
how the recipe should be run. This can also be a text string of
|
|
72
|
+
recipe settings.
|
|
73
|
+
_run: Set to True to run the recipe and get results. This input can also be
|
|
74
|
+
the integer "2" to run the recipe silently.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
report: Reports, errors, warnings, etc.
|
|
78
|
+
results: Raw result files (.ill) that contain illuminance matrices for each sensor
|
|
79
|
+
at each hour of the simulation. These can be postprocessed using
|
|
80
|
+
various components under the 4::Results sub-tab.
|
|
81
|
+
DA: Daylight autonomy results in percent. DA is the percentage of occupied hours
|
|
82
|
+
that each sensor recieves equal or more than the illuminance threshold.
|
|
83
|
+
Each value is for a different sensor of the grid. These can be plugged
|
|
84
|
+
into the "LB Spatial Heatmap" component along with meshes of the sensor
|
|
85
|
+
grids to visualize results. These can also be connected to the "HB
|
|
86
|
+
Spatial Daylight Autonomy" component to compute spatial daylight
|
|
87
|
+
autonomy for each grid. Note that the resulting sDA is only compliant
|
|
88
|
+
with LEED if dynamic blinds have been simulated using the methods
|
|
89
|
+
in IES-LM-83-12.
|
|
90
|
+
cDA: Continuous daylight autonomy results in percent. cDA is similar to DA except
|
|
91
|
+
that values below the illuminance threshold can still count partially
|
|
92
|
+
towards the final percentage. Each value is for a different
|
|
93
|
+
sensor of the grid. These can be plugged into the "LB Spatial Heatmap"
|
|
94
|
+
component along with meshes of the sensor grids to visualize results.
|
|
95
|
+
UDI: Useful daylight illuminance results in percent. UDI is the percentage of
|
|
96
|
+
occupied hours that illuminace falls between minimum and maximum
|
|
97
|
+
thresholds. Each value is for a different sensor of the grid. These
|
|
98
|
+
can be plugged into the "LB Spatial Heatmap" component along with
|
|
99
|
+
meshes of the sensor grids to visualize results.
|
|
100
|
+
UDI_low: Results for the percent of time that is below the lower threshold
|
|
101
|
+
of useful daylight illuminance in percent. Each value is for a different
|
|
102
|
+
sensor of the grid. These can be plugged into the "LB Spatial Heatmap"
|
|
103
|
+
component along with meshes of the sensor grids to visualize results.
|
|
104
|
+
UDI_up: Results for the percent of time that is above the upper threshold
|
|
105
|
+
of useful daylight illuminance in percent. Each value is for a different
|
|
106
|
+
sensor of the grid. These can be plugged into the "LB Spatial Heatmap"
|
|
107
|
+
component along with meshes of the sensor grids to visualize results.
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
ghenv.Component.Name = 'HB Annual Daylight'
|
|
111
|
+
ghenv.Component.NickName = 'AnnualDaylight'
|
|
112
|
+
ghenv.Component.Message = '1.9.0'
|
|
113
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
114
|
+
ghenv.Component.SubCategory = '3 :: Recipes'
|
|
115
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '1'
|
|
116
|
+
|
|
117
|
+
try:
|
|
118
|
+
from lbt_recipes.recipe import Recipe
|
|
119
|
+
except ImportError as e:
|
|
120
|
+
raise ImportError('\nFailed to import lbt_recipes:\n\t{}'.format(e))
|
|
121
|
+
|
|
122
|
+
try:
|
|
123
|
+
from ladybug_rhino.grasshopper import all_required_inputs, recipe_result
|
|
124
|
+
except ImportError as e:
|
|
125
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
if all_required_inputs(ghenv.Component) and _run:
|
|
129
|
+
# create the recipe and set the input arguments
|
|
130
|
+
recipe = Recipe('annual-daylight') if enhanced_ is False else \
|
|
131
|
+
Recipe('annual-daylight-enhanced')
|
|
132
|
+
recipe.input_value_by_name('model', _model)
|
|
133
|
+
recipe.input_value_by_name('wea', _wea)
|
|
134
|
+
recipe.input_value_by_name('north', north_)
|
|
135
|
+
recipe.input_value_by_name('thresholds', _thresholds_)
|
|
136
|
+
recipe.input_value_by_name('schedule', _schedule_)
|
|
137
|
+
recipe.input_value_by_name('grid-filter', grid_filter_)
|
|
138
|
+
recipe.input_value_by_name('radiance-parameters', radiance_par_)
|
|
139
|
+
|
|
140
|
+
# run the recipe
|
|
141
|
+
silent = True if _run > 1 else False
|
|
142
|
+
project_folder = recipe.run(run_settings_, radiance_check=True, silent=silent)
|
|
143
|
+
|
|
144
|
+
# load the results
|
|
145
|
+
try:
|
|
146
|
+
results = recipe_result(recipe.output_value_by_name('results', project_folder))
|
|
147
|
+
DA = recipe_result(recipe.output_value_by_name('da', project_folder))
|
|
148
|
+
cDA = recipe_result(recipe.output_value_by_name('cda', project_folder))
|
|
149
|
+
UDI = recipe_result(recipe.output_value_by_name('udi', project_folder))
|
|
150
|
+
UDI_low = recipe_result(recipe.output_value_by_name('udi-lower', project_folder))
|
|
151
|
+
UDI_up = recipe_result(recipe.output_value_by_name('udi-upper', project_folder))
|
|
152
|
+
except Exception:
|
|
153
|
+
raise Exception(recipe.failure_message(project_folder))
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# Honeybee: A Plugin for Environmental Analysis (GPL)
|
|
2
|
+
# This file is part of Honeybee.
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2025, Ladybug Tools.
|
|
5
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
6
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
7
|
+
#
|
|
8
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
Calculate Annual Glare Metrics from result (.dgp) files.
|
|
12
|
+
_
|
|
13
|
+
Glare Autonmy is a metric describing the percentage of occupied
|
|
14
|
+
hours that each sensor is below the glare threshold.
|
|
15
|
+
_
|
|
16
|
+
Spatial Glare Autonomy is a metric describing the percentage of the sensor grid
|
|
17
|
+
that is free glare according to the glare threshold and the target time. The sGA
|
|
18
|
+
value is expressed as a percentage of the sensors in the analysis grid.
|
|
19
|
+
|
|
20
|
+
-
|
|
21
|
+
Args:
|
|
22
|
+
_results: An list of annual Radiance result files from the "HB Imageless Annual
|
|
23
|
+
Glare" component (containing the .dgp files and the sun-up-hours.txt).
|
|
24
|
+
This can also be just the path to the folder containing these result
|
|
25
|
+
files.
|
|
26
|
+
_occ_sch_: An annual occupancy schedule as a Ladybug Data Collection or a HB-Energy
|
|
27
|
+
schedule object. This can also be the identifier of a schedule in
|
|
28
|
+
your HB-Energy schedule library. Any value in this schedule that is
|
|
29
|
+
0.1 or above will be considered occupied. If None, a schedule from
|
|
30
|
+
8AM to 6PM on all days will be used.
|
|
31
|
+
_glare_thresh_: Threshold for glare autonomy (GA) in DGP (default: 0.4).
|
|
32
|
+
grid_filter_: The name of a grid or a pattern to filter the grids. For instance,
|
|
33
|
+
first_floor_* will simulate only the sensor grids that have an
|
|
34
|
+
identifier that starts with first_floor_. By default all the grids
|
|
35
|
+
will be processed.
|
|
36
|
+
_target_time_: A minimum threshold of occupied time (eg. 95% of the time), above
|
|
37
|
+
which a given sensor passes and contributes to the spatial glare
|
|
38
|
+
autonomy. (Default: 95%).
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
report: Reports, errors, warnings, etc.
|
|
42
|
+
GA: Glare autonomy results in percent. GA is the percentage of occupied hours
|
|
43
|
+
that each sensor is free of glare according to the glare threshold.
|
|
44
|
+
Each value is for a different sensor of the grid. These can be plugged
|
|
45
|
+
into the "LB Spatial Heatmap" component along with meshes of the sensor
|
|
46
|
+
grids to visualize results.
|
|
47
|
+
sGA: Spatial glare autonomy as a percentage of the sensors for each analysis grid
|
|
48
|
+
that does not exceed the glare threshold for a specified fraction of
|
|
49
|
+
occupied hours, ie. the target time.
|
|
50
|
+
pass_fail: A data tree of zeros and ones, which indicate whether a given sensor
|
|
51
|
+
passes the criteria for being free of glare (1) or fails the criteria (0).
|
|
52
|
+
Being free of glare does not necessarily mean that the sensor is glare-free
|
|
53
|
+
for all hours, but that it is glare-free for a minimum percentage of
|
|
54
|
+
occupied hours defined by the target time. Each value is for a different
|
|
55
|
+
sensor of the grid. These can be plugged into the "LB Spatial Heatmap"
|
|
56
|
+
component along with meshes of the sensor grids to visualize results.
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
ghenv.Component.Name = "HB Annual Glare Metrics"
|
|
60
|
+
ghenv.Component.NickName = 'GlareMetrics'
|
|
61
|
+
ghenv.Component.Message = '1.9.0'
|
|
62
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
63
|
+
ghenv.Component.SubCategory = '4 :: Results'
|
|
64
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '1'
|
|
65
|
+
|
|
66
|
+
import os
|
|
67
|
+
|
|
68
|
+
try:
|
|
69
|
+
from ladybug.datacollection import BaseCollection
|
|
70
|
+
except ImportError as e:
|
|
71
|
+
raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))
|
|
72
|
+
|
|
73
|
+
try:
|
|
74
|
+
from honeybee_radiance.postprocess.annualglare import glare_autonomy_from_folder
|
|
75
|
+
except ImportError as e:
|
|
76
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
77
|
+
|
|
78
|
+
try:
|
|
79
|
+
from honeybee_energy.lib.schedules import schedule_by_identifier
|
|
80
|
+
except ImportError as e: # honeybee schedule library is not available
|
|
81
|
+
schedule_by_identifier = None
|
|
82
|
+
|
|
83
|
+
try:
|
|
84
|
+
from ladybug_rhino.grasshopper import all_required_inputs, list_to_data_tree, \
|
|
85
|
+
data_tree_to_list
|
|
86
|
+
except ImportError as e:
|
|
87
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
if all_required_inputs(ghenv.Component):
|
|
91
|
+
# set default values for the thresholds and the grid filter
|
|
92
|
+
grid_filter_ = '*' if grid_filter_ is None else grid_filter_
|
|
93
|
+
_glare_thresh_ = _glare_thresh_ if _glare_thresh_ else 0.4
|
|
94
|
+
|
|
95
|
+
# process the schedule
|
|
96
|
+
if _occ_sch_ is None:
|
|
97
|
+
schedule = None
|
|
98
|
+
elif isinstance(_occ_sch_, BaseCollection):
|
|
99
|
+
schedule = _occ_sch_.values
|
|
100
|
+
elif isinstance(_occ_sch_, str):
|
|
101
|
+
if schedule_by_identifier is not None:
|
|
102
|
+
try:
|
|
103
|
+
schedule = schedule_by_identifier(_occ_sch_).values()
|
|
104
|
+
except TypeError: # it's probably a ScheduleFixedInterval
|
|
105
|
+
schedule = schedule_by_identifier(_occ_sch_).values
|
|
106
|
+
else:
|
|
107
|
+
raise ValueError('honeybee-energy must be installed to reference '
|
|
108
|
+
'occupancy schedules by identifier.')
|
|
109
|
+
else: # assume that it is a honeybee schedule object
|
|
110
|
+
try:
|
|
111
|
+
schedule = _occ_sch_.values()
|
|
112
|
+
except TypeError: # it's probably a ScheduleFixedInterval
|
|
113
|
+
schedule = _occ_sch_.values
|
|
114
|
+
if schedule is not None:
|
|
115
|
+
bin_schedule = []
|
|
116
|
+
for val in schedule:
|
|
117
|
+
bin_val = 1 if val >= 0.1 else 0
|
|
118
|
+
bin_schedule.append(bin_val)
|
|
119
|
+
schedule = bin_schedule
|
|
120
|
+
|
|
121
|
+
# compute the annual metrics
|
|
122
|
+
res_folder = os.path.dirname(_results[0]) if os.path.isfile(_results[0]) \
|
|
123
|
+
else _results[0]
|
|
124
|
+
GA = glare_autonomy_from_folder(
|
|
125
|
+
res_folder, schedule, _glare_thresh_, grid_filter_)
|
|
126
|
+
GA = list_to_data_tree(GA)
|
|
127
|
+
|
|
128
|
+
# process the input values into a readable format
|
|
129
|
+
ga_mtx = [item[-1] for item in data_tree_to_list(GA)]
|
|
130
|
+
_target_time_ = 95 if _target_time_ is None else _target_time_
|
|
131
|
+
|
|
132
|
+
# determine whether each point passes or fails
|
|
133
|
+
pass_fail = [[int(val > _target_time_) for val in grid] for grid in ga_mtx]
|
|
134
|
+
|
|
135
|
+
# compute spatial glare autonomy from the pass/fail results
|
|
136
|
+
sGA = [sum(pf_list) / len(pf_list) for pf_list in pass_fail]
|
|
137
|
+
pass_fail = list_to_data_tree(pass_fail) # convert matrix to data tree
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Honeybee: A Plugin for Environmental Analysis (GPL)
|
|
2
|
+
# This file is part of Honeybee.
|
|
3
|
+
#
|
|
4
|
+
# Copyright (c) 2025, Ladybug Tools.
|
|
5
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
6
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
7
|
+
#
|
|
8
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
Run an annual irradiance study for a Honeybee model to compute hourly solar
|
|
12
|
+
irradiance for each sensor in a model's sensor grids.
|
|
13
|
+
_
|
|
14
|
+
The fundamental calculation of this recipe is the same as that of "HB Annual
|
|
15
|
+
Daylight" in that an enhaced 2-phase method is used to accurately account for
|
|
16
|
+
direct sun at each simulation step. However, this recipe computes broadband
|
|
17
|
+
solar irradiance in W/m2 instead of visible illuminance in lux.
|
|
18
|
+
_
|
|
19
|
+
Consequently, the average irradiance and cumulative radiation values produced from
|
|
20
|
+
this recipe are more accurate than those produced by the "HB Cumulative Radiation"
|
|
21
|
+
recipe. Furthermore, because the hourly irriadiance values are accurate, this
|
|
22
|
+
recipe can be used to evaluate `peak_irradiance` and determine the worst-case
|
|
23
|
+
solar loads over clear sky Weas that represent cooling design days.
|
|
24
|
+
|
|
25
|
+
-
|
|
26
|
+
Args:
|
|
27
|
+
_model: A Honeybee Model for which Annual Irradiance will be simulated.
|
|
28
|
+
Note that this model must have grids assigned to it.
|
|
29
|
+
_wea: A Wea object produced from the Wea components that are under the Light
|
|
30
|
+
Sources tab. This can also be the path to a .wea or a .epw file.
|
|
31
|
+
_timestep_: An integer for the timestep of the inpput _wea. This value is used
|
|
32
|
+
to compute average irradiance and cumulative radiation. (Default: 1)
|
|
33
|
+
visible_: Boolean to indicate the type of irradiance output, which can be solar (False)
|
|
34
|
+
or visible (True). Note that the output values will still be
|
|
35
|
+
irradiance (W/m2) when "visible" is selected but these irradiance
|
|
36
|
+
values will be just for the visible portion of the electromagnetic
|
|
37
|
+
spectrum. The visible irradiance values can be converted into
|
|
38
|
+
illuminance by multiplying them by the Radiance luminous efficacy
|
|
39
|
+
factor of 179. (Default: False).
|
|
40
|
+
north_: A number between -360 and 360 for the counterclockwise difference
|
|
41
|
+
between the North and the positive Y-axis in degrees. This can
|
|
42
|
+
also be Vector for the direction to North. (Default: 0).
|
|
43
|
+
grid_filter_: Text for a grid identifer or a pattern to filter the sensor grids of
|
|
44
|
+
the model that are simulated. For instance, first_floor_* will simulate
|
|
45
|
+
only the sensor grids that have an identifier that starts with
|
|
46
|
+
first_floor_. By default, all grids in the model will be simulated.
|
|
47
|
+
radiance_par_: Text for the radiance parameters to be used for ray
|
|
48
|
+
tracing. (Default: -ab 2 -ad 5000 -lw 2e-05).
|
|
49
|
+
run_settings_: Settings from the "HB Recipe Settings" component that specify
|
|
50
|
+
how the recipe should be run. This can also be a text string of
|
|
51
|
+
recipe settings.
|
|
52
|
+
_run: Set to True to run the recipe and get results. This input can also be
|
|
53
|
+
the integer "2" to run the recipe silently.
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
report: Reports, errors, warnings, etc.
|
|
57
|
+
results: Raw result files (.ill) that contain matrices of irradiance in W/m2
|
|
58
|
+
for each time step of the wea.
|
|
59
|
+
res_direct: Raw result files (.ill) that contain irradiance matrices for just the
|
|
60
|
+
direct sun at each hour of the simulation. These can be postprocessed
|
|
61
|
+
using various components under the 4::Results sub-tab.
|
|
62
|
+
avg_irr: The average irradiance in W/m2 for each sensor over the Wea time period.
|
|
63
|
+
peak_irr: The highest irradiance value in W/m2 during the Wea time period. This
|
|
64
|
+
is suitable for assessing the worst-case solar load of clear skies on
|
|
65
|
+
cooling design days. It can also be used to determine the highest
|
|
66
|
+
radiant temperatures that occupants might experience in over the
|
|
67
|
+
time period of the Wea.
|
|
68
|
+
radiation: The cumulative radiation in kWh/m2 over the Wea time period.
|
|
69
|
+
"""
|
|
70
|
+
|
|
71
|
+
ghenv.Component.Name = 'HB Annual Irradiance'
|
|
72
|
+
ghenv.Component.NickName = 'AnnualIrradiance'
|
|
73
|
+
ghenv.Component.Message = '1.9.0'
|
|
74
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
75
|
+
ghenv.Component.SubCategory = '3 :: Recipes'
|
|
76
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '1'
|
|
77
|
+
|
|
78
|
+
try:
|
|
79
|
+
from lbt_recipes.recipe import Recipe
|
|
80
|
+
except ImportError as e:
|
|
81
|
+
raise ImportError('\nFailed to import lbt_recipes:\n\t{}'.format(e))
|
|
82
|
+
|
|
83
|
+
try:
|
|
84
|
+
from ladybug_rhino.grasshopper import all_required_inputs, recipe_result
|
|
85
|
+
except ImportError as e:
|
|
86
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
if all_required_inputs(ghenv.Component) and _run:
|
|
90
|
+
# create the recipe and set the input arguments
|
|
91
|
+
recipe = Recipe('annual-irradiance')
|
|
92
|
+
recipe.input_value_by_name('model', _model)
|
|
93
|
+
recipe.input_value_by_name('wea', _wea)
|
|
94
|
+
recipe.input_value_by_name('timestep', _timestep_)
|
|
95
|
+
recipe.input_value_by_name('output-type', visible_)
|
|
96
|
+
recipe.input_value_by_name('north', north_)
|
|
97
|
+
recipe.input_value_by_name('grid-filter', grid_filter_)
|
|
98
|
+
recipe.input_value_by_name('radiance-parameters', radiance_par_)
|
|
99
|
+
|
|
100
|
+
# run the recipe
|
|
101
|
+
silent = True if _run > 1 else False
|
|
102
|
+
project_folder = recipe.run(run_settings_, radiance_check=True, silent=silent)
|
|
103
|
+
|
|
104
|
+
# load the results
|
|
105
|
+
try:
|
|
106
|
+
results = recipe_result(recipe.output_value_by_name('results', project_folder))
|
|
107
|
+
res_direct = recipe_result(recipe.output_value_by_name('results-direct', project_folder))
|
|
108
|
+
avg_irr = recipe_result(recipe.output_value_by_name('average-irradiance', project_folder))
|
|
109
|
+
peak_irr = recipe_result(recipe.output_value_by_name('peak-irradiance', project_folder))
|
|
110
|
+
radiation = recipe_result(recipe.output_value_by_name('cumulative-radiation', project_folder))
|
|
111
|
+
except Exception:
|
|
112
|
+
raise Exception(recipe.failure_message(project_folder))
|