Atmo constructor

Atmo({
  1. required double hp,
  2. required double temperature,
  3. bool temperatureIsDeltaISA = true,
  4. LengthUnit unitAltitude = LengthUnit.ft,
  5. TemperatureUnit unitTemperature = TemperatureUnit.C,
})

Atmospheric point constructor

Defines a point in the atmosphere for a known pressure altitude hp and temperature condition temperature. temperature defaults to delta ISA temperature, not Outside Air Temperature (OAT).

Set temperatureIsDeltaISA to false if OAT input is desired. temperatureIsDeltaISA defaults to true and a delta ISA temperature input.

Default units for hp and temperature are feet and Celsius, respectively, but can be changed to any LengthUnit with the name parameter unitAltitude, or to any TemperatureUnit with the named parameter unitTemperature.

Implementation

Atmo(
    {required this.hp,
    required this.temperature,
    this.temperatureIsDeltaISA = true,
    this.unitAltitude = LengthUnit.ft,
    this.unitTemperature = TemperatureUnit.C}) {
  // Ensure hp input is below stratopause and use value in feet for class
  // methods.
  _hp = Convert.lengthToFeet(hp, unitAltitude);
  if (_hp > heightStratopauseFt) {
    throw RangeError('Altitude is above stratopause');
  }

  // Calculate delta ISA as we use that internally with class methods.
  _dISA = temperatureIsDeltaISA
      ? temperature
      : Temperature().deltaIsa(hp, temperature,
          unitAltitude: unitAltitude, unitTemperature: unitTemperature);
}