From 8c3c5eaf6fcc981afdac9425afc96c0b0e309b53 Mon Sep 17 00:00:00 2001
From: LolloBici <lorenzo.amici@skywarder.eu>
Date: Sat, 15 Feb 2025 16:33:31 +0100
Subject: [PATCH] [documentation][stability] First update of the new readme

---
 common                      |   2 +-
 stabilityAnalysis/README.md | 105 +++++++++++++++++++++++++++---------
 2 files changed, 82 insertions(+), 25 deletions(-)

diff --git a/common b/common
index 04e33274..980f4165 160000
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 04e332747f9aeb153a4acc79d618caf51db48901
+Subproject commit 980f4165e3b771afc96141ea1dadb033d5a42320
diff --git a/stabilityAnalysis/README.md b/stabilityAnalysis/README.md
index 4c481ec9..7edb4f2b 100644
--- a/stabilityAnalysis/README.md
+++ b/stabilityAnalysis/README.md
@@ -1,31 +1,88 @@
-# stabilityAnalysis
+# Rocket Launch Stability Tool
 
-This program allows to evaluate the rocket static stability at launchpad exit in various atmospheric conditions.
-In particular the stability margin is computed using different models: 
+## What Does This Tool Do?
 
-* Classical longitudinal: `XCPlon`
-* Classical lateral: `XCPlat`
-* Longitudinal in the alpha total plane: `XCPlonATOT`
-* Directional in the alpha total plan: `XCPlatATOT`
-* With total normal moment and total normal force: `XCPtotSTD`
-* With total normal moment and normal force perpendicular to the moment: `XCPtotMOD`
-* With Open Rocket: `XCPor`
-Different quality indices are also computed: 
-* Angle between aerodynamic force and aerodynamic moment
-* Angle between normal aerodynamic force and normal aerodynamic moment
-* Angle between normal aerodynamic force and normal wind velocity
-* Error index T
-* Magnitude of normal force parallel to the normal moment
+This tool is designed to analyze the stability of a rocket during launch, specifically at launchpad exit. It evaluates the rocket's stability margin under various wind conditions (magnitude and azimuth) to ensure safe launch.
 
-# Usage
+---
 
-The analysis type and its features can be set in the script `configSensitivity.m`.
-It is possibile to set a range of wind magnidute values and a range of wind azimuth values through the variables `vars.windMag` and `vars.windAz` while the launchpad setup is considered fixed. It is possible to select which quanitites to plot through the set of variables in the section `PLOT SETTINGS`.
-The program computes the stability according to the different models, the aerodiynamic coefficients and the quality index in each point of the mesh defined in terms of magnitude and azimuth of the external wind.
-It is possible to save the launchpad exit velocity for further analysis enabling the flag `vars.saveRes`.
+##  How to use it 
 
-# Output
-If the mesh contains a single value of wind magnitude (or azimuth) the output consists in 2D plots of the stability, quality indices and coefficients along the different value selected, also a data printing in the command window will be present. If instead a full 2D mesh is submitted, the data printing and coefficients plot will be suppressed while stability results and quality indices are shown in 3D plots.
-In any case, all data are saved in the struct `data_stability`.
+1.  **Configure the Settings:** The script `stabilityAnalysisConfig.m` is where you tell the tool what to analyze.  You can set things like:
+    *   **Wind Scenarios:**  Choose the wind speeds and directions you want to test.
+    *   **Output Preferences:** Decide if you want charts, text summaries, or to save the detailed results.
 
+2.  **Run Script** Run the script `mainStabilityAnalysis`. This starts the whole stability analysis process.
 
+3.  **Check Out the Results:**  Once it's done running, you'll get:
+    *   **Charts:**  The tool makes graphs (using `stabilityPlots.m`) that show you the stability margin, cool "quality scores," and aerodynamic stuff.
+    *   **Text Summary:**  The function `stabilityPrints.m` prints the cases used to evaluate the stability margins.
+    *   **Save Data (Optional):** If you set it up in the settings, you can load a file called `stabilityRes.mat` to get all the raw data for even more detailed analysis later.
+
+---
+
+##  Key Files
+
+*   **`mainStabilityAnalysis.m`:**  It's the script you run to start everything. It:
+    *   Gets all the settings and data ready (rocket info, wind).
+    *   Does a quick simulation of the launch to see the rocket dynamics as it leaves the pad.
+    *   Run `computeStability.m` a function that computes the launchpad stability data.
+    *   Makes the charts, prints the text, and saves the results based on your settings.
+
+*   **`stabilityAnalysisConfig.m`:** It's where you set up everything for the stability analysis.  Key things to set here are:
+    *   **Wind:**  Tell it what wind directions (`stability.windAz`) and speeds (`stability.windMag`) to test.
+    *   **Output Choices:**  Pick if you want charts (`stability.plots`), text summaries (`stability.prints`), and if you want to save the data (`stability.saveRes`).
+    *   **Chart Options:** Customize which charts to make (like `stability.plotXCPlonATOT`, `stability.plotQINDEX`, `stability.plotCoeffs`).
+    *   **`dissileMatcom` Settings:**  Customize `dissile matcom` datas like (mach, alpha, beta, ecc...)
+
+    **Example Settings Inside `stabilityAnalysisConfig.m`:**
+    ```matlab
+    %% WINDY DAY SETUP
+    stability.windAz = (0:45:315)*pi/180; // Test winds from all directions, every 45 degrees
+    stability.windMag = [5, 10, 15];      // Test wind speeds of 5, 10, and 15 meters per second
+
+    %%  OUTPUT CHOICES
+    stability.plots = true;           //  Yes, make charts
+    stability.prints = true;          //  Yes, give me text summaries
+    stability.saveRes = true;         //  Yes, save the data
+
+    %% CHART PREFERENCES
+    stability.plotXCPlonATOT = true;
+    stability.plotQINDEX      = true;
+    stability.plotCoeffs      = false; //  Skip the coefficient charts
+
+*   **`computeStability.m`:** The brains of the operation for stability calculations.  It:
+    *   Runs through all the wind conditions you set up.
+    *   Gets aerodynamic info from `dissileMatcom`.
+    *   Figures out the stability margin and those "quality scores" using `getXCP.m`.
+    *   Packs all the results into a neat package called `data_stability`.
+
+*   **`getXCP.m`:**  This is the helper that calculates the important stability numbers:
+    *   **Stability Margin (XCP):**  Longitudinal, Lateral, and Total stability margins – different ways to measure stability.
+    *   **Quality Scores (Indices):** Numbers that tell you how "good" the aerodynamic stability is, like angles between forces and moments.
+
+*   **`stabilityPlots.m`:**  It is the chart maker.  It takes the results and creates visual plots of:
+    *   Stability Margin (SM) vs. Wind conditions
+    *   Quality Scores vs. Wind conditions
+    *   Aerodynamic Coefficients vs. Wind conditions
+    *   You control which charts to make in `stabilityAnalysisConfig.m`.
+
+*   **`stabilityPrints.m`:** The text report generator. It takes the results and creates a text summary for each wind scenario, showing:
+    *   Flight conditions (speed, angles)
+    *   Stability Margin values
+    *   Quality scores
+    *   And how long the calculations took
+---
+
+## Legend:
+* CA Axial force coefficient
+* CY Lateral force coefficient
+* CN Normal force coefficient
+* Cl Rolling moment coefficient
+* Cm Pitching moment coefficient
+* Cn Yawing moment coefficient
+* SM Static Margin of stability
+* α Angle of attack
+* β Sideslip angle
+* αtot Total angle of attack
+* ϕ Aerodynamic Roll angle
\ No newline at end of file
-- 
GitLab