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

Revision history [back]

  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