4

Peak monthly electricity demand in EnergyPlus

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.

__AmirRoth__'s avatar
4.4k
__AmirRoth__
asked 2016-01-23 11:31:12 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

5
  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
    
aparker's avatar
8.2k
aparker
answered 2016-01-25 21:30:17 -0500
edit flag offensive 0 remove flag delete link

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
add a comment see more comments
0

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
__AmirRoth__'s avatar
4.4k
__AmirRoth__
answered 2016-01-31 14:57:33 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments