Skip to content

Commit

Permalink
fix(material): Catch cases of invalid glazing materials
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Jul 10, 2024
1 parent 5c3ddb1 commit 310738b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/from_openstudio/material/window_glazing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,12 @@ def self.from_material(material)
hash[:display_name] = (material.displayName.get).force_encoding("UTF-8")
end
hash[:thickness] = material.thickness
hash[:solar_transmittance] = material.solarTransmittance
# check for the transmittance in begin/rescue in case spectral data is not set
begin
hash[:solar_transmittance] = material.solarTransmittance
rescue
return nil
end
# check if boost optional object is empty
unless material.frontSideSolarReflectanceatNormalIncidence.empty?
hash[:solar_reflectance] = material.frontSideSolarReflectanceatNormalIncidence.get
Expand Down
5 changes: 4 additions & 1 deletion lib/from_openstudio/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ def self.materials_from_model(openstudio_model)
end
# Create HB EnergyWindowMaterialGlazing from OpenStudio Material
openstudio_model.getStandardGlazings.each do |material|
result << EnergyWindowMaterialGlazing.from_material(material)
mat_hash = EnergyWindowMaterialGlazing.from_material(material)
unless mat_hash.nil?
result << mat_hash
end
end
# Create HB EnergyWindowMaterialBlind from OpenStudio Material
openstudio_model.getBlinds.each do |material|
Expand Down

0 comments on commit 310738b

Please # to comment.