---
Author: Antoine Foucault-Castelli
Date: 17/03/2026
Bibliography: @karmiFiabiliteOptimisationSystemes @ghorbelEffectBrakeLocation2020a @zhengAnalyticalApproachMesh2022
Version: 4.0 
---
| Newmark parameters                                 | Value     |
| -------------------------------------------------- | --------- |
| $\gamma$                                           |           |
| $\beta$                                            |           |
| **Gears**                                          | **Value** |
| $Z1$                                               |           |
| $Z2$                                               |           |
| $m_0$                                              |           |
| Pini$b$                                            |           |
| Internal diameter pinion 1 $d_{i1}$                |           |
| Internal diameter pinion 2 $d_{i_2}$               |           |
| Input speed $N_1$                                  |           |
| Contact angle $\alpha$                             |           |
| Steel density $\rho_{steel}$                       |           |
| **Masses**                                         | **Value** |
| Input mass $m_{in}$                                |           |
| Output mass $m_{out}$                              |           |
| **Stiffness**                                      |           |
| Flexion $x$ : k_x=k_{x_1}=k_{x_2}$                 |           |
| Flexion $y$ : k_y=k_{y_1}=k_{y_2}$                 |           |
| Torsion $z$ : $k_\theta=k_{\theta_1}=k_{\theta_2}$ |           |
| Mean mesh stiffness $k_{mesh_{mean}}$              |           |
| **Damping**                                        |           |
| Mass related $\eta$                                |           |
| Stiffness related $\beta$                          |           |
| **Wind excitation**                                |           |
| Blade radius $r_{blade}$                           |           |
|                                                    |           |
|                                                    |           |
|                                                    |           |
|                                                    |           |
|                                                    |           |
|                                                    |           |
|                                                    |           |
|                                                    |           |
|                                                    |           |
|                                                    |           |
|                                                    |           |
|                                                    |           |
|                                                    |           |
|                                                    |           |

# Gearbox simulation
## Structure
```
main.m
func.m
    time_sampling
    inertia
    gearbox_geometry
    mesh_stiffness
    wind_excitation
    mass_matrix
    stiffness_matrix
    stiffness_update
    damping_matrix
    forces_matrix
    initialization
    newmark
parameters.m
display.m
    disp_xy(t,x,i)
    speed_xy(t,v,i)
    acc_xy(t,v,i)
    disp_theta(t,x,i)
    speed_theta(t,v,i)
    acc_theta(t,a,i)
    mesh_stiffness(t,k_var,k_mean,i)
    taero(t,T_aero,i)
    rms_on_x(x)
    spectral_on_x(x,i,tf,dt)
    plot_x(t,x,i)
only_display.m
display_update.m 
```

`main.m` is the launcher for the full code compilation
`func` is the function class, containing every function used in the code
`parameters` is the model parameters document
`display` is the displayer for figures
`only_display` to skip non-needed full compilation
`display_update` to update a single graph if needed

## How does it work ?
**For Matlab under windows :** 
open matlab and launch main.m

> [!WARNING]
> remove `graphics_toolkit("gnuplot")` which is only useful for Octave visualization

**For Octave/Linux :**

```bash
cd [path_to_cloned]/code/versions/[current_version]/
octave
>>> run main.m
>>>
```

## Informations
- [x] Verified code with base code and paper
- [x] Implemented wind excitation
- [x] Implemented Ghorbel parameters
- [~] Add varying output torque depending on number of tooth in contact ?
- [~] add brake ?
- [~] Variation of C ?
- [~] ODE45 ?
- [x] Displays from last version (in class)
- [x] New mesh stiffness variation model (trapezoidal)
- [x] Print in pdf
- [ ] Errors/defects implementation
    - [ ] profile error
    - [ ] assembly defect (change on gear stiffness)
- [ ] README
    - [x] Maths
    - [ ] Source(s)
- [ ] Random models implementation
- [x] Display
    - [x] time response on a2
    - [x] speed response
    - [x] x movement (vs y movement ?)
    - [x] RMS STD Kurtosis
- [ ] Tests
    - [ ] different speed
    - [ ] different blade radii
## Maths

The model is represented by two 4DDL shafts in a gear connection : $x$ and $y$ are free at the pinion, $\theta$ is free at both ends of the shaft (input/output is $\theta_{ii}$ and meshing rotation is $\theta_{ij}$).

### Parameters



### Energy equations

$$
\frac{\partial Ep}{\partial q_i}+
	\frac{d}{dt}\left(\frac{Ec}{\dot{q}_i}\right)-
	\frac{\partial Ec}{\partial q_i}+
	\frac{\partial D}{\partial \dot{q}_i}
	=\frac{W}{\partial q_i} 
\\
Ec = 	\frac{1}{2}m_1*\dot{x}_1^2+
		\frac{1}{2}m_1*\dot{y}_1^2+
		\frac{1}{2}I_{11}\dot{\theta}_{11}^2+
		\frac{1}{2}I_{12}\dot{\theta}_{12}^2+
		\frac{1}{2}m_2*\dot{x_2}^2+
		\frac{1}{2}m_2*\dot{y_2}^2+
		\frac{1}{2}I_{22}\dot{\theta}_{22}^2+
		\frac{1}{2}I_{21}\dot{\theta}_{21}^2
\\
Ep =	\frac{1}{2}k_{x_1}x_{1}^2+
		\frac{1}{2}k_{y_1}y_{1}^2+
		\frac{1}{2}k_{\theta_1}(\theta_{11}-\theta_{12})^2+
		\frac{1}{2}k_{x_2}x_{2}^2+
		\frac{1}{2}k_{y_2}y_{2}^2+
		\frac{1}{2}k_{\theta_2}(\theta_{21}-\theta_{22})^2+
		\frac{1}{2}K_e(t)\delta_1^2(t)
$$

### Equations of movement

$Ep$ and $Ec$ are separated between the two shaft (1 and 2)
$$
\begin{cases}
&\frac{\partial Ep_1}{\partial x_1}+\frac{d}{dt}\left(\frac{\partial Ec_1}{\partial \dot{x}_1}\right)=m_1\ddot{x}_1+k_{x1}x_1+sin(\alpha)K_e(t)\delta _1(t)=0 \\
&\frac{\partial Ep_1}{\partial y_1}+\frac{d}{dt}\left(\frac{\partial Ec_1}{\partial \dot{y}_1}\right)=m_1\ddot{y}_1+k_{y1}y_1+cos(\alpha)K_e(t)\delta _1(t)=0 \\
&\frac{\partial Ep_1}{\partial \theta_{11}}+\frac{d}{dt}\left(\frac{\partial Ec_1}{\partial \dot{\theta}_{11}}\right)=I_{11}\ddot{\theta}_{11}+k_{\theta 1}(\theta_{11}-\theta_{12})=Cm \\
&\frac{\partial Ep_1}{\partial \theta_{12}}+\frac{d}{dt}\left(\frac{\partial Ec_1}{\partial \dot{\theta}_{12}}\right)=I_{12}\ddot{\theta}_{12}+k_{\theta 1}(\theta_{12}-\theta_{11})+K_e(t)r_{b12}\delta_1(t)=0 \\

&\frac{\partial Ep_1}{\partial x_2}+\frac{d}{dt}\left(\frac{\partial Ec_2}{\partial \dot{x}_2}\right)=m_2\ddot{x}_2+k_{x2}x_2-sin(\alpha)K_e(t)\delta _1(t)=0 \\
&\frac{\partial Ep_1}{\partial y_2}+\frac{d}{dt}\left(\frac{\partial Ec_2}{\partial \dot{y}_2}\right)=m_2\ddot{y}_2+k_{y2}y_2-cos(\alpha)K_e(t)\delta _1(t)=0 \\
&\frac{\partial Ep_1}{\partial \theta_{22}}+\frac{d}{dt}\left(\frac{\partial Ec_2}{\partial \dot{\theta}_{22}}\right)=I_{22}\ddot{\theta}_{22}-k_{\theta 2}(\theta_{21}-\theta_{22})=-Cr \\
&\frac{\partial Ep_1}{\partial \theta_{21}}+\frac{d}{dt}\left(\frac{\partial Ec_2}{\partial \dot{\theta}_{21}}\right)=I_{21}\ddot{\theta}_{21}-k_{\theta 2}(\theta_{21}-\theta_{22})+K_e(t)r_{b21}\delta_1(t)=0
\end{cases}
$$

With $\delta_i(t)=(x_1-x_2)sin(\alpha)+(y_1-y_2)cos(\alpha)+\theta_{12}r_{b1}+\theta_{21}r_{b2}$ and $r_{bij}$ the base radius of pinions, $K_e$ is the varying meshing stiffness, mass $m_i = \pi r^2_{i}\rho$ for both pinions, and $I_{ij} = \frac{1}{2}m_{ij}r_{ij}^2$ for pinions and input/output inertia.

### Matrices



**Equation to solve :**
$$
[M]\{\ddot{q}\}+C\{\dot{q}\}+([Ks]+[K(t)])\{q\}=\{F_0\} \\
\{q\}=\{x_1,y_1,\theta_{11},\theta_{12},x_2,y_2,\theta_{22},\theta_{21}\}
$$
**Mass matrix :**
$$
M =
\begin{bmatrix}
	m_1	&	0	&	0	&	0	&	0	&	0	&	0	&	0	\\
	0	&	m_1	&	0	&	0	&	0	&	0	&	0	&	0	\\
	0	&	0	&	I_{11}	&	0	&	0	&	0	&	0	&	0	\\
	0	&	0	&	0	&	I_{12}	&	0	&	0	&	0	&	0	\\
	0	&	0	&	0	&	0	&	m_2	&	0	&	0	&	0	\\
	0	&	0	&	0	&	0	&	0	&	m_2	&	0	&	0	\\
	0	&	0	&	0	&	0	&	0	&	0	&	I_{22}	&	0	\\
	0	&	0	&	0	&	0	&	0	&	0	&	0	&	I_{21}	\\
\end{bmatrix} \\
$$

With $m_1$ mass of shaft 1 and $m_2$ mass of shaft 2

**Variable mesh stiffness matrix**
$$
K(t)= K_e(t)
\begin{bmatrix}
	sin(\alpha)^2	&	sin(\alpha).cos(\alpha)	&	0	&	r_1.sin(\alpha)	&	-sin(\alpha)^2	&	-sin(\alpha).cos(\alpha)	&	0	&	r_2.sin(\alpha)	\\
	sin(\alpha).cos(\alpha)	&	cos(\alpha)^2	&	0	&	r_1.cos(\alpha)	&	-sin(\alpha).cos(\alpha)	&	-cos(\alpha)^2	&	0	&	r_2.cos(\alpha)	\\
	0	&	0	&	0	&	0	&	0	&	0	&	0	&	0	\\
	r_1.sin(\alpha)	&	r_1.cos(\alpha)	&	0	&	r_1^2	&	-r_1.sin(\alpha)	&	-r_1.cos(\alpha)	&	0	&	r_1.r_2	\\
	-sin(\alpha)^2	&	-sin(\alpha).cos(\alpha)	&	0	&	-r_1.sin(\alpha)	&	sin(\alpha)^2	&	sin(\alpha).cos(\alpha)	&	0	&	-r_2.sin(\alpha)	\\
	-sin(\alpha).cos(\alpha)	&	-cos(\alpha)^2	&	0	&	-r_1.cos(\alpha)	&	sin(\alpha).cos(\alpha)	&	cos(\alpha)^2	&	0	&	-r_2.cos(\alpha)	\\
	0	&	0	&	0	&	0	&	0	&	0	&	0	&	0	\\
	r_2.sin(\alpha)	&	r_2.cos(\alpha)	&	0	&	r_1.r_2	&	-r_2.sin(\alpha)	&	-r_2.cos(\alpha)	&	0	&	r_2^2	\\
\end{bmatrix}
$$

> [!NOTE]
>
> In matlab, cos and sin terms will be noted as $s_i$, for visual simplification

**Constant stiffness matrix**
$$
Ks=
\begin{bmatrix}
	k_{x1}	&	0	&	0	&	0	&	0	&	0	&	0	&	0	\\
	0	&	k_{y1}	&	0	&	0	&	0	&	0	&	0	&	0	\\
	0	&	0	&	k_{\theta1}&	-k_{\theta1}	&	0	&	0	&	0	&	0	\\
	0	&	0	&	-k_{\theta1}	&	k_{\theta1}	&	0	&	0	&	0	&	0	\\
	0	&	0	&	0	&	0	&	k_{x1}	&	0	&	0	&	0	\\
	0	&	0	&	0	&	0	&	0	&	k_{y1}	&	0	&	0	\\
	0	&	0	&	0	&	0	&	0	&	0	&	k_{\theta2}	&	-k_{\theta2}	\\
	0	&	0	&	0	&	0	&	0	&	0	&	-k_{\theta2}	&	k_{\theta2}	\\
\end{bmatrix}
$$

**Damping matrix**
$$
C = \eta M+\beta K_{mean}
$$
**Forces**
$$
F =
\begin{bmatrix}
0	\\	0	\\	T_{in}	\\	0	\\	0\\	0\\	T_{out}\\	0
\end{bmatrix}
$$


## TO FIX

> [!ATTENTION]
> ...

## Machine specifications
Example of computational time : `44sec for fs=2500` / `n_periods = 10`
```
                   -`                    
                  .o+`                   
                 `ooo/                   OS: Arch Linux x86_64 
                `+oooo:                  Host: 20EV000UFR ThinkPad E560 
               `+oooooo:                 Kernel: 6.19.8-arch1-1 
               -+oooooo+:                Shell: zsh 5.9
             `/:-:++oooo+:               Terminal: kitty 
            `/++++/+++++++:              CPU: Intel i5-6200U (4) @ 2.300GHz  
           `/++++++++++++++:             GPU: Intel Skylake-U GT2 [HD Graphics 520] 
          `/+++ooooooooooooo/`           Memory: 1703MiB / 3792MiB 
         ./ooosssso++osssssso+`          
        .oossssso-````/ossssss+`         
       -osssssso.      :ssssssso.        
      :osssssss/        osssso+++.       
     /ossssssss/        +ssssooo/-       
   `/ossssso+/:-        -:/+osssso+-     
  `+sso+:-`                 `.-/+oso:
 `++:.                           `-/+/                           
 .`                                 `/                           
```
