First time here? Check out the Help page!
1 | initial version |
Let's say you grab a ScheduleRuleset from your Model:
In [1]:
sch = m.getScheduleRulesetByName("Large Office Bldg Occ").get
# Get the default day schedule
sch_day = sch.defaultDaySchedule
# Or get one of the schedule rules' day schedule
sch_rule = sch.scheduleRules[0]
sch_day = sch_rule.daySchedule
In both cases, you end up with a ScheduleDay
object, which has two vectors: values and times. You can loop on them:
In [2]:
sch_day.times.each_with_index do |t, i|
v = sch_day.values[i]
puts "#{t} - #{v}"
end
Out[2]:
06:00:00 - 0.0
07:00:00 - 0.1
08:00:00 - 0.2
12:00:00 - 0.95
13:00:00 - 0.5
17:00:00 - 0.95
18:00:00 - 0.7
20:00:00 - 0.4
22:00:00 - 0.1
24:00:00 - 0.05
For the record, here's the content of my sch_day
In [3]: puts sch_day
Out[3]: OS:Schedule:Day,
{2b88cc09-05ab-4d50-acb8-6333aa6ac43b}, ! Handle
Large Office Bldg Occ Default Schedule, ! Name
{5eb48a4a-20e2-4feb-8b1f-c9c9b1824a15}, ! Schedule Type Limits Name
, ! Interpolate to Timestep
6, !- Hour 1
0, !- Minute 1
0, !- Value Until Time 1
7, !- Hour 2
0, !- Minute 2
0.1, !- Value Until Time 2
8, !- Hour 3
0, !- Minute 3
0.2, !- Value Until Time 3
12, !- Hour 4
0, !- Minute 4
0.95, !- Value Until Time 4
13, !- Hour 5
0, !- Minute 5
0.5, !- Value Until Time 5
17, !- Hour 6
0, !- Minute 6
0.95, !- Value Until Time 6
18, !- Hour 7
0, !- Minute 7
0.7, !- Value Until Time 7
20, !- Hour 8
0, !- Minute 8
0.4, !- Value Until Time 8
22, !- Hour 9
0, !- Minute 9
0.1, !- Value Until Time 9
24, !- Hour 10
0, !- Minute 10
0.05; !- Value Until Time 10
2 | No.2 Revision |
Let's say you grab a ScheduleRuleset from your Model:
In [1]:
sch = m.getScheduleRulesetByName("Large Office Bldg Occ").get
# Get the default day schedule
sch_day = sch.defaultDaySchedule
# Or get one of the schedule rules' day schedule
sch_rule = sch.scheduleRules[0]
sch_day = sch_rule.daySchedule
You could also get a specific schedule day from a list of dates: see SDK Doc for ScheduleRuleset::getDaySchedules
In [2]:
start_date and end_date are both inclusive, so to get a single schedule day for a specific date, do like this:
start_date = OpenStudio::Date.new(OpenStudio::MonthOfYear.new("Jan"), 3)
sch_days = sch.getDaySchedules(start_date, end_date)
sch_day = sch_days[0]
In all cases, you end up with a ScheduleDay
object, which has two vectors: values and times. You can loop on them:
In [2]:
[3]:
sch_day.times.each_with_index do |t, i|
v = sch_day.values[i]
puts "#{t} - #{v}"
end
Out[2]:
Out[3]:
06:00:00 - 0.0
07:00:00 - 0.1
08:00:00 - 0.2
12:00:00 - 0.95
13:00:00 - 0.5
17:00:00 - 0.95
18:00:00 - 0.7
20:00:00 - 0.4
22:00:00 - 0.1
24:00:00 - 0.05
For the record, here's the content of my sch_day
In [3]: [4]: puts sch_day
Out[3]: Out[4]: OS:Schedule:Day,
{2b88cc09-05ab-4d50-acb8-6333aa6ac43b}, ! Handle
Large Office Bldg Occ Default Schedule, ! Name
{5eb48a4a-20e2-4feb-8b1f-c9c9b1824a15}, ! Schedule Type Limits Name
, ! Interpolate to Timestep
6, !- Hour 1
0, !- Minute 1
0, !- Value Until Time 1
7, !- Hour 2
0, !- Minute 2
0.1, !- Value Until Time 2
8, !- Hour 3
0, !- Minute 3
0.2, !- Value Until Time 3
12, !- Hour 4
0, !- Minute 4
0.95, !- Value Until Time 4
13, !- Hour 5
0, !- Minute 5
0.5, !- Value Until Time 5
17, !- Hour 6
0, !- Minute 6
0.95, !- Value Until Time 6
18, !- Hour 7
0, !- Minute 7
0.7, !- Value Until Time 7
20, !- Hour 8
0, !- Minute 8
0.4, !- Value Until Time 8
22, !- Hour 9
0, !- Minute 9
0.1, !- Value Until Time 9
24, !- Hour 10
0, !- Minute 10
0.05; !- Value Until Time 10