Class: Ballistics::Atmosphere

Inherits:
Object
  • Object
show all
Defined in:
lib/ballistics/atmosphere.rb

Constant Summary collapse

STANDARD_TEMPERATURE =
59.to_d
STANDARD_PRESSURE =
29.53.to_d
STANDARD_HUMIDITY =
0.78.to_d
STANDARD_ALTITUDE =
0.to_d
RANKLINE_CORRECTION =
459.4.to_d

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Atmosphere

Returns a new instance of Atmosphere.



14
15
16
17
18
19
# File 'lib/ballistics/atmosphere.rb', line 14

def initialize(options = {})
  @altitude = options[:altitude].to_d
  @barometric_pressure = options[:barometric_pressure].to_d
  @temperature = options[:temperature].to_d
  @relative_humidity = options[:relative_humidity].to_d
end

Instance Attribute Details

#altitudeObject

Returns the value of attribute altitude.



12
13
14
# File 'lib/ballistics/atmosphere.rb', line 12

def altitude
  @altitude
end

#barometric_pressureObject

Returns the value of attribute barometric_pressure.



12
13
14
# File 'lib/ballistics/atmosphere.rb', line 12

def barometric_pressure
  @barometric_pressure
end

#relative_humidityObject

Returns the value of attribute relative_humidity.



12
13
14
# File 'lib/ballistics/atmosphere.rb', line 12

def relative_humidity
  @relative_humidity
end

#temperatureObject

Returns the value of attribute temperature.



12
13
14
# File 'lib/ballistics/atmosphere.rb', line 12

def temperature
  @temperature
end

Instance Method Details

#correct_ballistic_coefficient(ballistic_coefficient) ⇒ Object



21
22
23
24
25
# File 'lib/ballistics/atmosphere.rb', line 21

def correct_ballistic_coefficient(ballistic_coefficient)
  ballistic_coefficient = ballistic_coefficient.to_d
  corrected_ballistic_coefficient = (altitude_factor * (1 + temperature_factor - pressure_factor) * humidity_factor)
  return ballistic_coefficient * corrected_ballistic_coefficient
end