def test_03(self):

        # Mach 1, mph, 10,000 ft

        Value = A.tas2mach(734.58, speed_units='mph', altitude=10000)

        # truth value from NASA RP 1046

        Truth = 1
        self.assertTrue(RE(Value, Truth) <= 1e-5)
    def test_01(self):

        # Mach 1

        Value = A.tas2mach(661.48, 15)

        # truth value from NASA RP 1046

        Truth = 1
        self.assertTrue(RE(Value, Truth) <= 1e-5)
    def test_02(self):

        # Mach .5, mph, deg F

        Value = A.tas2mach(761.22 / 2, 59, speed_units='mph', temp_units='F')

        # truth value from NASA RP 1046

        Truth = .5
        self.assertTrue(RE(Value, Truth) <= 1e-5)
    def test_03(self):

        # Mach 1, mph, 10,000 ft

        Value = A.tas2mach(734.58, speed_units='mph', altitude=10000)

        # truth value from NASA RP 1046

        Truth = 1
        self.failUnless(RE(Value, Truth) <= 1e-5)
    def test_01(self):

        # Mach 1

        Value = A.tas2mach(661.48, 15)

        # truth value from NASA RP 1046

        Truth = 1
        self.failUnless(RE(Value, Truth) <= 1e-5)
    def test_04(self):

        # Mach 1, km/h, 10,000 m

        Value = A.tas2mach(1078.07, speed_units='km/h', altitude=10000,
                           alt_units='m')

        # truth value from NASA RP 1046

        Truth = 1
        self.failUnless(RE(Value, Truth) <= 1e-5)
    def test_02(self):

        # Mach .5, mph, deg F

        Value = A.tas2mach(761.22 / 2, 59, speed_units='mph',
                           temp_units='F')

        # truth value from NASA RP 1046

        Truth = .5
        self.failUnless(RE(Value, Truth) <= 1e-5)
    def test_04(self):

        # Mach 1, km/h, 10,000 m

        Value = A.tas2mach(1078.07,
                           speed_units='km/h',
                           altitude=10000,
                           alt_units='m')

        # truth value from NASA RP 1046

        Truth = 1
        self.assertTrue(RE(Value, Truth) <= 1e-5)
Example #9
0
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
Example #10
0
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