# Control Design and Validation for Floating Piston Electro-Pneumatic Gearbox Actuator
## 3 Model-Based Controller Development
### LQR Method  
The LQR design aims to find the feedback control law, which minimizes the quadratic cost function:  
\[J=\int_{0}^{\infty}(x^{T}Qx+u^{T}Ru)dt \tag{16}\]  
where \(Q\) and \(R\) are the weight matrices of the state error and the cost of the control, respectively. By solving the Ricatti equation, \(P\) is determined:  
\[A^{T}P+PA-PB^{T}R^{-1}B^{T}P+Q=-\dot{P} \tag{17}\]  
Then, the feedback matrix is calculated as follows. \[K=R^{-1}B^{T}P \tag{18}\]  
To design an LQR controller, a linear model is required, derived from the nonlinear model. However, the nonlinear model contains an unmanageable number of hybrid states, which increases the complexity of the linear state-space representation, therefore the following simplifications are necessary. * Solenoid valve models are substituted with their mass flow rates, which will serve as the control signals
* Chamber 3 pressure is assumed to be constant and equal to the ambient pressure
* Heat transfer is neglected
* Contact forces are neglected
* Coulomb-friction is neglected
* Detent mechanism is neglected  
Disregarding the contact forces was necessary as their derivatives would be discontinuous; therefore, they cannot be linearized, but the contact between the two pistons is not negligible regarding the actuator dynamics, thus it is taken into account as follows,  
\[x_{FP}^{+}= \begin{cases}0,&\text{if }x_{MP}<0\\ x_{MP},&\text{otherwise}\end{cases}  \tag{19}\]  
\[m_{MP}^{+}= \begin{cases}m_{MP}^{-},&\text{if }x_{MP}<0\\ m_{MP}^{-}+m_{FP},&\text{otherwise}\end{cases}  \tag{20}\]  
Figure 5: Effects of the P and D parameters in case of Low to Neutral gear change. \[A_{FP}^{+}= \begin{cases}0,&\text{if }x_{MP}<0\\ A_{FP}^{-},&\text{otherwise}\end{cases}  \tag{21}\]  
where \(x_{FP},x_{MP}\) are the pistons positions, \(m_{FP},m_{MP}\) are the masses, and \(A_{FP},A_{MP}\) are the cross section areas, where indices \(FP\) and \(MP\) refer to the Floating piston and the Main piston and superscripts \(-\) and \(+\) refer to the prior and posterior values, respectively. With the given simplifications, the actuator behavior is described by eight hybrid states, the actual state-space representation is determined by the mass flow rates and the Main piston position. For LQR design, the chosen state variables are the pressure of Chamber 1 and Chamber 2, and the speed and position of the main piston, thus the state-space representation is a fourth-order system. The state vector is written as follows. \[\underline{x}=\left[p_{ch1},p_{ch2},x_{MP},v_{MP}\right]^{T} \tag{22}\]  
The control signals are the mass flow rates of the chambers:  
\[\underline{u}=\left[\frac{dm_{ch1}}{dt},\frac{dm_{ch2}}{dt}\right]^{T} \tag{23}\]  
The output vector consists the chamber pressures and the main piston's position:  
\[\underline{y}=\left[p_{ch1},p_{ch2},x_{MP}\right]^{T} \tag{24}\]  
As the modeled system is input-affine, its state-space representation takes the following form,  
\[\underline{\dot{x}}=\underline{f}(\underline{x},\underline{d},r)+\sum_{i=1}^ {m}\underline{g}_{i}(\underline{x},\underline{d},r)u_{i}, \tag{25}\]  
\[\underline{y}=\underline{h}(\underline{x},\underline{d},\underline{u},r), \tag{26}\]  
where the vector functions can be written as follows,  
\[\underline{f}= \begin{bmatrix}\frac{-x_{P,h1}V_{ch1}}{V_{ch1}}\\ \frac{-x_{P,h2}V_{ch2}}{V_{ch2}}\\ v_{MP}\\ \frac{\sum_{F_{P}}-d_{i}v_{MP}}{m_{MP}+m_{FP}}\end{bmatrix} ,\quad\underline{g}= \begin{bmatrix}\underline{g1}&\underline{g2}\end{bmatrix} = \begin{bmatrix} \frac{\kappa_{air}R_{air}T_{imel}}{V_{ch1}}&0\\ 0&\frac{\kappa R_{air}T_{imel}}{V_{ch2}}\\ 0&0\\ 0&0\end{bmatrix} ,\quad\underline{h}= \begin{bmatrix}p_{ch1}\\ p_{ch2}\\ x_{MP}\end{bmatrix}  \tag{27}\]  
After linearization, the state-space representation is further simplified:  
\[\underline{\dot{x}}=\mathbf{A}\underline{x}+\mathbf{B}\underline{u} \tag{28}\]  
\[\underline{y}=\mathbf{C}\underline{x} \tag{29}\]  
where the state matrices of can be written as shown in (30)-(32). \[\mathbf{A}=