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

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
0

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 = 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
edit flag offensive delete link more
5

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 == OpenStudio::EnvironmentType.new("WeatherRunPeriod")
          ann_env_pd = env_pd
        end
      end
    end
    
    # 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
        end
    end
    
edit flag offensive delete link more

Comments

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's avatar rkbest  ( 2016-09-23 15:23:52 -0500 )edit

Close enough, it's Ruby.

__AmirRoth__'s avatar __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

Training Workshops

Careers

Question Tools

1 follower

Stats

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

Seen: 699 times

Last updated: Jan 31 '16