diff --git a/weight_and_balance_analysis/src/datapostprocessing.py b/weight_and_balance_analysis/src/datapostprocessing.py index cee068a2ee2587a20991e02067e71669438fdcee..fab2d9acccfe8318bb1672c87108e62188130cab 100644 --- a/weight_and_balance_analysis/src/datapostprocessing.py +++ b/weight_and_balance_analysis/src/datapostprocessing.py @@ -49,126 +49,136 @@ def data_postprocessing(paths_and_names, routing_dict, data_dict, runtime_output # Changes to this list are the sole responsibility of the module manager! switch = "study_mode" - switch = "design_mode" + # switch = "design_mode" if switch == "study_mode": paths_to_key_parameters_list = [ './analysis/masses_cg_inertia/study_mission/study_cg_shift/cg_point[@ID="0"]/center_of_gravity', './analysis/masses_cg_inertia/study_mission/study_cg_shift/cg_point[@ID="0"]/total_mass'] paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("most_forward_mass")) + MassPropertiesIO().key_parameters_paths_mission(switch, "most_forward_mass")) paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("most_afterward_mass")) + MassPropertiesIO().key_parameters_paths_mission(switch, "most_afterward_mass")) paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("study_mass")) + MassPropertiesIO().key_parameters_paths_mission(switch, "study_mass")) paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("study_fuel_mass")) + MassPropertiesIO().key_parameters_paths_mission(switch, "study_fuel_mass")) child_key_parameters_dict = {} child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("most_forward_mass", "")) + MassPropertiesIO().key_parameters_dicts("most_forward_mass", "Mass at the most forward CG position.")) child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("most_afterward_mass", "")) + MassPropertiesIO().key_parameters_dicts("most_afterward_mass", "Mass at the most aft CG position.")) child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("study_mass", "")) + MassPropertiesIO().key_parameters_dicts("study_mass", "Mass of the aircraft at takeoff.")) child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("study_fuel_mass", "")) + MassPropertiesIO().key_parameters_dicts("study_fuel_mass", "Mass of the fuel at takeoff.")) else: paths_to_key_parameters_list = [ - './analysis/masses_cg_inertia/design_cg_shift/cg_point[@ID="0"]/center_of_gravity', - './analysis/masses_cg_inertia/design_cg_shift/cg_point[@ID="0"]/total_mass'] + './analysis/masses_cg_inertia/design_mission/design_cg_shift/cg_point[@ID="0"]/center_of_gravity', + './analysis/masses_cg_inertia/design_mission/design_cg_shift/cg_point[@ID="0"]/total_mass'] paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("manufacturer_mass_empty")) + MassPropertiesIO().key_parameters_paths_mission(switch, "most_forward_mass")) paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("operating_mass_empty")) + MassPropertiesIO().key_parameters_paths_mission(switch, "most_afterward_mass")) paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("maximum_takeoff_mass")) + MassPropertiesIO().key_parameters_paths_mission(switch, "design_mass")) paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("maximum_zero_fuel_mass")) - paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("maximum_payload_mass")) - paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("maximum_landing_mass")) - paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("maximum_fuel_mass")) - paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("ferry_range_mass")) - paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("most_forward_mass")) - paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("most_afterward_mass")) - paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("design_mass")) - paths_to_key_parameters_list.extend( - MassPropertiesIO().key_parameters_paths("design_fuel_mass")) + MassPropertiesIO().key_parameters_paths_mission(switch, "design_fuel_mass")) child_key_parameters_dict = {} child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("manufacturer_mass_empty", "MME")) - child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("operating_mass_empty", "OME")) - child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("maximum_takeoff_mass", "MTOM")) - child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("maximum_zero_fuel_mass", "MZFM")) - child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("maximum_payload_mass", "")) - child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("maximum_landing_mass", "MLM")) - child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("maximum_fuel_mass", "")) - child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("ferry_range_mass", "")) - child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("most_forward_mass", "")) - child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("most_afterward_mass", "")) - child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("design_mass", "")) - child_key_parameters_dict.update( - MassPropertiesIO().key_parameters_dicts("design_fuel_mass", "")) - - module_key_parameters_dict = { - "analysis": { - "masses_cg_inertia": { - "attributes": {"description": "Masses, Center of Gravity, Inertias.", - "tool_level": "0"}, - **child_key_parameters_dict, - "design_cg_shift": { - 'attributes': { - 'description': 'Point cloud describing the center of gravity for a specific total aircraft mass while defueling.'}, - 'cg_point': { - 'attributes': { - 'ID': '0', - 'description': 'Point pair: center of gravity and total aircraft mass.'}, - 'center_of_gravity': { - 'attributes': { - 'description': 'Center of gravity in x-direction.'}, - 'value': '0', - 'unit': 'm', - 'lower_boundary': '-100', - 'upper_boundary': '100'}, - 'total_mass': { + MassPropertiesIO().key_parameters_dicts("most_forward_mass", "Mass at the most forward CG position.")) + child_key_parameters_dict.update( + MassPropertiesIO().key_parameters_dicts("most_afterward_mass", "Mass at the most aft CG position.")) + child_key_parameters_dict.update( + MassPropertiesIO().key_parameters_dicts("design_mass", "Mass of the aircraft at takeoff.")) + child_key_parameters_dict.update( + MassPropertiesIO().key_parameters_dicts("design_fuel_mass", "Mass of the fuel at takeoff.")) + + paths_to_key_parameters_list.extend( + MassPropertiesIO().key_parameters_paths("manufacturer_mass_empty")) + paths_to_key_parameters_list.extend( + MassPropertiesIO().key_parameters_paths("operating_mass_empty")) + paths_to_key_parameters_list.extend( + MassPropertiesIO().key_parameters_paths("maximum_takeoff_mass")) + paths_to_key_parameters_list.extend( + MassPropertiesIO().key_parameters_paths("maximum_zero_fuel_mass")) + paths_to_key_parameters_list.extend( + MassPropertiesIO().key_parameters_paths("maximum_payload_mass")) + paths_to_key_parameters_list.extend( + MassPropertiesIO().key_parameters_paths("maximum_landing_mass")) + paths_to_key_parameters_list.extend( + MassPropertiesIO().key_parameters_paths("maximum_fuel_mass")) + paths_to_key_parameters_list.extend( + MassPropertiesIO().key_parameters_paths("ferry_range_mass")) + + child_key_parameters_dict1 = {} + child_key_parameters_dict1.update( + MassPropertiesIO().key_parameters_dicts("manufacturer_mass_empty", "MME")) + child_key_parameters_dict1.update( + MassPropertiesIO().key_parameters_dicts("operating_mass_empty", "OME")) + child_key_parameters_dict1.update( + MassPropertiesIO().key_parameters_dicts("maximum_takeoff_mass", "MTOM")) + child_key_parameters_dict1.update( + MassPropertiesIO().key_parameters_dicts("maximum_landing_mass", "MLM")) + child_key_parameters_dict1.update( + MassPropertiesIO().key_parameters_dicts("maximum_zero_fuel_mass", "MZFM - mass of the aircraft without any fuel.")) + child_key_parameters_dict1.update( + MassPropertiesIO().key_parameters_dicts("maximum_payload_mass", "Maximum allowed payload mass (maximum structural payload mass reached).")) + child_key_parameters_dict1.update( + MassPropertiesIO().key_parameters_dicts("maximum_fuel_mass", "Maximum possible fuel mass (full tank capacity reached).")) + child_key_parameters_dict1.update( + MassPropertiesIO().key_parameters_dicts("ferry_range_mass", "Mass of the aircraft for maximum range.")) + + if switch == "study_mode": + module_key_parameters_dict = { + "analysis": { + "masses_cg_inertia": { + "attributes": {"description": "Masses, Center of Gravity, Inertias.", + "tool_level": "0"}, + **child_key_parameters_dict1, + "study_mission": { + "attributes": {"description": "Masses, Center of Gravity, Inertias for the study mission."}, + **child_key_parameters_dict, + "study_cg_shift": { 'attributes': { - 'description': 'Corresponding total aircraft mass.'}, - 'value': '0', - 'unit': 'kg', - 'lower_boundary': '0', - 'upper_boundary': 'inf'} + 'description': 'Point cloud describing the center of gravity for a specific total aircraft mass while defueling.'}, + 'cg_point': { + 'attributes': { + 'ID': '0', + 'description': 'Point pair: center of gravity and total aircraft mass.'}, + 'center_of_gravity': { + 'attributes': { + 'description': 'Center of gravity in x-direction.'}, + 'value': '0', + 'unit': 'm', + 'lower_boundary': '-100', + 'upper_boundary': '100'}, + 'total_mass': { + 'attributes': { + 'description': 'Corresponding total aircraft mass.'}, + 'value': '0', + 'unit': 'kg', + 'lower_boundary': '0', + 'upper_boundary': 'inf'} + } + } } } } } - } - - if switch == "study_mode": + else: module_key_parameters_dict = { "analysis": { "masses_cg_inertia": { - "study_mission": { - "attributes": {"description": "Masses, Center of Gravity, Inertias.", "tool_level": "0"}, + "attributes": {"description": "Masses, Center of Gravity, Inertias.", + "tool_level": "0"}, + **child_key_parameters_dict1, + "design_mission": { + "attributes": {"description": "Masses, Center of Gravity, Inertias for the design mission."}, **child_key_parameters_dict, - "study_cg_shift": { + "design_cg_shift": { 'attributes': { 'description': 'Point cloud describing the center of gravity for a specific total aircraft mass while defueling.'}, 'cg_point': { diff --git a/weight_and_balance_analysis/src/tube_and_wing/standard/basic/massPropertiesIO.py b/weight_and_balance_analysis/src/tube_and_wing/standard/basic/massPropertiesIO.py index e864e92c2f5753d374985b37582e90510baba4ef..980a7bc82891741454a60504eeee79da06fe6417 100644 --- a/weight_and_balance_analysis/src/tube_and_wing/standard/basic/massPropertiesIO.py +++ b/weight_and_balance_analysis/src/tube_and_wing/standard/basic/massPropertiesIO.py @@ -153,11 +153,33 @@ class MassPropertiesIO: basic_path = f"./analysis/masses_cg_inertia/{mass_type_w_underscore}/mass_properties" - switch = "study_mode" - switch = "design_mode" + mass_item_path = f"{basic_path}/mass" + inertia_path_j_xx = f"{basic_path}/inertia/j_xx" + inertia_path_j_yy = f"{basic_path}/inertia/j_yy" + inertia_path_j_zz = f"{basic_path}/inertia/j_zz" + inertia_path_j_xy = f"{basic_path}/inertia/j_xy" + inertia_path_j_xz = f"{basic_path}/inertia/j_xz" + inertia_path_j_yx = f"{basic_path}/inertia/j_yx" + inertia_path_j_yz = f"{basic_path}/inertia/j_yz" + inertia_path_j_zx = f"{basic_path}/inertia/j_zx" + inertia_path_j_zy = f"{basic_path}/inertia/j_zy" + cog_path_x = f"{basic_path}/center_of_gravity/x" + cog_path_y = f"{basic_path}/center_of_gravity/y" + cog_path_z = f"{basic_path}/center_of_gravity/z" + + return [mass_item_path, + inertia_path_j_xx, inertia_path_j_yy, inertia_path_j_zz, + inertia_path_j_xy, inertia_path_j_xz, + inertia_path_j_yx, inertia_path_j_yz, + inertia_path_j_zx, inertia_path_j_zy, + cog_path_x, cog_path_y, cog_path_z] + + def key_parameters_paths_mission(self, switch, mass_type_w_underscore: str = "mass"): if switch == "study_mode": basic_path = f"./analysis/masses_cg_inertia/study_mission/{mass_type_w_underscore}/mass_properties" + else: + basic_path = f"./analysis/masses_cg_inertia/design_mission/{mass_type_w_underscore}/mass_properties" mass_item_path = f"{basic_path}/mass" inertia_path_j_xx = f"{basic_path}/inertia/j_xx" 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 bf6f3b7bcd887518c7590c63c9c782aaf47eff69..60591a69a4f9e12c9a163076f8ba31d78c0e9b0d 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 @@ -67,7 +67,7 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi '/' + "Seats_positions.xlsx" switch = "study_mode" - switch = "design_mode" + # switch = "design_mode" if os.path.exists(excel_file_path): airplane_seatings = pd.read_excel(excel_file_path) @@ -173,7 +173,7 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi mission_fuel_mass.path_to_element = "./analysis/masses_cg_inertia/mission_fuel_mass" mission_fuel_mass.print("Mission fuel mass") - design_fuel_mass_takeoff.path_to_element = "./analysis/masses_cg_inertia/design_fuel_mass" + design_fuel_mass_takeoff.path_to_element = "./analysis/masses_cg_inertia/design_mission/design_fuel_mass" design_fuel_mass_takeoff.print("Design fuel mass (at takeoff)") # Maximum zero fuel mass @@ -193,7 +193,7 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi [operating_mass_empty, design_payload_mass, design_fuel_mass_takeoff], inertia_method ).print("Design mass takeoff") - design_mass_takeoff.path_to_element = "./analysis/masses_cg_inertia/design_mass" + design_mass_takeoff.path_to_element = "./analysis/masses_cg_inertia/design_mission/design_mass" design_mass_takeoff.cg_mac = ( design_mass.center_of_gravity['x'] - x_leading_edge_mac) / mac * 100 @@ -204,6 +204,8 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi 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") + else: + maximum_takeoff_mass.path_to_element = "./analysis/masses_cg_inertia/maximum_takeoff_mass" # Maximum fuel mass + maximum fuel mass per tank maximum_fuel_mass, maximum_fuel_mass_per_tank, ferry_range_mass = calculate_maximum_fuel_mass( @@ -238,6 +240,7 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi # as this was calculated in the design loop before maximum_landing_mass = MassPropertiesIO( "./analysis/masses_cg_inertia/maximum_landing_mass/mass_properties").read(ac_exchange_file) + maximum_landing_mass.path_to_element = "./analysis/masses_cg_inertia/maximum_landing_mass" ################################################################################################################## ### Determine W&B diagram and CG curtailment ### @@ -442,7 +445,7 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi # Prepare the data to be written as nodes for acxml most_forward_mass = MassPropertiesIO( - "./analysis/masses_cg_inertia/most_forward_mass") + "./analysis/masses_cg_inertia/design_mission/most_forward_mass") most_forward_mass.center_of_gravity["x"] = most_fwd_CG most_forward_mass.center_of_gravity["y"] = 0.0 most_forward_mass.center_of_gravity["z"] = 0.0 @@ -453,7 +456,7 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi inertia_method["additional_parameters"]) most_afterward_mass = MassPropertiesIO( - "./analysis/masses_cg_inertia/most_afterward_mass") + "./analysis/masses_cg_inertia/design_mission/most_afterward_mass") most_afterward_mass.center_of_gravity["x"] = most_aft_CG most_afterward_mass.center_of_gravity["y"] = 0.0 most_afterward_mass.center_of_gravity["z"] = 0.0 @@ -1648,6 +1651,7 @@ def calculate_maximum_payload_mass(maximum_structural_payload_mass, fuselage_acc maximum_payload_mass.center_of_gravity = fuselage_accomodation_mass_properties.center_of_gravity maximum_payload_mass.initialize_zero_inertia() DEBUG(msg="The CG of the maximum payload is set at the fuselage CG.") + DEBUG(msg="The maximum payload mass is equal the maximum structural payload mass.") return maximum_payload_mass diff --git a/weight_and_balance_analysis/src/tube_and_wing/standard/usermethoddatapreparation.py b/weight_and_balance_analysis/src/tube_and_wing/standard/usermethoddatapreparation.py index 8ad426b8698dddbf5660aa6bf012d2babeb4a631..0adbaafaf87e0159202fe29de8041b49e32dd765 100644 --- a/weight_and_balance_analysis/src/tube_and_wing/standard/usermethoddatapreparation.py +++ b/weight_and_balance_analysis/src/tube_and_wing/standard/usermethoddatapreparation.py @@ -44,7 +44,7 @@ def user_method_data_input_preparation(routing_dict): component_design_path = './component_design/' switch = "study_mode" - switch = "design_mode" + # switch = "design_mode" if switch == "study_mode": mission_analysis_path = './analysis/mission/study_mission/' @@ -180,7 +180,7 @@ def user_method_data_output_preparation(data_dict): j = 0 switch = "study_mode" - switch = "design_mode" + # switch = "design_mode" while j < len(data_dict["Defueling xCG"])-1: @@ -188,7 +188,7 @@ def user_method_data_output_preparation(data_dict): shift_path_id = './analysis/masses_cg_inertia/study_mission/study_cg_shift/cg_point[@ID="' + str( j) + '"]/' else: - shift_path_id = './analysis/masses_cg_inertia/design_cg_shift/cg_point[@ID="' + str( + shift_path_id = './analysis/masses_cg_inertia/design_mission/design_cg_shift/cg_point[@ID="' + str( j) + '"]/' shift_dict = {