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

TimeSeries alternative

asked 2016-02-10 16:06:03 -0500

ngkhanh gravatar image

updated 2016-02-11 07:33:34 -0500

Hi, Sometimes SQLlite doesn't give back data when we call .TimeSeries and return an empty value for an array. I want to create directly when value empty returned, so which syntax and should input here when i know start date, end date and frequency ? Regards

edit retag flag offensive close merge delete


Are you referring to SqlFile::timeseries. The arguments to that function are envPeriod, reportingFrequency, timeSeriesName, and keyValue. If you are not getting an initialized TimeSeries object back then you are either passing in bad values for those arguments or you did not request that EnergyPlus output the desired data.

macumber gravatar imagemacumber ( 2016-02-10 21:45:18 -0500 )edit

Sorry for my wrong syntax. It's .timeSeries method. It's a space without infiltration or outdoor rate, so they would not get recorded in .sql. The value can be zero but the timedate data still should input

ngkhanh gravatar imagengkhanh ( 2016-02-10 22:55:52 -0500 )edit

Are you asking how to create a TimeSeries?

Jason DeGraw gravatar imageJason DeGraw ( 2016-02-11 10:22:02 -0500 )edit

So in some cases you do your query and get back a result, is that right? In other cases, you do your query and get back an empty result, what do you want to do in that case? Create a timeseries with all zero values? Why do you want to do that?

macumber gravatar imagemacumber ( 2016-02-11 10:25:36 -0500 )edit

Yes, I want to get a times series with all zero value - that all time data have zero value (1/1/2009 0h:0m:0s, 0) 0 . I got time duration by sqlFile.hoursSimulated and RunPeriods , OpenStudio::Date for begin and and end day but have problem to create a TimeSeries with all zero array. I read here but still have problems with time creating and modifying in case of month or year frequency

ngkhanh gravatar imagengkhanh ( 2016-02-11 10:49:09 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-02-11 11:24:15 -0500

updated 2017-11-15 21:21:26 -0500

You should be able to create a time series with zero values, though the tricky parts may be getting the right Vector object and the right first report time. Here's Ruby code to do it for a complete year:

require 'openstudio'
values =, 0.0)
date ="Jan"), 1, 2009)
time =,1,0,0)
timeSeries =, time, values, "")

Note that in the documentation the firstReportDateTime arguments are going to be the date and time of the first value in the time series, so if I had used one of those constructors I would be passing in 1/1/2009 01:00.

There are more examples here on creating time series. Unfortunately, the Ruby tests are gone now, only the C++ tests remain.

edit flag offensive delete link more


Thank your syntaxs are very clear. I tried Time method in ruby console and saw that :,1) =,25) = 25:00:00. How i need to understand time value in Openstudio for checking purpose ? for example,24) = 24:00:00 should be midnight moment to 1 am of day 1 or this is the 24th hour of day 0 (from 23 to 24:00) ? sometime i get confusing between time format between : 00:00:00 to 23:00:00 and 1:00:00 to 24 :00:00 in result viewer ? how to determine them ?

ngkhanh gravatar imagengkhanh ( 2016-02-11 12:05:12 -0500 )edit

Yes, you do need to be careful about time. The time series associates the value with the time at the end of the interval. So the value attached to 1/1/2009 01:00 in the time series covers the interval from 1/1/2009 00:00 to 1/1/2009 01:00. The value attached to 1/1/2009 24:00 (which is the same as 1/2/2009 00:00) covers 1/1/2009 23:00 to 1/2/2009 00:00. Does that help?

Jason DeGraw gravatar imageJason DeGraw ( 2016-02-11 12:34:45 -0500 )edit

My answer originally linked to Ruby tests that are no longer available.

Jason DeGraw gravatar imageJason DeGraw ( 2017-11-15 21:23:14 -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

1 follower


Asked: 2016-02-10 16:06:03 -0500

Seen: 218 times

Last updated: Nov 15 '17