## 4 Controller Design
### Adaptive Terminal Sliding Mode Controller  
Adaptive terminal sliding mode control not only has strong robustness but can also can the system state converge to the desired trajectory in finite time. In addition, it also has a strong adaptive processing function to ensure that when the system has parameter uncertainty, there will be no unnecessary discontinuous switching. Train position and speed tracking errors are defined as  
\[e_{1}=x_{1}-x_{d} \tag{6}\] \[e_{2}=x_{2}-\dot{x}_{d} \tag{7}\]  
where \(x_{d}\) and \(\dot{x}_{d}\) are the known train position and speed information, that is, desired position and desired position. **Assumption 2**. : _The desired position \(x_{d}\) and its derivatives \(\dot{x}_{d}\) and \(\ddot{x}_{d}\) are known and bounded._  
The two sides differential of the \(e_{2}\) is obtained  
\[\dot{e}_{2}=\dot{x}_{2}-\ddot{x}_{d}=u+g+f(x)-\ddot{x}_{d} \tag{8}\]  
In the process of train operation, in order to meet the requirements of safety and punctuality, it is necessary to accurately track the desired position and speed curve. Therefore, the sliding hyperplane design needs to introduce the train position tracking error \(e_{1}\) and train speed tracking error \(e_{2}\) to ensure the rapid convergence of the error. The terminal sliding mode function is designed as  
\[s=\beta e_{1}+e_{2}^{p/q} \tag{9}\]  
where \(\beta>0\) is control parameters to be designed, \(p\) and \(q\) are positive odd numbers, and \(1<p/q<2\). The terminal sliding mode controller is designed to realize the on-line tracking of the train desired position and speed. The two sides differential of the \(s\) is obtained  
\[ \begin{array}{l}\dot{s}=\beta e_{2}+\frac{p}{q}(u+g+f(\mathbf{x})-\tilde{x}_{d})e_{2 }^{p/q-1}\\ =\beta e_{2}+\frac{p}{q}e^{p/q-1}(u-\frac{a_{0}}{m}-\frac{b_{0}}{m}x_{2}-\frac{ c_{0}}{m}x_{2}^{2}+f(\mathbf{x})-\tilde{x}_{d})\\ =\beta e_{2}+\frac{p}{q}e^{p/q-1}(u-a^{*}-b^{*}x_{2}-c^{*}x_{2}^{2}+f(\mathbf{x})- \tilde{x}_{d})\end{array}  \tag{10}\]  
where \(\frac{a_{0}}{m}=a^{*}\), \(\frac{b_{0}}{m}=b^{*}\), and \(\frac{c_{0}}{m}=c^{*}\). **Assumption 3**. : _The control input \(u\) is time-varying and bounded; that is, there is an unknown constant \(u^{*}\) satisfying the inequality\(|u|\leq u^{*}\)._  
Based on the principle of sliding mode controller, the input form of sliding mode control is as follows:  
\[u=u_{eq}+u_{sw} \tag{11}\]  
where \(u_{eq}\) and \(u_{sw}\) are equivalent control term and nonlinear switching control term of the system. Let Equation (10) approach zero, and we can get  
\[u_{\alpha q}=-\frac{q}{p}\beta e_{2}^{2-p/q}+a^{*}+b^{*}x_{2}+c^{*}x_{2}^{2}-f (x)+\tilde{x}_{d} \tag{12}\]  
According to the design principle of sliding mode control, the nonlinear switching term of the system is designed as  
\[u_{sw}=-\eta\mathrm{sgns} \tag{13}\]  
where \(\eta>0\) is control gain. Then the input of terminal sliding mode control is designed as  
\[u=-\frac{q}{p}\beta e_{2}^{2-p/q}+a^{*}+b^{*}x_{2}+c^{*}x_{2}^{2}-f(x)+\tilde{ x}_{d}-\eta\mathrm{sgns} \tag{14}\]  
Define Lyapunov function  
\[V=\frac{1}{2}s^{2} \tag{15}\]  
The two sides differential of the \(V\) and substituting Equation (14), we can get  
\[\dot{V}=s\dot{s}=s(-\eta\frac{p}{q}e_{2}^{p/q-1}\mathrm{sgns})\leq(-\eta\frac {p}{q}e_{2}^{p/q-1})|s|<0 \tag{16}\]  
Then the system is stable, and the disturbance in train operation can be well controlled due to the existence of switching term. However, to enhance the robustness, it will increase the control burden of the switching term and ultimately increase the possibility of chattering in the control system because the parameters \(a_{0}\),\(b_{0}\), and\(c_{0}\) are obtained by fitting historical data. Generally, the model can model the basic resistance. However, for different trains, routes, and even different weather, the parameters will change, which leads to the uncertainty of system model parameters. Therefore, based on the principle of adaptive terminal sliding mode control, this paper introduces a parameter adaptive mechanism.