Spaces:
Running
Running
Commit
·
c60f2c8
1
Parent(s):
59def3e
fuel calculation
Browse files- aircraft.csv +23 -23
- flight_distance.py +9 -13
- flight_route_ui.py +1 -1
- main.py +1 -1
- weather.py +1 -1
aircraft.csv
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
Aircraft,Range_NauticalMiles,Range_km,Fuel_Consumption_kg/hr,Cruising Speed (kts),Speed_kmh,MaxFlightTime_hr,Max_Fuel_Capacity_kg
|
2 |
-
|
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.
|
5 |
-
Airbus
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
Boeing 747-
|
14 |
-
|
15 |
-
Boeing
|
16 |
-
Boeing
|
17 |
-
Boeing
|
18 |
-
Boeing 777-
|
19 |
-
Boeing
|
20 |
-
|
21 |
-
|
22 |
-
Boeing
|
23 |
-
|
|
|
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
|
14 |
+
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
|
flight_distance.py
CHANGED
@@ -121,7 +121,7 @@ def calculate_distances(airport_identifiers):
|
|
121 |
|
122 |
return distances
|
123 |
|
124 |
-
def calculate_fuel_and_time(distance, cruising_speed, fuel_burn_rate, reserve_fuel_percentage, max_fuel_capacity):
|
125 |
"""
|
126 |
Calculate the total fuel required for a given distance including reserve fuel and flight time.
|
127 |
|
@@ -133,24 +133,20 @@ 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 =
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
# Calculate distances for each phase
|
142 |
-
climb_distance = climb_speed * climb_time
|
143 |
-
descent_distance = descent_speed * descent_time
|
144 |
-
cruise_distance = distance - (climb_distance + descent_distance)
|
145 |
|
146 |
# Adjust if cruise distance is negative (short flights)
|
147 |
if cruise_distance < 0:
|
148 |
-
climb_time =
|
149 |
-
descent_time =
|
150 |
cruise_distance = 0
|
151 |
|
152 |
cruise_time = cruise_distance / cruising_speed
|
153 |
-
|
|
|
154 |
# Total flight time
|
155 |
total_flight_time = climb_time + cruise_time + descent_time
|
156 |
|
|
|
121 |
|
122 |
return distances
|
123 |
|
124 |
+
def calculate_fuel_and_time(distance, cruising_speed, fuel_burn_rate, reserve_fuel_percentage, max_fuel_capacity, climb_descent_fraction=0.02):
|
125 |
"""
|
126 |
Calculate the total fuel required for a given distance including reserve fuel and flight time.
|
127 |
|
|
|
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:
|
143 |
+
climb_time = climb_descent_distance / climb_speed
|
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 |
|
flight_route_ui.py
CHANGED
@@ -48,7 +48,7 @@ def check_route(airport_selections, aircraft_type):
|
|
48 |
# Convert all dictionary keys to strings for JSON compatibility
|
49 |
return {
|
50 |
"Optimal Route": " -> ".join(optimal_route) + f" -> {optimal_route[0]}",
|
51 |
-
"Total
|
52 |
"Can Fly Route": str(result) # Convert to string if necessary
|
53 |
}
|
54 |
|
|
|
48 |
# Convert all dictionary keys to strings for JSON compatibility
|
49 |
return {
|
50 |
"Optimal Route": " -> ".join(optimal_route) + f" -> {optimal_route[0]}",
|
51 |
+
"Total Round Trip Distance": str(optimal_distance), # Convert to string if necessary
|
52 |
"Can Fly Route": str(result) # Convert to string if necessary
|
53 |
}
|
54 |
|
main.py
CHANGED
@@ -27,7 +27,7 @@ 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
|
31 |
|
32 |
aircraft_type = input("Enter the aircraft type: ")
|
33 |
|
|
|
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 |
|
weather.py
CHANGED
@@ -7,7 +7,7 @@ from functools import lru_cache
|
|
7 |
API_KEY = '9811dd1481209c64fba6cb2c90f27140'
|
8 |
|
9 |
# Interpolation function to get intermediate points between airports
|
10 |
-
def get_intermediate_points(start, end, num_points=
|
11 |
points = []
|
12 |
lat_step = (end[0] - start[0]) / (num_points + 1)
|
13 |
lon_step = (end[1] - start[1]) / (num_points + 1)
|
|
|
7 |
API_KEY = '9811dd1481209c64fba6cb2c90f27140'
|
8 |
|
9 |
# Interpolation function to get intermediate points between airports
|
10 |
+
def get_intermediate_points(start, end, num_points=4):
|
11 |
points = []
|
12 |
lat_step = (end[0] - start[0]) / (num_points + 1)
|
13 |
lon_step = (end[1] - start[1]) / (num_points + 1)
|