Skip to content

Commit

Permalink
fix(simulation): Update ShadowCalculation based on the new schema
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed May 28, 2020
1 parent e5bbb91 commit 039a4bc
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 15 deletions.
44 changes: 44 additions & 0 deletions honeybee_grasshopper_energy/src/HB Energy Config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Honeybee: A Plugin for Environmental Analysis (GPL)
# This file is part of Honeybee.
#
# Copyright (c) 2019, Ladybug Tools.
# You should have received a copy of the GNU General Public License
# along with Honeybee; If not, see <http://www.gnu.org/licenses/>.
#
# @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>

"""
Check the local configuration of the engines and data sets used by the honeybee
energy plugin. This is useful for verifying that everything has been installed
correctly and that the versions of the engines are as expected.
-
Returns:
os_install: The path to OpenStudio installation folder if it exists.
ep_install: The path to EnergyPlus installation folder if it exists.
hb_os_gem: The path to the honeybee_openstudio_gem if it exists. This gem
contains libraries and measures for translating between Honeybee
JSON schema and OpenStudio Model schema (OSM).
standards: The path to the library of standards if it exists. This library
contains the default Constructions, ConstructionSets, Schedules, and
ProgramTypes. It can be extended by dropping IDF or Honeybee JOSN
files into the appropriate sub-folder.
"""

ghenv.Component.Name = 'HB Energy Config'
ghenv.Component.NickName = 'EnergyConfig'
ghenv.Component.Message = '0.1.0'
ghenv.Component.Category = 'HB-Energy'
ghenv.Component.SubCategory = '0 :: Basic Properties'
ghenv.Component.AdditionalHelpFromDocStrings = '0'

try:
from honeybee_energy.config import folders
except ImportError as e:
raise ImportError('\nFailed to import honeybee_energy:\n\t{}'.format(e))


os_install = folders.openstudio_path
ep_install = folders.energyplus_path
hb_os_gem = folders.honeybee_openstudio_gem_path
standards = folders.standards_data_folder
16 changes: 10 additions & 6 deletions honeybee_grasshopper_energy/src/HB Gene Pool to Day Schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

ghenv.Component.Name = "HB Gene Pool to Day Schedule"
ghenv.Component.NickName = 'GenePoolToDaySch'
ghenv.Component.Message = '0.1.0'
ghenv.Component.Message = '0.1.1'
ghenv.Component.Category = 'HB-Energy'
ghenv.Component.SubCategory = '2 :: Schedules'
ghenv.Component.AdditionalHelpFromDocStrings = "1"
Expand Down Expand Up @@ -70,22 +70,26 @@
_low_bound_ = 0.0 if _low_bound_ is None else _low_bound_
_up_bound_ = 1.0 if _up_bound_ is None else _up_bound_
_decimals_ = 1 if _decimals_ is None else _decimals_

# get the template values
template = templates[_template_]

# get the gene pool
gp = ghenv.Component.Params.Input[0].Sources[0]

# modify the gene pool
gp.Count = 24.0
gp.Decimals = _decimals_
gp.Name = "HB Day Schedule"
gp.NickName = "DaySchedule"
gp.Maximum = _up_bound_
gp.Minimum = _low_bound_

# set gene pool values
gp.Count = 24
for i in range(gp.Count):
gp[i] = gp.Minimum + (template[i] * gp.Maximum)

# register the change on the component
gp.ExpireSolution(True)
else:
print('Connect _gene_pool and a button to _run.')
29 changes: 20 additions & 9 deletions honeybee_grasshopper_energy/src/HB Shadow Calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,21 @@
geometries are not supported by this solar distribution calculation
and it is recommeded that you either break up your zones in this
case or not use this solar distribution method.
_calc_method_: Text describing how the solar and shading models are calculated
with respect to the time of calculations during the simulation.
Default - AverageOverDaysInFrequency. Choose from the following:
* AverageOverDaysInFrequency
* TimestepFrequency
_calc_method_: Text noting whether CPU-based polygon clipping method or GPU-based
pixel counting method should be used. For low numbers of shading
surfaces (less than ~200), PolygonClipping requires less runtime than
PixelCounting. However, PixelCounting runtime scales significantly
better at higher numbers of shading surfaces. PixelCounting also has
no limitations related to zone concavity when used with any
“FullInterior” solar distribution options. (Default: PolygonClipping).
Choose from the following:
* PolygonClipping
* PixelCounting
_update_method_: Text describing how often the solar and shading calculations are
updated with respect to the flow of time in the simulation. (Default: Periodic)
Choose from the following:
* Periodic
* Timestep
_frequency_: Integer for the number of days in each period in
which a unique shadow calculation will be performed. This field is only
used if the AverageOverDaysInFrequency method is used in the previous
Expand All @@ -70,7 +80,7 @@

ghenv.Component.Name = "HB Shadow Calculation"
ghenv.Component.NickName = 'ShadowCalc'
ghenv.Component.Message = '0.1.1'
ghenv.Component.Message = '0.2.0'
ghenv.Component.Category = 'HB-Energy'
ghenv.Component.SubCategory = '5 :: Simulate'
ghenv.Component.AdditionalHelpFromDocStrings = "2"
Expand Down Expand Up @@ -105,10 +115,11 @@
'following:\n{}'.format(_solar_dist_, SOLAR_DISTRIBUTIONS.keys()))

# set other default values
_calc_method_ = _calc_method_ if _calc_method_ is not None else 'AverageOverDaysInFrequency'
_calc_method_ = _calc_method_ if _calc_method_ is not None else 'PolygonClipping'
_update_method_ = _update_method_ if _update_method_ is not None else 'Periodic'
_frequency_ = _frequency_ if _frequency_ is not None else 30
_max_figures_ = _max_figures_ if _max_figures_ is not None else 15000

# create the object
shadow_calc = ShadowCalculation(_solar_dist_, _calc_method_, _frequency_,
_max_figures_)
shadow_calc = ShadowCalculation(
_solar_dist_, _calc_method_, _update_method_, _frequency_, _max_figures_)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified samples/full_building_energy_model.gh
Binary file not shown.
Binary file modified samples/shoe_box_energy_model.gh
Binary file not shown.
Binary file modified samples/single_family_energy_model.gh
Binary file not shown.

0 comments on commit 039a4bc

Please sign in to comment.