def test_equiv_airspeed(self): """tests atm_equivalent_airspeed""" alt = 0. mach = 1. veq1 = atm_equivalent_airspeed(alt, mach, alt_units='ft', eas_units='ft/s') assert np.allclose(veq1, 1115.5461442719434) alt = 10000. veq2 = atm_equivalent_airspeed(alt, mach, alt_units='ft', eas_units='ft/s') assert np.allclose(veq2, 925.407847794747) veq3 = atm_equivalent_airspeed(alt / 1000., mach, alt_units='kft', eas_units='ft/s') assert np.allclose(veq2, veq3) alt = 0. veq4 = atm_equivalent_airspeed(alt, mach, alt_units='ft', eas_units='m/s') assert np.allclose(veq4, 340.0184647740884)
def test_get_alt_for_eas_with_constant_mach(self): """tests get_alt_for_q_with_constant_mach""" mach = 0.8 alt_targets = [0., 10., 20., 30., 40., 50.] for alt_target in alt_targets: veq1 = atm_equivalent_airspeed(alt_target * 1000., mach, alt_units='ft', eas_units='ft/s') veq2 = atm_equivalent_airspeed(alt_target, mach, alt_units='kft', eas_units='knots') tol = 5. # 5 feet alt1 = get_alt_for_eas_with_constant_mach(veq1, mach, velocity_units='ft/s', alt_units='ft', nmax=20, tol=tol) tol = 5 / 1000. # 5 feet alt2 = get_alt_for_eas_with_constant_mach(veq2, mach, velocity_units='knots', alt_units='kft', nmax=20, tol=tol) assert np.allclose( alt1 / 1000., alt_target, atol=1e-3), 'alt1=%s alt_target=%s' % (alt1, alt_target) assert np.allclose( alt2, alt_target, atol=1e-3), 'alt2=%s alt_target=%s' % (alt2, alt_target)
def test_equiv_airspeed(self): """tests atm_equivalent_airspeed""" alt = 0. mach = 1. veq1 = atm_equivalent_airspeed(alt, mach) veq2 = atm_equivalent_airspeed2(alt, mach, alt_units='ft', eas_units='ft/s') assert np.allclose(veq1, veq2) alt = 10000. veq1 = atm_equivalent_airspeed(alt, mach) veq2 = atm_equivalent_airspeed2(alt, mach, alt_units='ft', eas_units='ft/s') assert np.allclose(veq1, veq2) veq2 = atm_equivalent_airspeed2(alt / 1000., mach, alt_units='kft', eas_units='ft/s') assert np.allclose(veq1, veq2) alt = 0. veq1 = atm_equivalent_airspeed(alt, mach, SI=True) veq2 = atm_equivalent_airspeed2(alt, mach, alt_units='ft', eas_units='m/s') assert np.allclose(veq1, veq2)
def test_get_alt_for_eas_with_constant_mach2(self): """tests get_alt_for_eas_with_constant_mach""" eas_expected = 500. mach = 0.8 alt = get_alt_for_eas_with_constant_mach(eas_expected, mach, velocity_units='ft/s', alt_units='ft', nmax=20, tol=5.) eas = atm_equivalent_airspeed(alt, mach, alt_units='ft', eas_units='ft/s') assert np.allclose( eas, eas_expected), 'eas=%s eas_expected=%s' % (eas, eas_expected) eas = atm_equivalent_airspeed(alt, mach, alt_units='ft', eas_units='knots') assert np.allclose(eas, 296.2418795250434), eas