## 4 Controller Design
### Adaptive Terminal Sliding Mode Controller
the controller is modified to  
\[u=-\frac{q}{p}\beta e_{2}^{2-p/q}+\hat{a}+\hat{b}x_{2}+\hat{c}x_{2}^{2}-f(\mathbf{ x})+\tilde{x}_{d}-\eta\mathrm{sgns} \tag{17}\]  
where \(\hat{a}\), \(\hat{b}\), and \(\hat{c}\) are respectively estimated value of \(a^{*}\), \(b^{*}\), and \(c^{*}\). **Assumption 4**. : _The Davis equation coefficients of basic resistance satisfy inequality \(|a^{*}|\leq a^{\ddagger}\), \(|b^{*}|\leq b^{*}\) and \(|c^{*}|\leq c^{\ddagger}\) where \(a^{\ddagger}\), \(b^{\ddagger}\)and \(c^{\ddagger}\) are unknown bounded values._Define Lyapunov function  
\[V=\frac{1}{2}s^{2}+\frac{1}{2\lambda_{1}}\widetilde{a}^{2}+\frac{1}{2\lambda_{2}} \widetilde{b}^{2}+\frac{1}{2\lambda_{3}}\widetilde{c}^{2} \tag{18}\]  
where \(\lambda_{i}>0\), \(i=1,2,3\) is the adaptive gain of corresponding parameters. The two sides differential of Equation (18) is obtained  
\[\dot{V}=s\dot{s}+\frac{1}{\lambda_{1}}\widetilde{a}\dot{\widetilde{a}}+\frac{ 1}{\lambda_{2}}\widetilde{b}\dot{\widetilde{b}}+\frac{1}{\lambda_{3}} \widetilde{c}\dot{\widetilde{c}} \tag{19}\]  
where \(\widetilde{a}=\hat{a}-a^{*}\), \(\widetilde{b}=\hat{b}-b^{*}\), and \(\widetilde{c}=\hat{c}-c^{*}\) are respectively estimated error values. By substituting Equations (10) and (17) into Equation (19), we can get  
\[ \begin{array}{c}\dot{V}=\frac{p}{q}e_{2}^{p/q-1}s(\hat{a}-a^{*})+\frac{p}{q }e_{2}^{p/q-1}s(\hat{b}-b^{*})x_{2}+\frac{p}{q}e_{2}^{p/q-1}s(\hat{c}-c^{*})x_ {2}^{2}\\ -\frac{p}{q}e_{2}^{p/q-1}s\eta\mathrm{sgn}(s)+\frac{1}{\lambda_{1}}\dot{ \widetilde{a}}\dot{\widetilde{a}}+\frac{1}{\lambda_{2}}\dot{\widetilde{b}} \dot{\widetilde{b}}+\frac{1}{\lambda_{3}}\dot{\widetilde{c}}\dot{\widetilde{c }}\end{array}  \tag{20}\]  
In order to satisfy the stability of Lyapunov, formula (20) is further organized to obtain the parameter adaptation law as follows:  
\[\left\{ \begin{array}{l}\dot{\hat{a}}=-\lambda_{1}\frac{p}{q}e_{2}^{p/q-1}s\\ \dot{\hat{b}}=-\lambda_{2}\frac{p}{q}e_{2}^{p/q-1}sx_{2}\\ \dot{\hat{c}}=-\lambda_{3}\frac{p}{q}e_{2}^{p/q-1}sx_{2}^{2}\end{array} \right. \tag{21}\]  
In order to improve the robustness of the controller, based on the \(\sigma\) modified robust adaptive control theory [29], the parameter adaptive law is redesigned  
\[\left\{ \begin{array}{l}\dot{\hat{a}}=-\lambda_{1}(\frac{p}{q}e_{2}^{p/q-1}s+ \sigma_{1}\hat{a})\\ \dot{\hat{b}}=-\lambda_{2}(\frac{p}{q}e_{2}^{p/q-1}sx_{2}+\sigma_{2}\hat{b})\\ \dot{\hat{c}}=-\lambda_{3}(\frac{p}{q}e_{2}^{p/q-1}sx_{2}^{2}+\sigma_{3}\hat{c })\end{array} \right. \tag{22}\]  
where \(\sigma_{i}>0\), \(i=1,2,3\) is a newly introduced parameter. According to the adaptive terminal sliding mode control law designed above, because of the existence of a discontinuous switching function \(\eta\mathrm{sgn}(s)\), ATO will send discontinuous control signals to keep the operating state of the train on the sliding mode surface. However, in the actual operation process of the train, due to the additional resistance of the route, the basic resistance or the measurement deviation, and other factors, the operating state of the train cannot stay on the sliding surface, and the state error repeatedly passes through the ideal sliding surface, finally forming the chattering phenomenon [30]. In order to avoid frequent switching of train operation control input caused by excessive chattering, the sign function \(\mathrm{sgn}(s)\) in the control switching term of Equation (17) is replaced by the saturation function  
\[sat(s)=\left\{ \begin{array}{l l}1&\mathrm{s}>\phi\\ s&|s|\leq\phi\\ -1&\mathrm{s}<-\phi\end{array} \right. \tag{23}\]