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

How to find u-value of Standard glazing?

asked 2016-03-29 23:42:17 -0500

nikunj gravatar image

updated 2017-06-02 18:24:49 -0500

I am writing reporting measure on openstudio. For Simple glazing there is a option to set u-value directly in openstudio and in coding I can directly access u-value of Simpleglazing using 'uFactor' function but in case of Standard glazing this function is not working. How to write code to access uFactor of Standard glazing?

uValue = sub_surface.uFactor.to_f
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-03-30 02:59:02 -0500

updated 2016-03-31 08:10:29 -0500

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.


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=>, :construction=>0, :u_si=>0, :u_ip=>0 }
  next if
  construction =
  row[:construction] =
  query = query_u_value % { :window_name => }
  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

# Export to a csv file"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
edit flag offensive delete link more


how to read ufactor from SQL output file? Is there any way to calculate uFactor from model?

nikunj gravatar image nikunj  ( 2016-03-30 03:57:06 -0500 )edit

hey Thanks!! This is working .. but there is a correction in one line u_ip = OpenStudio::convert(u_si, 'W/m^2K', 'Btu/ft^2h*R').get

I also want to know how to calculate it without reading from sql file. If anyone has idea please share.. Thanks again!!! :)

nikunj gravatar image nikunj  ( 2016-03-31 04:22:46 -0500 )edit

require 'csv' is also needed at the top.

MatthewSteen gravatar image MatthewSteen  ( 2016-03-31 07:55:30 -0500 )edit

Thanks again!! this code is working in case of reporting measure but if i want to write a measure in which i have to read u value of glazing on the basis of that value I have to change some thing . In this case there is not any sql file i guess then how to find uValue of standard glazing?

nikunj gravatar image nikunj  ( 2016-04-01 00:39:32 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer


Question Tools



Asked: 2016-03-29 23:42:17 -0500

Seen: 178 times

Last updated: Mar 31 '16