honeybee_energy.schedule.rule module

Object storing rules for how a given ScheduleDay gets applied over a year.

class honeybee_energy.schedule.rule.ScheduleRule(schedule_day, apply_sunday=False, apply_monday=False, apply_tuesday=False, apply_wednesday=False, apply_thursday=False, apply_friday=False, apply_saturday=False, start_date=None, end_date=None)[source]

Bases: object

Schedule rule including a ScheduleDay and when it should be applied.

Note that a ScheduleRule cannot be assigned to Rooms, Shades, etc. The ScheduleRule must be added to a ScheduleRuleset and then the ScheduleRuleset can be applied to such objects.

Parameters:
  • schedule_day – A ScheduleDay object associated with this rule.

  • apply_sunday – Boolean noting whether to apply schedule_day on Sundays.

  • apply_monday – Boolean noting whether to apply schedule_day on Mondays.

  • apply_tuesday – Boolean noting whether to apply schedule_day on Tuesdays.

  • apply_wednesday – Boolean noting whether to apply schedule_day on Wednesdays.

  • apply_thursday – Boolean noting whether to apply schedule_day on Thursdays.

  • apply_friday – Boolean noting whether to apply schedule_day on Fridays.

  • apply_saturday – Boolean noting whether to apply schedule_day on Saturdays.

  • start_date – A ladybug Date object for the start of the period over which the schedule_day will be applied. If None, Jan 1 will be used.

  • end_date – A ladybug Date object for the end of the period over which the schedule_day will be applied. If None, Dec 31 will be used.

Properties:
  • schedule_day

  • apply_sunday

  • apply_monday

  • apply_tuesday

  • apply_wednesday

  • apply_thursday

  • apply_friday

  • apply_saturday

  • start_date

  • end_date

  • apply_weekday

  • apply_weekend

  • apply_all

  • days_applied

  • week_apply_tuple

  • is_reversed

ToString()[source]

Overwrite .NET ToString.

apply_day_by_dow(dow)[source]

Set the rule to apply to the day of the week by its dow integer.

Parameters:

week_day_index

An integer from 1-8 for the day of the week. Values correspond to the following:

1 - Sunday 2 - Monday 3 - Tuesday 4 - Wednesday 5 - Thursday 6 - Friday 7 - Saturday

apply_day_by_name(day_name)[source]

Set the rule to apply to the day of the week by its name.

Parameters:

day_name – A text string for the day on which this rule should be applied. The following options are acceptable: ‘sunday’, ‘monday’, ‘tuesday’, ‘wednesday’, ‘thursday’, ‘friday’, ‘saturday’, ‘weekday’, ‘weekend’, ‘all’

does_rule_apply(doy, dow=None)[source]

Check if this rule applies to a given day of the year and day of the week.

Parameters:
  • doy – An integer between 1 anf 365 for the day of the year to test.

  • dow – An integer between 1 anf 7 for the day of the week to test. If None, this value will be derived from the doy, assuming the first day of the year is a Sunday.

does_rule_apply_doy(doy)[source]

Check if this rule applies to a given day of the year.

Parameters:

doy – An integer between 1 anf 365 for the day of the year to test.

does_rule_apply_doy_leap_year(doy)[source]

Check if this rule applies to a given day of a leap year.

Parameters:

doy – An integer between 1 anf 366 for the day of the leap year to test.

does_rule_apply_leap_year(doy, dow=None)[source]

Check if this rule applies to a given day of a leap year and day of the week.

Parameters:
  • doy – An integer between 1 anf 366 for the day of the leap year to test.

  • dow – An integer between 1 anf 7 for the day of the week to test. If None, this value will be derived from the doy, assuming the first day of the year is a Sunday.

duplicate()[source]

Get a copy of this object.

static extract_all_from_schedule_week(week_idf_string, day_schedule_dict, start_date=None, end_date=None)[source]

Extract all ScheduleRule objects from an IDF string of a Schedule:Week.

Parameters:
  • week_idf_string – A text string fully describing an EnergyPlus Schedule:Week:Daily or Schedule:Week:Compact.

  • day_schedule_dict – A dictionary with the identifiers of ScheduleDay objects as keys and the corresponding ScheduleDay objects as values. These objects will be used to build the ScheduleRules using the week_idf_string.

  • start_date – A ladybug Date object for the start of the period over which the ScheduleRules apply. If None, Jan 1 will be used.

  • end_date – A ladybug Date object for the end of the period over which the ScheduleRules apply. If None, Dec 31 will be used.

Returns:

schedule_rules – A list of ScheduleRule objects that together describe the Schedule:Week.

classmethod from_days_applied(schedule_day, applicable_days=None, start_date=None, end_date=None)[source]

Initialize a ScheduleRule using a list of days when the rule is applied.

Parameters:
  • schedule_day – A ScheduleDay object associated with this rule.

  • applicable_days – A list of text strings for the days when theScheduleRule will be applied. For example [‘monday’, ‘weekend’]. The following options are acceptable: ‘sunday’, ‘monday’, ‘tuesday’, ‘wednesday’, ‘thursday’, ‘friday’, ‘saturday’, ‘weekday’, ‘weekend’, ‘all’

  • start_date – A ladybug Date object for the start of the period over which the schedule_day will be applied. If None, Jan 1 will be used.

  • end_date – A ladybug Date object for the end of the period over which the schedule_day will be applied. If None, Dec 31 will be used.

classmethod from_dict(data)[source]

Create a ScheduleRule from a dictionary.

Parameters:

data – ScheduleRule dictionary following the format below.

{
"type": 'ScheduleRule'
"schedule_day": {
    "type": 'ScheduleDay',
    "identifier": 'Office Occupancy',
    "values": [0, 1, 0],
    "times": [(0, 0), (9, 0), (17, 0)],
    "interpolate": False
    },
"apply_sunday": False,
"apply_monday": True,
"apply_tuesday": True,
"apply_wednesday": True,
"apply_thursday": True,
"apply_friday": True,
"apply_saturday": False,
"start_date": (1, 1),
"end_date": (12, 31)
}
classmethod from_dict_abridged(data, schedule_day)[source]

Create a ScheduleRule object from an abridged dictionary.

Parameters:
  • data – A ScheduleRuleAbridged dictionary in following the format below.

  • schedule_day – A honeybee ScheduleDay object that will be assigned to this ScheduleRule.

{
"type": 'ScheduleRuleAbridged',
"schedule_day": str,
"apply_sunday": False,
"apply_monday": True,
"apply_tuesday": True,
"apply_wednesday": True,
"apply_thursday": True,
"apply_friday": True,
"apply_saturday": False,
"start_date": (1, 1),
"end_date": (12, 31)
}
lock()[source]

The lock() method will also lock the schedule_day.

to_dict(abridged=False)[source]

ScheduleRule dictionary representation.

Parameters:

abridged – Boolean to note whether the full dictionary describing the object should be returned (False) or just an abridged version (True), which only specifies the identifier of the schedule_day. Default: False.

unlock()[source]

The unlock() method will also unlock the schedule_day.

property apply_all

Get or set a boolean noting whether to apply schedule_day on all days.

property apply_friday

Get or set a boolean noting whether to apply schedule_day on Fridays.

property apply_monday

Get or set a boolean noting whether to apply schedule_day on Mondays.

property apply_saturday

Get or set a boolean noting whether to apply schedule_day on Saturdays.

property apply_sunday

Get or set a boolean noting whether to apply schedule_day on Sundays.

property apply_thursday

Get or set a boolean noting whether to apply schedule_day on Thursdays.

property apply_tuesday

Get or set a boolean noting whether to apply schedule_day on Tuesdays.

property apply_wednesday

Get or set a boolean noting whether to apply schedule_day on Wednesdays.

property apply_weekday

Get or set a boolean noting whether to apply schedule_day on week days.

property apply_weekend

Get or set a boolean noting whether to apply schedule_day on weekends.

property days_applied

Get a list of text values for the days applied.

property end_date

Get or set a ladybug Date object for the end of the period.

property is_reversed

A property to note whether the start date is after the end date.

This indicates that the rule applies through the end of the year into the start of the year.

property schedule_day

Get or set the ScheduleDay object associated with this rule..

property start_date

Get or set a ladybug Date object for the start of the period.

property week_apply_tuple

Get a tuple of 7 booleans for each of the days of the week.