Skip to content

Commit

Permalink
Merge pull request #1640 from NREL/simp_glaz_mod
Browse files Browse the repository at this point in the history
Simple glazing cleanup
  • Loading branch information
mdahlhausen authored Jan 11, 2024
2 parents 1c85457 + fad17de commit c1fbb2f
Show file tree
Hide file tree
Showing 94 changed files with 465,059 additions and 502,112 deletions.
4,028 changes: 2,014 additions & 2,014 deletions data/standards/test_performance_expected_dd_results.csv

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions lib/openstudio-standards/daylighting/space.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module OpenstudioStandards
module Daylighting
# @!group Space


# add a daylight sensor to a space
#
# @param space [OpenStudio::Model::Space] OpenStudio Space object
Expand Down Expand Up @@ -44,4 +43,4 @@ def self.space_add_daylight_sensor(space,
return daylight_sensor
end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def create_coil_heating_water_to_air_heat_pump_equation_fit(model,
end
htg_coil.setHeatingPowerConsumptionCurve(heating_power_consumption_curve)
end

# part load fraction correlation curve added as a required curve in OS v3.7.0
if model.version > OpenStudio::VersionString.new('3.6.1')
if model.getCurveByName('Water to Air Heat Pump Part Load Fraction Correlation Curve').is_initialized
Expand Down
11 changes: 0 additions & 11 deletions lib/openstudio-standards/standards/Standards.Construction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,12 @@ def construction_set_glazing_u_value(construction, target_u_value_ip, intended_s
# Set the U-value of the insulation layer
glass_layer = construction.layers.first.to_SimpleGlazing.get
glass_layer.setUFactor(ins_u_value_si)
glass_layer.setName("#{glass_layer.name} U-#{ins_u_value_ip.round(2)}")

OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Construction', "---ins_r_value_ip = #{ins_r_value_ip.round(2)} for #{construction.name}.")
OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Construction', "---ins_u_value_ip = #{ins_u_value_ip.round(2)} for #{construction.name}.")
OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Construction', "---ins_u_value_si = #{ins_u_value_si.round(2)} for #{construction.name}.")
OpenStudio.logFree(OpenStudio::Debug, 'openstudio.standards.Construction', "---glass_layer = #{glass_layer.name} u_factor_si = #{glass_layer.uFactor.round(2)}.")

# Modify the construction name
construction.setName("#{construction.name} U-#{target_u_value_ip.round(2)}")

return true
end

Expand All @@ -232,10 +228,6 @@ def construction_set_glazing_shgc(construction, target_shgc)
# Set the SHGC
glass_layer = construction.layers.first.to_SimpleGlazing.get
glass_layer.setSolarHeatGainCoefficient(target_shgc)
glass_layer.setName("#{glass_layer.name} SHGC #{target_shgc.round(2)}")

# Modify the construction name
construction.setName("#{construction.name} SHGC #{target_shgc.round(2)}")

return true
end
Expand Down Expand Up @@ -894,10 +886,7 @@ def construction_set_glazing_tvis(construction, target_tvis)
# Set the Tvis
glass_layer = construction.layers.first.to_SimpleGlazing.get
glass_layer.setVisibleTransmittance(target_tvis)
glass_layer.setName("#{glass_layer.name} TVis #{target_tvis.round(3)}")

# Modify the construction name
construction.setName("#{construction.name} TVis #{target_tvis.round(2)}")
return true
end
end
70 changes: 57 additions & 13 deletions lib/openstudio-standards/standards/Standards.Model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3160,7 +3160,6 @@ def model_add_schedule(model, schedule_name)
# @param model [OpenStudio::Model::Model] OpenStudio model object
# @param material_name [String] name of the material
# @return [OpenStudio::Model::Material] material object
# @todo make return an OptionalMaterial
def model_add_material(model, material_name)
# First check model and return material if it already exists
model.getMaterials.sort.each do |material|
Expand All @@ -3170,19 +3169,64 @@ def model_add_material(model, material_name)
end
end

# OpenStudio::logFree(OpenStudio::Info, 'openstudio.standards.Model', "Adding material: #{material_name}")

# Get the object data
data = model_find_object(standards_data['materials'], 'name' => material_name)
unless data
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find data for material: #{material_name}, will not be created.")
return false
# @todo change to return empty optional material
# For Simple Glazing materials:
# Attempt to get properties from the name of the material
material_type = nil
if material_name.downcase.include?('simple glazing')
material_type = 'SimpleGlazing'
u_factor = nil
shgc = nil
vt = nil
material_name.split.each_with_index do |item, i|
prop_value = material_name.split[i + 1].to_f
if item == 'U'
unless u_factor.nil?
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Multiple U-Factor values have been identified for #{material_name}: previous = #{u_factor}, new = #{prop_value}. Please check the material name. New U-Factor will be used.")
end
u_factor = prop_value
elsif item == 'SHGC'
unless shgc.nil?
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Multiple SHGC values have been identified for #{material_name}: previous = #{shgc}, new = #{prop_value}. Please check the material name. New SHGC will be used.")
end
shgc = prop_value
elsif item == 'VT'
unless vt.nil?
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Multiple VT values have been identified for #{material_name}: previous = #{vt}, new = #{prop_value}. Please check the material name. New SHGC will be used.")
end
vt = prop_value
end
end
if u_factor.nil? && shgc.nil? && vt.nil?
material_type = nil
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Properties of the simple glazing material named #{material_name} could not be identified from its name.")
else
if u_factor.nil?
u_factor = 1.23
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find the U-Factor for the simple glazing material named #{material_name}, a default value of 1.23 is used.")
end
if shgc.nil?
shgc = 0.61
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find the SHGC for the simple glazing material named #{material_name}, a default value of 0.61 is used.")
end
if vt.nil?
vt = 0.81
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find the VT for the simple glazing material named #{material_name}, a default value of 0.81 is used.")
end
end
end
# If no properties could be found or the material
# is not of the simple glazing type, search the database
if material_type.nil?
data = model_find_object(standards_data['materials'], 'name' => material_name)
unless data
OpenStudio.logFree(OpenStudio::Warn, 'openstudio.standards.Model', "Cannot find data for material: #{material_name}, will not be created.")
return OpenStudio::Model::OptionalMaterial.new
end
material_type = data['material_type']
end

material = nil
material_type = data['material_type']

if material_type == 'StandardOpaqueMaterial'
material = OpenStudio::Model::StandardOpaqueMaterial.new(model)
material.setName(material_name)
Expand Down Expand Up @@ -3222,9 +3266,9 @@ def model_add_material(model, material_name)
material = OpenStudio::Model::SimpleGlazing.new(model)
material.setName(material_name)

material.setUFactor(OpenStudio.convert(data['u_factor'].to_f, 'Btu/hr*ft^2*R', 'W/m^2*K').get)
material.setSolarHeatGainCoefficient(data['solar_heat_gain_coefficient'].to_f)
material.setVisibleTransmittance(data['visible_transmittance'].to_f)
material.setUFactor(OpenStudio.convert(u_factor.to_f, 'Btu/hr*ft^2*R', 'W/m^2*K').get)
material.setSolarHeatGainCoefficient(shgc.to_f)
material.setVisibleTransmittance(vt.to_f)

elsif material_type == 'StandardGlazing'
material = OpenStudio::Model::StandardGlazing.new(model)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12747,7 +12747,7 @@
"intended_surface_type": "ExteriorWindow",
"standards_construction_type": "Metal framing (all other)",
"building_category": "Nonresidential",
"construction": "U 1.22 SHGC 0.25 Simple Glazing Window",
"construction": "Simple Glazing U 1.22 SHGC 0.25",
"orientation": null,
"minimum_percent_of_surface": 40.001,
"maximum_percent_of_surface": 100.0,
Expand Down Expand Up @@ -12847,7 +12847,7 @@
"intended_surface_type": "ExteriorWindow",
"standards_construction_type": "Metal framing (all other)",
"building_category": "Residential",
"construction": "U 0.72 SHGC 0.25 Simple Glazing Window",
"construction": "Simple Glazing U 0.72 SHGC 0.25",
"orientation": null,
"minimum_percent_of_surface": 40.001,
"maximum_percent_of_surface": 100.0,
Expand Down Expand Up @@ -13047,7 +13047,7 @@
"intended_surface_type": "ExteriorWindow",
"standards_construction_type": "Metal framing (curtainwall/storefront)",
"building_category": "Nonresidential",
"construction": "U 1.22 SHGC 0.25 Simple Glazing Window",
"construction": "Simple Glazing U 1.22 SHGC 0.25",
"orientation": null,
"minimum_percent_of_surface": 40.001,
"maximum_percent_of_surface": 100.0,
Expand Down Expand Up @@ -13147,7 +13147,7 @@
"intended_surface_type": "ExteriorWindow",
"standards_construction_type": "Metal framing (curtainwall/storefront)",
"building_category": "Residential",
"construction": "U 0.72 SHGC 0.25 Simple Glazing Window",
"construction": "Simple Glazing U 0.72 SHGC 0.25",
"orientation": null,
"minimum_percent_of_surface": 40.001,
"maximum_percent_of_surface": 100.0,
Expand Down Expand Up @@ -13347,7 +13347,7 @@
"intended_surface_type": "ExteriorWindow",
"standards_construction_type": "Nonmetal framing (all)",
"building_category": "Nonresidential",
"construction": "U 1.22 SHGC 0.25 Simple Glazing Window",
"construction": "Simple Glazing U 1.22 SHGC 0.25",
"orientation": null,
"minimum_percent_of_surface": 40.001,
"maximum_percent_of_surface": 100.0,
Expand Down Expand Up @@ -13447,7 +13447,7 @@
"intended_surface_type": "ExteriorWindow",
"standards_construction_type": "Nonmetal framing (all)",
"building_category": "Residential",
"construction": "U 0.72 SHGC 0.25 Simple Glazing Window",
"construction": "Simple Glazing U 0.72 SHGC 0.25",
"orientation": null,
"minimum_percent_of_surface": 40.001,
"maximum_percent_of_surface": 100.0,
Expand Down Expand Up @@ -13647,7 +13647,7 @@
"intended_surface_type": "GlassDoor",
"standards_construction_type": "Metal framing (entrance door)",
"building_category": "Nonresidential",
"construction": "U 1.22 SHGC 0.25 Simple Glazing Window",
"construction": "Simple Glazing U 1.22 SHGC 0.25",
"orientation": null,
"minimum_percent_of_surface": 40.001,
"maximum_percent_of_surface": 100.0,
Expand Down Expand Up @@ -13747,7 +13747,7 @@
"intended_surface_type": "GlassDoor",
"standards_construction_type": "Metal framing (entrance door)",
"building_category": "Residential",
"construction": "U 0.72 SHGC 0.25 Simple Glazing Window",
"construction": "Simple Glazing U 0.72 SHGC 0.25",
"orientation": null,
"minimum_percent_of_surface": 40.001,
"maximum_percent_of_surface": 100.0,
Expand Down
Loading

0 comments on commit c1fbb2f

Please sign in to comment.