Skip to content

Commit

Permalink
feat(energy): Add components to assign HVAC system
Browse files Browse the repository at this point in the history
This commit adds components to assign customized HVAC templates to dragonfly objects.  It also adds a component to assign operable windows for passive design.

With this, dragonfly should have the key energy simulation features that are needed to get three of the most useful metrics energy models can produce:
* energy use
* thermal comfort
* peak load (HVAC size)
  • Loading branch information
chriswmackey authored and Chris Mackey committed Aug 11, 2020
1 parent 3249bba commit 9898175
Show file tree
Hide file tree
Showing 21 changed files with 666 additions and 31 deletions.
146 changes: 146 additions & 0 deletions dragonfly_grasshopper/src/DF All-Air HVAC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# 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+>

"""
Apply an All-Air template HVAC to a list of Dragonfly Buildings, Stories or Room2Ds.
_
All-air systems provide both ventilation and satisfaction of heating + cooling
demand with the same stream of warm/cool air. As such, they often grant tight
control over zone humidity. However, because such systems often involve the
cooling of air only to reheat it again, they are often more energy intensive
than systems that separate ventilation from the meeting of thermal loads.
-
Args:
_df_objs: Dragonfly Buildings, Stories or Room2Ds to which the input template
HVAC will be assigned. If a list of Room2Ds is input, all objects
will receive the same HVAC instance. Otherwise, each object gets its
own instance (eg. each input Story will get its own HVAC).
_system_type: Text for the specific type of all-air system and equipment.
The "HB All-Air HVAC Templates" component has a full list of the
supported all-air system templates.
_vintage_: Text for the vintage of the template system. This will be used
to set efficiencies for various pieces of equipment within the system.
The "HB Building Vintages" component has a full list of supported
HVAC vintages. (Default: 90.1-2013). Choose from the following.
* DOE Ref Pre-1980
* DOE Ref 1980-2004
* 90.1-2004
* 90.1-2007
* 90.1-2010
* 90.1-2013
_name_: Text to set the name for the HVAC system and to be incorporated into
unique HVAC identifier. If the name is not provided, a random name
will be assigned.
_economizer_: Text to indicate the type of air-side economizer used on the
HVAC system. Economizers will mix in a greater amount of outdoor
air to cool the zone (rather than running the cooling system) when
the zone needs cooling and the outdoor air is cooler than the zone.
Choose from the options below. If Inferred, the economizer will be set
to whatever is recommended for the given vintage. Default: Inferred.
* Inferred
* NoEconomizer
* DifferentialDryBulb
* DifferentialEnthalpy
sensible_hr_: A number between 0 and 1 for the effectiveness of sensible
heat recovery within the system. Typical values range from 0.5 for
simple glycol loops to 0.81 for enthalpy wheels (the latter tends to
be fiarly expensive for air-based systems) Default: auto-calculated
by vintage (usually 0 for no heat recovery).
latent_hr_: A number between 0 and 1 for the effectiveness of latent heat
recovery within the system. Typical values are 0 for all types of
heat recovery except enthalpy wheels, which can have values as high
as 0.76. Default: auto-calculated by vintage (usually 0 for no heat
recovery).
Returns:
df_objs: The input Dragonfly objects with an all-air HVAC system applied.
"""

ghenv.Component.Name = "DF All-Air HVAC"
ghenv.Component.NickName = 'DFAllAirHVAC'
ghenv.Component.Message = '0.1.0'
ghenv.Component.Category = 'Dragonfly'
ghenv.Component.SubCategory = '3 :: Energy'
ghenv.Component.AdditionalHelpFromDocStrings = '3'

import uuid

try: # import the honeybee extension
from honeybee.altnumber import autosize
from honeybee.typing import clean_and_id_ep_string
from honeybee.model import Model
except ImportError as e:
raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try: # import the honeybee-energy extension
from honeybee_energy.hvac.allair import EQUIPMENT_TYPES_DICT
except ImportError as e:
raise ImportError('\nFailed to import honeybee_energy:\n\t{}'.format(e))

try: # import the core dragonfly dependencies
from dragonfly.building import Building
from dragonfly.story import Story
except ImportError as e:
raise ImportError('\nFailed to import dragonfly:\n\t{}'.format(e))

try: # import the dragonfly-energy extension
import dragonfly_energy
except ImportError as e:
raise ImportError('\nFailed to import dragonfly_energy energy:\n\t{}'.format(e))

try:
from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

# dictionary to get correct vintages
vintages = {
'DOE Ref Pre-1980': 'DOE Ref Pre-1980',
'DOE Ref 1980-2004': 'DOE Ref 1980-2004',
'90.1-2004': '90.1-2004',
'90.1-2007': '90.1-2007',
'90.1-2010': '90.1-2010',
'90.1-2013': '90.1-2013',
'pre_1980': 'DOE Ref Pre-1980',
'1980_2004': 'DOE Ref 1980-2004',
'2004': '90.1-2004',
'2007': '90.1-2007',
'2010': '90.1-2010',
'2013': '90.1-2013',
None: '90.1-2013'
}

if all_required_inputs(ghenv.Component):
# duplicate the initial objects
df_objs = [obj.duplicate() for obj in _df_objs]

# create the instance of the HVAC system to be applied to the objects
try: # get the class for the HVAC system
hvac_class = EQUIPMENT_TYPES_DICT[_system_type]
except KeyError:
raise ValueError('System Type "{}" is not recognized as an all-air HVAC '
'system.'.format(_system_type))
vintage = vintages[_vintage_] # get the vintage of the HVAC
# set default values for economizer and heat recovery
econ = _economizer_ if _economizer_ is not None else 'Inferred'
sens = sensible_hr_ if sensible_hr_ is not None else autosize
latent = latent_hr_ if latent_hr_ is not None else autosize
# get an identifier for the HVAC system
name = clean_and_id_ep_string(_name_) if _name_ is not None else str(uuid.uuid4())[:8]
hvac = hvac_class(name, vintage, _system_type, econ, sens, latent)
if _name_ is not None:
hvac.display_name = _name_

# apply the HVAC system to the objects
for obj in df_objs:
if isinstance(obj, (Building, Story)):
obj.properties.energy.set_all_room_2d_hvac(hvac)
elif obj.properties.energy.is_conditioned: # assume it's a Room2D
obj.properties.energy.hvac = hvac
142 changes: 142 additions & 0 deletions dragonfly_grasshopper/src/DF DOAS HVAC.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# 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+>

"""
Apply a Dedicated Outdoor Air System (DOAS) template HVAC to a list of Dragonfly
Buildings, Stories or Room2Ds.
_
DOAS systems separate minimum ventilation supply from the satisfaction of heating
+ cooling demand. Ventilation air tends to be supplied at neutral temperatures
(close to room air temperature) and heating / cooling loads are met with additional
pieces of zone equipment (eg. Fan Coil Units (FCUs)).
_
Because DOAS systems only have to cool down and re-heat the minimum ventilation air,
they tend to use less energy than all-air systems. They also tend to use less energy
to distribute heating + cooling by puping around hot/cold water or refrigerant
instead of blowing hot/cold air. However, they do not provide as good of control
over humidity and so they may not be appropriate for rooms with high latent loads
like auditoriums, kitchens, laundromats, etc.
-
Args:
_df_objs: Dragonfly Buildings, Stories or Room2Ds to which the input template
HVAC will be assigned. If a list of Room2Ds is input, all objects
will receive the same HVAC instance. Otherwise, each object gets its
own instance (eg. each input Story will get its own HVAC).
_system_type: Text for the specific type of DOAS system and equipment.
The "HB DOAS HVAC Templates" component has a full list of the
supported DOAS system templates.
_vintage_: Text for the vintage of the template system. This will be used
to set efficiencies for various pieces of equipment within the system.
The "HB Building Vintages" component has a full list of supported
HVAC vintages. (Default: 90.1-2013). Choose from the following.
* DOE Ref Pre-1980
* DOE Ref 1980-2004
* 90.1-2004
* 90.1-2007
* 90.1-2010
* 90.1-2013
_name_: Text to set the name for the HVAC system and to be incorporated into
unique HVAC identifier. If the name is not provided, a random name
will be assigned.
sensible_hr_: A number between 0 and 1 for the effectiveness of sensible
heat recovery within the system. Typical values range from 0.5 for
simple glycol loops to 0.81 for enthalpy wheels (the latter of
which is a fairly common ECM for DOAS systems) Default: auto-calculated
by vintage (usually 0 for no heat recovery).
latent_hr_: A number between 0 and 1 for the effectiveness of latent heat
recovery within the system. Typical values are 0 for all types of
heat recovery except enthalpy wheels, which can have values as high
as 0.76. Default: auto-calculated by vintage (usually 0 for no heat
recovery).
Returns:
df_objs: The input Dragonfly objects with a DOAS HVAC system applied.
"""

ghenv.Component.Name = 'DF DOAS HVAC'
ghenv.Component.NickName = 'DFDOASHVAC'
ghenv.Component.Message = '0.1.0'
ghenv.Component.Category = 'Dragonfly'
ghenv.Component.SubCategory = '3 :: Energy'
ghenv.Component.AdditionalHelpFromDocStrings = '3'

import uuid

try: # import the honeybee extension
from honeybee.altnumber import autosize
from honeybee.typing import clean_and_id_ep_string
from honeybee.model import Model
except ImportError as e:
raise ImportError('\nFailed to import honeybee:\n\t{}'.format(e))

try: # import the honeybee-energy extension
from honeybee_energy.hvac.doas import EQUIPMENT_TYPES_DICT
except ImportError as e:
raise ImportError('\nFailed to import honeybee_energy:\n\t{}'.format(e))

try: # import the core dragonfly dependencies
from dragonfly.building import Building
from dragonfly.story import Story
except ImportError as e:
raise ImportError('\nFailed to import dragonfly:\n\t{}'.format(e))

try: # import the dragonfly-energy extension
import dragonfly_energy
except ImportError as e:
raise ImportError('\nFailed to import dragonfly_energy energy:\n\t{}'.format(e))

try:
from ladybug_rhino.grasshopper import all_required_inputs
except ImportError as e:
raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

# dictionary to get correct vintages
vintages = {
'DOE Ref Pre-1980': 'DOE Ref Pre-1980',
'DOE Ref 1980-2004': 'DOE Ref 1980-2004',
'90.1-2004': '90.1-2004',
'90.1-2007': '90.1-2007',
'90.1-2010': '90.1-2010',
'90.1-2013': '90.1-2013',
'pre_1980': 'DOE Ref Pre-1980',
'1980_2004': 'DOE Ref 1980-2004',
'2004': '90.1-2004',
'2007': '90.1-2007',
'2010': '90.1-2010',
'2013': '90.1-2013',
None: '90.1-2013'
}

if all_required_inputs(ghenv.Component):
# duplicate the initial objects
df_objs = [obj.duplicate() for obj in _df_objs]

# create the instance of the HVAC system to be applied to the rooms
try: # get the class for the HVAC system
hvac_class = EQUIPMENT_TYPES_DICT[_system_type]
except KeyError:
raise ValueError('System Type "{}" is not recognized as an all-air HVAC '
'system.'.format(_system_type))
vintage = vintages[_vintage_] # get the vintage of the HVAC
# set default values for heat recovery
sens = sensible_hr_ if sensible_hr_ is not None else autosize
latent = latent_hr_ if latent_hr_ is not None else autosize
# get an identifier for the HVAC system
name = clean_and_id_ep_string(_name_) if _name_ is not None else str(uuid.uuid4())[:8]
hvac = hvac_class(name, vintage, _system_type, sens, latent)
if _name_ is not None:
hvac.display_name = _name_

# apply the HVAC system to the objects
for obj in df_objs:
if isinstance(obj, (Building, Story)):
obj.properties.energy.set_all_room_2d_hvac(hvac)
elif obj.properties.energy.is_conditioned: # assume it's a Room2D
obj.properties.energy.hvac = hvac
Loading

0 comments on commit 9898175

Please sign in to comment.