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

Revision history [back]

click to hide/show revision 1
initial version

Define scheduleRuleset by measure

Hi,

I'm defining a new scheduleRuleset and when I ask for the activeRuleIndices got an array of -1 and this error:

[utilities.time.Date] <1> Comparing Dates with improper base years

I've try using the year in the Date definition but I've got the same error.

This is the code I'm using:

scheduleRuleset = OpenStudio::Model::ScheduleRuleset.new(model)
scheduleDay     = OpenStudio::Model::ScheduleDay.new(model, 18.5)
scheduleRule    = OpenStudio::Model::ScheduleRule.new(scheduleRuleset, scheduleDay)
monthOfTheYear  = OpenStudio::MonthOfYear.new(1)
startDate       = OpenStudio::Date.new(monthOfTheYear, 1)
endDate         = OpenStudio::Date.new(monthOfTheYear, 7)

scheduleRule.setStartDate(startDate)
scheduleRule.setEndDate(endDate)
msg(f, "scheduleRule.ruleIndex: #{scheduleRule.ruleIndex}\n")
activeIndices = scheduleRuleset.getActiveRuleIndices(startDate, endDate)
msg(f, "#{activeIndices}\n")

The stdout sais 14 times:

[utilities.time.Date] <1> Comparing Dates with improper base years

And that's the output:

scheduleRule.ruleIndex: 0

[-1, -1, -1, -1, -1, -1, -1]

I've tried also defining the days like this:

startDate  = OpenStudio::Date.new(monthOfTheYear, 1, 2009)
endDate    = OpenStudio::Date.new(monthOfTheYear, 7, 2009)

But with the same result.

Is that the way to define a scheduleRuleset by measure?

How should I manage the year to avoid improper base year comparing dates?

Thanks in advance.

Define scheduleRuleset by measure

Hi,

I'm defining a new scheduleRuleset and when I ask for the activeRuleIndices got an array of -1 and this error:

[utilities.time.Date] <1> Comparing Dates with improper base years

I've try using the year in the Date definition but I've got the same error.

This is the code I'm using:

scheduleRuleset = OpenStudio::Model::ScheduleRuleset.new(model)
scheduleDay     = OpenStudio::Model::ScheduleDay.new(model, 18.5)
scheduleRule    = OpenStudio::Model::ScheduleRule.new(scheduleRuleset, scheduleDay)
monthOfTheYear  = OpenStudio::MonthOfYear.new(1)
startDate       = OpenStudio::Date.new(monthOfTheYear, 1)
endDate         = OpenStudio::Date.new(monthOfTheYear, 7)

scheduleRule.setStartDate(startDate)
scheduleRule.setEndDate(endDate)
msg(f, "scheduleRule.ruleIndex: #{scheduleRule.ruleIndex}\n")
activeIndices = scheduleRuleset.getActiveRuleIndices(startDate, endDate)
msg(f, "#{activeIndices}\n")

The stdout sais 14 times:

[utilities.time.Date] <1> Comparing Dates with improper base years

And that's the output:

scheduleRule.ruleIndex: 0

[-1, -1, -1, -1, -1, -1, -1]

I've tried also defining the days like this:

startDate  = OpenStudio::Date.new(monthOfTheYear, 1, 2009)
endDate    = OpenStudio::Date.new(monthOfTheYear, 7, 2009)

But with the same result.

Is that the way to define a scheduleRuleset by measure?

How should I manage the year to avoid improper base year comparing dates?

Thanks in advance.