def test_03(self): # Truth values from NASA RP 1046 Value = SA.press2alt(2511.01, alt_units='m', press_units='pa') Truth = 25000 self.assertTrue(RE(Value, Truth) <= 1e-5)
def test_01(self): # Truth values from NASA RP 1046 Value = SA.press2alt(24.8959) Truth = 5000 self.assertTrue(RE(Value, Truth) <= 2e-5)
def test_02(self): # Truth values from NASA RP 1046 Value = SA.press2alt(254.139, press_units='psf') Truth = 49000 self.assertTrue(RE(Value, Truth) <= 1e-5)
def test_03(self): # Truth values from NASA RP 1046 Value = SA.press2alt(2511.01, alt_units='m', press_units='pa') Truth = 25000 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_02(self): # Truth values from NASA RP 1046 Value = SA.press2alt(254.139, press_units='psf') Truth = 49000 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_01(self): # Truth values from NASA RP 1046 Value = SA.press2alt(24.8959) Truth = 5000 self.failUnless(RE(Value, Truth) <= 2e-5)
def tas2ssec(tas, alt, oat, ias, speed_units=default_speed_units, alt_units=default_alt_units, temp_units=default_temp_units, press_units = default_press_units): """ Return static source position error as speed error, pressure error and altitude error at sea level. Returns delta_Vpc, delta_Ps, delta_Hpc and Vc delta_Vpc = error in airspeed = calibrated airspeed - indicated airspeed corrected for instrument error delta_Ps = error in the pressure sensed by the static system = pressure sensed in the static system - ambient pressure delta_Hpc = altitude error at sea level = actual altitude - altitude sensed by the static system Vc = calibrated airspeed at the test point """ P0 = U.press_conv(constants.P0, from_units = 'pa', to_units = press_units) cas = A.tas2cas(tas, alt, oat, speed_units=speed_units, alt_units=alt_units, temp_units=temp_units) delta_Vpc = cas - ias qcic = A.cas2dp(ias, speed_units=speed_units, press_units =press_units) qc = A.cas2dp(cas, speed_units=speed_units, press_units = press_units) delta_Ps = qc - qcic delta_Hpc = SA.press2alt(P0 - delta_Ps, press_units = press_units) # print 'Vc = %.1f, delta_vpc = %.1f, delta_ps = %.1f, delta_hpc = %.0f' % (cas, delta_Vpc, delta_Ps, delta_Hpc) return delta_Vpc, delta_Ps, delta_Hpc, cas
def test_07(self): # truth value calculated from program at: # http://www.sworld.com.au/steven/space/atmosphere/ Value = SA.press2alt(0.75009, press_units='pa', alt_units='m') Truth = 80956 self.assertTrue(RE(Value, Truth) <= 1e-5)
def test_07(self): # truth value calculated from program at: # http://www.sworld.com.au/steven/space/atmosphere/ Value = SA.press2alt(0.75009, press_units='pa', alt_units='m') Truth = 80956 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_06(self): # truth value calculated from program at: # http://www.sworld.com.au/steven/space/atmosphere/ Value = SA.press2alt(9.4609, press_units='pa', alt_units='m') Truth = 65322 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_06(self): # truth value calculated from program at: # http://www.sworld.com.au/steven/space/atmosphere/ Value = SA.press2alt(9.4609, press_units="pa", alt_units="m") Truth = 65322 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_04(self): # test units in other order # truth value calculated from program at: # http://www.sworld.com.au/steven/space/atmosphere/ Value = SA.press2alt(287.14, press_units='pa', alt_units='m') Truth = 39750 self.assertTrue(RE(Value, Truth) <= 1e-5)
def test_04(self): # test units in other order # truth value calculated from program at: # http://www.sworld.com.au/steven/space/atmosphere/ Value = SA.press2alt(287.14, press_units='pa', alt_units='m') Truth = 39750 self.failUnless(RE(Value, Truth) <= 1e-5)
def tas2ssec(tas, alt, oat, ias, speed_units=default_speed_units, alt_units=default_alt_units, temp_units=default_temp_units, press_units=default_press_units): """ Return static source position error as speed error, pressure error and altitude error at sea level. Returns delta_Vpc, delta_Ps, delta_Hpc and Vc delta_Vpc = error in airspeed = calibrated airspeed - indicated airspeed corrected for instrument error delta_Ps = error in the pressure sensed by the static system = pressure sensed in the static system - ambient pressure delta_Hpc = altitude error at sea level = actual altitude - altitude sensed by the static system Vc = calibrated airspeed at the test point """ P0 = U.press_conv(constants.P0, from_units='pa', to_units=press_units) cas = A.tas2cas(tas, alt, oat, speed_units=speed_units, alt_units=alt_units, temp_units=temp_units) delta_Vpc = cas - ias qcic = A.cas2dp(ias, speed_units=speed_units, press_units=press_units) qc = A.cas2dp(cas, speed_units=speed_units, press_units=press_units) delta_Ps = qc - qcic delta_Hpc = SA.press2alt(P0 - delta_Ps, press_units=press_units) # print 'Vc = %.1f, delta_vpc = %.1f, delta_ps = %.1f, delta_hpc = %.0f' % (cas, delta_Vpc, delta_Ps, delta_Hpc) return delta_Vpc, delta_Ps, delta_Hpc, cas
def tas2ssec2(tas, ind_alt, oat, ias, std_alt=0, speed_units=default_speed_units, alt_units=default_alt_units, temp_units=default_temp_units, press_units=default_press_units): """ Return static source position error as speed error, pressure error and altitude error at sea level using speed course method. Returns delta_Vpc, delta_Ps and delta_Hpc tas = true airspeed determined by speed course method, or GPS ind_alt = pressure altitude, corrected for instrument error oat = outside air temperature, corrected for instrument error and ram temperature rise ias = indicated airspeed, corrected for instrument error std_alt = altitude to provide delta_Hpc for delta_Vpc = error in airspeed = calibrated airspeed - indicated airspeed corrected for instrument error delta_Ps = error in the pressure sensed by the static system = pressure sensed in the static system - ambient pressure delta_Hpc = altitude error at std_alt = actual altitude - altitude sensed by the static system Uses analysis method from USAF Test Pilot School. Unlike some other methods (e.g.. that in FAA AC 23-8B, or NTPS GPS_PEC.xls), this method provides an exact conversion from TAS to CAS (some other methods assume CAS = EAS), and it accounts for the effect of position error of altitude on the conversion from TAS to CAS (some other methods assume pressure altitude = indicated pressure altitude). """ tas = U.speed_conv(tas, speed_units, 'kt') ind_alt = U.length_conv(ind_alt, alt_units, 'ft') oat = U.temp_conv(oat, temp_units, 'C') M = A.tas2mach(tas, oat, temp_units='C', speed_units='kt') if M > 1: raise ValueError('This method only works for Mach < 1') delta_ic = SA.alt2press_ratio(ind_alt, alt_units='ft') qcic_over_Psl = A.cas2dp(ias, speed_units='kt', press_units=press_units) / U.press_conv( constants.P0, 'pa', to_units=press_units) qcic_over_Ps = qcic_over_Psl / delta_ic Mic = A.dp_over_p2mach(qcic_over_Ps) delta_mach_pc = M - Mic if Mic > 1: raise ValueError('This method only works for Mach < 1') deltaPp_over_Ps = (1.4 * delta_mach_pc * (Mic + delta_mach_pc / 2)) / ( 1 + 0.2 * (Mic + delta_mach_pc / 2)**2) deltaPp_over_qcic = deltaPp_over_Ps / qcic_over_Ps delta_Hpc = SA.alt2temp_ratio( std_alt, alt_units='ft') * deltaPp_over_Ps / 3.61382e-5 # experimental - alternate way to calculate delta_Hpc that gives same answer Ps = SA.alt2press(ind_alt, alt_units='ft', press_units=press_units) delta_Ps = deltaPp_over_Ps * Ps P_std = SA.alt2press(std_alt, alt_units='ft', press_units=press_units) deltaPs_std = deltaPp_over_Ps * P_std delta_Hpc2 = SA.press2alt(P_std - deltaPs_std, press_units=press_units) - std_alt delta_std_alt = SA.alt2press_ratio(std_alt, alt_units='ft') asl = U.speed_conv(constants.A0, 'm/s', 'kt') delta_Vpc_std_alt = deltaPp_over_Ps * delta_std_alt * asl**2 / ( 1.4 * ias * (1 + 0.2 * (ias / asl)**2)**2.5) actual_alt = SA.press2alt(Ps + delta_Ps, press_units=press_units, alt_units='ft') cas = A.tas2cas(tas, actual_alt, oat, speed_units='kt', alt_units='ft', temp_units='C') return delta_Vpc, delta_Ps, delta_Hpc, cas
def tas2ssec2(tas, ind_alt, oat, ias, std_alt = 0, speed_units=default_speed_units, alt_units=default_alt_units, temp_units=default_temp_units, press_units = default_press_units): """ Return static source position error as speed error, pressure error and altitude error at sea level using speed course method. Returns delta_Vpc, delta_Ps and delta_Hpc tas = true airspeed determined by speed course method, or GPS ind_alt = pressure altitude, corrected for instrument error oat = outside air temperature, corrected for instrument error and ram temperature rise ias = indicated airspeed, corrected for instrument error std_alt = altitude to provide delta_Hpc for delta_Vpc = error in airspeed = calibrated airspeed - indicated airspeed corrected for instrument error delta_Ps = error in the pressure sensed by the static system = pressure sensed in the static system - ambient pressure delta_Hpc = altitude error at std_alt = actual altitude - altitude sensed by the static system Uses analysis method from USAF Test Pilot School. Unlike some other methods (e.g.. that in FAA AC 23-8B, or NTPS GPS_PEC.xls), this method provides an exact conversion from TAS to CAS (some other methods assume CAS = EAS), and it accounts for the effect of position error of altitude on the conversion from TAS to CAS (some other methods assume pressure altitude = indicated pressure altitude). """ tas = U.speed_conv(tas, speed_units, 'kt') ind_alt = U.length_conv(ind_alt, alt_units, 'ft') oat = U.temp_conv(oat, temp_units, 'C') M = A.tas2mach(tas, oat, temp_units='C', speed_units='kt') if M > 1: raise ValueError, 'This method only works for Mach < 1' delta_ic = SA.alt2press_ratio(ind_alt, alt_units='ft') qcic_over_Psl = A.cas2dp(ias, speed_units='kt', press_units=press_units) / U.press_conv(constants.P0, 'pa', to_units=press_units) qcic_over_Ps = qcic_over_Psl / delta_ic Mic = A.dp_over_p2mach(qcic_over_Ps) delta_mach_pc = M - Mic if Mic > 1: raise ValueError, 'This method only works for Mach < 1' deltaPp_over_Ps = (1.4 * delta_mach_pc * (Mic + delta_mach_pc / 2)) / (1 + 0.2 * (Mic + delta_mach_pc / 2 )**2) deltaPp_over_qcic = deltaPp_over_Ps / qcic_over_Ps delta_Hpc = SA.alt2temp_ratio(std_alt, alt_units='ft') * deltaPp_over_Ps / 3.61382e-5 # experimental - alternate way to calculate delta_Hpc that gives same answer Ps = SA.alt2press(ind_alt, alt_units='ft', press_units=press_units) delta_Ps = deltaPp_over_Ps * Ps P_std = SA.alt2press(std_alt, alt_units='ft', press_units=press_units) deltaPs_std = deltaPp_over_Ps * P_std delta_Hpc2 = SA.press2alt(P_std - deltaPs_std, press_units = press_units) - std_alt delta_std_alt = SA.alt2press_ratio(std_alt, alt_units='ft') asl = U.speed_conv(constants.A0, 'm/s', 'kt') delta_Vpc_std_alt = deltaPp_over_Ps * delta_std_alt * asl**2 / (1.4 * ias * (1 + 0.2 * (ias / asl)**2)**2.5) actual_alt = SA.press2alt(Ps + delta_Ps, press_units = press_units, alt_units = 'ft') cas = A.tas2cas(tas, actual_alt, oat, speed_units='kt', alt_units='ft', temp_units='C') return delta_Vpc, delta_Ps, delta_Hpc, cas