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

Can you load Schedule:File in OpenStudio?

asked 2016-01-25 11:12:44 -0500

Can you load a Schedule:File object in OpenStudio?

If not what's the best way to translate a csv file into an OpenStudio schedule?

In my case I've got a 8760 schedule (and some 87600 ones) that I'm not going to consider creating by hand

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-01-27 03:24:02 -0500

Here's an example on how to import an 8760-hour schedule in OpenStudio via Schedule:FixedInterval. It's a little bit awkward indeed to do, so I thought this could help some people. In my case I just ran it in command line, but it's easy to adapt that as a measure if you need it.

require 'csv'

# load the test model
translator =
path ="./example_model.osm")
model = translator.loadModel(path)
model = model.get

def create_schedule_and_rename(timeseries, name, model)
  schedule = OpenStudio::Model::ScheduleInterval::fromTimeSeries(timeseries, model)
  if schedule.empty?
    puts "Could not create schedule '#{name}'. Skipping"
    return false
    schedule = schedule.get
    return schedule

# Loading csv. In my case I have 4 columns timestamp, supply temp, supply flow, load
raw_data =  CSV.table('IT.csv')
# [88] Repiping(main)> raw_data.headers
#=> [:timestamp, :chw_itloopsecchwstemp, :chw_itloopsecchwrflow_cov, :w]

# Create Vectors to load the 8760 values.
it_supply_temp =
it_flow_fraction =
it_load =

# Loop on each row of the csv and load data in the OpenStudio::Vector objects
raw_data.each_with_index do |row, i|
  # Convert F to C on the fly
  it_supply_temp[i] = OpenStudio::convert(row[:chw_itloopsecchwstemp],'F','C').get
  # This is a fraction, no conversion needed
  it_flow_fraction[i] = row[:it_flow_fraction]
  # Load is already in Watts
  it_load[i] = row[:w]

# Get number of initial Schedule:FixedInterval for reporting
initial_number = model.getScheduleFixedIntervals.size

# To create timeSeries we need a start date (January 1st) and a time interval (hourly interval)
date ="Jan"), 1, 2009)
time =,1,0,0)

# Create a timeSeries
it_supply_temp_timeSeries =, time, it_supply_temp, "F")
# Convert to schedule and if it worked, rename. See function above
it_supply_temp_sch = create_schedule_and_rename(it_supply_temp_timeSeries, "IT ChW Supply Outlet Temp Schedule", model)

it_flow_fraction_timeSeries =, time, it_flow_fraction, "Fraction")
it_flow_fraction_sch = create_schedule_and_rename(it_flow_fraction_timeSeries, "IT ChW Load Profile - Flow Fraction Schedule", model)

it_load_timeSeries =, time, it_load, "W")
it_load_sch = create_schedule_and_rename(it_load_timeSeries, "IT ChW Load Profile - Load Schedule", model)

# Final Reporting
final_number = model.getScheduleFixedIntervals.size

puts "Model started with #{initial_number} Schedule:FixedInterval and ended with #{final_number}"

# to save:
#, true)
edit flag offensive delete link more



Great work! I was able to incorporate in a measure to create a custom hourly fixed interval schedule from a CSV. Thanks for sharing.

Lyle K gravatar imageLyle K ( 2016-02-08 20:15:41 -0500 )edit

Hi, I have the same issue trying to upload a load profile into open studio. Where would I save the above script to? I'm new to open studio.

eddieb gravatar imageeddieb ( 2016-12-01 19:41:03 -0500 )edit

answered 2016-01-25 11:45:32 -0500

Schedule:File is not currently supported by OpenStudio. OpenStudio 2.0 will have better support for external files; Schedule:File could be considered for integration after OpenStudio 2.0 is released. In the meantime, you can use the ScheduleInterval object in OpenStudio, this object pulls the information from the schedule into the OSM. You can create a ScheduleInterval from a TimeSeries object using ScheduleInterval.fromTimeSeries. You can create a TimeSeries using the Ruby API, this is probably the constructor you want. The constructor takes an OpenStudio::Vector object which is a little awkward to work with, here are some examples.

edit flag offensive delete link more


Dan, is schedule file now supported? Thanks!

VictoriaEagen gravatar imageVictoriaEagen ( 2016-04-07 09:15:16 -0500 )edit

Not yet, won't be until after September

macumber gravatar imagemacumber ( 2016-04-07 13:01:08 -0500 )edit

Dan, I see that this is an old post, but I have the same question with OS 2.4. Is there a way to import an external schedule file into OS? Thanks!

kheine gravatar imagekheine ( 2018-01-30 12:58:47 -0500 )edit

I have exactly the same question. Any updates on this? Thanks!

JohannesBk gravatar imageJohannesBk ( 2018-02-02 02:09:27 -0500 )edit

We are actually planning to include Schedule:File in OS 2.6.0 due out in June 2018. I will update this thread with news as it is available.

macumber gravatar imagemacumber ( 2018-02-02 11:22:11 -0500 )edit

Your Answer

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

Add Answer


Question Tools



Asked: 2016-01-25 11:12:44 -0500

Seen: 608 times

Last updated: Jan 27 '16