From f2ab4cfd110ad1f202d205e45e8917bcd5bce8de Mon Sep 17 00:00:00 2001
From: AndiGob <andreas.gobbbin@hotmail.de>
Date: Wed, 26 Feb 2025 22:36:51 +0100
Subject: [PATCH 1/2] landing_gear_design: - bug fix of maximum nose gear
 position error

---
 .../general/call_functions/_00_estimatepositions.py    |  6 ++----
 .../general/call_functions/_02_estimateloads.py        | 10 +++++-----
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/landing_gear_design/src/wing_mounted/empirical/landing_gear_design_tu_berlin/general/call_functions/_00_estimatepositions.py b/landing_gear_design/src/wing_mounted/empirical/landing_gear_design_tu_berlin/general/call_functions/_00_estimatepositions.py
index 38fad55d..de31e4dc 100644
--- a/landing_gear_design/src/wing_mounted/empirical/landing_gear_design_tu_berlin/general/call_functions/_00_estimatepositions.py
+++ b/landing_gear_design/src/wing_mounted/empirical/landing_gear_design_tu_berlin/general/call_functions/_00_estimatepositions.py
@@ -87,10 +87,8 @@ def estimate_positions(dict_ac_exchange, dict_mod_config, landing_gear_descripti
             not ('main_gear_x_position' in landing_gear_positions):
         _, landing_gear_position_value = \
             next(reversed(list(dict_ac_exchange['landing_gear_positions_in_x_direction'].items())), (None, None))
-        _, wing_reference_point_value = \
-            next(reversed(list(dict_ac_exchange['wing_section_position_in_x'].items())), (None, None))
-        _, wing_chord_length_value = \
-            next(reversed(list(dict_ac_exchange['wing_chord_length_on_section'].items())), (None, None))
+        wing_reference_point_value = next(iter(dict_ac_exchange['wing_section_position_in_x'].values()))
+        wing_chord_length_value = next(iter(dict_ac_exchange['wing_chord_length_on_section'].values()))
         # Check if the main gear position and the wing center reference point
         #  and the o most aft CoG position in x direction are None.
         #   -> if true: -> Check which kind of fuselage type is selected and set type specific start values.
diff --git a/landing_gear_design/src/wing_mounted/empirical/landing_gear_design_tu_berlin/general/call_functions/_02_estimateloads.py b/landing_gear_design/src/wing_mounted/empirical/landing_gear_design_tu_berlin/general/call_functions/_02_estimateloads.py
index 2890d7bc..eade1cfc 100644
--- a/landing_gear_design/src/wing_mounted/empirical/landing_gear_design_tu_berlin/general/call_functions/_02_estimateloads.py
+++ b/landing_gear_design/src/wing_mounted/empirical/landing_gear_design_tu_berlin/general/call_functions/_02_estimateloads.py
@@ -54,7 +54,7 @@ def estimate_loads(dict_ac_exchange, dict_mod_config, landing_gear_description,
     # set maximum aft position of nose landing gear
     if not ('landing_gear_limitations' in landing_gear_description) \
             and not ('maximum_aft_position_of_nose_gear' in landing_gear_limitations):
-        landing_gear_limitations['maximum_aft_position_of_nose_gear'] = 6.5
+        landing_gear_limitations['maximum_aft_position_of_nose_gear'] = 7.5
     else:
         landing_gear_limitations['maximum_aft_position_of_nose_gear'] = \
             landing_gear_description['landing_gear_limitations']['maximum_aft_position_of_nose_gear']
@@ -62,7 +62,7 @@ def estimate_loads(dict_ac_exchange, dict_mod_config, landing_gear_description,
     # set minimum foremost position of nose landing gear
     if not ('landing_gear_limitations' in landing_gear_description) \
             and not ('minimum_forward_position_of_nose_gear' in landing_gear_limitations):
-        landing_gear_limitations['minimum_forward_position_of_nose_gear'] = 4.5
+        landing_gear_limitations['minimum_forward_position_of_nose_gear'] = 4.0
     else:
         landing_gear_limitations['minimum_forward_position_of_nose_gear'] = \
             landing_gear_description['landing_gear_limitations']['minimum_forward_position_of_nose_gear']
@@ -168,7 +168,7 @@ def estimate_loads(dict_ac_exchange, dict_mod_config, landing_gear_description,
             #  -> if true: -> Move the x-position of the nose landing gear forward by 0.05 meter.
             if percentage_of_nose_gear_minimum_load > 6 \
                     and landing_gear_description['landing_gear_positions']['nose_gear_x_position'] \
-                    > landing_gear_limitations['minimum_forward_position_of_nose_gear']:
+                    >= landing_gear_limitations['minimum_forward_position_of_nose_gear']:
                 landing_gear_description['landing_gear_positions']['nose_gear_x_position'] -= 0.05
             # Else condition: Most forward x-position of nose gear is reached. -> No further movement possible.
             else:
@@ -193,7 +193,7 @@ def estimate_loads(dict_ac_exchange, dict_mod_config, landing_gear_description,
             #  -> if true: -> Move the x-position of the nose landing gear backward by 0.05 meter.
             if percentage_of_nose_gear_minimum_load < 20 \
                     and landing_gear_description['landing_gear_positions']['nose_gear_x_position'] \
-                    < landing_gear_limitations['maximum_aft_position_of_nose_gear']:
+                    <= landing_gear_limitations['maximum_aft_position_of_nose_gear']:
                 landing_gear_description['landing_gear_positions']['nose_gear_x_position'] += 0.05
             # Else condition: Most backward x-position of nose gear is reached. -> No further movement possible.
             else:
@@ -203,7 +203,7 @@ def estimate_loads(dict_ac_exchange, dict_mod_config, landing_gear_description,
             #  -> if true: -> Raise an error and abort program.
             if maximum_nose_gear_position_reached:
                 runtime_output.critical(
-                    'Error: The maximum nose gear position is reached but the minimum allowed percentage of '
+                    'Error: The maximum aft nose gear position is reached but the minimum allowed percentage of '
                     'the nose gear load is greater lower than 6 \n '
                     '                                    Load estimation for landing gear '
                     'design not possible. Program aborted!')
-- 
GitLab


From 96e770ecd053b5531dc91ee897b04db64c64e4ec Mon Sep 17 00:00:00 2001
From: AndiGob <andreas.gobbbin@hotmail.de>
Date: Thu, 27 Feb 2025 09:58:42 +0100
Subject: [PATCH 2/2] landing_gear_design: - add tool version to html report

---
 landing_gear_design/landing_gear_design.py            |  3 ++-
 landing_gear_design/src/datapreprocessing.py          |  3 ++-
 .../general/methodhtmlreport.py                       | 11 ++++++++---
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/landing_gear_design/landing_gear_design.py b/landing_gear_design/landing_gear_design.py
index f3a50e4c..a4348ba8 100644
--- a/landing_gear_design/landing_gear_design.py
+++ b/landing_gear_design/landing_gear_design.py
@@ -51,12 +51,13 @@ def main():
 
     # Initialize exception string and runtime output logger.
     tool_name = 'landing gear design'
+    tool_version = '0.5.0'
     runtime_output = logging.getLogger('module_logger')
 
     try:
         """Preprocessing: Acquire necessary data and paths."""
         # Run 'data_preprocessing' function from 'datapreprocessing.py'.
-        paths_and_names, routing_dict, runtime_output = data_preprocessing('landing_gear_design_conf.xml', argv)
+        paths_and_names, routing_dict, runtime_output = data_preprocessing('landing_gear_design_conf.xml', tool_version, argv)
         runtime_output.print('Landing gear design started...')
 
         """Run: Execute code depending on method layers."""
diff --git a/landing_gear_design/src/datapreprocessing.py b/landing_gear_design/src/datapreprocessing.py
index 805a72aa..a856648e 100644
--- a/landing_gear_design/src/datapreprocessing.py
+++ b/landing_gear_design/src/datapreprocessing.py
@@ -29,7 +29,7 @@ from datapreprocessingmodule import get_paths_and_names
 from datapreprocessingmodule import read_routing_values_from_xml
 
 
-def data_preprocessing(module_configuration_file, argv):
+def data_preprocessing(module_configuration_file, tool_version, argv):
     """Conduct data preprocessing.
 
     This function provides data preprocessing functionalities. It sets up the necessary data and imports
@@ -60,6 +60,7 @@ def data_preprocessing(module_configuration_file, argv):
     """Get paths, names, and xml trees for module configuration and aircraft exchange file."""
     # Call 'get_paths_and_names' function to obtain various paths and names.
     paths_and_names, runtime_output = get_paths_and_names(module_configuration_file, argv)
+    paths_and_names['tool_version'] = tool_version
     # Note: It is the exclusive responsibility of the module manager to modify the following information!
     # Create layer description dictionary according to the number of individual layers. The dictionary associates
     # layers with their respective XML paths and expected data types according to the following scheme:
diff --git a/landing_gear_design/src/wing_mounted/empirical/landing_gear_design_tu_berlin/general/methodhtmlreport.py b/landing_gear_design/src/wing_mounted/empirical/landing_gear_design_tu_berlin/general/methodhtmlreport.py
index 650f944b..6aeb5474 100644
--- a/landing_gear_design/src/wing_mounted/empirical/landing_gear_design_tu_berlin/general/methodhtmlreport.py
+++ b/landing_gear_design/src/wing_mounted/empirical/landing_gear_design_tu_berlin/general/methodhtmlreport.py
@@ -40,6 +40,7 @@ def method_html_report(paths_and_names, routing_dict, data_dict, method_specific
     """ Preparation and data extraction."""
     # Extract tool and project name.
     tool_name = paths_and_names['tool_name']
+    tool_version = paths_and_names['tool_version']
     report_title = (tool_name.replace('_', ' ')).capitalize()
     project_name = paths_and_names['name_of_project']
     root_of_module_config_tree = paths_and_names['root_of_module_config_tree']
@@ -230,8 +231,13 @@ def method_html_report(paths_and_names, routing_dict, data_dict, method_specific
             with tag('div', klass="content"):
                 with tag('h1'):
                     text(f"Report - {report_title} of {project_name}")
+                    with tag('br'):  # Line break for formatting
+                        pass
+                    with tag('span'):
+                        with tag('font', size="2"):
+                            text(f"All outputs of the program '{tool_name}' were created with version {tool_version}")
+                    
                 with tag('div', klass="container"):
-
                     # Data on the left side.
                     with tag('div', klass="box data"):
                         
@@ -394,7 +400,6 @@ def generate_report_header(doc, tool_name):
         doc.stag('meta', name="viewport", content="width=device-width, initial-scale=1.0")
         doc.stag('meta', charset="UTF-8")
         with doc.tag('title'):
-            doc.text(tool_name)
+             doc.text(tool_name)
         doc.stag('link', rel="stylesheet", href="style.css")
-    
     return
-- 
GitLab