# Off-Line Optimization Based Active Control of Torsional Oscillation for Electric Vehicle Drivetrain
## 3 Active Control System  
### Controller Design  
Active control of oscillation for shifting unloads motor torque dynamically rather than directly, until it is suitable for detaching the meshed gears, it will introduce much less motion oscillation. Therefore, minimization of the torque \(\tau\) of meshed gears is selected as control objective of this controller. Figure 5 shows a simplified transmission model, where damping is considered in input and output shafts, with \(d_{t1}\) and \(d_{t2}\), respectively. Figure 4: Electric vehicle drivetrain model. For each gear shaft in transmission above, dynamic equation with transmission torque \(\tau\) can be obtained as follows. \[J_{t1}\ddot{\theta}_{m}\ =\ u-d_{t1}\dot{\theta}_{m}-\tau \tag{4}\]  
Combining them with the drive shaft dynamic Equation (5), Equation (6) can be transformed. The specific process of derivation can be seen in [32]:  
\[\Bigg{(}J_{m}+\frac{I_{t}}{i_{t}^{2}}+\frac{J_{f}}{i_{t}^{2}i_{f}^{2}}\Bigg{)} \ddot{\theta}_{m}=T_{m}-\Bigg{(}\frac{d_{t}}{i_{t}^{2}}+\frac{d_{f}}{i_{t}^{2}i _{f}^{2}}\Bigg{)}\dot{\theta}_{m}-k\frac{\big{(}\theta_{m}/i_{i}i_{f}-\theta_{ w}\big{)}}{i_{t}i_{f}}-d\frac{\big{(}\dot{\theta}_{m}/i_{i}i_{f}-\dot{ \theta}_{w}\big{)}}{i_{t}i_{f}} \tag{5}\]  
\[\tau\ =\ \mathbf{M}\mathbf{x}+Du \tag{6}\]  
where  
\[\mathbf{M}\ =\ \left( \begin{array}{cc}\frac{I_{t1}k}{J_{1}i_{g}i_{0}}&-\frac{I_ {t1}d}{I_{1}i_{g}i_{0}}&\frac{I_{t1}(d_{1}+\frac{d}{i_{g}i_{0}^{2}})}{J_{1}}- d_{t1}\end{array} \right)\!,D\ =\ 1-\frac{J_{t1}}{J_{1}} \tag{7}\]  
The objective of the control system is to minimize the deviation between torque \(\tau\) in meshed gears and the desirable reference value; \(\tau\) should be reduced to zero before gear change begins in order to ensure smooth and quick shifting, so the reference value is 0. However, the response time should not be as short as possible, because quite a short response time always introduce a large overshoot, so a reasonable compromise is necessary. The cost function can be extended as (8). The second term indicates deviation between the control signal and the reference \(u_{shift}\), \(\eta\) is introduced as a trade-off between response time and large deviations of control signal (overshoot). It is the variable to be optimized. \[\lim_{T\rightarrow\infty}\int_{0}^{T}\tau^{2}+\eta(u-u_{shift})^{2}\mathrm{d}t \tag{8}\]  
\(u_{shift}\) can be derived as shown in Equation (9) by setting \(\tau\ =\ 0\). \[u_{shift}\ =\ \mu_{x}\dot{\theta}_{w}+\mu_{l}l \tag{9}\]  
where  
\[\mu_{x}\ =\ (d_{t1}i-\frac{J_{t1}i}{J_{1}i^{2}+J_{2}}d_{1}i^{2})[1-\frac{J_ {t1}i^{2}}{J_{1}i^{2}+J_{2}}]^{-1}\,\mu_{l}\ =\ -\frac{J_{t1}i}{J_{1}i^{2}+J_{2}}[1-\frac{J_{t1}i^{2}}{J_{1}i^{2}+J_{2}}]^{-1} \tag{10}\]  
Figure 5: Simplified transmission model. However, Equation (1) is an affine system because of the constant term \(l\)[32], in order to obtain an optimal feedback unit based on LQR algorithm, Equation (1) should be linearized in the area near the equilibrium point, and the linearized state space equation is given in Equation (11). \[\Delta\dot{\mathbf{x}}\ =\ \mathbf{A}\Delta\mathbf{x}+\mathbf{B}\Delta\ u \tag{11}\]  
where \(\Delta\mathbf{x}\ =\ \mathbf{x}-\mathbf{x}_{0}\), \(\Delta\ u\ =\ u-u_{0}\), \(\mathbf{x}_{0}\ =\ \mathbf{x}_{0}(x_{20},l)\), \(u_{0}\ =\ u_{0}(x_{20},l)\). \(x_{20}\) and \(u_{0}\) are the initial values of \(x_{2}\) and \(u\) respectively, and considering the Equation (6), Equation (8) can be transformed into Equation (12). \[\lim_{T\rightarrow\infty}\int_{0}^{T}\big{(}\mathbf{M}\Delta\ x+D\Delta\ u+r_{1} \big{)}^{2}+\eta(\Delta\ u-\mu_{x}\Delta\ x_{2}+r_{2})\mathrm{d}t \tag{12}\]  
where \(r_{1}\ =\ \mathbf{M}\mathbf{x}_{0}+Du_{0}\), \(r_{2}\ =\ u_{0}-\mu_{x}x_{20}-\mu_{l}l\). Based on Equation (1), the model of the drivetrain is augmented into Equation (13), \(\sigma\) should be small enough so that \(r_{1,2}\) is a slow-varying value, i.e., \(\dot{r}_{1}\ =\ -\sigma\,r_{1}\), \(\dot{r}_{2}\ =\ -\sigma\,r_{2}\), and the linearized system will be stable. \[\mathbf{A}_{r}\ =\ \left(