Skip to content

Commit

Permalink
fix(schedule): Fix typo in season schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Mar 20, 2024
1 parent 9d96dcd commit fb74d14
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Binary file modified honeybee_grasshopper_energy/icon/HB Seasonal Schedule.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_Seasonal_Schedule.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.7.0",
"version": "1.7.1",
"nickname": "SeasonalSchedule",
"outputs": [
[
Expand Down Expand Up @@ -78,7 +78,7 @@
}
],
"subcategory": "2 :: Schedules",
"code": "\ntry: # import the core honeybee dependencies\n from ladybug.dt import Date\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\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: # import the honeybee-energy dependencies\n from honeybee_energy.schedule.day import ScheduleDay\n from honeybee_energy.schedule.ruleset import ScheduleRuleset\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: # import ladybug_{{cad}} dependencies\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 # check that the input _season_scheds align with the _analysis_periods\n assert len(_season_scheds) == len(_analysis_periods), \\\n 'Length of the _season_scheds list must match that of the _analysis_periods.' \\\n '\\n{} does not equal {}'.format(len(_season_scheds), len(_analysis_periods))\n\n # start by duplicating the base schedule\n name = clean_and_id_ep_string('SeasonalSchedule') if _name_ is None else \\\n clean_ep_string(_name_)\n if isinstance(_base_schedule, str):\n _base_schedule = schedule_by_identifier(_base_schedule)\n schedule = _base_schedule.duplicate()\n schedule.identifier = name\n if _name_ is not None:\n schedule.display_name = _name_\n\n # translate the _season_scheds to individual Rules and apply them to the base\n for season_sch, a_period in zip(_season_scheds, _analysis_periods):\n if isinstance(season_sch, str):\n season_sch = schedule_by_identifier(season_sch)\n if a_period.is_reversed:\n season_rules = season_sch.to_rules(Date(1, 1), a_period.end_time.date) + \\\n season_sch.to_rules(a_period.st_time.date, Date(12, 31))\n else:\n season_rules = season_sch.to_rules(\n a_period.st_time.date, a_period.end_time.date)\n for rule in reversed(season_rules): # preserve priority order of rules\n schedule.add_rule(rule)\n\n # apply the summer and winter design days if specified\n if len(_summer_des_) != 0:\n s_vals = [_summer_des_[0]] * 24 if len(_summer_des_) == 1 else _summer_des_\n s_id = '{}_SmrDsn'.format(schedule.identifier)\n s_day = ScheduleDay.from_values_at_timestep(s_id, s_vals)\n schedule.summer_designday_schedule = s_day\n if len(_winter_des_) != 0:\n w_vals = [_winter_des_[0]] * 24 if len(_winter_des_) == 1 else _winter_des_\n w_id = '{}_WntrDsn'.format(schedule.identifier)\n w_day = ScheduleDay.from_values_at_timestep(s_id, s_vals)\n schedule.winter_designday_schedule = w_day\n\n # get the idf strings of the schedule\n idf_year, idf_week = schedule.to_idf()\n idf_days = [day_sch.to_idf(schedule.schedule_type_limit)\n for day_sch in schedule.day_schedules]\n",
"code": "\ntry: # import the core honeybee dependencies\n from ladybug.dt import Date\nexcept ImportError as e:\n raise ImportError('\\nFailed to import honeybee:\\n\\t{}'.format(e))\n\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: # import the honeybee-energy dependencies\n from honeybee_energy.schedule.day import ScheduleDay\n from honeybee_energy.schedule.ruleset import ScheduleRuleset\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: # import ladybug_{{cad}} dependencies\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 # check that the input _season_scheds align with the _analysis_periods\n assert len(_season_scheds) == len(_analysis_periods), \\\n 'Length of the _season_scheds list must match that of the _analysis_periods.' \\\n '\\n{} does not equal {}'.format(len(_season_scheds), len(_analysis_periods))\n\n # start by duplicating the base schedule\n name = clean_and_id_ep_string('SeasonalSchedule') if _name_ is None else \\\n clean_ep_string(_name_)\n if isinstance(_base_schedule, str):\n _base_schedule = schedule_by_identifier(_base_schedule)\n schedule = _base_schedule.duplicate()\n schedule.identifier = name\n if _name_ is not None:\n schedule.display_name = _name_\n\n # translate the _season_scheds to individual Rules and apply them to the base\n for season_sch, a_period in zip(_season_scheds, _analysis_periods):\n if isinstance(season_sch, str):\n season_sch = schedule_by_identifier(season_sch)\n if a_period.is_reversed:\n season_rules = season_sch.to_rules(Date(1, 1), a_period.end_time.date) + \\\n season_sch.to_rules(a_period.st_time.date, Date(12, 31))\n else:\n season_rules = season_sch.to_rules(\n a_period.st_time.date, a_period.end_time.date)\n for rule in reversed(season_rules): # preserve priority order of rules\n schedule.add_rule(rule)\n\n # apply the summer and winter design days if specified\n if len(_summer_des_) != 0:\n s_vals = [_summer_des_[0]] * 24 if len(_summer_des_) == 1 else _summer_des_\n s_id = '{}_SmrDsn'.format(schedule.identifier)\n s_day = ScheduleDay.from_values_at_timestep(s_id, s_vals)\n schedule.summer_designday_schedule = s_day\n if len(_winter_des_) != 0:\n w_vals = [_winter_des_[0]] * 24 if len(_winter_des_) == 1 else _winter_des_\n w_id = '{}_WntrDsn'.format(schedule.identifier)\n w_day = ScheduleDay.from_values_at_timestep(w_id, w_vals)\n schedule.winter_designday_schedule = w_day\n\n # get the idf strings of the schedule\n idf_year, idf_week = schedule.to_idf()\n idf_days = [day_sch.to_idf(schedule.schedule_type_limit)\n for day_sch in schedule.day_schedules]\n",
"category": "HB-Energy",
"name": "HB Seasonal Schedule",
"description": "Create a schedule using from other ScheduleRulesets and AnalysisPeriods over which\neach schedule should be applied.\n-"
Expand Down
4 changes: 2 additions & 2 deletions honeybee_grasshopper_energy/src/HB Seasonal Schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@

ghenv.Component.Name = "HB Seasonal Schedule"
ghenv.Component.NickName = 'SeasonalSchedule'
ghenv.Component.Message = '1.7.0'
ghenv.Component.Message = '1.7.1'
ghenv.Component.Category = 'HB-Energy'
ghenv.Component.SubCategory = '2 :: Schedules'
ghenv.Component.AdditionalHelpFromDocStrings = "4"
Expand Down Expand Up @@ -131,7 +131,7 @@
if len(_winter_des_) != 0:
w_vals = [_winter_des_[0]] * 24 if len(_winter_des_) == 1 else _winter_des_
w_id = '{}_WntrDsn'.format(schedule.identifier)
w_day = ScheduleDay.from_values_at_timestep(s_id, s_vals)
w_day = ScheduleDay.from_values_at_timestep(w_id, w_vals)
schedule.winter_designday_schedule = w_day

# get the idf strings of the schedule
Expand Down
Binary file not shown.

0 comments on commit fb74d14

Please sign in to comment.