souvik0306 commited on
Commit
53ec97e
·
1 Parent(s): c60f2c8

fuel calculation corrections

Browse files
Files changed (3) hide show
  1. aircraft.csv +10 -10
  2. flight_distance.py +8 -7
  3. main.py +6 -6
aircraft.csv CHANGED
@@ -1,13 +1,13 @@
1
  Aircraft,Range_NauticalMiles,Range_km,Fuel_Consumption_kg/hr,Cruising Speed (kts),Speed_kmh,MaxFlightTime_hr,Max_Fuel_Capacity_kg
2
- Airbus A320,3300,6111.6,2430,468,866.74,7.05,17131.5
3
  Airbus A321-100,3000,5556,2885,493,913.04,6.09,17569.65
4
- Airbus A321-231,3200,5926.4,2740,493,913.04,6.49,17782.6
5
  Airbus A330-200,7250,13427,5590,490,907.48,14.8,82732
6
  Airbus A330-300,6350,11760.2,5700,490,907.48,12.96,73872
7
  Airbus A340-300,7300,13519.6,6500,488,903.78,14.96,97240
8
  Airbus A340-500,9000,16668,8000,488,903.78,18.44,147520
9
- Airbus A350-900,8100,15732,5800,470,870.44,17.23,165000
10
- Airbus A380,8000,14816,12280,470,870.44,17.35,256000
11
  Boeing 737-800,2935,5435.62,2530,455,842.66,6.45,16318.5
12
  Boeing 747-400,7260,13445.52,10230,488,903.78,14.88,152222.4
13
  Boeing 747-8,7730,14315.96,9600,470,870.44,16.45,157920
@@ -15,9 +15,9 @@ Boeing 757-200,3915,7250.58,3320,470,870.44,8.33,27655.6
15
  Boeing 767-200,3900,7222.8,4500,470,870.44,8.3,37350
16
  Boeing 767-300,4020,7445.04,4800,470,870.44,8.55,41040
17
  Boeing 767-300ER,5980,11074.96,4940,490,907.48,12.2,60268
18
- Boeing 777-200,5240,9704.48,6080,490,907.48,10.69,64995.2
19
- Boeing 777-200ER,7725,14306.7,6630,470,870.44,16.44,108997.2
20
- Boeing 777-200LR,8555,15843.86,6800,488,903.78,17.53,119204
21
- Boeing 777-300ER,7370,13649.24,7700,447,827.84,16.49,127154.39
22
- Boeing 787-8,7355,13621.46,4900,447,827.84,16.45,80605
23
- Boeing 787-9,7530,13945.56,5600,447,827.84,17.45,12116
 
1
  Aircraft,Range_NauticalMiles,Range_km,Fuel_Consumption_kg/hr,Cruising Speed (kts),Speed_kmh,MaxFlightTime_hr,Max_Fuel_Capacity_kg
2
+ Airbus A320,3300,6111.6,2430,468,829,7.05,21760
3
  Airbus A321-100,3000,5556,2885,493,913.04,6.09,17569.65
4
+ Airbus A321-200,3200,5926.4,2740,493,913.04,6.49,17782.6
5
  Airbus A330-200,7250,13427,5590,490,907.48,14.8,82732
6
  Airbus A330-300,6350,11760.2,5700,490,907.48,12.96,73872
7
  Airbus A340-300,7300,13519.6,6500,488,903.78,14.96,97240
8
  Airbus A340-500,9000,16668,8000,488,903.78,18.44,147520
9
+ Airbus A350-900,8100,15732,5800,470,903,17.23,165000
10
+ Airbus A380,8000,14816,12280,470,903,17.35,256000
11
  Boeing 737-800,2935,5435.62,2530,455,842.66,6.45,16318.5
12
  Boeing 747-400,7260,13445.52,10230,488,903.78,14.88,152222.4
13
  Boeing 747-8,7730,14315.96,9600,470,870.44,16.45,157920
 
15
  Boeing 767-200,3900,7222.8,4500,470,870.44,8.3,37350
16
  Boeing 767-300,4020,7445.04,4800,470,870.44,8.55,41040
17
  Boeing 767-300ER,5980,11074.96,4940,490,907.48,12.2,60268
18
+ Boeing 777-200,5240,9704.48,6080,490,907.48,10.69,93872
19
+ Boeing 777-200ER,7725,14306.7,6630,470,870.44,16.44,136936
20
+ Boeing 777-200LR,8555,15843.86,6800,488,903.78,17.53,145024
21
+ Boeing 777-300ER,7370,13649.24,7700,447,827.84,16.49,145024
22
+ Boeing 787-8,7355,13621.46,4900,447,827.84,16.45,101343
23
+ Boeing 787-9,7530,13945.56,5600,447,827.84,17.45,101522
flight_distance.py CHANGED
@@ -133,10 +133,10 @@ def calculate_fuel_and_time(distance, cruising_speed, fuel_burn_rate, reserve_fu
133
  :return: Total fuel required including reserve, and estimated flight time
134
  """
135
  # Phase speeds and times
136
- climb_speed = cruising_speed*0.7
137
- descent_speed = cruising_speed*0.6 # km/h
138
- climb_descent_distance = distance * climb_descent_fraction
139
- cruise_distance = distance - (2 * climb_descent_distance) # Remaining distance for cruise
140
 
141
  # Adjust if cruise distance is negative (short flights)
142
  if cruise_distance < 0:
@@ -144,10 +144,11 @@ def calculate_fuel_and_time(distance, cruising_speed, fuel_burn_rate, reserve_fu
144
  descent_time = climb_descent_distance / descent_speed
145
  cruise_distance = 0
146
 
147
- cruise_time = cruise_distance / cruising_speed
148
- climb_time = climb_descent_distance / climb_speed
149
- descent_time = climb_descent_distance / descent_speed
150
  # Total flight time
 
151
  total_flight_time = climb_time + cruise_time + descent_time
152
 
153
  # Fuel calculations
 
133
  :return: Total fuel required including reserve, and estimated flight time
134
  """
135
  # Phase speeds and times
136
+ climb_speed = cruising_speed*0.3 # km/h
137
+ descent_speed = cruising_speed*0.2 # km/h
138
+ climb_descent_distance = round(distance * climb_descent_fraction,2)
139
+ cruise_distance = round(distance - (2 * climb_descent_distance),2) # Remaining distance for cruise
140
 
141
  # Adjust if cruise distance is negative (short flights)
142
  if cruise_distance < 0:
 
144
  descent_time = climb_descent_distance / descent_speed
145
  cruise_distance = 0
146
 
147
+ cruise_time = round(cruise_distance / cruising_speed,2)
148
+ climb_time = round(climb_descent_distance / climb_speed,2)
149
+ descent_time = round(climb_descent_distance / descent_speed,2)
150
  # Total flight time
151
+ print(climb_descent_distance,climb_time,cruise_distance, cruise_time,descent_time)
152
  total_flight_time = climb_time + cruise_time + descent_time
153
 
154
  # Fuel calculations
main.py CHANGED
@@ -3,20 +3,20 @@ from flight_distance import *
3
  from optimizer import *
4
  from weather import *
5
 
6
- airport_identifiers = ['BLR', 'CCU', 'DEL'] # Replace with actual identifiers
7
 
8
  #Get Airport Coordinates
9
  lat_long_dict = get_airport_lat_long(airport_identifiers)
10
- print("Coordinates: \n",lat_long_dict)
11
 
12
  #Get Distance between each node (airports)
13
  trip_distance = calculate_distances(airport_identifiers)
14
- print("Distance b/w Airports: \n",trip_distance)
15
 
16
  #Get onroute weather
17
  raw_weather = fetch_weather_for_all_routes(airport_identifiers, lat_long_dict)
18
  route_factors = extract_route_factors(raw_weather)
19
- print("On Route weather: \n", raw_weather)
20
 
21
  # # Ensure the graph is bidirectional (undirected)
22
  for (a, b), dist in list(trip_distance.items()):
@@ -27,9 +27,9 @@ optimal_route, optimal_distance = find_optimal_route(airport_identifiers, trip_d
27
 
28
  # Display the optimal route and the total adjusted distance/cost
29
  print("Optimal Route:", " -> ".join(optimal_route) + f" -> {optimal_route[0]}")
30
- print("Total Adjusted Distance:", optimal_distance)
31
 
32
- aircraft_type = input("Enter the aircraft type: ")
33
 
34
  # Check if the aircraft can fly the route without refuel
35
  result = can_fly_route(aircraft_type, airport_identifiers)
 
3
  from optimizer import *
4
  from weather import *
5
 
6
+ airport_identifiers = ['BLR', 'SFO'] # Replace with actual identifiers
7
 
8
  #Get Airport Coordinates
9
  lat_long_dict = get_airport_lat_long(airport_identifiers)
10
+ # print("Coordinates: \n",lat_long_dict)
11
 
12
  #Get Distance between each node (airports)
13
  trip_distance = calculate_distances(airport_identifiers)
14
+ # print("Distance b/w Airports: \n",trip_distance)
15
 
16
  #Get onroute weather
17
  raw_weather = fetch_weather_for_all_routes(airport_identifiers, lat_long_dict)
18
  route_factors = extract_route_factors(raw_weather)
19
+ # print("On Route weather: \n", raw_weather)
20
 
21
  # # Ensure the graph is bidirectional (undirected)
22
  for (a, b), dist in list(trip_distance.items()):
 
27
 
28
  # Display the optimal route and the total adjusted distance/cost
29
  print("Optimal Route:", " -> ".join(optimal_route) + f" -> {optimal_route[0]}")
30
+ print("Total Round Trip Distance:", optimal_distance)
31
 
32
+ aircraft_type = "Boeing 777-200LR"
33
 
34
  # Check if the aircraft can fly the route without refuel
35
  result = can_fly_route(aircraft_type, airport_identifiers)