Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Holidays in OpenStudio SDK #3783

Closed
tanushree04 opened this issue Nov 25, 2019 · 4 comments · Fixed by #3814
Closed

Support Holidays in OpenStudio SDK #3783

tanushree04 opened this issue Nov 25, 2019 · 4 comments · Fixed by #3814

Comments

@tanushree04
Copy link
Collaborator

  • Add method to setApplyHoliday for ScheduleRule and add its forward translation to IDF.
  • Implement method to add start date, duration and setSpecialDayType for Holiday in the RunPeriodControlSpecialDays and add forward translation to IDF.

Issue submitted previously for supporting holidays in schedule GUI : #1382

@joseph-robertson
Copy link
Collaborator

joseph-robertson commented Dec 10, 2019

Anyone know of any idf files that show use of holiday schedules?

Here's what I'm thinking in terms of implementation (add a new Holiday Schedule Name field):

OS:Schedule:Rule,
  {6b1b58f5-ac28-4802-a811-73fcf78efe8c}, !- Handle
  res heating setpoint allday rule1,      !- Name
  {b1754556-50bc-49d3-b36d-4aca10adb40f}, !- Schedule Ruleset Name
  11,                                     !- Rule Order
  {2916afa2-bf7e-4daf-8014-1822bd8043d6}, !- Day Schedule Name
  {4233afa2-c84e-4daf-8014-182097sdf3d4}, !- Holiday Schedule Name 
  Yes,                                    !- Apply Sunday
  Yes,                                    !- Apply Monday
  Yes,                                    !- Apply Tuesday
  Yes,                                    !- Apply Wednesday
  Yes,                                    !- Apply Thursday
  Yes,                                    !- Apply Friday
  Yes,                                    !- Apply Saturday
  ,                                       !- Apply Holiday
  DateRange,                              !- Date Specification Type
  1,                                      !- Start Month
  1,                                      !- Start Day
  1,                                      !- End Month
  31;                                     !- End Day

OS:Schedule:Day,
  {2916afa2-bf7e-4daf-8014-1822bd8043d6}, !- Handle
  res heating setpoint allday1,           !- Name
  {5ff99a34-50b7-4beb-a81f-909216c4ac6b}, !- Schedule Type Limits Name
  ,                                       !- Interpolate to Timestep
  24,                                     !- Hour 1
  0,                                      !- Minute 1
  21.6666666666667;                       !- Value Until Time 1

OS:Schedule:Day,
  {4233afa2-c84e-4daf-8014-182097sdf3d4}, !- Handle
  res heating setpoint holiday1,          !- Name
  {5ff99a34-50b7-4beb-a81f-909216c4ac6b}, !- Schedule Type Limits Name
  ,                                       !- Interpolate to Timestep
  24,                                     !- Hour 1
  0,                                      !- Minute 1
  21.6666666666667;                       !- Value Until Time 1

Would we need the Apply Holiday field anymore in the Schedule:Rule object if Holiday Schedule Name existed (blank for "apply holiday = no" and populated for "apply holiday = yes")?

Then we would forward translate from the ScheduleRuleset object, populating the Holiday Schedule:Day Name fields for each Schedule:Week:Daily object.

The ScheduleRuleset object would have an additional getHolidaySchedules(startDate, endDate) method on it.

@kbenne @jmarrec @shorowit

@jmarrec
Copy link
Collaborator

jmarrec commented Dec 11, 2019

$ cd /usr/local/EnergyPlus-9-2-0/ExampleFiles && grep -l "Holiday Schedule" *

1ZoneUncontrolledCondFDWithVariableKat24C.idf
ASHRAE9012016_Warehouse_Denver.idf
HAMT_DailyProfileReport.idf
HAMT_HourlyProfileReport.idf
HybridModel_4Zone_Solve_Infiltration_free_floating.idf
HybridModel_4Zone_Solve_PeopleCount_with_HVAC.idf

@jmarrec
Copy link
Collaborator

jmarrec commented Dec 11, 2019

Note: This is not what I'm recommending anymore, but I'm leaving it because the thought process is important for the dicussion

I would advise to keep the current IDD form for Schedule:Rule, just add getter/setters for "Apply Holiday", then handle that in FT. It seems more consistent with the rest of the rules and the E+ object itself. THe Schedule:Rule is meant to represent a given daily schedule and to apply that to any days appropriate, so having it bear two schedules seems weird to me.

Keeping it as is means you could both:

  • Create a single schedule to apply for both weekends and holidays (eg: Office building occupancy)
  • You could also create a single rule specifically for Holidays and apply that to all year, and have no other rules apply to holiday.

For the GUI side, adding an "Apply Holiday" button to the OS App would be easy, visualizing the applicability of a Holiday rule slightly more complicated since you'd have to parse the EPW to get Holidays.


Then the trick is to make the FT work... I originally thought it wouldn't be that bad.

weekSchedule->holidayDaySchedule = holidayDaySchedule.name().get();

Around here you could leverage index = ScheduleRuleset::getActiveRuleIndices(date, date)[0] then use rule = ScheduleRuleset::scheduleRules[index] and check if rule.applyHolidays, if so populate the field with rule.daySchedule

The problem is that the ScheduleRule has a start and end date, and potentially you could end up with two different ScheduleRule that have applyHoliday==true in the same week

@jmarrec
Copy link
Collaborator

jmarrec commented Dec 11, 2019

My recommendation

Instead, my recommendation is to add it to the ScheduleRuleset directly, similar to how we treat winter/summer design day schedules

This would incur a slight loss of functionality in the sense that you couldn't define different profiles for example for winter versus summer holidays, but I don't think anyone actually wants that (and if they do they can still tediously create appropriate ScheduleRules...).

In the OS App, here's a mockup:

image

The FT would be really simple: always fill the ScheduleWeek's holiday day with that schedule, similar to

ScheduleDay winterDesignDaySchedule = modelObject.winterDesignDaySchedule();

ScheduleDay holidayDaySchedule = modelObject.holidaySchedule()

ScheduleDay ScheduleRuleset::holidaySchedule() would return the defaultDaySchedule if not explicitly set, like winterDesignDaySchedule() and summerDesignDaySchedule().

I guess an alternative is to do boost::optional<ScheduleDay> ScheduleRuleset::holidaySchedule() and only fill each ScheduleWeek's Holiday Schedule if there's one to be used, meaning the ScheduleRule's schedule would take precedence over the ScheduleRuleset's defaultDaySchedule. I actually think this makes more sense, but it would change the current behavior (ScheduleRuleset::defaultDaySchedule is used all the time currently)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants