Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

Looks like when a ScheduleRule is created, by default, it doesn't apply to any days of the week:

OS:Schedule:Rule,
  {ea8d5c2b-8374-4bc2-a856-09ff6929d7dc}, !- Handle
  Schedule Rule 1,                        !- Name
  {3a2377af-5752-4cff-9d44-3f7959130ccc}, !- Schedule Ruleset Name
  0,                                      !- Rule Order
  {219ae30c-5d3e-40db-af25-94c7365d0a73}, !- Day Schedule Name
  ,                                       !- Apply Sunday
  ,                                       !- Apply Monday
  ,                                       !- Apply Tuesday
  ,                                       !- Apply Wednesday
  ,                                       !- Apply Thursday
  ,                                       !- Apply Friday
  ,                                       !- Apply Saturday
  ,                                       !- Apply Holiday
  DateRange,                              !- Date Specification Type
  1,                                      !- Start Month
  1,                                      !- Start Day
  1,                                      !- End Month
  7;                                      !- End Day

So you need to tell it which days of the week it applies to like this:

scheduleRule.setApplyMonday(true)
scheduleRule.setApplyTuesday(true)
scheduleRule.setApplyWednesday(true)
scheduleRule.setApplyThursday(true)
scheduleRule.setApplyFriday(true)
scheduleRule.setApplySaturday(true)
scheduleRule.setApplySunday(true)

Once you do that, the ScheduleRule looks like this:

OS:Schedule:Rule,
  {ea8d5c2b-8374-4bc2-a856-09ff6929d7dc}, !- Handle
  Schedule Rule 1,                        !- Name
  {3a2377af-5752-4cff-9d44-3f7959130ccc}, !- Schedule Ruleset Name
  0,                                      !- Rule Order
  {219ae30c-5d3e-40db-af25-94c7365d0a73}, !- Day 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
  7;                                      !- End Day

and the result of your code looks like this:

scheduleRule.ruleIndex: 0
[0, 0, 0, 0, 0, 0, 0]

I don't know what the deal is with the messages about comparing dates, but I've been using code almost exactly like yours on models for a while and haven't seen any simulation issues.