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,211 @@
|
|
|
1
|
+
# This file is part of Honeybee.
|
|
2
|
+
#
|
|
3
|
+
# Copyright (c) 2025, Ladybug Tools.
|
|
4
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
5
|
+
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
|
|
6
|
+
#
|
|
7
|
+
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
Generate electric lighting schedules from annual daylight results, which can be
|
|
11
|
+
used to account for daylight controls in energy simulations.
|
|
12
|
+
_
|
|
13
|
+
Such controls will dim the lights in the energy simulation according to whether
|
|
14
|
+
the illuminance values at the sensor locations are at a target illuminance setpoint.
|
|
15
|
+
_
|
|
16
|
+
In addition to benefiting from the accuracy of Radiance, using this component has
|
|
17
|
+
several advantages over the "HB Apply Daylight Control" component under HB-Energy.
|
|
18
|
+
Notably, it can account for setups with multiple illuminance sensors.
|
|
19
|
+
_
|
|
20
|
+
This component will generate one schedule per sensor grid in the simulation. Each
|
|
21
|
+
grid should have sensors at the locations in space where daylight dimming sensors
|
|
22
|
+
are located. Grids with one, two, or more sensors can be used to model setups
|
|
23
|
+
where fractions of each room are controlled by different sensors. If the sensor
|
|
24
|
+
grids are distributed over the entire floor of the rooms, the resulting schedules
|
|
25
|
+
will be idealized, where light dimming has been optimized to supply the minimum
|
|
26
|
+
illuminance setpoint everywhere in the room.
|
|
27
|
+
-
|
|
28
|
+
|
|
29
|
+
Args:
|
|
30
|
+
_results: An list of annual Radiance result files from the "HB Annual Daylight"
|
|
31
|
+
component (containing the .ill files and the sun-up-hours.txt).
|
|
32
|
+
This can also be just the path to the folder containing these
|
|
33
|
+
result files.
|
|
34
|
+
dyn_sch_: Optional dynamic Aperture Group Schedules from the "HB Aperture Group
|
|
35
|
+
Schedule" component, which will be used to customize the behavior
|
|
36
|
+
of any dyanmic aperture geometry in the output metrics. If unsupplied,
|
|
37
|
+
all dynamic aperture groups will be in their default state in for
|
|
38
|
+
the output metrics.
|
|
39
|
+
_base_schedule_: A lighting schedule representing the usage of lights without
|
|
40
|
+
any daylight controls. The values of this schedule will be multiplied
|
|
41
|
+
by the hourly dimming fraction to yield the output lighting schedules.
|
|
42
|
+
The format of this schedule can be a Ladybug Data Collection, a HB-Energy
|
|
43
|
+
schedule object, or the identifier of a schedule in the HB-Energy
|
|
44
|
+
schedule library. If None, a schedule from 8AM to 6PM on all days
|
|
45
|
+
will be used.
|
|
46
|
+
_ill_setpoint_: A number for the illuminance setpoint in lux beyond which
|
|
47
|
+
electric lights are dimmed if there is sufficient daylight.
|
|
48
|
+
Some common setpoints are listed below. (Default: 300 lux).
|
|
49
|
+
-
|
|
50
|
+
50 lux - Corridors and hallways.
|
|
51
|
+
150 lux - Computer work spaces (screens provide illumination).
|
|
52
|
+
300 lux - Paper work spaces (reading from surfaces that need illumination).
|
|
53
|
+
500 lux - Retail spaces or museums illuminating merchandise/artifacts.
|
|
54
|
+
1000 lux - Operating rooms and workshops where light is needed for safety.
|
|
55
|
+
|
|
56
|
+
_min_power_in_: A number between 0 and 1 for the the lowest power the lighting
|
|
57
|
+
system can dim down to, expressed as a fraction of maximum
|
|
58
|
+
input power. (Default: 0.3).
|
|
59
|
+
_min_light_out_: A number between 0 and 1 the lowest lighting output the lighting
|
|
60
|
+
system can dim down to, expressed as a fraction of maximum light
|
|
61
|
+
output. Note that setting this to 1 means lights aren't dimmed at
|
|
62
|
+
all until the illuminance setpoint is reached. This can be used to
|
|
63
|
+
approximate manual light-switching behavior when used in conjunction
|
|
64
|
+
with the off_at_min_ output below. (Default: 0.2).
|
|
65
|
+
off_at_min_: Boolean to note whether lights should switch off completely when
|
|
66
|
+
they get to the minimum power input. (Default: False).
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
report: Reports, errors, warnings, etc.
|
|
70
|
+
rooms: The input Rooms with simple daylight controls assigned to them.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
ghenv.Component.Name = 'HB Daylight Control Schedule'
|
|
74
|
+
ghenv.Component.NickName = 'DaylightSchedule'
|
|
75
|
+
ghenv.Component.Message = '1.9.0'
|
|
76
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
77
|
+
ghenv.Component.SubCategory = '4 :: Results'
|
|
78
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '1'
|
|
79
|
+
|
|
80
|
+
import os
|
|
81
|
+
import json
|
|
82
|
+
import subprocess
|
|
83
|
+
|
|
84
|
+
try:
|
|
85
|
+
from ladybug.datacollection import BaseCollection
|
|
86
|
+
from ladybug.futil import write_to_file
|
|
87
|
+
except ImportError as e:
|
|
88
|
+
raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))
|
|
89
|
+
|
|
90
|
+
try:
|
|
91
|
+
from honeybee.config import folders
|
|
92
|
+
except ImportError as e:
|
|
93
|
+
raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))
|
|
94
|
+
|
|
95
|
+
try:
|
|
96
|
+
from honeybee_radiance.postprocess.electriclight import daylight_control_schedules
|
|
97
|
+
except ImportError as e:
|
|
98
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
99
|
+
|
|
100
|
+
try:
|
|
101
|
+
from honeybee_radiance_postprocess.dynamic import DynamicSchedule
|
|
102
|
+
except ImportError as e:
|
|
103
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
104
|
+
|
|
105
|
+
try:
|
|
106
|
+
from honeybee_energy.lib.schedules import schedule_by_identifier
|
|
107
|
+
from honeybee_energy.lib.scheduletypelimits import schedule_type_limit_by_identifier
|
|
108
|
+
from honeybee_energy.schedule.fixedinterval import ScheduleFixedInterval
|
|
109
|
+
except ImportError as e:
|
|
110
|
+
raise ImportError('\nFailed to import honeybee_energy:\n\t{}'.format(e))
|
|
111
|
+
|
|
112
|
+
try:
|
|
113
|
+
from ladybug_rhino.grasshopper import all_required_inputs, give_warning
|
|
114
|
+
except ImportError as e:
|
|
115
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def load_schedules_from_folder(folder):
|
|
119
|
+
"""Load schedule values from a folder."""
|
|
120
|
+
info = os.path.join(folder, 'grids_info.json')
|
|
121
|
+
with open(info) as data_f:
|
|
122
|
+
data = json.load(data_f)
|
|
123
|
+
sch_vals, sch_ids = [], []
|
|
124
|
+
for grid in data:
|
|
125
|
+
res_file = os.path.join(folder, '{}.txt'.format(grid['full_id']))
|
|
126
|
+
with open(res_file) as res_f:
|
|
127
|
+
sch_vals.append([float(v) for v in res_f])
|
|
128
|
+
sch_ids.append('{} Daylight Control'.format(grid['full_id']))
|
|
129
|
+
return sch_vals, sch_ids
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
if all_required_inputs(ghenv.Component):
|
|
133
|
+
# set default values for all controls
|
|
134
|
+
_ill_setpoint_ = 300 if _ill_setpoint_ is None else _ill_setpoint_
|
|
135
|
+
_min_power_in_ = 0.3 if _min_power_in_ is None else _min_power_in_
|
|
136
|
+
_min_light_out_ = 0.2 if _min_light_out_ is None else _min_light_out_
|
|
137
|
+
off_at_min_ = False if off_at_min_ is None else off_at_min_
|
|
138
|
+
|
|
139
|
+
# process the base schedule input into a list of values
|
|
140
|
+
if _base_schedule_ is None:
|
|
141
|
+
schedule = _base_schedule_
|
|
142
|
+
elif isinstance(_base_schedule_, BaseCollection):
|
|
143
|
+
schedule = _base_schedule_.values
|
|
144
|
+
elif isinstance(_base_schedule_, str):
|
|
145
|
+
schedule = schedule_by_identifier(_base_schedule_).values()
|
|
146
|
+
else: # assume that it is a honeybee schedule object
|
|
147
|
+
try:
|
|
148
|
+
schedule = _base_schedule_.values()
|
|
149
|
+
except TypeError: # it's probably a ScheduleFixedInterval
|
|
150
|
+
schedule = _base_schedule_.values
|
|
151
|
+
# get the relevant .ill files
|
|
152
|
+
res_folder = os.path.dirname(_results[0]) if os.path.isfile(_results[0]) \
|
|
153
|
+
else _results[0]
|
|
154
|
+
|
|
155
|
+
# check to see if results use the newer numpy arrays
|
|
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
|
+
'schedule', 'control-schedules', res_folder,
|
|
161
|
+
'--ill-setpoint', str(_ill_setpoint_),
|
|
162
|
+
'--min-power-in', str(_min_power_in_),
|
|
163
|
+
'--min-light-out', str(_min_light_out_),
|
|
164
|
+
'--sub-folder', 'schedules'
|
|
165
|
+
]
|
|
166
|
+
if _base_schedule_ is not None:
|
|
167
|
+
sch_str = '\n'.join(str(h) for h in schedule)
|
|
168
|
+
sch_file = os.path.join(res_folder, 'schedule.txt')
|
|
169
|
+
write_to_file(sch_file, sch_str)
|
|
170
|
+
cmds.extend(['--base-schedule-file', sch_file])
|
|
171
|
+
if off_at_min_:
|
|
172
|
+
cmds.append('--off-at-min')
|
|
173
|
+
if len(dyn_sch_) != 0:
|
|
174
|
+
if os.path.isfile(os.path.join(res_folder, 'grid_states.json')):
|
|
175
|
+
dyn_sch = dyn_sch_[0] if isinstance(dyn_sch_[0], DynamicSchedule) else \
|
|
176
|
+
DynamicSchedule.from_group_schedules(dyn_sch_)
|
|
177
|
+
dyn_sch_file = dyn_sch.to_json(folder=res_folder)
|
|
178
|
+
cmds.extend(['--states', dyn_sch_file])
|
|
179
|
+
else:
|
|
180
|
+
msg = 'No dynamic aperture groups were found in the Model.\n' \
|
|
181
|
+
'The input dynamic schedules will be ignored.'
|
|
182
|
+
print(msg)
|
|
183
|
+
give_warning(ghenv.Component, msg)
|
|
184
|
+
use_shell = True if os.name == 'nt' else False
|
|
185
|
+
custom_env = os.environ.copy()
|
|
186
|
+
custom_env['PYTHONHOME'] = ''
|
|
187
|
+
process = subprocess.Popen(
|
|
188
|
+
cmds, cwd=res_folder, shell=use_shell, env=custom_env,
|
|
189
|
+
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
190
|
+
stdout = process.communicate() # wait for the process to finish
|
|
191
|
+
if stdout[-1] != '':
|
|
192
|
+
print(stdout[-1])
|
|
193
|
+
raise ValueError('Failed to compute control schedule.')
|
|
194
|
+
cntrl_dir = os.path.join(res_folder, 'schedules', 'control_schedules')
|
|
195
|
+
if os.path.isdir(cntrl_dir):
|
|
196
|
+
sch_vals, sch_ids = load_schedules_from_folder(cntrl_dir)
|
|
197
|
+
|
|
198
|
+
else:
|
|
199
|
+
if len(dyn_sch_) != 0:
|
|
200
|
+
msg = 'Dynamic Schedules are currently only supported for Annual Daylight ' \
|
|
201
|
+
'simulations.\nThe input schedules will be ignored.'
|
|
202
|
+
print(msg)
|
|
203
|
+
give_warning(ghenv.Component, msg)
|
|
204
|
+
sch_vals, sch_ids = daylight_control_schedules(
|
|
205
|
+
res_folder, schedule, _ill_setpoint_, _min_power_in_, _min_light_out_, off_at_min_)
|
|
206
|
+
|
|
207
|
+
# create the schedule by combining the base schedule with the dimming fraction
|
|
208
|
+
type_limit = schedule_type_limit_by_identifier('Fractional')
|
|
209
|
+
schedules = []
|
|
210
|
+
for shc_val, sch_id in zip(sch_vals, sch_ids):
|
|
211
|
+
schedules.append(ScheduleFixedInterval(sch_id, shc_val, type_limit))
|
|
@@ -0,0 +1,82 @@
|
|
|
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 a daylight factor study for a Honeybee model.
|
|
12
|
+
_
|
|
13
|
+
Daylight Factor (DF) is defined as the ratio of the indoor daylight illuminance
|
|
14
|
+
to outdoor illuminance under an unobstructed overcast sky. It is expressed as a
|
|
15
|
+
percentage between 0 and 100.
|
|
16
|
+
_
|
|
17
|
+
Because daylight factor is computed using an overcast sky, it does not change
|
|
18
|
+
with [North, East, South, West] orientation. As such, it is more suited to
|
|
19
|
+
assessing daylight in climates where cloudy conditions are common. The "HB
|
|
20
|
+
Annual Daylight" recipe yields a much more accurate assessment of daylight
|
|
21
|
+
and is suitable for all climates, though it requires a significantly longer
|
|
22
|
+
calculation time than Daylight Factor.
|
|
23
|
+
|
|
24
|
+
-
|
|
25
|
+
Args:
|
|
26
|
+
_model: A Honeybee Model for which Daylight Factor will be simulated.
|
|
27
|
+
Note that this model should have grids assigned to it in order
|
|
28
|
+
to produce meaningfule results.
|
|
29
|
+
grid_filter_: Text for a grid identifer or a pattern to filter the sensor grids of
|
|
30
|
+
the model that are simulated. For instance, `first_floor_*` will simulate
|
|
31
|
+
only the sensor grids that have an identifier that starts with
|
|
32
|
+
`first_floor_`. By default, all grids in the model will be simulated.
|
|
33
|
+
radiance_par_: Text for the radiance parameters to be used for ray
|
|
34
|
+
tracing. (Default: -ab 2 -aa 0.1 -ad 2048 -ar 64).
|
|
35
|
+
run_settings_: Settings from the "HB Recipe Settings" component that specify
|
|
36
|
+
how the recipe should be run. This can also be a text string of
|
|
37
|
+
recipe settings.
|
|
38
|
+
_run: Set to True to run the recipe and get results. This input can also be
|
|
39
|
+
the integer "2" to run the recipe silently.
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
report: Reports, errors, warnings, etc.
|
|
43
|
+
results: The daylight factor values from the simulation in percent. Each
|
|
44
|
+
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
|
|
46
|
+
sensor grids to visualize results.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
ghenv.Component.Name = 'HB Daylight Factor'
|
|
50
|
+
ghenv.Component.NickName = 'DaylightFactor'
|
|
51
|
+
ghenv.Component.Message = '1.9.0'
|
|
52
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
53
|
+
ghenv.Component.SubCategory = '3 :: Recipes'
|
|
54
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '3'
|
|
55
|
+
|
|
56
|
+
try:
|
|
57
|
+
from lbt_recipes.recipe import Recipe
|
|
58
|
+
except ImportError as e:
|
|
59
|
+
raise ImportError('\nFailed to import lbt_recipes:\n\t{}'.format(e))
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
from ladybug_rhino.grasshopper import all_required_inputs, recipe_result
|
|
63
|
+
except ImportError as e:
|
|
64
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
if all_required_inputs(ghenv.Component) and _run:
|
|
68
|
+
# create the recipe and set the input arguments
|
|
69
|
+
recipe = Recipe('daylight-factor')
|
|
70
|
+
recipe.input_value_by_name('model', _model)
|
|
71
|
+
recipe.input_value_by_name('grid-filter', grid_filter_)
|
|
72
|
+
recipe.input_value_by_name('radiance-parameters', radiance_par_)
|
|
73
|
+
|
|
74
|
+
# run the recipe
|
|
75
|
+
silent = True if _run > 1 else False
|
|
76
|
+
project_folder = recipe.run(run_settings_, radiance_check=True, silent=silent)
|
|
77
|
+
|
|
78
|
+
# load the results
|
|
79
|
+
try:
|
|
80
|
+
results = recipe_result(recipe.output_value_by_name('results', project_folder))
|
|
81
|
+
except Exception:
|
|
82
|
+
raise Exception(recipe.failure_message(project_folder))
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
"""
|
|
12
|
+
Deconstruct a modifier into a radiance string.
|
|
13
|
+
-
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
_mod: A modifier to be deconstructed or text for a modifier to be looked
|
|
17
|
+
up in the modifier library.
|
|
18
|
+
|
|
19
|
+
Returns:
|
|
20
|
+
rad_str: A Radiance string that includes all of the attributes that
|
|
21
|
+
define the modifier.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
ghenv.Component.Name = 'HB Deconstruct Modifier'
|
|
25
|
+
ghenv.Component.NickName = 'DecnstrMod'
|
|
26
|
+
ghenv.Component.Message = '1.9.0'
|
|
27
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
28
|
+
ghenv.Component.SubCategory = '1 :: Modifiers'
|
|
29
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '0'
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
try: # import the honeybee-radiance dependencies
|
|
33
|
+
from honeybee_radiance.lib.modifiers import modifier_by_identifier
|
|
34
|
+
except ImportError as e:
|
|
35
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
36
|
+
|
|
37
|
+
try: # import ladybug_rhino dependencies
|
|
38
|
+
from ladybug_rhino.grasshopper import all_required_inputs
|
|
39
|
+
except ImportError as e:
|
|
40
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
if all_required_inputs(ghenv.Component):
|
|
44
|
+
# check the input
|
|
45
|
+
if isinstance(_mod, str):
|
|
46
|
+
_mod = modifier_by_identifier(_mod)
|
|
47
|
+
rad_str = _mod.to_radiance()
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
"""
|
|
12
|
+
Deconstruct a modifier set into its constituient interior modifiers.
|
|
13
|
+
-
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
_mod_set: A modifier set to be deconstructed. This can also be
|
|
17
|
+
text for a modifier set to be looked up in the modifier
|
|
18
|
+
set library.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
interior_wall: A modifier object for the set's interior walls.
|
|
22
|
+
ceiling: A modifier object for the set's interior roofs.
|
|
23
|
+
interior_floor: A modifier object for the set's interior floors.
|
|
24
|
+
interior_window: A modifier object for all apertures with a Surface
|
|
25
|
+
boundary condition.
|
|
26
|
+
interior_door: A modifier object for all opaque doors with a Surface
|
|
27
|
+
boundary condition.
|
|
28
|
+
int_glass_door: A modifier object for all glass doors with a Surface
|
|
29
|
+
boundary condition.
|
|
30
|
+
interior_shade: A modifier object for all interior shades.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
ghenv.Component.Name = 'HB Deconstruct ModifierSet Interior'
|
|
34
|
+
ghenv.Component.NickName = 'DecnstrConstrSetInt'
|
|
35
|
+
ghenv.Component.Message = '1.9.0'
|
|
36
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
37
|
+
ghenv.Component.SubCategory = '1 :: Modifiers'
|
|
38
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '5'
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
try: # import the honeybee-radiance dependencies
|
|
42
|
+
from honeybee_radiance.modifierset import ModifierSet
|
|
43
|
+
from honeybee_radiance.lib.modifiersets import modifier_set_by_identifier
|
|
44
|
+
except ImportError as e:
|
|
45
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
46
|
+
|
|
47
|
+
try: # import ladybug_rhino dependencies
|
|
48
|
+
from ladybug_rhino.grasshopper import all_required_inputs
|
|
49
|
+
except ImportError as e:
|
|
50
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
if all_required_inputs(ghenv.Component):
|
|
54
|
+
# check the input
|
|
55
|
+
if isinstance(_mod_set, str):
|
|
56
|
+
_mod_set = modifier_set_by_identifier(_mod_set)
|
|
57
|
+
else:
|
|
58
|
+
assert isinstance(_mod_set, ModifierSet), \
|
|
59
|
+
'Expected ModifierSet. Got {}.'.format(type(_mod_set))
|
|
60
|
+
|
|
61
|
+
interior_wall = _mod_set.wall_set.interior_modifier
|
|
62
|
+
ceiling = _mod_set.roof_ceiling_set.interior_modifier
|
|
63
|
+
interior_floor = _mod_set.floor_set.interior_modifier
|
|
64
|
+
interior_window = _mod_set.aperture_set.interior_modifier
|
|
65
|
+
interior_door = _mod_set.door_set.interior_modifier
|
|
66
|
+
int_glass_door = _mod_set.door_set.interior_glass_modifier
|
|
67
|
+
interior_shade = _mod_set.shade_set.interior_modifier
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
"""
|
|
12
|
+
Deconstruct a modifier set into its constituient exterior modifiers.
|
|
13
|
+
-
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
_mod_set: A modifier set to be deconstructed. This can also be
|
|
17
|
+
text for a modifier set to be looked up in the modifier
|
|
18
|
+
set library.
|
|
19
|
+
|
|
20
|
+
Returns:
|
|
21
|
+
exterior_wall: A modifier object for the set's exterior walls.
|
|
22
|
+
exterior_roof: A modifier object for the set's exterior roofs.
|
|
23
|
+
exposed_floor: A modifier object for the set's exposed floors.
|
|
24
|
+
ground_wall: A modifier object for the set's underground walls.
|
|
25
|
+
ground_roof: A modifier object for the set's underground roofs.
|
|
26
|
+
ground_floor: A modifier object for the set's ground-contact floors.
|
|
27
|
+
window: A modifier object for apertures with an Outdoors boundary
|
|
28
|
+
condition and a Wall face type for their parent face.
|
|
29
|
+
skylight: A modifier object for apertures with an Outdoors boundary
|
|
30
|
+
condition and a RoofCeiling or Floor face type for their parent face.
|
|
31
|
+
operable: A modifier object for apertures with an Outdoors boundary
|
|
32
|
+
condition and True is_operable property.
|
|
33
|
+
exterior_door: A modifier object for opaque doors with an Outdoors
|
|
34
|
+
boundary condition and a Wall face type for their parent face.
|
|
35
|
+
overhead_door: A modifier object for opaque doors with an Outdoors
|
|
36
|
+
boundary condition and a RoofCeiling or Floor face type for their
|
|
37
|
+
parent face.
|
|
38
|
+
glass_door: A modifier object for all glass doors with an Outdoors
|
|
39
|
+
boundary condition.
|
|
40
|
+
exterior_shade: A modifier object for all exterior shades.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
ghenv.Component.Name = 'HB Deconstruct ModifierSet'
|
|
44
|
+
ghenv.Component.NickName = 'DecnstrModSet'
|
|
45
|
+
ghenv.Component.Message = '1.9.0'
|
|
46
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
47
|
+
ghenv.Component.SubCategory = '1 :: Modifiers'
|
|
48
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '5'
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
try: # import the honeybee-radiance dependencies
|
|
52
|
+
from honeybee_radiance.modifierset import ModifierSet
|
|
53
|
+
from honeybee_radiance.lib.modifiersets import modifier_set_by_identifier
|
|
54
|
+
except ImportError as e:
|
|
55
|
+
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
|
|
56
|
+
|
|
57
|
+
try: # import ladybug_rhino dependencies
|
|
58
|
+
from ladybug_rhino.grasshopper import all_required_inputs
|
|
59
|
+
except ImportError as e:
|
|
60
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
if all_required_inputs(ghenv.Component):
|
|
64
|
+
# check the input
|
|
65
|
+
if isinstance(_mod_set, str):
|
|
66
|
+
_mod_set = modifier_set_by_identifier(_mod_set)
|
|
67
|
+
else:
|
|
68
|
+
assert isinstance(_mod_set, ModifierSet), \
|
|
69
|
+
'Expected ModifierSet. Got {}.'.format(type(_mod_set))
|
|
70
|
+
|
|
71
|
+
exterior_wall = _mod_set.wall_set.exterior_modifier
|
|
72
|
+
exterior_roof = _mod_set.roof_ceiling_set.exterior_modifier
|
|
73
|
+
exposed_floor = _mod_set.floor_set.exterior_modifier
|
|
74
|
+
window = _mod_set.aperture_set.window_modifier
|
|
75
|
+
skylight = _mod_set.aperture_set.skylight_modifier
|
|
76
|
+
operable = _mod_set.aperture_set.operable_modifier
|
|
77
|
+
exterior_door = _mod_set.door_set.exterior_modifier
|
|
78
|
+
overhead_door = _mod_set.door_set.overhead_modifier
|
|
79
|
+
glass_door = _mod_set.door_set.exterior_glass_modifier
|
|
80
|
+
exterior_shade = _mod_set.shade_set.exterior_modifier
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
Deconstruct a Wea object into data collections of direct, diffuse, and golbal
|
|
12
|
+
irradiance at each timestep of the file.
|
|
13
|
+
|
|
14
|
+
-
|
|
15
|
+
Args:
|
|
16
|
+
_wea: A Honeybee WEA object.
|
|
17
|
+
|
|
18
|
+
Returns:
|
|
19
|
+
readMe!: Reports, errors, warnings, etc.
|
|
20
|
+
dir: A data collection of direct normal irradiance values at each timestep
|
|
21
|
+
of the Wea.
|
|
22
|
+
diff: A data collection of diffuse sky solar irradiance values at each
|
|
23
|
+
timestep of the Wea.
|
|
24
|
+
glob: A data collection of global horizontal irradiance values at each
|
|
25
|
+
timestep of the Wea.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
ghenv.Component.Name = 'HB Deconstruct Wea'
|
|
29
|
+
ghenv.Component.NickName = 'DecnstrWea'
|
|
30
|
+
ghenv.Component.Message = '1.9.0'
|
|
31
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
32
|
+
ghenv.Component.SubCategory = '2 :: Light Sources'
|
|
33
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '3'
|
|
34
|
+
|
|
35
|
+
try:
|
|
36
|
+
from ladybug_rhino.grasshopper import all_required_inputs
|
|
37
|
+
except ImportError as e:
|
|
38
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
if all_required_inputs(ghenv.Component):
|
|
42
|
+
dir = _wea.direct_normal_irradiance
|
|
43
|
+
diff = _wea.diffuse_horizontal_irradiance
|
|
44
|
+
glob = _wea.global_horizontal_irradiance
|
|
@@ -0,0 +1,88 @@
|
|
|
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 the number of hours of direct sun received by grids of sensors in a
|
|
12
|
+
Honeybee model.
|
|
13
|
+
_
|
|
14
|
+
The fundamental calculation of this recipe is the same as that of the "LB Direct
|
|
15
|
+
Sun Hours" component except that this recipe uses Radiance, which allows the
|
|
16
|
+
simulation to scale better for large numbers of sensors.
|
|
17
|
+
|
|
18
|
+
-
|
|
19
|
+
Args:
|
|
20
|
+
_model: A Honeybee Model for which Direct Sun Hours will be simulated.
|
|
21
|
+
Note that this model should have grids assigned to it in order
|
|
22
|
+
to produce meaningfule results.
|
|
23
|
+
_wea: A Wea object produced from the Wea components that are under the Light
|
|
24
|
+
Sources tab. This can also be the path to a .wea or a .epw file.
|
|
25
|
+
_timestep_: An integer for the timestep of the inpput _wea. This value will
|
|
26
|
+
be used to ensure the units of the results are in hours. (Default: 1)
|
|
27
|
+
north_: A number between -360 and 360 for the counterclockwise difference
|
|
28
|
+
between the North and the positive Y-axis in degrees. This can
|
|
29
|
+
also be Vector for the direction to North. (Default: 0).
|
|
30
|
+
grid_filter_: Text for a grid identifer or a pattern to filter the sensor grids of
|
|
31
|
+
the model that are simulated. For instance, first_floor_* will simulate
|
|
32
|
+
only the sensor grids that have an identifier that starts with
|
|
33
|
+
first_floor_. By default, all grids in the model will be simulated.
|
|
34
|
+
run_settings_: Settings from the "HB Recipe Settings" component that specify
|
|
35
|
+
how the recipe should be run. This can also be a text string of
|
|
36
|
+
recipe settings.
|
|
37
|
+
_run: Set to True to run the recipe and get results. This input can also be
|
|
38
|
+
the integer "2" to run the recipe silently.
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
report: Reports, errors, warnings, etc.
|
|
42
|
+
results: Raw result files (.ill) that contain matrices of zero/one values
|
|
43
|
+
indicating whether each sensor is exposed to the sun at a given
|
|
44
|
+
time step of the input Wea.
|
|
45
|
+
hours: The cumulative number of hours that each sensor can see the sun.
|
|
46
|
+
Each value is always in hours provided that the input _timestep_
|
|
47
|
+
is the same as the input Wea.
|
|
48
|
+
"""
|
|
49
|
+
|
|
50
|
+
ghenv.Component.Name = 'HB Direct Sun Hours'
|
|
51
|
+
ghenv.Component.NickName = 'DirectSunHours'
|
|
52
|
+
ghenv.Component.Message = '1.9.0'
|
|
53
|
+
ghenv.Component.Category = 'HB-Radiance'
|
|
54
|
+
ghenv.Component.SubCategory = '3 :: Recipes'
|
|
55
|
+
ghenv.Component.AdditionalHelpFromDocStrings = '3'
|
|
56
|
+
|
|
57
|
+
try:
|
|
58
|
+
from lbt_recipes.recipe import Recipe
|
|
59
|
+
except ImportError as e:
|
|
60
|
+
raise ImportError('\nFailed to import lbt_recipes:\n\t{}'.format(e))
|
|
61
|
+
|
|
62
|
+
try:
|
|
63
|
+
from ladybug_rhino.grasshopper import all_required_inputs, recipe_result
|
|
64
|
+
except ImportError as e:
|
|
65
|
+
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
if all_required_inputs(ghenv.Component) and _run:
|
|
69
|
+
# create the recipe and set the input arguments
|
|
70
|
+
recipe = Recipe('direct-sun-hours')
|
|
71
|
+
recipe.input_value_by_name('model', _model)
|
|
72
|
+
recipe.input_value_by_name('wea', _wea)
|
|
73
|
+
recipe.input_value_by_name('timestep', _timestep_)
|
|
74
|
+
recipe.input_value_by_name('north', north_)
|
|
75
|
+
recipe.input_value_by_name('grid-filter', grid_filter_)
|
|
76
|
+
|
|
77
|
+
# run the recipe
|
|
78
|
+
silent = True if _run > 1 else False
|
|
79
|
+
project_folder = recipe.run(run_settings_, radiance_check=True, silent=silent)
|
|
80
|
+
|
|
81
|
+
# load the results
|
|
82
|
+
try:
|
|
83
|
+
results = recipe_result(recipe.output_value_by_name(
|
|
84
|
+
'direct-sun-hours', project_folder))
|
|
85
|
+
hours = recipe_result(recipe.output_value_by_name(
|
|
86
|
+
'cumulative-sun-hours', project_folder))
|
|
87
|
+
except Exception:
|
|
88
|
+
raise Exception(recipe.failure_message(project_folder))
|