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

Revision history [back]

pip install openstudio. Make sure you use python 3.7, 3.8 or 3.9, see the OpenStudio SDK Python Binding Version Compatibility Matrix

Then it's a matter of using the SDK to modify the schedule. Depends which schedule type is used (eg: ScheduleRuleset).

A short example:

In [1]: import openstudio

In [2]: openstudio.openStudioLongVersion()
Out[2]: '3.6.1+bb9481519e'

In [3]: m = openstudio.model.exampleModel()

In [4]: sch_ruleset = m.getScheduleRulesets()[0]
   ...: print(sch_ruleset)
OS:Schedule:Ruleset,
  {759b60e6-ce95-4ff3-8400-2162e0d007be}, !- Handle
  Medium Office Cooling Setpoint Schedule, !- Name
  {1f748523-f5e7-4388-8c2d-3aed545795c2}, !- Schedule Type Limits Name
  {91357986-488a-469e-8dca-cd87a7647e4b}, !- Default Day Schedule Name
  {d651ceae-2f44-465b-9617-554befb57e9b}; !- Summer Design Day Schedule Name


In [5]: sch_day = sch_ruleset.defaultDaySchedule()
   ...: print(sch_day)
OS:Schedule:Day,
  {91357986-488a-469e-8dca-cd87a7647e4b}, !- Handle
  Medium Office Cooling Setpoint All Other Days Schedule, !- Name
  {1f748523-f5e7-4388-8c2d-3aed545795c2}, !- Schedule Type Limits Name
  ,                                       !- Interpolate to Timestep
  24,                                     !- Hour 1
  0,                                      !- Minute 1
  26.7;                                   !- Value Until Time 1



In [6]: sch_day.clearExtensibleGroups()
   ...: sch_day.addValue(openstudio.Time(0, 12, 0), 18)
   ...: sch_day.addValue(openstudio.Time(0, 16, 0), 20)
   ...: sch_day.addValue(openstudio.Time(0, 24, 0), 18)

In [7]: print(sch_day)
OS:Schedule:Day,
  {91357986-488a-469e-8dca-cd87a7647e4b}, !- Handle
  Medium Office Cooling Setpoint All Other Days Schedule, !- Name
  {1f748523-f5e7-4388-8c2d-3aed545795c2}, !- Schedule Type Limits Name
  ,                                       !- Interpolate to Timestep
  12,                                     !- Hour 1
  0,                                      !- Minute 1
  18,                                     !- Value Until Time 1
  16,                                     !- Hour 2
  0,                                      !- Minute 2
  20,                                     !- Value Until Time 2
  24,                                     !- Hour 3
  0,                                      !- Minute 3
  18;                                     !- Value Until Time 3

pip install openstudio. Make sure you use python 3.7, 3.8 or 3.9, 3.7 to 3.10, see the OpenStudio SDK Python Binding Version Compatibility Matrix

Then it's a matter of using the SDK to modify the schedule. Depends which schedule type is used (eg: ScheduleRuleset).

A short example:

In [1]: import openstudio

In [2]: openstudio.openStudioLongVersion()
Out[2]: '3.6.1+bb9481519e'

In [3]: m = openstudio.model.exampleModel()

In [4]: sch_ruleset = m.getScheduleRulesets()[0]
   ...: print(sch_ruleset)
OS:Schedule:Ruleset,
  {759b60e6-ce95-4ff3-8400-2162e0d007be}, !- Handle
  Medium Office Cooling Setpoint Schedule, !- Name
  {1f748523-f5e7-4388-8c2d-3aed545795c2}, !- Schedule Type Limits Name
  {91357986-488a-469e-8dca-cd87a7647e4b}, !- Default Day Schedule Name
  {d651ceae-2f44-465b-9617-554befb57e9b}; !- Summer Design Day Schedule Name

 In [5]: sch_day = sch_ruleset.defaultDaySchedule()
   ...: print(sch_day)
OS:Schedule:Day,
  {91357986-488a-469e-8dca-cd87a7647e4b}, !- Handle
  Medium Office Cooling Setpoint All Other Days Schedule, !- Name
  {1f748523-f5e7-4388-8c2d-3aed545795c2}, !- Schedule Type Limits Name
  ,                                       !- Interpolate to Timestep
  24,                                     !- Hour 1
  0,                                      !- Minute 1
  26.7;                                   !- Value Until Time 1

 In [6]: sch_day.clearExtensibleGroups()
   ...: sch_day.addValue(openstudio.Time(0, 12, 0), 18)
   ...: sch_day.addValue(openstudio.Time(0, 16, 0), 20)
   ...: sch_day.addValue(openstudio.Time(0, 24, 0), 18)

In [7]: print(sch_day)
OS:Schedule:Day,
  {91357986-488a-469e-8dca-cd87a7647e4b}, !- Handle
  Medium Office Cooling Setpoint All Other Days Schedule, !- Name
  {1f748523-f5e7-4388-8c2d-3aed545795c2}, !- Schedule Type Limits Name
  ,                                       !- Interpolate to Timestep
  12,                                     !- Hour 1
  0,                                      !- Minute 1
  18,                                     !- Value Until Time 1
  16,                                     !- Hour 2
  0,                                      !- Minute 2
  20,                                     !- Value Until Time 2
  24,                                     !- Hour 3
  0,                                      !- Minute 3
  18;                                     !- Value Until Time 3