First time here? Check out the Help page!
1 | initial version |
Maybe I didn't phrase the question correctly, but what I actually needed was the peak (hourly) usage in each month. And the way to do that is this:
env_pd = sql_file.availableEnvPeriods[0]
elec_ts = sql_file.timeSeries(env_pd, "Hourly", "Electricity:Facility")
if elec_ts.length > 0
elec_ts = elec_ts[0]
year = elec_ts.firstReportDateTime.date.assumedBaseYear
# Grab Jan time series and find the max
elec_ts_Jan = elec_ts.values(OpenStudio::DateTime.new(OpenStudio::Date.new(OpenStudio::MonthOfYear.new("Jan"), 1, year), OpenStudio::Time.new(0,0)),
OpenStudio::DateTime.new(OpenStudio::Date.new(OpenStudio::MonthOfYear.new("Jan"), 31, year), OpenStudio::Time.new(0,23)))
for i in 0 .. elec_ts_Jan.length-1 do
if elec_ts_Jan[i] > peak_electricity_Jan
peak_electricity_Jan = elec_ts_Jan[i]
end
end
# Repeat for other months