I am trying to conduct a daylight analysis with a sun using sun vectors (altitude, azimuth) instead of month/day/hour. But every type of ‘Sky’ component seems to represent sun in the Time (month/day/hour) format.
Is there a way to do this in Ladybug and/or Honeybee? Do I need to change the metadata of the file?
Sun vectors (altitude, azimuth) is the output of Radiance sky command. https://www.ladybug.tools/honeybee-radiance/docs/cli/sky.html
You can use Sunpath component to calcutate the sun vectors for mm/dd/hh. The setting of sun vectors and the sky of certain time is equal.
Thank you for the link.
Sorry I should have specified. I’m trying to make the daylight analysis independent of the location. But the sky component takes a ‘location’ input in the form of epw file and mm/dd/hh from that epw file. I understand that the sky of a certain mm/dd/hh and the sun vector setting are equal but I’m trying to see if I can just use the azimuth and altitude angles of the sun to run a simulation so that it is location-independent. Is it possible to do so?
You can use the honeybee-radiance library with a custom Python component. I have not tested the code in Grasshopper, but if you create a Python component with _altitude, _azimuth, and _type_ as input, and sky as output then I think it should work if you add the code below in the component.
# Honeybee: A Plugin for Environmental Analysis (GPL)
# This file is part of Honeybee.
#
# Copyright (c) 2024, Ladybug Tools.
# You should have received a copy of the GNU Affero General Public License
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
#
# @license AGPL-3.0-or-later <https://spdx.org/licenses/AGPL-3.0-or-later>
"""
Create a point-in-time standard Radiance CIE sky from altitude and azimuth.
-
Args:
_altitude: Solar altitude. The altitude is measured in degrees above
the horizon.
_azimuth: Solar azimuth. The azimuth is measured in degrees east of
North. East is 90, South is 180 and West is 270. Note that this
input is different from Radiance convention. In Radiance the
azimuth degrees are measured in west of South.
_type_: An integer between 0..5 to indicate CIE Sky Type (default: 0).
* 0 = Sunny with sun
* 1 = sunny without sun
* 2 = intermediate with sun
* 3 = intermediate without sun
* 4 = cloudy sky
* 5 = uniform sky
Returns:
sky: A honeybee sky that can be used to create a point-in-time recipe.
"""
ghenv.Component.Name = 'HB CIE Standard Sky Vector'
ghenv.Component.NickName = 'CIESkyVector'
ghenv.Component.Message = '1.8.0'
ghenv.Component.Category = 'HB-Radiance'
ghenv.Component.SubCategory = '2 :: Light Sources'
ghenv.Component.AdditionalHelpFromDocStrings = '1'
try:
from honeybee_radiance.lightsource.sky import CIE
except ImportError as e:
raise ImportError('\nFailed to import honeybee_radiance:\n\t{}'.format(e))
try: # import ladybug_rhino dependencies
from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))
if all_required_inputs(ghenv.Component):
# set default values if they are not set
_type_ = 0 if _type_ is None else _type_
# create the sky object
sky = CIE(_altitude, _azimuth, _type_)
Thank you @mikkel. I tried the code but I’m getting an error ‘Input parameter _sky failed to collect data’. Am I doing something wrong?
Below is the Gh file.
I am not sure why it did not return the sky output from the component, but I tried to create a new output and delete the old one, and that got it to work. Please try again with the attached file.