Example #1
0
def cl2cas(
    Cl,
    altitude,
    weight,
    wing_area,
    load_factor=1,
    speed_units=default_speed_units,
    alt_units=default_alt_units,
    weight_units=default_weight_units,
    area_units=default_area_units,
):
    """
    Returns the calibrated airspeed, given coefficient of lift, altitude, 
    weight, and wing area.

    Load factor is an optional input.  The load factor, if not provided, 
    defaults to 1.
    """

    weight = U.wt_conv(weight, from_units=weight_units, to_units='kg')
    wing_area = U.area_conv(wing_area, from_units=area_units, to_units='m**2')

    eas = ((((2. * weight) * g) * load_factor) /
           ((Rho0 * wing_area) * Cl))**0.5
    eas = U.speed_conv(eas, from_units='m/s', to_units=speed_units)
    cas = A.eas2cas(eas, altitude, speed_units, alt_units)

    return cas
Example #2
0
def cd2drag(
    Cd,
    eas,
    wing_area,
    speed_units=default_speed_units,
    area_units=default_area_units,
    drag_units=default_weight_units,
    ):
    """
    Returns the drag, given coefficient of drag, equivalent airspeed, and wing
    area.
    
    Example:
    >>> cd2drag(.138, 100, 10, speed_units='km/h', area_units='m**2',\
    drag_units='N')
    652.19907407407425
    """

    eas = U.speed_conv(eas, from_units=speed_units, to_units='m/s')
    wing_area = U.area_conv(wing_area, from_units=area_units,
                            to_units='m**2')

    drag = (((0.5 * Rho0) * eas ** 2) * wing_area) * Cd
    drag = U.force_conv(drag, from_units='N', to_units=drag_units)

    return drag
Example #3
0
def cd2drag(
    Cd,
    eas,
    wing_area,
    speed_units=default_speed_units,
    area_units=default_area_units,
    drag_units=default_weight_units,
):
    """
    Returns the drag, given coefficient of drag, equivalent airspeed, and wing
    area.
    
    Example:
    >>> cd2drag(.138, 100, 10, speed_units='km/h', area_units='m**2',\
    drag_units='N')
    652.1990740740742
    """

    eas = U.speed_conv(eas, from_units=speed_units, to_units='m/s')
    wing_area = U.area_conv(wing_area, from_units=area_units, to_units='m**2')

    drag = (((0.5 * Rho0) * eas**2) * wing_area) * Cd
    drag = U.force_conv(drag, from_units='N', to_units=drag_units)

    return drag
Example #4
0
def cl2lift(
    Cl,
    eas,
    wing_area,
    speed_units=default_speed_units,
    lift_units=default_weight_units,
    area_units=default_area_units,
    ):
    """
    Returns the lift, given coefficient of lift, equivalent airspeed, and wing
    area.
    """

    eas = U.speed_conv(eas, from_units=speed_units, to_units='m/s')
    wing_area = U.area_conv(wing_area, from_units=area_units,
                            to_units='m**2')

    lift = (((0.5 * Rho0) * eas ** 2.) * wing_area) * Cl
    if lift_units == 'kg':
        lift = U.force_conv(lift, 'N', 'lb')
        lift = U.mass_conv(lift, 'lb', 'kg')
    else:
        lift = U.force_conv(lift, 'N', lift_units)

    return lift
Example #5
0
def cl2cas(
    Cl,
    altitude,
    weight,
    wing_area,
    load_factor=1,
    speed_units=default_speed_units,
    alt_units=default_alt_units,
    weight_units=default_weight_units,
    area_units=default_area_units,
    ):
    """
    Returns the calibrated airspeed, given coefficient of lift, altitude, 
    weight, and wing area.

    Load factor is an optional input.  The load factor, if not provided, 
    defaults to 1.
    """

    weight = U.wt_conv(weight, from_units=weight_units, to_units='kg')
    wing_area = U.area_conv(wing_area, from_units=area_units,
                            to_units='m**2')

    eas = ((((2. * weight) * g) * load_factor) / ((Rho0 * wing_area)
            * Cl)) ** 0.5
    eas = U.speed_conv(eas, from_units='m/s', to_units=speed_units)
    cas = A.eas2cas(eas, altitude, speed_units, alt_units)

    return cas
Example #6
0
def mach2cl(
    mach,
    altitude,
    weight,
    wing_area,
    load_factor=1,
    alt_units=default_alt_units,
    weight_units=default_weight_units,
    area_units=default_area_units,
):
    """
    Returns the coefficient of lift, given equivalent mach, altitude, weight,
    and wing area.
    
    Load factor is an optional input.  The load factor, if not provided, 
    defaults to 1.
    
    Example:
    if the wing area is 110 square feet,
    altitude is 10,000 ft,
    the weight is 1800 lb,
    and the Mach number is 0.3 kt,
    in straight and level flight (so the load factor = 1),
    
    then:
    >>> Hp = 10000
    >>> S = 110
    >>> W = 1800
    >>> Mach = 0.3
    >>> mach2cl(Mach, Hp, W, S, weight_units='lb', area_units='ft**2')
    0.17847495222708878
    """

    P = SA.alt2press(altitude, alt_units=alt_units, press_units="pa")
    wing_area = U.area_conv(wing_area, from_units=area_units, to_units="m**2")
    weight = U.wt_conv(weight, from_units=weight_units, to_units="kg")

    Cl = (weight * g * load_factor) / (0.7 * P * wing_area * mach**2)

    return Cl
Example #7
0
def cl2tas(
    Cl,
    altitude,
    weight,
    wing_area,
    temperature='std',
    load_factor=1,
    speed_units=default_speed_units,
    alt_units=default_alt_units,
    weight_units=default_weight_units,
    area_units=default_area_units,
    temp_units=default_temp_units,
    ):
    """
    Returns the true airspeed, given coefficient of lift, altitude, weight,
    and wing area.
    
    Temperature and load factor are optional inputs.  The temperature, if 
    not provided, defaults to the standard temperature for the altitude.  
    The load factor, if not provided, defaults to 1.
    """

    weight = U.wt_conv(weight, from_units=weight_units, to_units='kg')
    wing_area = U.area_conv(wing_area, from_units=area_units,
                            to_units='m**2')

    eas = ((((2. * weight) * g) * load_factor) / ((Rho0 * wing_area)
            * Cl)) ** 0.5
    eas = U.speed_conv(eas, from_units='m/s', to_units=speed_units)
    tas = A.eas2tas(
        eas,
        altitude,
        temperature,
        speed_units,
        alt_units,
        temp_units=temp_units,
        )

    return tas
Example #8
0
def eas2cl(
    eas,
    weight,
    wing_area,
    load_factor=1,
    speed_units=default_speed_units,
    weight_units=default_weight_units,
    area_units=default_area_units,
    ):
    """
    Returns the coefficient of lift, given equivalent airspeed, weight, and 
    wing area.
    
    Load factor is an optional input.  The load factor, if not provided, 
    defaults to 1.
    
    Example:
    if the wing area is 110 square feet,
    and the weight is 1800 lb,
    and the eas is 55 kt,
    in straight and level flight (so the load factor = 1),
    
    then:
    >>> S = 110
    >>> W = 1800
    >>> EAS = 55
    >>> eas2cl(EAS, W, S, speed_units='kt', weight_units='lb', area_units='ft**2')
    1.597820083228606
    """

    eas = U.speed_conv(eas, from_units=speed_units, to_units='m/s')
    weight = U.wt_conv(weight, from_units=weight_units, to_units='kg')
    wing_area = U.area_conv(wing_area, from_units=area_units,
                            to_units='m**2')

    Cl = (((2. * weight) * g) * load_factor) / ((Rho0 * wing_area) * eas
             ** 2.)

    return Cl
Example #9
0
def cl2tas(
    Cl,
    altitude,
    weight,
    wing_area,
    temperature='std',
    load_factor=1,
    speed_units=default_speed_units,
    alt_units=default_alt_units,
    weight_units=default_weight_units,
    area_units=default_area_units,
    temp_units=default_temp_units,
):
    """
    Returns the true airspeed, given coefficient of lift, altitude, weight,
    and wing area.
    
    Temperature and load factor are optional inputs.  The temperature, if 
    not provided, defaults to the standard temperature for the altitude.  
    The load factor, if not provided, defaults to 1.
    """

    weight = U.wt_conv(weight, from_units=weight_units, to_units='kg')
    wing_area = U.area_conv(wing_area, from_units=area_units, to_units='m**2')

    eas = ((((2. * weight) * g) * load_factor) /
           ((Rho0 * wing_area) * Cl))**0.5
    eas = U.speed_conv(eas, from_units='m/s', to_units=speed_units)
    tas = A.eas2tas(
        eas,
        altitude,
        temperature,
        speed_units,
        alt_units,
        temp_units=temp_units,
    )

    return tas
Example #10
0
def eas2cl(
    eas,
    weight,
    wing_area,
    load_factor=1,
    speed_units=default_speed_units,
    weight_units=default_weight_units,
    area_units=default_area_units,
):
    """
    Returns the coefficient of lift, given equivalent airspeed, weight, and 
    wing area.
    
    Load factor is an optional input.  The load factor, if not provided, 
    defaults to 1.
    
    Example:
    if the wing area is 110 square feet,
    and the weight is 1800 lb,
    and the eas is 55 kt,
    in straight and level flight (so the load factor = 1),
    
    then:
    >>> S = 110
    >>> W = 1800
    >>> EAS = 55
    >>> eas2cl(EAS, W, S, speed_units='kt', weight_units='lb', area_units='ft**2')
    1.597820083228606
    """

    eas = U.speed_conv(eas, from_units=speed_units, to_units='m/s')
    weight = U.wt_conv(weight, from_units=weight_units, to_units='kg')
    wing_area = U.area_conv(wing_area, from_units=area_units, to_units='m**2')

    Cl = (((2. * weight) * g) * load_factor) / ((Rho0 * wing_area) * eas**2.)

    return Cl
Example #11
0
def cl2lift(
    Cl,
    eas,
    wing_area,
    speed_units=default_speed_units,
    lift_units=default_weight_units,
    area_units=default_area_units,
):
    """
    Returns the lift, given coefficient of lift, equivalent airspeed, and wing
    area.
    """

    eas = U.speed_conv(eas, from_units=speed_units, to_units='m/s')
    wing_area = U.area_conv(wing_area, from_units=area_units, to_units='m**2')

    lift = (((0.5 * Rho0) * eas**2.) * wing_area) * Cl
    if lift_units == 'kg':
        lift = U.force_conv(lift, 'N', 'lb')
        lift = U.mass_conv(lift, 'lb', 'kg')
    else:
        lift = U.force_conv(lift, 'N', lift_units)

    return lift
 def test_06(self):
     Value = U.area_conv(1, from_units='nm**2', to_units='ft**2')
     Truth = (1852. / 0.3048) ** 2
     self.failUnless(RE(Value, Truth) <= 1e-5)
 def test_04(self):
     Value = U.area_conv(1, from_units='km**2', to_units='sm**2')
     Truth = ((1000 / 0.3048) / 5280) ** 2
     self.failUnless(RE(Value, Truth) <= 1e-5)
 def test_03(self):
     Value = U.area_conv(1000, from_units='m**2', to_units='km**2')
     Truth = 0.001
     self.failUnless(RE(Value, Truth) <= 1e-5)
 def test_02(self):
     Value = U.area_conv(144, from_units='in**2', to_units='m**2')
     Truth = 0.3048 ** 2
     self.failUnless(RE(Value, Truth) <= 1e-5)
 def test_01(self):
     Value = U.area_conv(10, from_units='ft**2', to_units='in**2')
     Truth = 1440
     self.failUnless(RE(Value, Truth) <= 1e-5)
 def test_05(self):
     Value = U.area_conv(1, from_units='sm**2', to_units='nm**2')
     Truth = (5280 / (1852. / 0.3048))**2
     self.assertTrue(RE(Value, Truth) <= 1e-5)
 def test_06(self):
     Value = U.area_conv(1, from_units='nm**2', to_units='ft**2')
     Truth = (1852. / 0.3048)**2
     self.failUnless(RE(Value, Truth) <= 1e-5)
 def test_04(self):
     Value = U.area_conv(1, from_units='km**2', to_units='sm**2')
     Truth = ((1000 / 0.3048) / 5280)**2
     self.failUnless(RE(Value, Truth) <= 1e-5)
 def test_03(self):
     Value = U.area_conv(1000, from_units='m**2', to_units='km**2')
     Truth = 0.001
     self.failUnless(RE(Value, Truth) <= 1e-5)
 def test_02(self):
     Value = U.area_conv(144, from_units='in**2', to_units='m**2')
     Truth = 0.3048**2
     self.failUnless(RE(Value, Truth) <= 1e-5)
 def test_01(self):
     Value = U.area_conv(10, from_units='ft**2', to_units='in**2')
     Truth = 1440
     self.failUnless(RE(Value, Truth) <= 1e-5)