Skip to content
Snippets Groups Projects
Commit 85ac8006 authored by Andi's avatar Andi
Browse files

Merge branch 'fix/wb_allow_overshoot_tanks' into 'develop'

Update overshoot tanks allowed during the first iterations (same as in landing gear)

See merge request !57
parents 3b28881f d1f1e8b4
No related branches found
No related tags found
5 merge requests!263Apply 1 suggestion(s) to 1 file(s),!261Reintruduced automatic flight condition selection,!245Apply 1 suggestion(s) to 1 file(s),!233Initial open source version,!57Update overshoot tanks allowed during the first iterations (same as in landing gear)
......@@ -179,7 +179,7 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi
maximum_takeoff_mass.path_to_element = "./analysis/masses_cg_inertia/maximum_takeoff_mass"
maximum_takeoff_mass.cg_mac = (
design_mass_takeoff.center_of_gravity['x'] - x_leading_edge_mac) / mac * 100
maximum_takeoff_mass.print("Maximum takeoff mass")
maximum_takeoff_mass.print("Maximum Takeoff Mass")
# Maximum payload + fuel up to MTOW
mtow_max_payload_mass = calculate_mtow_max_payload(
......@@ -315,10 +315,12 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi
# Prepare defueling
defueling_mass_per_tank = calculate_fuel_properties_defueling(
sorted_tanks_defueling, consumed_fuel, design_fuel_mass_takeoff_per_tank, runtime_output)
sorted_tanks_defueling, consumed_fuel, design_fuel_mass_takeoff_per_tank,
runtime_output, routing_dict, dict_ac_exchange)
defueling_mass_per_tank_ferry = calculate_fuel_properties_defueling(
sorted_tanks_defueling, consumed_fuel, maximum_fuel_mass_per_tank, runtime_output)
sorted_tanks_defueling, consumed_fuel, maximum_fuel_mass_per_tank,
runtime_output, routing_dict, dict_ac_exchange)
starting_mass = total_mass_cargo_back_front[-1]
starting_cg = cg_positions_over_mac_cargo_front_back[-1] * \
......@@ -1194,7 +1196,8 @@ def calculate_fuel_mass_properties(tanks, fuel_mass, routing_dict, dict_ac_excha
return fuel_mass_properties, fuel_mass_per_tank
def calculate_fuel_properties_defueling(tanks, fuel_to_remove, fuel_mass_per_tank, runtime_output):
def calculate_fuel_properties_defueling(
tanks, fuel_to_remove, fuel_mass_per_tank, runtime_output, routing_dict, dict_ac_exchange):
def map_fuel_mass_to_tanks(tanks, fuel_mass_per_tank, runtime_output):
......@@ -1255,10 +1258,12 @@ def calculate_fuel_properties_defueling(tanks, fuel_to_remove, fuel_mass_per_tan
total_fuel_available = sum(tank.filled_fuel_mass for tank in tanks)
if fuel_to_remove > total_fuel_available:
runtime_output.critical(
"Fuel to remove exceeds the available fuel in all tanks!")
raise ValueError(
"Fuel to remove exceeds the available fuel in all tanks!")
if int(dict_ac_exchange['tool_level']) < int(routing_dict['tool_level']):
runtime_output.warning(
"Fuel to remove exceeds the available fuel in all tanks!")
else:
raise ValueError(
"Fuel to remove exceeds the available fuel in all tanks!")
remaining_fuel_to_remove = fuel_to_remove
defueled_mass_per_tank = []
......@@ -1374,9 +1379,12 @@ def calculate_fuel_properties_defueling(tanks, fuel_to_remove, fuel_mass_per_tan
# Check if we have defueled the correct amount
if remaining_fuel_to_remove > 0:
runtime_output.critical(
"Not enough fuel in the tanks to complete defueling!")
raise ValueError("Not enough fuel in the tanks to complete defueling!")
if int(dict_ac_exchange['tool_level']) < int(routing_dict['tool_level']):
runtime_output.warning(
"Not enough fuel in the tanks to complete defueling!")
else:
raise ValueError(
"Not enough fuel in the tanks to complete defueling!")
return defueled_mass_per_tank
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment