def climb_data(prop, weight = 1800., alt_max = 20000., TO_fuel = 0, TO_dist = 0, \ fuel_units = 'USG', alt_interval = 500., isa_dev = 0, temp_units = 'C', \ rv = '8', wing_area = 110., pwr = 'max', pwr_factor=1.0, \ climb_speed = 'max', output = 'raw'): """ Returns a table of climb performance vs altitude. The items in each row of the table are altitude, time, fuel burned and distance. Time is in units of minutes, rounded to the nearest half minute. Fuel units are selectable, with a default of USG. Distances are in nm. The output may be specified as raw, latex (a LaTeX table for the POH), or array. pwr may be 'max', 'cc' (cruise climb = 2500 rpm and 25") or 2500 (2500 rpm and full throttle) climb_speed may be 'max' (Vy), 'cc' (120 kt to 10,000 ft, then reducing by 4 kt/1000 ft) or 'norm' (100 kt to 10,000 ft, then reducing by 2 kt/1000 ft) Note: compared cruise range for all climb speed and power. The predicted results are all within 1.5 nm of range. Thus there is no advantage to using anything but Vy and max power. """ def _alt2ROC(prop, alt): """ calculate ROC for an altitude """ temp = SA.isa2temp(isa_dev, alt) calc_pwr = alt2pwr(alt, rpm = rpm, MP_max = MP_max, temp = temp) * pwr_factor cas = alt2roc_speed(alt, climb_speed = climb_speed) eas = A.cas2eas(cas, alt) ROC = roc(prop, alt, eas, weight, calc_pwr, rpm, rv = rv, \ wing_area = wing_area) return ROC alt = 0 time = 0 fuel_used = U.avgas_conv(TO_fuel, from_units = fuel_units, to_units = 'lb') weight = weight - fuel_used dist = TO_dist if pwr == 'max': # rpm = 2700 rpm = 2650 MP_max = 30 elif pwr == 'cc': rpm = 2500 MP_max = 25 elif pwr == 2500: rpm = 2500 MP_max = 30 else: raise ValueError, "pwr must be one of 'max', 'cc', or 2500" if output == 'raw': print S.center('Altitude', 10), print S.center('ROC', 10), print S.center('Time', 10), print S.center('Fuel Used', 10), print S.center('Dist', 10), print S.center('Speed', 10) print S.center('(ft)', 10), print S.center('(ft/mn)', 10), print S.center('(mn)', 10), f_units = '(' + fuel_units + ')' print S.center(f_units, 10), print S.center('(nm)', 10), print S.center('(KCAS)', 10) # data for MSL print S.rjust(locale.format('%.0f', 0, True), 7), # calculate ROC at MSL print S.rjust(locale.format('%.0f', round(_alt2ROC(prop, 0) / 10.) * 10, \ True), 10), print S.rjust('%.1f' % (0), 10), print S.rjust('%.1f' % (TO_fuel), 10), print S.rjust('%.1f' % (TO_dist), 10), print S.rjust('%3d' % (alt2roc_speed(0, climb_speed = climb_speed)), 10) elif output == 'latex': temp = 15 + isa_dev MSL_line = [] MSL_line.append(str(locale.format('%.0f', weight, True))) MSL_line.append('0') MSL_line.append(str(locale.format('%.0f', temp))) MSL_line.append(str(locale.format('%.0f', alt2roc_speed(0, \ climb_speed = climb_speed)))) MSL_line.append(str(locale.format('%.0f', round(_alt2ROC(prop, 0) / 10.)\ * 10, True))) MSL_line.append('0') MSL_line.append(str(TO_fuel)) MSL_line.append(str(TO_dist)) print '&'.join(MSL_line) + '\\\\' print '\\hline' elif output == 'array': # no header rows, but make blank array array = [[0,0,TO_fuel,0]] calc_alt = alt_interval / 2. while calc_alt < alt_max: temp = SA.isa2temp(isa_dev, calc_alt) pwr = alt2pwr(calc_alt, rpm = rpm, MP_max = MP_max, temp = temp) calc_pwr = pwr * pwr_factor cas = alt2roc_speed(calc_alt, climb_speed = climb_speed) eas = A.cas2eas(cas, calc_alt) tas = A.cas2tas(cas, calc_alt, temp = temp, temp_units = temp_units) tas_fts = U.speed_conv(tas, from_units = 'kt', to_units = 'ft/s') ROC = roc(prop, calc_alt, eas, weight, calc_pwr, rpm, rv = rv, \ wing_area = wing_area) roc_fts = ROC / 60 fuel_flow = IO.pwr2ff(pwr, rpm, ff_units = 'lb/hr') slice_time = alt_interval / roc_fts slice_dist = tas_fts * slice_time slice_fuel = fuel_flow * slice_time / 3600 fuel_used += slice_fuel fuel_out = (U.avgas_conv(fuel_used, from_units = 'lb', \ to_units = fuel_units)) weight -= slice_fuel alt += alt_interval cas_out = alt2roc_speed(alt, climb_speed = climb_speed) temp_out = SA.isa2temp(isa_dev, alt) ROC = _alt2ROC(prop, alt) time += slice_time / 60 dist += slice_dist / 6076.115 if output == 'raw': print S.rjust(locale.format('%.0f', alt, True), 7), # calculate ROC at the displayed altitude print S.rjust(locale.format('%.0f', ROC, True), 10), print S.rjust('%.1f' % (time), 10), print S.rjust('%.1f' % (fuel_out), 10), print S.rjust('%.1f' % (dist), 10), print S.rjust('%3d' % (int(cas_out)), 10) elif output == 'latex': line = [] line.append(str(locale.format('%.0f', alt, True))) line.append(str(locale.format('%.0f', round(temp_out)))) line.append(str(locale.format('%.0f', cas_out))) line.append(str(locale.format('%.0f', round(ROC / 10.) * 10, True))) line.append(str(locale.format('%.0f', time))) line.append(str(locale.format('%.1f', fuel_out))) line.append(str(locale.format('%.0f', dist))) print '&' + '&'.join(line) + '\\\\' print '\\hline' elif output == 'array': array.append([alt, time, fuel_out, dist]) calc_alt += alt_interval if output == 'array': return array
def climb_data(prop, weight = 1800., alt_max = 20000., TO_fuel = 0, TO_dist = 0, \ fuel_units = 'USG', alt_interval = 500., isa_dev = 0, temp_units = 'C', \ rv = '8', wing_area = 110., pwr = 'max', pwr_factor=1.0, \ climb_speed = 'max', output = 'raw'): """ Returns a table of climb performance vs altitude. The items in each row of the table are altitude, time, fuel burned and distance. Time is in units of minutes, rounded to the nearest half minute. Fuel units are selectable, with a default of USG. Distances are in nm. The output may be specified as raw, latex (a LaTeX table for the POH), or array. pwr may be 'max', 'cc' (cruise climb = 2500 rpm and 25") or 2500 (2500 rpm and full throttle) climb_speed may be 'max' (Vy), 'cc' (120 kt to 10,000 ft, then reducing by 4 kt/1000 ft) or 'norm' (100 kt to 10,000 ft, then reducing by 2 kt/1000 ft) Note: compared cruise range for all climb speed and power. The predicted results are all within 1.5 nm of range. Thus there is no advantage to using anything but Vy and max power. """ def _alt2ROC(prop, alt): """ calculate ROC for an altitude """ temp = SA.isa2temp(isa_dev, alt) calc_pwr = alt2pwr(alt, rpm=rpm, MP_max=MP_max, temp=temp) * pwr_factor cas = alt2roc_speed(alt, climb_speed=climb_speed) eas = A.cas2eas(cas, alt) ROC = roc(prop, alt, eas, weight, calc_pwr, rpm, rv = rv, \ wing_area = wing_area) return ROC alt = 0 time = 0 fuel_used = U.avgas_conv(TO_fuel, from_units=fuel_units, to_units='lb') weight = weight - fuel_used dist = TO_dist if pwr == 'max': # rpm = 2700 rpm = 2650 MP_max = 30 elif pwr == 'cc': rpm = 2500 MP_max = 25 elif pwr == 2500: rpm = 2500 MP_max = 30 else: raise ValueError("pwr must be one of 'max', 'cc', or 2500") if output == 'raw': print(S.center('Altitude', 10), end=' ') print(S.center('ROC', 10), end=' ') print(S.center('Time', 10), end=' ') print(S.center('Fuel Used', 10), end=' ') print(S.center('Dist', 10), end=' ') print(S.center('Speed', 10)) print(S.center('(ft)', 10), end=' ') print(S.center('(ft/mn)', 10), end=' ') print(S.center('(mn)', 10), end=' ') f_units = '(' + fuel_units + ')' print(S.center(f_units, 10), end=' ') print(S.center('(nm)', 10), end=' ') print(S.center('(KCAS)', 10)) # data for MSL print(S.rjust(locale.format('%.0f', 0, True), 7), end=' ') # calculate ROC at MSL print(S.rjust(locale.format('%.0f', round(_alt2ROC(prop, 0) / 10.) * 10, \ True), 10), end=' ') print(S.rjust('%.1f' % (0), 10), end=' ') print(S.rjust('%.1f' % (TO_fuel), 10), end=' ') print(S.rjust('%.1f' % (TO_dist), 10), end=' ') print(S.rjust('%3d' % (alt2roc_speed(0, climb_speed=climb_speed)), 10)) elif output == 'latex': temp = 15 + isa_dev MSL_line = [] MSL_line.append(str(locale.format('%.0f', weight, True))) MSL_line.append('0') MSL_line.append(str(locale.format('%.0f', temp))) MSL_line.append(str(locale.format('%.0f', alt2roc_speed(0, \ climb_speed = climb_speed)))) MSL_line.append(str(locale.format('%.0f', round(_alt2ROC(prop, 0) / 10.)\ * 10, True))) MSL_line.append('0') MSL_line.append(str(TO_fuel)) MSL_line.append(str(TO_dist)) print('&'.join(MSL_line) + '\\\\') print('\\hline') elif output == 'array': # no header rows, but make blank array array = [[0, 0, TO_fuel, 0]] calc_alt = alt_interval / 2. while calc_alt < alt_max: temp = SA.isa2temp(isa_dev, calc_alt) pwr = alt2pwr(calc_alt, rpm=rpm, MP_max=MP_max, temp=temp) calc_pwr = pwr * pwr_factor cas = alt2roc_speed(calc_alt, climb_speed=climb_speed) eas = A.cas2eas(cas, calc_alt) tas = A.cas2tas(cas, calc_alt, temp=temp, temp_units=temp_units) tas_fts = U.speed_conv(tas, from_units='kt', to_units='ft/s') ROC = roc(prop, calc_alt, eas, weight, calc_pwr, rpm, rv = rv, \ wing_area = wing_area) roc_fts = ROC / 60 fuel_flow = IO.pwr2ff(pwr, rpm, ff_units='lb/hr') slice_time = alt_interval / roc_fts slice_dist = tas_fts * slice_time slice_fuel = fuel_flow * slice_time / 3600 fuel_used += slice_fuel fuel_out = (U.avgas_conv(fuel_used, from_units = 'lb', \ to_units = fuel_units)) weight -= slice_fuel alt += alt_interval cas_out = alt2roc_speed(alt, climb_speed=climb_speed) temp_out = SA.isa2temp(isa_dev, alt) ROC = _alt2ROC(prop, alt) time += slice_time / 60 dist += slice_dist / 6076.115 if output == 'raw': print(S.rjust(locale.format('%.0f', alt, True), 7), end=' ') # calculate ROC at the displayed altitude print(S.rjust(locale.format('%.0f', ROC, True), 10), end=' ') print(S.rjust('%.1f' % (time), 10), end=' ') print(S.rjust('%.1f' % (fuel_out), 10), end=' ') print(S.rjust('%.1f' % (dist), 10), end=' ') print(S.rjust('%3d' % (int(cas_out)), 10)) elif output == 'latex': line = [] line.append(str(locale.format('%.0f', alt, True))) line.append(str(locale.format('%.0f', round(temp_out)))) line.append(str(locale.format('%.0f', cas_out))) line.append(str(locale.format('%.0f', round(ROC / 10.) * 10, True))) line.append(str(locale.format('%.0f', time))) line.append(str(locale.format('%.1f', fuel_out))) line.append(str(locale.format('%.0f', dist))) print('&' + '&'.join(line) + '\\\\') print('\\hline') elif output == 'array': array.append([alt, time, fuel_out, dist]) calc_alt += alt_interval if output == 'array': return array
def cruise_data(prop, cruise_A=821.27884302, cruise_B=3.8201670757e-05,\ cruise_power = 130, mixture = 'econ', cruise_rpm=2400, climb_weight=1800., \ descent_weight=1600., alt_max=20000., fuel_units='USG', alt_interval=500., \ isa_dev=0, temp_units='C', rv='8', wing_area=110., TO_fuel = 1.5, TO_dist = 0, \ climb_pwr = 'max', climb_pwr_factor=0.9, \ climb_speed = 'norm', \ descent_tas=180, descent_ROD=-500., descent_angle='', speed_units='kt', \ descent_rpm=2100., descent_sfc=0.45, fuel_reserve=8, output='raw'): """ Returns a table of cruise performance vs altitude. The items in each row of the table are altitude, time, fuel burned and distance. Time is in units of minutes, rounded to the nearest half minute. Fuel units are selectable, with a default of USG. Distances are in nm. The output may be specified as raw, latex (a LaTeX table for the POH), data (suitable for graphing with gnuplot) or array. descent_angle is the flight path angle in degrees. It overrides the rate of descent (ROD) if provided. """ Wt_std = 1800. Wt_ratio = climb_weight/Wt_std climb_data_a = climb_data(prop, weight = climb_weight, alt_max = alt_max, TO_fuel = TO_fuel, TO_dist = TO_dist, fuel_units = fuel_units, alt_interval = alt_interval, isa_dev = isa_dev, temp_units = temp_units, rv = rv, wing_area = wing_area, pwr = climb_pwr, pwr_factor=climb_pwr_factor, climb_speed = climb_speed, output = 'array') descent_data_a = descent_data(prop, weight=descent_weight, alt_max=alt_max, fuel_units=fuel_units, alt_interval=alt_interval, isa_dev=isa_dev, temp_units=temp_units, rv=rv, wing_area=wing_area, tas=descent_tas, ROD=descent_ROD, angle=descent_angle, speed_units=speed_units, rpm=descent_rpm, sfc=descent_sfc, output='array') cruise_ff = IO.pwr2ff(cruise_power, cruise_rpm, mixture=mixture) if output == 'raw': print "Climb speed = %s and climb power = %s" % (climb_speed, climb_pwr) print "Cruise power = %.0f and cruise fuel flow = %.2f" % (cruise_power, cruise_ff) print S.center('Altitude', 10), print S.center('TAS', 10), print S.center('Range', 10), print S.center('Fuel Flow', 10) print S.center('(ft)', 10), print S.center('(kt)', 10), print S.center('(nm)', 10), print S.center('(USG/h)', 10) elif output == 'array': array = [] elif output == 'data': if descent_angle: angle_text = 'a descent angle of %s degrees' % descent_angle else: angle_text = 'a descent rate of %i ft/mn' % descent_ROD print '# RV-8 Cruise Range Chart - Wheel Pants OFF' print '# descent at %.0f KTAS and %s' % (descent_tas, angle_text) print '# %i%% power with fuel flow of %.1f USG/hr' % (cruise_power / 2., cruise_ff) print '# altitude range' print '# ft KTAS' elif output == 'latex': line.append(str(locale.format('%.0f', calt, True))) line.append(str(locale.format('%.1f', cruise_tas))) line.append(str(locale.format('%.0f', total_dist))) # print line pass for item in zip(climb_data_a, descent_data_a): ([calt, ctime, cfuel, cdist], [dalt, dtime, dfuel, ddist]) = item cruise_fuel = 42 - (cfuel + dfuel + fuel_reserve) sigma = SA.alt2density_ratio(calt) cruise_tas = 1/12.*((8*cruise_A*cruise_B*Wt_ratio**2 + (3.*M.sqrt(3.)*cruise_power**2*sigma + M.sqrt(-256*cruise_A**3.*cruise_B*Wt_ratio**6 + 27.*cruise_power**4*sigma**2))**(2/3.)*2**(1/3.)*cruise_B**(2/3.))**(3./4)*3.**(3./4)*sigma**(1/4.) + M.sqrt(12.*M.sqrt(3.*M.sqrt(3.)*cruise_power**2*sigma + M.sqrt(-256*cruise_A**3.*cruise_B*Wt_ratio**6 + 27.*cruise_power**4*sigma**2))*cruise_B**(1/3.)*cruise_power*sigma - M.sqrt(8*cruise_A*cruise_B*Wt_ratio**2 + (3.*M.sqrt(3.)*cruise_power**2*sigma + M.sqrt(-256*cruise_A**3.*cruise_B*Wt_ratio**6 + 27.*cruise_power**4*sigma**2))**(2/3.)*2**(1/3.)*cruise_B**(2/3.))*(8*3.**(1/4.)*cruise_A*cruise_B**(1/3.)*Wt_ratio**2*M.sqrt(sigma) + (3.*M.sqrt(3.)*cruise_power**2*sigma + M.sqrt(-256*cruise_A**3.*cruise_B*Wt_ratio**6 + 27.*cruise_power**4*sigma**2))**(2/3.)*2**(1/3.)*3.**(1/4.)*M.sqrt(sigma)))*3.**(5/8)*abs(cruise_B)**(1/3.))*2**(2/3.)/((3.*M.sqrt(3.)*cruise_power**2*sigma + M.sqrt(-256*cruise_A**3.*cruise_B*Wt_ratio**6 + 27.*cruise_power**4*sigma**2))**(1/6.)*(8*cruise_A*cruise_B*Wt_ratio**2 + (3.*M.sqrt(3.)*cruise_power**2*sigma + M.sqrt(-256*cruise_A**3.*cruise_B*Wt_ratio**6 + 27.*cruise_power**4*sigma**2))**(2/3.)*2**(1/3.)*cruise_B**(2/3.))**(1/4.)*cruise_B**(2/3.)*sigma**(3./4)) cruise_dist = cruise_fuel * cruise_tas / cruise_ff cruise_time = cruise_dist / cruise_tas * 60 total_dist = cdist + cruise_dist + ddist total_time = ctime + cruise_time + dtime # print "%5.0f %.1f %.1f %.1f %5.1f" % (calt, cruise_tas, cruise_fuel, cruise_dist, total_dist) if output == 'raw': print S.rjust(locale.format('%.0f', calt, True), 7), print S.rjust('%.1f' % (cruise_tas), 10), print S.rjust('%.1f' % (total_dist), 10), print S.rjust('%.1f' % (cruise_ff), 10) elif output == 'data': print '%.1f\t%.0f' % (total_dist, calt)
def cruise_data(prop, cruise_A=821.27884302, cruise_B=3.8201670757e-05,\ cruise_power = 130, mixture = 'econ', cruise_rpm=2400, climb_weight=1800., \ descent_weight=1600., alt_max=20000., fuel_units='USG', alt_interval=500., \ isa_dev=0, temp_units='C', rv='8', wing_area=110., TO_fuel = 1.5, TO_dist = 0, \ climb_pwr = 'max', climb_pwr_factor=0.9, \ climb_speed = 'norm', \ descent_tas=180, descent_ROD=-500., descent_angle='', speed_units='kt', \ descent_rpm=2100., descent_sfc=0.45, fuel_reserve=8, output='raw'): """ Returns a table of cruise performance vs altitude. The items in each row of the table are altitude, time, fuel burned and distance. Time is in units of minutes, rounded to the nearest half minute. Fuel units are selectable, with a default of USG. Distances are in nm. The output may be specified as raw, latex (a LaTeX table for the POH), data (suitable for graphing with gnuplot) or array. descent_angle is the flight path angle in degrees. It overrides the rate of descent (ROD) if provided. """ Wt_std = 1800. Wt_ratio = climb_weight / Wt_std climb_data_a = climb_data(prop, weight=climb_weight, alt_max=alt_max, TO_fuel=TO_fuel, TO_dist=TO_dist, fuel_units=fuel_units, alt_interval=alt_interval, isa_dev=isa_dev, temp_units=temp_units, rv=rv, wing_area=wing_area, pwr=climb_pwr, pwr_factor=climb_pwr_factor, climb_speed=climb_speed, output='array') descent_data_a = descent_data(prop, weight=descent_weight, alt_max=alt_max, fuel_units=fuel_units, alt_interval=alt_interval, isa_dev=isa_dev, temp_units=temp_units, rv=rv, wing_area=wing_area, tas=descent_tas, ROD=descent_ROD, angle=descent_angle, speed_units=speed_units, rpm=descent_rpm, sfc=descent_sfc, output='array') cruise_ff = IO.pwr2ff(cruise_power, cruise_rpm, mixture=mixture) if output == 'raw': print("Climb speed = %s and climb power = %s" % (climb_speed, climb_pwr)) print("Cruise power = %.0f and cruise fuel flow = %.2f" % (cruise_power, cruise_ff)) print(S.center('Altitude', 10), end=' ') print(S.center('TAS', 10), end=' ') print(S.center('Range', 10), end=' ') print(S.center('Fuel Flow', 10)) print(S.center('(ft)', 10), end=' ') print(S.center('(kt)', 10), end=' ') print(S.center('(nm)', 10), end=' ') print(S.center('(USG/h)', 10)) elif output == 'array': array = [] elif output == 'data': if descent_angle: angle_text = 'a descent angle of %s degrees' % descent_angle else: angle_text = 'a descent rate of %i ft/mn' % descent_ROD print('# RV-8 Cruise Range Chart - Wheel Pants OFF') print('# descent at %.0f KTAS and %s' % (descent_tas, angle_text)) print('# %i%% power with fuel flow of %.1f USG/hr' % (cruise_power / 2., cruise_ff)) print('# altitude range') print('# ft KTAS') elif output == 'latex': line.append(str(locale.format('%.0f', calt, True))) line.append(str(locale.format('%.1f', cruise_tas))) line.append(str(locale.format('%.0f', total_dist))) # print line pass for item in zip(climb_data_a, descent_data_a): ([calt, ctime, cfuel, cdist], [dalt, dtime, dfuel, ddist]) = item cruise_fuel = 42 - (cfuel + dfuel + fuel_reserve) sigma = SA.alt2density_ratio(calt) cruise_tas = 1 / 12. * ( (8 * cruise_A * cruise_B * Wt_ratio**2 + (3. * M.sqrt(3.) * cruise_power**2 * sigma + M.sqrt(-256 * cruise_A**3. * cruise_B * Wt_ratio**6 + 27. * cruise_power**4 * sigma**2))**(2 / 3.) * 2** (1 / 3.) * cruise_B**(2 / 3.))**(3. / 4) * 3.**(3. / 4) * sigma** (1 / 4.) + M.sqrt( 12. * M.sqrt(3. * M.sqrt(3.) * cruise_power**2 * sigma + M.sqrt(-256 * cruise_A**3. * cruise_B * Wt_ratio**6 + 27. * cruise_power**4 * sigma**2)) * cruise_B** (1 / 3.) * cruise_power * sigma - M.sqrt(8 * cruise_A * cruise_B * Wt_ratio**2 + (3. * M.sqrt(3.) * cruise_power**2 * sigma + M.sqrt(-256 * cruise_A**3. * cruise_B * Wt_ratio**6 + 27. * cruise_power**4 * sigma**2))** (2 / 3.) * 2**(1 / 3.) * cruise_B**(2 / 3.)) * (8 * 3.**(1 / 4.) * cruise_A * cruise_B** (1 / 3.) * Wt_ratio**2 * M.sqrt(sigma) + (3. * M.sqrt(3.) * cruise_power**2 * sigma + M.sqrt(-256 * cruise_A**3. * cruise_B * Wt_ratio**6 + 27. * cruise_power**4 * sigma**2))**(2 / 3.) * 2** (1 / 3.) * 3.**(1 / 4.) * M.sqrt(sigma))) * 3.** (5 / 8) * abs(cruise_B)**(1 / 3.)) * 2**(2 / 3.) / ( (3. * M.sqrt(3.) * cruise_power**2 * sigma + M.sqrt(-256 * cruise_A**3. * cruise_B * Wt_ratio**6 + 27. * cruise_power**4 * sigma**2))**(1 / 6.) * (8 * cruise_A * cruise_B * Wt_ratio**2 + (3. * M.sqrt(3.) * cruise_power**2 * sigma + M.sqrt(-256 * cruise_A**3. * cruise_B * Wt_ratio**6 + 27. * cruise_power**4 * sigma**2))**(2 / 3.) * 2** (1 / 3.) * cruise_B**(2 / 3.))**(1 / 4.) * cruise_B**(2 / 3.) * sigma**(3. / 4)) cruise_dist = cruise_fuel * cruise_tas / cruise_ff cruise_time = cruise_dist / cruise_tas * 60 total_dist = cdist + cruise_dist + ddist total_time = ctime + cruise_time + dtime # print "%5.0f %.1f %.1f %.1f %5.1f" % (calt, cruise_tas, cruise_fuel, cruise_dist, total_dist) if output == 'raw': print(S.rjust(locale.format('%.0f', calt, True), 7), end=' ') print(S.rjust('%.1f' % (cruise_tas), 10), end=' ') print(S.rjust('%.1f' % (total_dist), 10), end=' ') print(S.rjust('%.1f' % (cruise_ff), 10)) elif output == 'data': print('%.1f\t%.0f' % (total_dist, calt))