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 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
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
def eff2thrust(eff, bhp, TAS, power_units="hp", speed_units="kt", thrust_units="lb"): """ Returns thrust, given prop efficiency, true airspeed and brake power. Matches the results from the Hartzell prop map program fairly closely. """ TAS = U.speed_conv(TAS, from_units=speed_units, to_units="m/s") bhp = U.power_conv(bhp, from_units=power_units, to_units="W") thrust = eff * bhp / TAS return U.force_conv(thrust, from_units="N", to_units=thrust_units)
def ct2thrust(Ct, Rho, rpm, dia, thrust_units="lb", density_units="lb/ft**3", dia_units="in"): """ Returns the thrust, given thrust coefficient, Ct, density, rpm and prop diameter. """ Rho = U.density_conv(Rho, from_units=density_units, to_units="kg/m**3") dia = U.length_conv(dia, from_units=dia_units, to_units="m") # convert rpm to revolutions / s n = rpm / 60.0 thrust = Ct * Rho * n ** 2.0 * dia ** 4.0 return U.force_conv(thrust, from_units="N", to_units=thrust_units)
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 eff2thrust(eff, bhp, TAS, power_units='hp', speed_units='kt', thrust_units='lb'): """ Returns thrust, given prop efficiency, true airspeed and brake power. Matches the results from the Hartzell prop map program fairly closely. """ TAS = U.speed_conv(TAS, from_units=speed_units, to_units='m/s') bhp = U.power_conv(bhp, from_units=power_units, to_units='W') thrust = eff * bhp / TAS return U.force_conv(thrust, from_units='N', to_units=thrust_units)
def ct2thrust(Ct, Rho, rpm, dia, thrust_units='lb', density_units='lb/ft**3', dia_units='in'): """ Returns the thrust, given thrust coefficient, Ct, density, rpm and prop diameter. """ Rho = U.density_conv(Rho, from_units=density_units, to_units='kg/m**3') dia = U.length_conv(dia, from_units=dia_units, to_units='m') # convert rpm to revolutions / s n = rpm / 60. thrust = Ct * Rho * n**2. * dia**4. return U.force_conv(thrust, from_units='N', to_units=thrust_units)
def test_02(self): Value = U.force_conv(444.82216, from_units='N', to_units='lb') Truth = 100 self.failUnless(RE(Value, Truth) <= 1e-7)
def test_01(self): Value = U.force_conv(100, from_units='lb', to_units='N') Truth = 444.82216 self.failUnless(RE(Value, Truth) <= 1e-7)
def test_02(self): Value = U.force_conv(444.822, from_units='N', to_units='lb') Truth = 100 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_01(self): Value = U.force_conv(100, from_units='lb', to_units='N') Truth = 444.822 self.failUnless(RE(Value, Truth) <= 1e-5)
def test_02(self): Value = U.force_conv(444.82216, from_units='N', to_units='lb') Truth = 100 self.assertTrue(RE(Value, Truth) <= 1e-7)
def test_01(self): Value = U.force_conv(100, from_units='lb', to_units='N') Truth = 444.82216 self.assertTrue(RE(Value, Truth) <= 1e-7)