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

Peak monthly electricity demand in EnergyPlus

asked 2016-01-23 11:31:12 -0500

Is there a way to grab the peak (total or net) monthly electricity demand from the OpenStudio SDK or even EnergyPlus SQL file? I see how to get peak monthly use by fuel type end-use, but summing those together is not only annoying, it also doesn't actually give the monthly peak, because the end-use peaks are not likely to be concurrent.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-01-31 14:57:33 -0500

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 =
          # Grab Jan time series and find the max
          elec_ts_Jan = elec_ts.values("Jan"), 1, year),,0)),
                             "Jan"), 31, year),,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]
          # Repeat for other months
edit flag offensive delete link more

answered 2016-01-25 21:30:17 -0500

  1. Request the time series output variable Electricity:Facility at Monthly resolution
  2. Get the data out of the sql file using something like this:

    # Get the weather file run period (as opposed to design day run period)
    ann_env_pd = nil
    sql.availableEnvPeriods.each do |env_pd|
      env_type = sql.environmentType(env_pd)
      if env_type.is_initialized
        if env_type.get =="WeatherRunPeriod")
          ann_env_pd = env_pd
    # Only try to get the annual peak demand if an annual simulation was run
    exit if ann_env_pd.empty?
    # Get the timeseries data
    elec = sql.timeSeries(ann_env_pd, "Monthly", "Electricity:Facility", "")
    if elec.is_initialized
        elec = elec.get            
        elec.values.each do |val|
          # There should be 12 monthly values
edit flag offensive delete link more


I was using sql queries to get data aggregated from sqlite. Just for knowledge what language are you both using to fetch the data. Is this Python syntax?

rkbest gravatar imagerkbest ( 2016-09-23 15:23:52 -0500 )edit

Close enough, it's Ruby.

__AmirRoth__ gravatar image__AmirRoth__ ( 2016-09-23 15:44:08 -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-01-23 11:31:12 -0500

Seen: 308 times

Last updated: Jan 31 '16