diff --git a/weight_and_balance_analysis/src/tube_and_wing/standard/basic/methodbasic.py b/weight_and_balance_analysis/src/tube_and_wing/standard/basic/methodbasic.py index 43d4a7ccec0862e780eda48a25f37782a8fee468..9f77567ef204cf5878d1f9f12b22ac496d96946d 100644 --- a/weight_and_balance_analysis/src/tube_and_wing/standard/basic/methodbasic.py +++ b/weight_and_balance_analysis/src/tube_and_wing/standard/basic/methodbasic.py @@ -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