First time here? Check out the Help page!
1 | initial version |
Electricity:Facility
at Monthly
resolutionGet 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