## 3 Control System Design
### Upper Controller
#### 3.2.4 Design of the Upper-Level Controller Based on the ASSM Algorithm  
(1) Controller design based on SSM: Taking the three-degrees-of-freedom vehicle model as an ideal reference model, the upper-level controller of the control system is designed based on the SSM algorithm. The yaw dynamics Equation (10) of the electric vehicle driven by the distributed drive is as follows:  
\[I_{2}\dot{\gamma}=M_{2}+\frac{B}{2}(F_{yfl}-F_{yfr})\sin\delta+a(F_{yfl}+F_{ yfr})\cos\delta-b(F_{yfl}+F_{yrr})+d \tag{30}\]  
In Formula (30), \(d\) is the aggregate disturbance caused by model uncertainty and interference. Define the sliding mode variables as  
\[s=\gamma-\gamma_{d}+\frac{1}{2}(\beta-\beta_{d}) \tag{31}\]  
Find the first-order derivative and the second-order derivative of the sliding mode variables respectively, and substitute Equation (30) into  
\[ \begin{array}{rl}\dot{s}=\frac{1}{l_{z}}\Big{\{}M_{z}+\frac{\beta}{2}(F_{yfl} -F_{yfr})\sin\delta+a(F_{yfl}+F_{yfr})\cos\delta\\ \qquad\qquad-b(F_{yfl}+F_{yrr})+I_{z}\big{[}\frac{1}{2}(\dot{\beta}-\dot{\beta }_{d})-\dot{\gamma}_{d}\big{]}+\dot{d}\Big{\}}\end{array}  \tag{32}\]  
\[ \begin{array}{rl}\ddot{s}=\frac{1}{l_{z}}\Big{\{}\dot{M}_{z}+\frac{\beta}{2}( \dot{F}_{yfl}-\dot{F}_{yfr})\sin\delta+\frac{\beta}{2}(F_{yfl}-F_{yfr})\cos \delta\cdot\dot{\delta}\\ \qquad\qquad+a(\dot{F}_{yfl}+\dot{F}_{yfr})\cos\delta-a(F_{yfl}+F_{yfr})\sin \delta\cdot\dot{\delta}\\ \qquad\qquad-b(\dot{F}_{yfl}+\dot{F}_{yrr})+I_{z}\big{[}\frac{1}{2}(\dot{ \beta}-\dot{\beta}_{d})-\dot{\gamma}_{d}\big{]}+\dot{d}\Big{\}}\end{array}  \tag{33}\]  
The output of the upper controller is  
\[M_{z}=u=u_{1}+u_{2} \tag{34}\]  
\[\left\{ \begin{array}{rl}\dot{u}_{1}&=-I_{z}\cdot\alpha[\text{sgn}(s)+\frac{1 }{2}\text{sgn}(\dot{s})]\\ u_{2}&=-\Big{\{}\frac{\beta}{2}(F_{yfl}-F_{yfr})\sin\delta+a(F_{yfl}+F_{yfr}) \cos\delta\\ &\qquad-b(F_{yfl}+F_{yrr})+I_{z}\big{[}\frac{1}{2}(\dot{\beta}-\dot{\beta}_{ d})-\dot{\gamma}_{d}\big{]}\Big{\}}\end{array} \right. \tag{35}\]  
In Formula (35), \(\gamma\) and \(\gamma_{d}\) are the actual value of the lateral angular velocity and the ideal value based on the three-degrees-of-freedom vehicle reference model; \(\beta\), \(\beta_{d}\) are the actual value of the center-of-mass slip angle and the ideal value based on the three-degrees-of-freedom vehicle reference model, respectively; \(\alpha\) is the spiral sliding mode control gain; \(u_{1}\) is the SSM control output, and \(u_{2}\) is the modeling compensation feedforward output. From the structure of the SSM algorithm, it can be seen that the controller outputs the integral value of the sign function. If the controller is designed properly, it can effectively reduce or eliminate the system chattering caused by the sign function output. (2) Design of the control gain adaptive law: In order to make the sliding mode variable and its derivative converge to 0 within a finite time, it is necessary to design a control gain adaptive law. To this end, the following control gain adaptive law is proposed:  
\[\dot{\alpha}=\left\{ \begin{array}{rl}\omega\sqrt{\frac{\theta}{2}}\text{ sgn}[E(s,\dot{s})-\rho];&\alpha>\alpha_{t}\\ \lambda;&\alpha\leq\alpha_{t}\end{array} \right. \tag{36}\]  
Stability conditions:  
\[\left\{ \begin{array}{rl}\alpha>2D\\ 0<\kappa<\min(\frac{2\sqrt{2\alpha}}{3}(\frac{\alpha}{2}-D),2\alpha^{\frac{3}{ 2}})\end{array} \right. \tag{37}\]  
In the Formulas (36) and (37), \(E(s,\dot{s})=e^{k(\dot{s}^{2}+\frac{1}{2}\dot{s}^{2})}\), \(k\), \(\omega\), \(\theta\), \(\rho\), \(\lambda\) and \(\alpha_{t}\) are all positive constants. The design significance of the adaptive critical function \(E(s,\dot{s})=e^{k(\dot{s}^{2}+\frac{1}{2}\dot{s}^{2})}\): It is designed in the form of an exponential function, such that when the deviation between the system state and the ideal state is small, there is a small compensation amount and compensation rate, which effectively reduces the chattering of the system when it is close to or reaches a steady state.