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

Best method for creating a ScheduleRule

asked 2016-05-31 16:30:29 -0500

updated 2016-05-31 19:00:43 -0500

When creating a schedule via ruby scripts, I create a new ScheduleRuleset object ruleset , then create a ScheduleDay object scheduleDay and finally create the associated ScheduleRule as:

rule =, scheduleDay)

This works just fine but (as indicated in the documentation) the ScheduleDay object is cloned and the new object is associated with the rule. Practically this is fine and the ruleset is created as expected but it leaves these orphaned ScheduleDay objects in the OSM.

My question is, is there a (non-hacky) way to create the ScheduleRules without polluting the OSM with a bunch of unused ScheduleDay objects? Or alternatively, if I create the rule without the ScheduleDay and a new ScheduleDay object is created, how do I access it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-05-31 21:30:44 -0500

updated 2016-05-31 21:45:35 -0500

The ScheduleRule API was designed to disallow sharing of DaySchedules. So if you create the DaySchedule first and pass it in, you will have to delete the original yourself. If you use the other constructor (with a ScheduleRuleset but not ScheduleDay) the ScheduleRule will construct its own ScheduleDay. You can get that from the ScheduleRule later and modify it.

edit flag offensive delete link more


Thanks @macumber. How does one access the ScheduleDay that the rule constructs? In the method list for ScheduleRule I'm not seeing a straight forward way to do so; is it necessary to call children() and search for the ScheduleDay?

Sam Currie's avatar Sam Currie  ( 2016-06-01 16:26:03 -0500 )edit
macumber's avatar macumber  ( 2016-06-01 16:50:44 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops


Question Tools

1 follower


Asked: 2016-05-31 16:30:29 -0500

Seen: 176 times

Last updated: May 31 '16