From 287b7e04b7fe104625bc75221e639710b2b5b309 Mon Sep 17 00:00:00 2001
From: Mauco03 <marco.gaibotti@skywarder.eu>
Date: Wed, 19 Feb 2025 15:52:59 +0100
Subject: [PATCH] [documentation][ApogeeAnalisys] Updated documentation

---
 apogeeAnalysis/README.md | 173 ++++++++++++++++++++++-----------------
 1 file changed, 96 insertions(+), 77 deletions(-)

diff --git a/apogeeAnalysis/README.md b/apogeeAnalysis/README.md
index 0f11666d..d259678e 100644
--- a/apogeeAnalysis/README.md
+++ b/apogeeAnalysis/README.md
@@ -1,82 +1,101 @@
 # apogeeAnalysis
-This is a program developed in MATLAB for a primary apogee
-analysis with different motors when the structural mass
-is only known with a degree of uncertainty.
-The simulator computes the different apogees, maximum
-accelerations and launchpad exit velocities for
-different motors and different masses. <br/>
-You can choose between simulating engines with a full or partial burn duration, in the latter the engine is cut at a fixed percentage of total burn time.
 
-## Usage
-The script requires the geometric variables describing the rocket which are taken from `simulationsData.m`:
+This program is developed in MATLAB for a primary apogee analysis with different motors when the structural mass is only known with a degree of uncertainty. The simulator computes the different apogees, maximum accelerations, and launchpad exit velocities for different motors and different masses. You can choose between simulating engines with a full or partial burn duration, in the latter the engine is cut at a fixed percentage of total burn time.
+
+---
+
+## How to Use It
+
+1. **Configure the Settings:** The script `apogeeAnalysisConfig.m` is where you set up the parameters for the apogee analysis. You can configure:
+    * **Total Impulse Range:** Define the range of total impulse to filter motors.
+    * **Mass Deviation:** Set the deviation from the structural mass.
+    * **Mass Points:** Specify the number of mass points in the deviation range.
+    * **Engine Company:** Choose the company that produces the engine.
+    * **Plot Options:** Set options for plotting maximum acceleration and launchpad exit velocity.
+    * **Wind and Launchpad Settings:** Configure wind magnitude, elevation, azimuth, and launchpad settings for both 'upwind' and 'downwind' scenarios.
+
+2. **Run Script:** Execute the script `mainApogeeAnalysis.m` to start the computation process.
+
+3. **Check Out the Results:** Once the computation is complete, the results are saved in `.mat` files in the mission's data directory.
+
+---
+
+## Key Files
+
+* **`mainApogeeAnalysis.m`:** The main script to run the computation. It:
+    * Loads the necessary data and configurations.
+    * Computes the apogee, maximum acceleration, and launchpad exit velocity for different motors and masses.
+    * Saves the results in `.mat` files.
+
+* **`apogeeAnalysisConfig.m`:** The configuration script where you set up the parameters for the apogee analysis. Key settings include:
+    * **Mission Name:** Specify the mission name.
+    * **Total Impulse Range:** Define the range of total impulse to filter motors.
+    * **Mass Deviation:** Set the deviation from the structural mass.
+    * **Mass Points:** Specify the number of mass points in the deviation range.
+    * **Engine Company:** Choose the company that produces the engine.
+    * **Plot Options:** Set options for plotting maximum acceleration and launchpad exit velocity.
+    * **Wind and Launchpad Settings:** Configure wind magnitude, elevation, azimuth, and launchpad settings for both 'upwind' and 'downwind' scenarios.
+
+    **Example Settings Inside `apogeeAnalysisConfig.m`:**
+    ```matlab
+    %% ANALYSIS TYPE
+    analysis.isStandard  = true;
+    analysis.isEngineCut = true;
+
+    %% SELECT MOTORS
+    selection.producer = {'Skyward'};
+    selection.totalImpulseRange = [10000 15000];
+    selection.motorString = 'SFT';
+    selection.motorName = {};
+
+    %% PLOTS OPTIONS
+    plots.targetApogee = 3000;
+    plots.maxAcceleration = 15;
+    plots.minVexit = 20;
+    plots.accelerationPlot = true;
+    plots.launchpadVelPlot = true;
+
+    %% UNCERTAINTIES
+    uncert.totalImpulse = 145;
+    uncert.sigma = 3;
+    uncert.mass = 3;
+    uncert.massNumber = 15;
+    uncert.percEngineCut = 0.8;
+    uncert.percDeltaTime = 0.2;
+    uncert.timeEngineCutNumber = 5;
+
+    %% HIGHEST CASE
+    cases(1).wind.altitudes = 0;
+    cases(1).wind.magVec = 0.01;
+    cases(1).wind.azVec = 180*pi/180;
+    cases(1).omega = 90*pi/180;
+    cases(1).phi = 0*pi/180;
+    cases(1).airbrakes.enabled = true;
+    cases(1).airbrakes.extension = 1;
+    cases(1).airbrakes.deltaTime = 0;
+    cases(1).thrustUncertSign = 1;
+
+    %% LOWEST APOGEE CASE
+    cases(2).wind.altitudes = 0;
+    cases(2).wind.magVec = 9;
+    cases(2).wind.azVec = 0*pi/180;
+    cases(2).omega = 84*pi/180;
+    cases(2).phi = 0*pi/180;
+    cases(2).airbrakes.enabled = false;
+    cases(2).airbrakes.extension = 0;
+    cases(2).airbrakes.deltaTime = 0;
+    cases(2).thrustUncertSign = -1;
+    ```
+
+---
 
-``` matlab
-settings.mission = 'missionName';
-dataPath = strcat('../data/', settings.mission);
-run(strcat(dataPath, '/simulationsData'));
-```
-where you have to replace `missionName` with the specific name of the mission required (e.g. `Lynx_Portugal_October_2021`).<br/>
-The variables that do not depend directly on the geometry of the rocket and that cannot be known a priori, such as the masses computed, are taken from `configApogee.m`.<br/>
-
-For instance, you need to choose:
-
-- total impulse range. It allows
-the simulator to pick the motors that are in this range
-from the motors matrix (`Motors.mat`)
-- deviation from the structural mass 
-- amount of mass points in this deviation,
-in order to have a different range of masses
-- company that produces the engine
-
-The plots of maximum acceleration and launchpad exit
-velocity can be chosen by setting:
-
-- `settings.accelerationPlot = true` 
-- `settings.launchpadVelPlot = true`
-
-For both 'upwind' and 'downwind' you have to choose:
-
-- wind magnitude,
-- wind elevation
-- wind azimuth 
-- elevation (`OMEGA`) of the launchpad
-- azimuth (`PHI`) of the launchpad 
-- airbrakes height (1= closed, 2= 50% open, 3= fully open).
-
-Here there is a brief explaination regarding those two configuration:
-
-- `upwind` is what we consider the best case. In fact, in this case, wind magnitude is set to 0 and the elevation of the launchpad is 90 degrees. Moreover, airbrakes are fully open.
-- `downwind` is what we consider the worst case. In fact, in this case, wind magnitude is set to 9 m/s (maximum for EuRoC rules). It is directed with an angle of 180 degrees out of phase with respect to launchpad azimuth. Moreover, airbrakes are closed. 
-
-
-The computation is started by running `mainApogee.m`. 
-
-Once the simulation is started, it runs
-`quickApogeeOnly.m`, which gives apogees and maximum
-accelerations for
-every motor, mass, airbrakes configuration, wind condition and launchpad setup as
-outputs.
+## Outputs
+The main outputs are the apogee, the maximum acceleration, and the launchpad exit velocity for every motor, mass, airbrakes, wind condition, and launchpad setup. This program will then plot a number of different figures, which will be a combination of the wind and airbrakes conditions chosen.
 
-Then, it runs `exitVelocity.m`, which gives launchpad exit velocity for
-every motor, mass, airbrakes, wind condition and launchpad setup as
-outputs.
+### Plots
+In every figure, there will be three subplots where apogees, maximum accelerations, and launchpad exit velocities will be plotted for every motor in every mass point. There will also be a legend, where the motors will be listed in the same order (and color) they appear in the apogee subplot. In the plots, some areas and lines appear. They represent the following:
 
-## Outputs
-The main outputs are the apogee, the maximum acceleration and the launchpad exit velocity for every motor, mass, airbrakes, wind condition and launchpad setup.
-This program will then plot a number of different figures,
-which will be a combination of the wind and airbrakes
-condition chosen.
-
-#### Plots
-In every figure there will be three subplots where
-apogees, maximum accelerations and launchpad exit
-velocities will be plotted for every motor in every
-mass point. There will also be a legend, where the
-motors will be listed in the same order (and color)
-they appear in the apogee subplot.
-In the plots, some areas and lines appear. They represent the following things:
-
-- Green areas in both `upwind` and `downwind`, which represent graphically apogees for which the motors falling in it are acceptable.
-- Line in the apogee subplot, which represents the targeted apogee.
-- Line in the maximum acceleration subplot, which represents the maximum acceleration acceptable for electronic and structure constraints.
-- Line in the launchpad exit velocity subplot, which represents the minimum launchpad exit velocity acceptable for competition requirements.
+- Green areas in both `upwind` and `downwind`, representing acceptable apogees.
+- Line in the apogee subplot, representing the targeted apogee.
+- Line in the maximum acceleration subplot, representing the maximum acceptable acceleration for electronic and structural constraints.
+- Line in the launchpad exit velocity subplot, representing the minimum acceptable launchpad exit velocity for competition requirements.
-- 
GitLab