diff --git a/weight_and_balance_analysis/src/datapostprocessing.py b/weight_and_balance_analysis/src/datapostprocessing.py index 3a8e56b2a311eeea3d2a853bb7ebbad108b62321..cee068a2ee2587a20991e02067e71669438fdcee 100644 --- a/weight_and_balance_analysis/src/datapostprocessing.py +++ b/weight_and_balance_analysis/src/datapostprocessing.py @@ -49,7 +49,7 @@ 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 = [ 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 79375db3323a4cb5089ca27518c4891fb69d0adb..e864e92c2f5753d374985b37582e90510baba4ef 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 @@ -154,7 +154,7 @@ class MassPropertiesIO: basic_path = f"./analysis/masses_cg_inertia/{mass_type_w_underscore}/mass_properties" switch = "study_mode" - # switch = "design_mode" + switch = "design_mode" if switch == "study_mode": basic_path = f"./analysis/masses_cg_inertia/study_mission/{mass_type_w_underscore}/mass_properties" 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 e85d48659c0481d1d07bb1da4ab22232be236166..bf6f3b7bcd887518c7590c63c9c782aaf47eff69 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) @@ -229,10 +229,15 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi # Landing mass runtime_output.print("Calculate MLM by RWTH regression ...") - maximum_landing_mass = calculate_maximum_landing_mass_by_regression_rwth( - maximum_takeoff_mass, inertia_method, [operating_mass_empty, design_payload_mass, - design_fuel_mass_minimum_landing]).print("Maximum landing mass") - maximum_landing_mass.path_to_element = "./analysis/masses_cg_inertia/maximum_landing_mass" + if switch != "study_mode": + maximum_landing_mass = calculate_maximum_landing_mass_by_regression_rwth( + maximum_takeoff_mass, inertia_method, [operating_mass_empty, design_payload_mass, + design_fuel_mass_minimum_landing]).print("Maximum landing mass") + maximum_landing_mass.path_to_element = "./analysis/masses_cg_inertia/maximum_landing_mass" + else: # don't calculate this for the study mode as it should remain unchanged, read it from the acxml + # 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) ################################################################################################################## ### Determine W&B diagram and CG curtailment ### @@ -442,7 +447,10 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi most_forward_mass.center_of_gravity["y"] = 0.0 most_forward_mass.center_of_gravity["z"] = 0.0 most_forward_mass.mass = corresponding_mass_most_fwd_CG - most_forward_mass.inertia = maximum_takeoff_mass.inertia + most_forward_mass.inertia = inertia_method["method"]( + [most_forward_mass, MassPropertiesIO().initialize_zero(), MassPropertiesIO().initialize_zero(), + main_components_mass_properties, most_forward_mass.center_of_gravity], + inertia_method["additional_parameters"]) most_afterward_mass = MassPropertiesIO( "./analysis/masses_cg_inertia/most_afterward_mass") @@ -486,16 +494,8 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi } if switch == "study_mode": - # manufacturer_mass_empty.path_to_element = "./analysis/masses_cg_inertia/study_mission/manufacturer_mass_empty" - # operating_mass_empty.path_to_element = "./analysis/masses_cg_inertia/study_mission/operating_mass_empty" design_fuel_mass_takeoff.path_to_element = "./analysis/masses_cg_inertia/study_mission/study_fuel_mass" - # maximum_landing_mass.path_to_element = "./analysis/masses_cg_inertia/study_mission/maximum_landing_mass" - # maximum_takeoff_mass.path_to_element = "./analysis/masses_cg_inertia/study_mission/maximum_takeoff_mass" design_mass_takeoff.path_to_element = "./analysis/masses_cg_inertia/study_mission/study_mass" - # maximum_zero_fuel_mass.path_to_element = "./analysis/masses_cg_inertia/study_mission/maximum_zero_fuel_mass" - # maximum_payload_mass.path_to_element = "./analysis/masses_cg_inertia/study_mission/maximum_payload_mass" - # maximum_fuel_mass.path_to_element = "./analysis/masses_cg_inertia/study_mission/maximum_fuel_mass" - # ferry_range_mass.path_to_element = "./analysis/masses_cg_inertia/study_mission/ferry_range_mass" most_afterward_mass.path_to_element = "./analysis/masses_cg_inertia/study_mission/most_afterward_mass" most_forward_mass.path_to_element = "./analysis/masses_cg_inertia/study_mission/most_forward_mass" @@ -535,6 +535,8 @@ def method_basic(paths_and_names, routing_dict, dict_ac_exchange, dict_mod_confi "Cargo loading front back mass change": total_mass_dict["cargo_loading"], "Cargo loading back front CG change": cg_positions_dict["cargo_loading_back_front"], "Cargo loading back front mass change": total_mass_dict["cargo_loading_back_front"], + "Cargo mass": transport_task_data.additional_cargo_mass, + "PAX mass": transport_task_data.combined_passenger_and_luggage_mass, "Neutral point mac position": neutral_point_mac, "most_forward_mass": most_forward_mass, "most_afterward_mass": most_afterward_mass, diff --git a/weight_and_balance_analysis/src/tube_and_wing/standard/general/methodhtmlreport.py b/weight_and_balance_analysis/src/tube_and_wing/standard/general/methodhtmlreport.py index 7a2e0152303f265924ec205ab3ed5c4cede28e54..ae9bd5eb745abc8755bb1943647da8cca22d016c 100644 --- a/weight_and_balance_analysis/src/tube_and_wing/standard/general/methodhtmlreport.py +++ b/weight_and_balance_analysis/src/tube_and_wing/standard/general/methodhtmlreport.py @@ -42,6 +42,14 @@ def method_html_report(paths_and_names, routing_dict, data_dict, method_specific report_title = camelcase_to_string(tool_name) project_name = paths_and_names['name_of_project'] + switch = "study_mode" + switch = "design_mode" + + if switch == "study_mode": + tool_name = tool_name + f"_study_mission" + else: + tool_name = tool_name + f"_desgin_mission" + runtime_output.print(f'Creating {tool_name} report') doc, tag, text = generate_report_header( @@ -53,8 +61,6 @@ def method_html_report(paths_and_names, routing_dict, data_dict, method_specific data_dict["manufacturer_mass_empty"].mass), ("Operating Empty Mass", "OEM", data_dict["operating_mass_empty"].mass), - ("Maximum Ramp Mass", "MRM", - data_dict["design_mass"].mass), ("Maximum Takeoff Mass", "MTOM", data_dict["maximum_takeoff_mass"].mass), ("Maximum Landing Mass", "MLM", @@ -62,22 +68,28 @@ def method_html_report(paths_and_names, routing_dict, data_dict, method_specific ("Maximum Zero Fuel Mass", "MZFM", data_dict["maximum_zero_fuel_mass"].mass), ("Maximum Payload Mass", "-", data_dict["maximum_payload_mass"].mass), - ("Maximum Fuel mass", "-", data_dict["maximum_fuel_mass"].mass), - ("Mass at most forward CG", "-", data_dict["most_forward_mass"].mass), - ("Mass at most afterward CG", "-", - data_dict["most_afterward_mass"].mass) + ("Maximum Fuel Mass", "-", data_dict["maximum_fuel_mass"].mass), ] aircraft_design_masses = [ - ("Design Payload Mass", "-", data_dict["design_payload_mass"].mass), - ("Design Fuel Mass (Mission)", "-", + ("Ramp Mass", "-", + data_dict["design_mass"].mass), + ("Payload Mass:", "-", data_dict["design_payload_mass"].mass), + (" - Cargo Mass", + "-", data_dict["Cargo mass"]), + (" - Passenger and Luggage Mass", + "-", data_dict["PAX mass"]), + ("Fuel Mass (Mission)", "-", data_dict["mission_fuel_mass"].mass), - ("Design Fuel Mass (Takeoff)", "-", + ("Fuel Mass (@Takeoff)", "-", data_dict["design_fuel_takeoff"].mass), - ("Design Fuel Mass Midflight", "-", + ("Fuel Mass (@Midflight)", "-", data_dict["design_fuel_mass_midflight"].mass), - ("Design Fuel Mass Minimum Landing", "-", + ("Fuel Mass (@Landing)", "-", data_dict["design_fuel_mass_minimum_landing"].mass), + ("Mass at most forward CG", "-", data_dict["most_forward_mass"].mass), + ("Mass at most afterward CG", "-", + data_dict["most_afterward_mass"].mass) ] aircraft_group_masses = [] @@ -147,8 +159,9 @@ def method_html_report(paths_and_names, routing_dict, data_dict, method_specific pass with tag('span'): with tag('font', size="2"): - text(f"All outputs of the program '{tool_name}' were created with version {tool_version}") - + text( + f"All outputs of the program '{tool_name}' were created with version {tool_version}") + with tag('div', klass="container"): with tag('div', klass="box data"): with tag('h2'): @@ -182,7 +195,10 @@ def method_html_report(paths_and_names, routing_dict, data_dict, method_specific with tag('table', klass="content-table"): with tag('caption'): - text("Aircraft Design Masses") + if switch == "study_mode": + text("Aircraft Study Masses") + else: + text("Aircraft Design Masses") with tag('thead'): with tag('tr'): for col in ["Description", "Acronym", "Mass [kg]"]: @@ -342,16 +358,26 @@ def method_html_report(paths_and_names, routing_dict, data_dict, method_specific with tag('td'): if isinstance(col, str): text(col) - - with tag('div', klass="box plot"): - with tag('h2'): - text("Plot") - with tag('img', src="../plots/aircraft_group_masses.svg", klass="image-plot"): - pass - with tag('img', src="../plots/weight_and_balance_diagramm.svg", klass="image-plot"): - pass - with tag('img', src="../plots/cg_cases.svg", klass="image-plot"): - pass + if switch == "study_mode": + with tag('div', klass="box plot"): + with tag('h2'): + text("Plot") + with tag('img', src="../plots/aircraft_group_masses.svg", klass="image-plot"): + pass + with tag('img', src="../plots/weight_and_balance_diagramm_study.svg", klass="image-plot"): + pass + with tag('img', src="../plots/cg_cases_study.svg", klass="image-plot"): + pass + else: + with tag('div', klass="box plot"): + with tag('h2'): + text("Plot") + with tag('img', src="../plots/aircraft_group_masses.svg", klass="image-plot"): + pass + with tag('img', src="../plots/weight_and_balance_diagramm_design.svg", klass="image-plot"): + pass + with tag('img', src="../plots/cg_cases_design.svg", klass="image-plot"): + pass soup = BeautifulSoup(doc.getvalue(), 'html.parser') html_output = soup.prettify() diff --git a/weight_and_balance_analysis/src/tube_and_wing/standard/general/methodplot.py b/weight_and_balance_analysis/src/tube_and_wing/standard/general/methodplot.py index cfbca0deed2cd21be5087f6410f3addd6a99c617..e7aa390a6270a56ee4efd95f691b6c627e2cd42e 100644 --- a/weight_and_balance_analysis/src/tube_and_wing/standard/general/methodplot.py +++ b/weight_and_balance_analysis/src/tube_and_wing/standard/general/methodplot.py @@ -41,6 +41,9 @@ def method_plot(paths_and_names, routing_dict, data_dict, method_specific_output tool_name = paths_and_names['tool_name'] output_path = paths_and_names["project_directory"] + '/reporting/plots/' + switch = "study_mode" + # switch = "design_mode" + aircraft_group_masses = [] ome = data_dict["operating_mass_empty"].mass mtom = data_dict["maximum_takeoff_mass"].mass @@ -193,7 +196,12 @@ def method_plot(paths_and_names, routing_dict, data_dict, method_specific_output plt.xlabel("CG x-position over MAC in %", color='#ecf0f1') plt.ylabel("Mass [kg]", color='#ecf0f1') - plt.savefig(output_path + "weight_and_balance_diagramm.svg", format="svg") + if switch == "study_mode": + plt.savefig( + output_path + "weight_and_balance_diagramm_study.svg", format="svg") + else: + plt.savefig( + output_path + "weight_and_balance_diagramm_design.svg", format="svg") # Plot different mass configuration cases: @@ -219,7 +227,7 @@ def method_plot(paths_and_names, routing_dict, data_dict, method_specific_output # Define legend labels and colors legend_labels2 = ['OEM', 'MZFM (max Payload)', 'max Payload + Fuel', 'max Fuel + Payload', 'max Fuel', - 'Design Fuel + Design Payload'] + 'Mission Fuel + Mission Payload'] legend = plt.legend(legend_labels2, loc='lower right', fontsize='small') for text in legend.get_texts(): text.set_color('black') @@ -229,6 +237,10 @@ def method_plot(paths_and_names, routing_dict, data_dict, method_specific_output plt.title("Loading Cases") plt.xlabel("CG x-position over MAC in %", color='#ecf0f1') plt.ylabel("Mass [kg]", color='#ecf0f1') - plt.savefig(output_path + "cg_cases.svg", format="svg") + + if switch == "study_mode": + plt.savefig(output_path + "cg_cases_study.svg", format="svg") + else: + plt.savefig(output_path + "cg_cases_design.svg", format="svg") runtime_output.print("plotted") 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 431cbba5ed2b3f2b7a07e645de391e5f2e3a670d..8ad426b8698dddbf5660aa6bf012d2babeb4a631 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: