def rank_origins(origins, destinations): p('debug', 'Ranking origins: %s' % origins) midpoint_origins = midpoint(origins) midpoint_destinations = midpoint(destinations) hub_route = Segment(midpoint_origins, midpoint_destinations) for origin in origins: AC = Segment(midpoint_origins, origin) orthogonal_heading = hub_route.get_initial_bearing() + 90 (a, b) = project_segment( abs(orthogonal_heading - AC.get_initial_bearing()), AC.get_length()) projection = midpoint_origins.get_position(orthogonal_heading, a) midpoint_to_projection = Segment(midpoint_origins, projection) angle = abs(hub_route.get_initial_bearing() - midpoint_to_projection.get_initial_bearing()) if abs(angle - 90) < 0.1: distance = -1 * midpoint_to_projection.get_length() else: distance = midpoint_to_projection.get_length() origin.distance_to_midpoint = distance return sorted(origins, key=lambda point: point.distance_to_midpoint)
def run(): alpha = .13 # Formation discount hub_to_destination = 1500 # distance in NM trunk_deviation = 4 # degrees W_1 = 297550 - 14000 # B777 Maxweight at start of cruise font = {'family': 'sans-serif', 'weight': 'normal', 'size': 12} model = {'name': 'B772', 'W_1': W_1, 'V': 500, 'c_L': .6, 'L_D': 19.26} # Split the segment hub-destination up into a trunk segment and a # cross segment (trunk, cross) = project_segment(trunk_deviation, hub_to_destination) for alpha in np.arange(.04, .20, .02): (Q_list, Q_opt, fuel_list, fuel_opt) =\ get_hookoff(alpha, trunk, cross, model) plt.plot(Q_list, fuel_list, label=r'$\alpha=%s$' % alpha) plt.plot(Q_opt, fuel_opt, 'sb') plt.xlabel('Q', fontweight='bold') plt.ylabel('Fuel Burn', fontweight='bold') plt.legend(loc=(0.05, 0.05)) plt.title('Breguet Fuel Burn Against Q (B777-200ER)', fontsize=16, fontweight='bold') plt.show()
def rank_origins(origins, destinations): p('debug', 'Ranking origins: %s' % origins) midpoint_origins = midpoint(origins) midpoint_destinations = midpoint(destinations) hub_route = Segment(midpoint_origins, midpoint_destinations) for origin in origins: AC = Segment(midpoint_origins, origin) orthogonal_heading = hub_route.get_initial_bearing() + 90 (a, b) = project_segment( abs(orthogonal_heading - AC.get_initial_bearing()), AC.get_length() ) projection = midpoint_origins.get_position( orthogonal_heading, a ) midpoint_to_projection = Segment( midpoint_origins, projection ) angle = abs( hub_route.get_initial_bearing() - midpoint_to_projection.get_initial_bearing() ) if abs(angle - 90) < 0.1: distance = -1 * midpoint_to_projection.get_length() else: distance = midpoint_to_projection.get_length() origin.distance_to_midpoint = distance return sorted(origins, key = lambda point: point.distance_to_midpoint)
def get_exit(hub, trunk_route, flight): dest = flight['route'].waypoints[-1] hub_to_dest = Segment(hub, dest) theta = abs(hub_to_dest.get_initial_bearing() - trunk_route.get_initial_bearing()) (a, b) = project_segment(theta, hub_to_dest.get_length()) Q = get_hookoff_quotient(a, b, config.alpha) d_hub_to_exit = a * Q # Exit to destination must be long enough to allow for safe descent # TOD is at 150NM out of dest, so exit->dest must be longer than 150NM d_exit_to_dest = 0 while d_exit_to_dest < 150: exit_point = hub.get_position( trunk_route.get_initial_bearing(), d_hub_to_exit ) d_hub_to_exit -= 1 exit_dest = Segment(exit_point, dest) d_exit_to_dest = exit_dest.get_length() assert exit_dest.get_length() > 150 print 'For flight %s, the exit point is %dNM away from dest' % ( flight['route'], d_exit_to_dest ) return exit_point
def run(): alpha = .13 # Formation discount hub_to_destination = 1500 # distance in NM trunk_deviation = 4 # degrees W_1 = 297550 - 14000 # B777 Maxweight at start of cruise font = {'family' : 'sans-serif', 'weight' : 'normal', 'size' : 12} models = [{ 'name' : 'B772', 'W_1' : W_1, 'V' : 500, 'c_L' : .6, 'L_D' : 19.26 },{ 'name' : 'A333', 'W_1' : W_1, 'V' : 500, 'c_L' : .5, 'L_D' : 17 },{ 'name' : 'B763', 'W_1' : W_1, 'V' : 500, 'c_L' : .48, 'L_D' : 16 }] # Split the segment hub-destination up into a trunk segment and a # cross segment (trunk, cross) = project_segment(trunk_deviation, hub_to_destination) for model in models: x = [] y = [] for alpha in np.arange(0.10, .16, .005): (Q_list, Q_opt, fuel_list, fuel_opt) =\ get_hookoff(alpha, trunk, cross, model) x.append(alpha) y.append(Q_opt) plt.plot(x, y, label = model['name']) plt.legend(loc=(0.05, 0.05)) plt.xlabel(r'$\alpha$') plt.ylabel(r'$Q$') plt.title( r'$Q_{opt}$ against $\alpha$ using Breguet Fuel Estimation' ) plt.show()
def run(): alpha = .13 # Formation discount hub_to_destination = 1500 # distance in NM trunk_deviation = 4 # degrees W_1 = 297550 - 14000 # B777 Maxweight at start of cruise font = {'family': 'sans-serif', 'weight': 'normal', 'size': 12} models = [{ 'name': 'B772', 'W_1': W_1, 'V': 500, 'c_L': .6, 'L_D': 19.26 }, { 'name': 'A333', 'W_1': W_1, 'V': 500, 'c_L': .5, 'L_D': 17 }, { 'name': 'B763', 'W_1': W_1, 'V': 500, 'c_L': .48, 'L_D': 16 }] # Split the segment hub-destination up into a trunk segment and a # cross segment (trunk, cross) = project_segment(trunk_deviation, hub_to_destination) for model in models: x = [] y = [] for alpha in np.arange(0.10, .16, .005): (Q_list, Q_opt, fuel_list, fuel_opt) =\ get_hookoff(alpha, trunk, cross, model) x.append(alpha) y.append(Q_opt) plt.plot(x, y, label=model['name']) plt.legend(loc=(0.05, 0.05)) plt.xlabel(r'$\alpha$') plt.ylabel(r'$Q$') plt.title(r'$Q_{opt}$ against $\alpha$ using Breguet Fuel Estimation') plt.show()
def get_exit(hub, trunk_route, flight): dest = flight['route'].waypoints[-1] hub_to_dest = Segment(hub, dest) theta = abs(hub_to_dest.get_initial_bearing() - trunk_route.get_initial_bearing()) (a, b) = project_segment(theta, hub_to_dest.get_length()) Q = get_hookoff_quotient(a, b, config.alpha) d_hub_to_exit = a * Q # Exit to destination must be long enough to allow for safe descent # TOD is at 150NM out of dest, so exit->dest must be longer than 150NM d_exit_to_dest = 0 while d_exit_to_dest < 150: exit_point = hub.get_position(trunk_route.get_initial_bearing(), d_hub_to_exit) d_hub_to_exit -= 1 exit_dest = Segment(exit_point, dest) d_exit_to_dest = exit_dest.get_length() assert exit_dest.get_length() > 150 print 'For flight %s, the exit point is %dNM away from dest' % ( flight['route'], d_exit_to_dest) return exit_point
def run(): alpha = .13 # Formation discount hub_to_destination = 1500 # distance in NM trunk_deviation = 4 # degrees W_1 = 297550 - 14000 # B777 Maxweight at start of cruise font = {'family' : 'sans-serif', 'weight' : 'normal', 'size' : 12} model = { 'name' : 'B772', 'W_1' : W_1, 'V' : 500, 'c_L' : .6, 'L_D' : 19.26 } # Split the segment hub-destination up into a trunk segment and a # cross segment (trunk, cross) = project_segment(trunk_deviation, hub_to_destination) for alpha in np.arange(.04, .20, .02): (Q_list, Q_opt, fuel_list, fuel_opt) =\ get_hookoff(alpha, trunk, cross, model) plt.plot(Q_list, fuel_list, label = r'$\alpha=%s$' % alpha) plt.plot(Q_opt, fuel_opt, 'sb') plt.xlabel('Q', fontweight = 'bold') plt.ylabel('Fuel Burn', fontweight = 'bold') plt.legend(loc=(0.05, 0.05)) plt.title('Breguet Fuel Burn Against Q (B777-200ER)', fontsize = 16, fontweight = 'bold') plt.show() #x = [] #y = [] #for alpha in np.arange(0, 1, .005): # (Q_list, Q_opt, fuel_list, fuel_opt) = get_hookoff(alpha, trunk, cross, W_1) # x.append(alpha) # y.append(Q_opt) # #plt.plot(x, y, ) #plt.xlabel('Q') #plt.ylabel('Fuel Burn') #plt.legend(loc=(0.05, 0.05)) #plt.title( # r'$Q_{opt}$ against $\alpha$ using Breguet Fuel Estimation (B777-200ER)' #) #plt.show()