souvik0306 commited on
Commit
fb8b137
·
1 Parent(s): 7e42a33

Refactor check_route function: Update fuel unit and CO2 emission calculation

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -33,23 +33,25 @@ def check_route(airport_selections, aircraft_type):
33
 
34
  feasibility_result = check_route_feasibility(optimal_route, trip_distance, aircraft_specs)
35
  map_html = create_route_map(airports_dict, lat_long_dict, optimal_route, feasibility_result["Refuel Sectors"])
36
-
37
  sector_details_html = """
38
  <table border="1" style="border-collapse: collapse; width: 100%;">
39
  <tr>
40
  <th>Sector</th>
41
- <th>Fuel Required (kg)</th>
42
  <th>Flight Time (hrs)</th>
43
  <th>Refuel Required</th>
 
44
  </tr>
45
  """
46
  for sector in feasibility_result["Sector Details"]:
47
  sector_details_html += f"""
48
  <tr>
49
  <td>{sector['Sector']}</td>
50
- <td>{sector['Fuel Required (kg)']}</td>
51
  <td>{sector['Flight Time (hrs)']}</td>
52
  <td>{sector['Refuel Required']}</td>
 
53
  </tr>
54
  """
55
  sector_details_html += "</table>"
@@ -64,6 +66,8 @@ def check_route(airport_selections, aircraft_type):
64
  <p>{round(feasibility_result["Total Fuel Required (kg)"]/1000,2)}</p>
65
  <h3>Round Trip Flight Time (hrs)</h3>
66
  <p>{feasibility_result["Total Flight Time (hrs)"]}</p>
 
 
67
  <h3>Can Fly Entire Route</h3>
68
  <p>Yes</p>
69
  <h3>Sector Details</h3>
 
33
 
34
  feasibility_result = check_route_feasibility(optimal_route, trip_distance, aircraft_specs)
35
  map_html = create_route_map(airports_dict, lat_long_dict, optimal_route, feasibility_result["Refuel Sectors"])
36
+
37
  sector_details_html = """
38
  <table border="1" style="border-collapse: collapse; width: 100%;">
39
  <tr>
40
  <th>Sector</th>
41
+ <th>Fuel Required (Tonnes)</th>
42
  <th>Flight Time (hrs)</th>
43
  <th>Refuel Required</th>
44
+ <th>CO2 Emission (Tonnes)</th>
45
  </tr>
46
  """
47
  for sector in feasibility_result["Sector Details"]:
48
  sector_details_html += f"""
49
  <tr>
50
  <td>{sector['Sector']}</td>
51
+ <td>{round(sector['Fuel Required (kg)']/1000,2)}</td>
52
  <td>{sector['Flight Time (hrs)']}</td>
53
  <td>{sector['Refuel Required']}</td>
54
+ <td>{round(sector['Fuel Required (kg)']*3.16/1000,2)}</td>
55
  </tr>
56
  """
57
  sector_details_html += "</table>"
 
66
  <p>{round(feasibility_result["Total Fuel Required (kg)"]/1000,2)}</p>
67
  <h3>Round Trip Flight Time (hrs)</h3>
68
  <p>{feasibility_result["Total Flight Time (hrs)"]}</p>
69
+ <h3>Total CO2 Emission (Tonnes)</h3>
70
+ <p>{round(feasibility_result["Total Fuel Required (kg)"]*3.16/1000,2)}</p>
71
  <h3>Can Fly Entire Route</h3>
72
  <p>Yes</p>
73
  <h3>Sector Details</h3>