Skip to content

Commit

Permalink
fix(designday): Use new humidity methods instead of deprecated ones
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey authored and Chris Mackey committed Mar 12, 2024
1 parent a2783de commit 018836c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
10 changes: 8 additions & 2 deletions lib/from_openstudio/simulation/design_day.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def self.dry_bulb_condition_from_design_day(design_day)
end

def self.humidity_type_from_design_day(design_day)
humidity_type = design_day.humidityIndicatingType
humidity_type = design_day.humidityConditionType
allowed_types = ['WetBulb', 'Dewpoint', 'HumidityRatio', 'Enthalpy']
if !allowed_types.any?{ |s| s.casecmp(humidity_type)==0 }
raise "'#{humidity_type}' is not an allowed humidity type"
Expand All @@ -72,7 +72,13 @@ def self.humidity_condition_from_design_day(design_day)
hash = {}
hash[:type] = 'HumidityCondition'
hash[:humidity_type] = humidity_type_from_design_day(design_day)
hash[:humidity_value] = design_day.humidityIndicatingConditionsAtMaximumDryBulb
if hash[:humidity_type] == 'HumidityRatio'
hash[:humidity_value] = design_day.humidityRatioAtMaximumDryBulb
elsif hash[:humidity_type] == 'Enthalpy'
hash[:humidity_value] = design_day.enthalpyAtMaximumDryBulb
else
hash[:humidity_value] = design_day.wetBulbOrDewPointAtMaximumDryBulb
end
hash[:barometric_pressure] = design_day.barometricPressure
hash[:rain] = design_day.rainIndicator
hash[:snow_on_ground] = design_day.snowIndicator
Expand Down
11 changes: 9 additions & 2 deletions lib/to_openstudio/simulation/design_day.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,15 @@ def to_openstudio(openstudio_model)
os_des_day.setDailyDryBulbTemperatureRange(@hash[:dry_bulb_condition][:dry_bulb_range])

# set the HumidityCondition properties
os_des_day.setHumidityIndicatingType(@hash[:humidity_condition][:humidity_type])
os_des_day.setHumidityIndicatingConditionsAtMaximumDryBulb(@hash[:humidity_condition][:humidity_value])
humid_type = @hash[:humidity_condition][:humidity_type]
os_des_day.setHumidityConditionType(@hash[:humidity_condition][:humidity_type])
if humid_type == 'HumidityRatio'
os_des_day.setHumidityRatioAtMaximumDryBulb(@hash[:humidity_condition][:humidity_value])
elsif humid_type == 'Enthalpy'
os_des_day.setEnthalpyAtMaximumDryBulb(@hash[:humidity_condition][:humidity_value])
else
os_des_day.setWetBulbOrDewPointAtMaximumDryBulb(@hash[:humidity_condition][:humidity_value])
end
if @hash[:humidity_condition][:barometric_pressure]
os_des_day.setBarometricPressure(@hash[:humidity_condition][:barometric_pressure])
end
Expand Down

0 comments on commit 018836c

Please sign in to comment.