# READ ME - Uniform_Loc.m

## What this script does

This MATLAB script performs a **parametric study** of a lunar rover wheel system.  
It evaluates many wheel configurations by combining:

- wheel diameter,
- wheel width,
- number of wheels,
- wheel type (`rigid` or `elastic`),
- terrain slope,
- vehicle speed,
- vehicle mass,
- slip ratio,
- elastic wheel deflection.

For each configuration, the script computes the main wheel-soil performance quantities on **soft lunar regolith**, including:

- wheel sinkage,
- contact area,
- average ground pressure,
- maximum traction,
- soil thrust,
- motion resistance components,
- drawbar pull,
- drive torque,
- drive power,
- wheel thickness,
- wheel mass,
- equivalent stresses.

At the end, the script:

1. builds a results table for all simulated configurations,
2. computes a simple **Figure of Merit (FoM)**,
3. ranks the configurations,
4. extracts the best 30 configurations,

---

## Main purpose

The script is intended to support **wheel sizing and configuration selection** for a lunar locomotion system.

It helps answer questions such as:

- Which wheel diameter gives lower sinkage?
- How does wheel width affect traction and resistance?
- How many wheels are preferable for a given rover mass?
- Is a rigid wheel or an elastic wheel better under the chosen assumptions?
- Which configurations maximize drawbar pull while limiting power and wheel mass?

---

## Modeling assumptions

The script uses the following assumptions:

- Gravity is fixed to **lunar gravity** (`g = 1.62 m/s^2`).
- Soil is modeled as **soft lunar regolith** with Bekker/Wong-style terramechanics parameters.
- Calculations are performed **per wheel**, assuming the vehicle load is distributed among the wheels.
- Traction and resistance are evaluated for each configuration using external support functions.
- For elastic wheels, wheel deflection is added to soil sinkage in the contact geometry.
- The wheel structural mass is estimated using an Aluminum 7075 shell approximation.

---

## External functions required

The script depends on these MATLAB functions:

- `Ww_fun`
- `H_fun`
- `Rall_fun`
- `DP_fun`
- `T_P_fun`

### Role of each function

#### `Ww_fun(Nw, W_total)`
Returns the **load acting on one wheel**.

#### `H_fun(Aw, soil, Ww)`
Returns the **maxmimum soil thrust** contribution used in the traction analysis.

#### `Rall_fun(Type, bw, pw, zw, Ww, teta_inc, dw, soil, fr, soil.n)`
Returns all motion resistance contributions:

- `Rc`: compaction resistance,
- `Rb`: bulldozing resistance,
- `Rr`: rolling resistance,
- `Rg`: gravitational resistance,
- `Ro`: obstacle resistance,
- `Rall`: total resistance.

#### `DP_fun(Fmax, Rall)`
Returns the **drawbar pull**.

#### `T_P_fun(Type, Rall, dw, deltaw, vel)`
Returns:

- drive torque per wheel,
- drive power per wheel.


## How to run

1. Put this script in your MATLAB working folder.
2. Make sure these functions are available in the MATLAB path:
   - `Ww_fun`
   - `H_fun`
   - `Rall_fun`
   - `DP_fun`
   - `T_P_fun`
3. Run the script.
4. Inspect:
   - `TAB` for all results,
   - `TAB_sorted_metric` for ranked results,
   - `bestConfigurations` for the top 30 solutions.

---

## Comparison model

The uniform model is saved in the File Comparison model,
 togheter with the quadratic model in order to be analysed.

## Final summary

This script is a **design-space exploration tool** for lunar wheel systems.  
It evaluates a large number of wheel configurations, computes terramechanics and structural indicators, ranks the results through a simple multi-objective metric.
