Class: Ballistics::Atmosphere
- Inherits:
-
Object
- Object
- Ballistics::Atmosphere
- 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
-
#altitude ⇒ Object
Returns the value of attribute altitude.
-
#barometric_pressure ⇒ Object
Returns the value of attribute barometric_pressure.
-
#relative_humidity ⇒ Object
Returns the value of attribute relative_humidity.
-
#temperature ⇒ Object
Returns the value of attribute temperature.
Instance Method Summary collapse
- #correct_ballistic_coefficient(ballistic_coefficient) ⇒ Object
-
#initialize(options = {}) ⇒ Atmosphere
constructor
A new instance of Atmosphere.
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( = {}) @altitude = [:altitude].to_d @barometric_pressure = [:barometric_pressure].to_d @temperature = [:temperature].to_d @relative_humidity = [:relative_humidity].to_d end |
Instance Attribute Details
#altitude ⇒ Object
Returns the value of attribute altitude.
12 13 14 |
# File 'lib/ballistics/atmosphere.rb', line 12 def altitude @altitude end |
#barometric_pressure ⇒ Object
Returns the value of attribute barometric_pressure.
12 13 14 |
# File 'lib/ballistics/atmosphere.rb', line 12 def @barometric_pressure end |
#relative_humidity ⇒ Object
Returns the value of attribute relative_humidity.
12 13 14 |
# File 'lib/ballistics/atmosphere.rb', line 12 def relative_humidity @relative_humidity end |
#temperature ⇒ Object
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 |