Short story, you can't do it like this.
Just like any other constructions constructed from several layers, the resulting U value will be computed during the actual simulation.
What you want to do for your reporting measure is to query this value in the SQL output file.
Edit:
To find it in the SQL file, here's the logic:
- Find the construction attached to the subsurface
- Query SQL by construction name in table
Constructions
Here's a bit of code that you can use. I'm assuming you have stored the OpenStudio::SqlFile
in the variable sqlFile
.
What it does: create an array of hash (table), and also exports it to CSV file: Each row is a sub_surface, and you have 3 additional columns: construction name, U value in SI units, U value in IP units
require 'csv'
# Basic query
query_u_value = """
SELECT Uvalue FROM Constructions WHERE
Name = '%{window_name}'
"""
# Create a table to store the resulting things
table = []
model.getSubSurfaces.each do |sub_surface|
# Create a row
row = {:sub_surface=>sub_surface.name.to_s, :construction=>0, :u_si=>0, :u_ip=>0 }
next if sub_surface.construction.empty?
construction = sub_surface.construction.get
row[:construction] = construction.name.to_s
query = query_u_value % { :window_name => construction.name.to_s.upcase }
u_si = sqlFile.execAndReturnFirstDouble(query)
next if u_si.empty?
u_si = u_si.get
u_ip = OpenStudio::convert(u_si.get, 'W/m^2*K', 'Btu/ft^2*h*R').get
row[:u_si] = u_si
row[:u_ip] = u_ip
# Add row to table
table << row
end
# Export to a csv file
CSV.open("Window_u_values.csv", "wb") do |csv|
csv << table.first.keys # adds the attributes name on the first line
table.each do |hash|
csv << hash.values
end
end