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

How to find u-value of Standard glazing?

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

nikunj's avatar

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

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
6

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

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

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
edit flag offensive delete link more

Comments

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

nikunj's avatar nikunj  ( 2016-03-30 03:57:06 -0600 )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's avatar nikunj  ( 2016-03-31 04:22:46 -0600 )edit
1

require 'csv' is also needed at the top.

MatthewSteen's avatar MatthewSteen  ( 2016-03-31 07:55:30 -0600 )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's avatar nikunj  ( 2016-04-01 00:39:32 -0600 )edit

Your Answer

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

Add Answer

Training Workshops

Careers

Question Tools

2 followers

Stats

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

Seen: 274 times

Last updated: Mar 31 '16