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 9 years ago

nikunj's avatar

updated 7 years ago

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
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
6

answered 9 years ago

updated 9 years ago

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
Preview: (hide)
link

Comments

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

nikunj's avatar nikunj  ( 9 years ago )

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  ( 9 years ago )
1

require 'csv' is also needed at the top.

MatthewSteen's avatar MatthewSteen  ( 9 years ago )

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  ( 9 years ago )

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: 9 years ago

Seen: 292 times

Last updated: Mar 31 '16