Skip to content

Commit

Permalink
fix(load): Output None when the load value is zero
Browse files Browse the repository at this point in the history
This makes it a little easier to use when creating lots of programs at once.
  • Loading branch information
chriswmackey committed Aug 10, 2024
1 parent 32e3b6f commit 98d0c4f
Show file tree
Hide file tree
Showing 12 changed files with 33 additions and 24 deletions.
Binary file modified honeybee_grasshopper_energy/icon/HB Equipment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified honeybee_grasshopper_energy/icon/HB People.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified honeybee_grasshopper_energy/icon/HB Service Hot Water.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions honeybee_grasshopper_energy/json/HB_Equipment.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.8.0",
"version": "1.8.1",
"nickname": "Equipment",
"outputs": [
[
Expand Down Expand Up @@ -64,7 +64,7 @@
}
],
"subcategory": "3 :: Loads",
"code": "\ntry: # import the core honeybee dependencies\n from honeybee.typing import clean_and_id_ep_string, clean_ep_string\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.load.equipment import ElectricEquipment, GasEquipment\n from honeybee_energy.lib.schedules import schedule_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # make a default Equipment name if none is provided\n name = clean_and_id_ep_string('Equipment') if _name_ is None else \\\n clean_ep_string(_name_)\n\n # get the schedule\n if isinstance(_schedule, str):\n _schedule = schedule_by_identifier(_schedule)\n\n # get default radiant, latent, and lost fractions\n radiant_fract_ = radiant_fract_ if radiant_fract_ is not None else 0.0\n latent_fract_ = latent_fract_ if latent_fract_ is not None else 0.0\n lost_fract_ = lost_fract_ if lost_fract_ is not None else 0.0\n\n # create the Equipment object\n if gas_:\n equip = GasEquipment(name, _watts_per_area, _schedule,\n radiant_fract_, latent_fract_, lost_fract_)\n else:\n equip = ElectricEquipment(name, _watts_per_area, _schedule,\n radiant_fract_, latent_fract_, lost_fract_)\n if _name_ is not None:\n equip.display_name = _name_",
"code": "\ntry: # import the core honeybee dependencies\n from honeybee.typing import clean_and_id_ep_string, clean_ep_string\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.load.equipment import ElectricEquipment, GasEquipment\n from honeybee_energy.lib.schedules import schedule_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # make a default Equipment name if none is provided\n name = clean_and_id_ep_string('Equipment') if _name_ is None else \\\n clean_ep_string(_name_)\n\n # get the schedule\n if isinstance(_schedule, str):\n _schedule = schedule_by_identifier(_schedule)\n\n # get default radiant, latent, and lost fractions\n radiant_fract_ = radiant_fract_ if radiant_fract_ is not None else 0.0\n latent_fract_ = latent_fract_ if latent_fract_ is not None else 0.0\n lost_fract_ = lost_fract_ if lost_fract_ is not None else 0.0\n\n # create the Equipment object\n if _watts_per_area == 0:\n equip = None\n else:\n if gas_:\n equip = GasEquipment(name, _watts_per_area, _schedule,\n radiant_fract_, latent_fract_, lost_fract_)\n else:\n equip = ElectricEquipment(name, _watts_per_area, _schedule,\n radiant_fract_, latent_fract_, lost_fract_)\n if _name_ is not None:\n equip.display_name = _name_",
"category": "HB-Energy",
"name": "HB Equipment",
"description": "Create an Equipment object that can be used to specify equipment usage in a ProgramType.\n-"
Expand Down
4 changes: 2 additions & 2 deletions honeybee_grasshopper_energy/json/HB_People.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.8.0",
"version": "1.8.1",
"nickname": "People",
"outputs": [
[
Expand Down Expand Up @@ -50,7 +50,7 @@
}
],
"subcategory": "3 :: Loads",
"code": "\ntry: # import the core honeybee dependencies\n from honeybee.typing import clean_and_id_ep_string, clean_ep_string\n from honeybee.altnumber import autocalculate\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.load.people import People\n from honeybee_energy.lib.schedules import schedule_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # make a default People name if none is provided\n name = clean_and_id_ep_string('People') if _name_ is None else \\\n clean_ep_string(_name_)\n latent = autocalculate if latent_fraction_ is None else latent_fraction_\n\n # get the schedules\n if isinstance(_occupancy_sch, str):\n _occupancy_sch = schedule_by_identifier(_occupancy_sch)\n if isinstance(_activity_sch_, str):\n _activity_sch_ = schedule_by_identifier(_activity_sch_)\n\n # create the People object\n people = People(name, _ppl_per_area, _occupancy_sch, _activity_sch_,\n latent_fraction=latent)\n if _name_ is not None:\n people.display_name = _name_\n",
"code": "\ntry: # import the core honeybee dependencies\n from honeybee.typing import clean_and_id_ep_string, clean_ep_string\n from honeybee.altnumber import autocalculate\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.load.people import People\n from honeybee_energy.lib.schedules import schedule_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # make a default People name if none is provided\n name = clean_and_id_ep_string('People') if _name_ is None else \\\n clean_ep_string(_name_)\n latent = autocalculate if latent_fraction_ is None else latent_fraction_\n\n # get the schedules\n if isinstance(_occupancy_sch, str):\n _occupancy_sch = schedule_by_identifier(_occupancy_sch)\n if isinstance(_activity_sch_, str):\n _activity_sch_ = schedule_by_identifier(_activity_sch_)\n\n # create the People object\n if _ppl_per_area == 0:\n people = None\n else:\n people = People(name, _ppl_per_area, _occupancy_sch, _activity_sch_,\n latent_fraction=latent)\n if _name_ is not None:\n people.display_name = _name_\n",
"category": "HB-Energy",
"name": "HB People",
"description": "Create a People object that can be used to create a ProgramType or be assigned\ndirectly to a Room.\n-"
Expand Down
4 changes: 2 additions & 2 deletions honeybee_grasshopper_energy/json/HB_Service_Hot_Water.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.8.0",
"version": "1.8.1",
"nickname": "ServiceHotWater",
"outputs": [
[
Expand Down Expand Up @@ -57,7 +57,7 @@
}
],
"subcategory": "3 :: Loads",
"code": "\ntry: # import the core honeybee dependencies\n from honeybee.typing import clean_and_id_ep_string, clean_ep_string\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.load.hotwater import ServiceHotWater\n from honeybee_energy.lib.schedules import schedule_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # make a default ServiceHotWater name if none is provided\n name = clean_and_id_ep_string('ServiceHotWater') if _name_ is None else \\\n clean_ep_string(_name_)\n\n # get the schedule\n if isinstance(_schedule, str):\n _schedule = schedule_by_identifier(_schedule)\n\n # get default radiant, latent, and lost fractions\n _target_temp_ = _target_temp_ if _target_temp_ is not None else 60\n _sensible_fract_ = _sensible_fract_ if _sensible_fract_ is not None else 0.2\n _latent_fract_ = _latent_fract_ if _latent_fract_ is not None else 0.05\n\n # create the ServiceHotWater object\n hot_water = ServiceHotWater(name, _flow_per_area, _schedule, _target_temp_,\n _sensible_fract_, _latent_fract_)\n if _name_ is not None:\n hot_water.display_name = _name_",
"code": "\ntry: # import the core honeybee dependencies\n from honeybee.typing import clean_and_id_ep_string, clean_ep_string\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\ntry:\n from honeybee_energy.load.hotwater import ServiceHotWater\n from honeybee_energy.lib.schedules import schedule_by_identifier\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee_energy:\\n\\t{}'.format(e))\n\ntry:\n from ladybug_{{cad}}.{{plugin}} import all_required_inputs\nexcept ImportError as e:\n raise ImportError('\\nFailed to import ladybug_{{cad}}:\\n\\t{}'.format(e))\n\n\nif all_required_inputs(ghenv.Component):\n # make a default ServiceHotWater name if none is provided\n name = clean_and_id_ep_string('ServiceHotWater') if _name_ is None else \\\n clean_ep_string(_name_)\n\n # get the schedule\n if isinstance(_schedule, str):\n _schedule = schedule_by_identifier(_schedule)\n\n # get default radiant, latent, and lost fractions\n _target_temp_ = _target_temp_ if _target_temp_ is not None else 60\n _sensible_fract_ = _sensible_fract_ if _sensible_fract_ is not None else 0.2\n _latent_fract_ = _latent_fract_ if _latent_fract_ is not None else 0.05\n\n # create the ServiceHotWater object\n if _flow_per_area == 0:\n hot_water = None\n else:\n hot_water = ServiceHotWater(name, _flow_per_area, _schedule, _target_temp_,\n _sensible_fract_, _latent_fract_)\n if _name_ is not None:\n hot_water.display_name = _name_",
"category": "HB-Energy",
"name": "HB Service Hot Water",
"description": "Create an ServiceHotWater object that can be used to specify hot water usage in\na ProgramType.\n-"
Expand Down
19 changes: 11 additions & 8 deletions honeybee_grasshopper_energy/src/HB Equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

ghenv.Component.Name = 'HB Equipment'
ghenv.Component.NickName = 'Equipment'
ghenv.Component.Message = '1.8.0'
ghenv.Component.Message = '1.8.1'
ghenv.Component.Category = 'HB-Energy'
ghenv.Component.SubCategory = '3 :: Loads'
ghenv.Component.AdditionalHelpFromDocStrings = '3'
Expand Down Expand Up @@ -75,11 +75,14 @@
lost_fract_ = lost_fract_ if lost_fract_ is not None else 0.0

# create the Equipment object
if gas_:
equip = GasEquipment(name, _watts_per_area, _schedule,
radiant_fract_, latent_fract_, lost_fract_)
if _watts_per_area == 0:
equip = None
else:
equip = ElectricEquipment(name, _watts_per_area, _schedule,
radiant_fract_, latent_fract_, lost_fract_)
if _name_ is not None:
equip.display_name = _name_
if gas_:
equip = GasEquipment(name, _watts_per_area, _schedule,
radiant_fract_, latent_fract_, lost_fract_)
else:
equip = ElectricEquipment(name, _watts_per_area, _schedule,
radiant_fract_, latent_fract_, lost_fract_)
if _name_ is not None:
equip.display_name = _name_
13 changes: 8 additions & 5 deletions honeybee_grasshopper_energy/src/HB People.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

ghenv.Component.Name = "HB People"
ghenv.Component.NickName = 'People'
ghenv.Component.Message = '1.8.0'
ghenv.Component.Message = '1.8.1'
ghenv.Component.Category = 'HB-Energy'
ghenv.Component.SubCategory = '3 :: Loads'
ghenv.Component.AdditionalHelpFromDocStrings = "3"
Expand Down Expand Up @@ -79,7 +79,10 @@
_activity_sch_ = schedule_by_identifier(_activity_sch_)

# create the People object
people = People(name, _ppl_per_area, _occupancy_sch, _activity_sch_,
latent_fraction=latent)
if _name_ is not None:
people.display_name = _name_
if _ppl_per_area == 0:
people = None
else:
people = People(name, _ppl_per_area, _occupancy_sch, _activity_sch_,
latent_fraction=latent)
if _name_ is not None:
people.display_name = _name_
13 changes: 8 additions & 5 deletions honeybee_grasshopper_energy/src/HB Service Hot Water.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

ghenv.Component.Name = 'HB Service Hot Water'
ghenv.Component.NickName = 'ServiceHotWater'
ghenv.Component.Message = '1.8.0'
ghenv.Component.Message = '1.8.1'
ghenv.Component.Category = 'HB-Energy'
ghenv.Component.SubCategory = '3 :: Loads'
ghenv.Component.AdditionalHelpFromDocStrings = '3'
Expand Down Expand Up @@ -75,7 +75,10 @@
_latent_fract_ = _latent_fract_ if _latent_fract_ is not None else 0.05

# create the ServiceHotWater object
hot_water = ServiceHotWater(name, _flow_per_area, _schedule, _target_temp_,
_sensible_fract_, _latent_fract_)
if _name_ is not None:
hot_water.display_name = _name_
if _flow_per_area == 0:
hot_water = None
else:
hot_water = ServiceHotWater(name, _flow_per_area, _schedule, _target_temp_,
_sensible_fract_, _latent_fract_)
if _name_ is not None:
hot_water.display_name = _name_
Binary file modified honeybee_grasshopper_energy/user_objects/HB Equipment.ghuser
Binary file not shown.
Binary file modified honeybee_grasshopper_energy/user_objects/HB People.ghuser
Binary file not shown.
Binary file not shown.

0 comments on commit 98d0c4f

Please sign in to comment.