2

Setting SHGC in OpenStudio

I am trying to set the SHGC(Solar Heat Gain Coefficient) in OpenStudio for a Fixed Window under the category Simple Glazing System Window Materials using a ruby measure. I am using OpenStudio 1.6.0 and there is no method to set the SHGC using ruby that I can find. The only other way I have found to set SHGC is by translating the whole model to EnergyPlus, setting SHGC and bring it back to OpenStudio. The code for that method looks like this:

ft = OpenStudio::EnergyPlus::ForwardTranslator.new
workspace = ft.translateModel(model)
win = model.getObjectsByType("WindowMaterial:SimpleGlazingSystem".to_IddObjectType)
win[0].setDouble(2,shgc) 
bt = OpenStudio::EnergyPlus::ReverseTranslator.new
model = bt.translateWorkspace(workspace)

Unfortunately the above code seems to work in the cmd but the changes do not show up in OpenStudio. What should I try next to set the SHGC?

Alex Bennett's avatar
327
Alex Bennett
asked 2015-09-02 09:20:15 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-08-05 13:05:04 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

6

If you want to manipulate code in IDF, then you meed to make an EnergyPlus measure, which takes in and returns an IDF file vs. an OSM.

But you can edit and create simple glazing objects in OpenStudio.

# create construction and material and link them together
construction = OpenStudio::Model::Construction.new(model)
material = OpenStudio::Model::SimpleGlazing.new(model)

# add material to construction
construction.insertLayer(0,material)

# set material properties
material.setUFactor(options["uFactor"])
material.setSolarHeatGainCoefficient(options["solarHeatGainCoef"])
material.setVisibleTransmittance(options["visibleTransmittance"])

If you are have a material already in the model that you want to alter you need to do something like this.

if material.to_SimpleGlazing.is_initialized
  material = material.to_SimpleGlazing.get
  material.setSolarHeatGainCoefficient(options["solarHeatGainCoef"])
end
David Goldwasser's avatar
20.4k
David Goldwasser
answered 2015-09-02 09:47:08 -0500, updated 2015-09-02 09:57:02 -0500
edit flag offensive 0 remove flag delete link

Comments

Thanks that worked perfectly! I realized I was looking at the subSurface rather than the Material but got confused because you can set a UFactor for subSurface.

Alex Bennett's avatar Alex Bennett (2015-09-02 10:14:50 -0500) edit
add a comment see more comments