def test_03(self): # Truth values from NASA RP 1046 Value = SA.alt2press_ratio(20000, alt_units='m') Truth = 5474.87 / 101325 self.assertLessEqual(RE(Value, Truth), 1e-5)
def test_02(self): # Truth values from NASA RP 1046 Value = SA.alt2press_ratio(-1000) Truth = 2193.82 / 2116.22 self.assertLessEqual(RE(Value, Truth), 1e-5)
def prop_eff(prop, bhp, rpm, tas, altitude, temp='std', power_units='hp', alt_units='ft', temp_units='C', speed_units='kt', dia_units='in'): """ Returns propeller efficiency based on engine power provided to the propeller. """ press_ratio = SA.alt2press_ratio(altitude, alt_units=alt_units) if temp == 'std': temp = SA.alt2temp(altitude, temp_units=temp_units, alt_units=alt_units) temp_ratio = U.temp_conv(temp, from_units=temp_units, to_units='K') / 288.15 density_ratio = press_ratio / temp_ratio density = density_ratio * SA.Rho0 Cp = bhp2Cp(bhp, rpm, density, prop.dia, power_units=power_units, density_units='kg/m**3', dia_units=dia_units) J = advance_ratio(tas, rpm, prop.dia, speed_units=speed_units, dia_units=dia_units) blade_tip_mach = tip_mach(tas, rpm, temp, prop.dia, speed_units=speed_units, temp_units=temp_units, dia_units=dia_units) prop_eff = cp2eff(prop, Cp, J, blade_tip_mach) if N.isnan(prop_eff): raise ValueError('Out of range inputs') return prop_eff
def blade_angle2bhp(prop, blade_angle, rpm, tas, altitude, temp='std', power_units='hp', alt_units='ft', temp_units='C', speed_units='kt', dia_units='in'): """ Returns returns engine power, given blade angle, rpm and flight conditions. """ press_ratio = SA.alt2press_ratio(altitude, alt_units=alt_units) if temp == 'std': temp = SA.alt2temp(altitude, temp_units=temp_units, alt_units=alt_units) temp_ratio = U.temp_conv(temp, from_units=temp_units, to_units='K') / 288.15 density_ratio = press_ratio / temp_ratio density = density_ratio * SA.Rho0 # Cp = bhp2Cp(bhp, rpm, density, prop.dia, power_units = power_units, density_units = 'kg/m**3', dia_units = dia_units) J = advance_ratio(tas, rpm, prop.dia, speed_units=speed_units, dia_units=dia_units) blade_tip_mach = tip_mach(tas, rpm, temp, prop.dia, speed_units=speed_units, temp_units=temp_units, dia_units=dia_units) Cp = blade_angle2cp(prop, blade_angle, J, blade_tip_mach) bhp = cp2bhp(Cp, rpm, density, prop.dia, power_units=power_units, density_units='kg/m**3', dia_units=dia_units) return bhp
def blade_angle(prop, bhp, rpm, tas, altitude, temp='std', power_units='hp', alt_units='ft', temp_units='C', speed_units='kt', dia_units='in'): """ Returns propeller blade angle. """ press_ratio = SA.alt2press_ratio(altitude, alt_units=alt_units) if temp == 'std': temp = SA.alt2temp(altitude, temp_units=temp_units, alt_units=alt_units) temp_ratio = U.temp_conv(temp, from_units=temp_units, to_units='K') / 288.15 density_ratio = press_ratio / temp_ratio density = density_ratio * SA.Rho0 Cp = bhp2Cp(bhp, rpm, density, prop.dia, power_units=power_units, density_units='kg/m**3', dia_units=dia_units) J = advance_ratio(tas, rpm, prop.dia, speed_units=speed_units, dia_units=dia_units) blade_tip_mach = tip_mach(tas, rpm, temp, prop.dia, speed_units=speed_units, temp_units=temp_units, dia_units=dia_units) blade_angle = cp2blade_angle(prop, Cp, J, blade_tip_mach) return blade_angle
def prop_data(prop, bhp, rpm, tas, altitude, temp='std', power_units='hp', alt_units='ft', temp_units='C', speed_units='kt', dia_units='in', thrust_units='lb'): """ Returns advance ratio, power coefficient, thrust coefficient, blade tip mach number, propeller efficiency and thrust. Validated against Excel spreadsheet provided by Les Doud (Hartzell). """ press_ratio = SA.alt2press_ratio(altitude, alt_units=alt_units) if temp == 'std': temp = SA.alt2temp(altitude, temp_units=temp_units, alt_units=alt_units) temp_ratio = U.temp_conv(temp, from_units=temp_units, to_units='K') / 288.15 density_ratio = press_ratio / temp_ratio density = density_ratio * SA.Rho0 Cp = bhp2Cp(bhp, rpm, density, prop.dia, power_units=power_units, density_units='kg/m**3', dia_units=dia_units) J = advance_ratio(tas, rpm, prop.dia, speed_units=speed_units, dia_units=dia_units) blade_tip_mach = tip_mach(tas, rpm, temp, prop.dia, speed_units=speed_units, temp_units=temp_units, dia_units=dia_units) prop_eff = cp2eff(prop, Cp, J, blade_tip_mach) try: Ct = cp2ct(prop, Cp, J, blade_tip_mach) except BaseException: Ct = cp2ct_alt(prop, Cp, bhp, rpm, tas, altitude, temp=temp, power_units=power_units, alt_units=alt_units, temp_units=temp_units, speed_units=speed_units) if prop_eff > 0.1: thrust = eff2thrust(prop_eff, bhp, tas, power_units=power_units, speed_units=speed_units, thrust_units=thrust_units) else: thrust = ct2thrust(Ct, density, rpm, prop.dia, thrust_units=thrust_units, density_units='kg/m**3', dia_units=dia_units) # data_block = 'J = ' + str(J) + '\nCp = ' + str(Cp) + '\n Tip mach = ' + str(blade_tip_mach) + '\n Ct = ' + str(Ct) + '\n Thrust = ' + str(thrust) + ' ' + thrust_units + '\n Prop efficiency = ' + str(prop_eff) print(' prop = ', prop.prop) print(' J = %.3f' % J) print(' Cp = %.5f' % Cp) print(' Tip Mach = %.3f' % blade_tip_mach) print(' Ct = %.3f' % Ct) print(' Thrust = %.2f' % thrust, thrust_units) print('Prop efficiency = %.4f' % prop_eff) print(' Thrust HP = %.2f' % bhp * prop_eff) return
def test_01(self): PR = SA.alt2press_ratio(0) self.assertEqual(PR, 1)