Class: Toji::PsychrometryToRelativeHumidity

Inherits:
Object
  • Object
show all
Defined in:
lib/toji/psychrometry_to_relative_humidity.rb

Overview

乾湿差から相対湿度へ変換

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(swvp: Swvp.default, pressure: 1013, k: 0.000662) ⇒ PsychrometryToRelativeHumidity

Returns a new instance of PsychrometryToRelativeHumidity.



10
11
12
13
14
# File 'lib/toji/psychrometry_to_relative_humidity.rb', line 10

def initialize(swvp: Swvp.default, pressure: 1013, k: 0.000662)
  @swvp = swvp
  @pressure = pressure
  @k = k
end

Instance Attribute Details

#kObject (readonly)

Returns the value of attribute k.



8
9
10
# File 'lib/toji/psychrometry_to_relative_humidity.rb', line 8

def k
  @k
end

#pressureObject (readonly)

Returns the value of attribute pressure.



7
8
9
# File 'lib/toji/psychrometry_to_relative_humidity.rb', line 7

def pressure
  @pressure
end

#swvpObject (readonly)

Returns the value of attribute swvp.



6
7
8
# File 'lib/toji/psychrometry_to_relative_humidity.rb', line 6

def swvp
  @swvp
end

Instance Method Details

#convert(t_wet, t_dry) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/toji/psychrometry_to_relative_humidity.rb', line 16

def convert(t_wet, t_dry)
  p_wet = swvp.calc(t_wet)
  p_dry = swvp.calc(t_dry)

  p_w = p_wet - pressure * k * (t_dry - t_wet)
  p_w / p_dry
end