# Adaptive Neural Network Control of Zero-Speed Vessel Fin Stabilizer Based on Command Filter
## 3 Controller Design and Stability Analysis
### Control Law Design  
As shown in (18), \(f(x_{1},x_{2})\) is an unknown nonlinear function, which cannot be directly used for the design of control law. According to Lemma 1, the RBF neural network can be used to approximate the unknown function, i.e.,  
\[f(x_{1},x_{2})={W^{*}}^{\mathrm{T}}\psi(x)+\varepsilon \tag{23}\]  
where \(\varepsilon\) is the approximation error of the neural network, \(|\varepsilon|\leq\bar{\varepsilon}\). According to (17), (18) and (23), the vessel roll fin stabilizer control system can be written as follows:  
\[\left\{ \begin{array}{l}\dot{x}_{1}=x_{2}\\ \dot{x}_{2}={W^{*}}^{\mathrm{T}}\psi(x)+bu+\mathrm{e}\\ y=x_{1}\end{array} \right. \tag{24}\]  
where \(e=d_{e}+\varepsilon\). To handle the effect of input saturation, the following ADS is designed:  
\[\left\{ \begin{array}{l}\dot{\lambda}_{1}=\lambda_{2}-\phi_{1}\lambda_{1}\\ \dot{\lambda}_{2}=b\Delta u-\phi_{2}\lambda_{2}\end{array} \right. \tag{25}\]  
where \(\lambda_{1}\) and \(\lambda_{2}\) are the states of the ADS, the initial values of \(\lambda_{1}\) and \(\lambda_{2}\) are set to 0, \(\phi_{1}\) and \(\phi_{2}\) are the design parameters and are both greater than 0, \(\Delta u\) is the difference between the actual control input \(u\) and the command control input \(v\), \(\Delta u=u-v\), \(\dot{b}\) is an estimate of \(b\). \(\Delta u\) is the non-executable part caused by the physical constraint of actuator, which results in the control quality. In this work, we use the design idea of ADS to compensate the effect of \(\Delta u\). From the whole system, the non-executable part \(\Delta u\) affects \(\varphi\) and \(\dot{\varphi}\). In this context, the ADS (25) is designed to compensate the effect of \(\Delta u\). Using (25), the error variable is redefined as follows:  
\[\left\{ \begin{array}{l}z_{1}=x_{1}-\lambda_{1}\\ z_{2}=x_{2}-\alpha_{1}-\lambda_{2}\end{array} \right. \tag{26}\]  
where \(z_{1}\) and \(z_{2}\) are the error variables and \(\alpha_{1}\) is the state of the command filter. Define the command filter as shown below:  
\[\left\{ \begin{array}{l}\dot{\alpha}_{1}=\omega_{n}\alpha_{2}\\ \dot{\alpha}_{2}=-2\zeta\omega_{n}\alpha_{2}-\omega_{n}\big{(}\alpha_{1}- \alpha_{1}^{0}\big{)}\end{array} \right. \tag{27}\]  
where \(\omega_{n}\) is a design parameter and has a value greater than 0, and \(\zeta\in(0,1]\) is also a design parameter. The initial value of filter state \(\alpha_{1}\) should be the same as the initial value of virtual control law \(\alpha_{1}^{0}\), that is, \(\alpha_{1}(0)=\alpha_{1}^{0}(0)\), and the initial value of filter state \(\alpha_{2}\) is set to 0. According to (26), the error of the compensation is defined as follows:  
\[\left\{ \begin{array}{l}\dot{z}_{1}=z_{1}-s_{1}\\ \dot{z}_{2}=z_{2}-s_{2}\end{array} \right. \tag{28}\]  
where \(z_{1}\) and \(z_{2}\) are the compensated error variables, and \(s_{1}\) and \(s_{2}\) are the compensated variables. The derivation of the first compensating error variable of (28) is as follows:  
\[ \begin{split}&\dot{z}_{1}=\dot{z}_{1}-\dot{s}_{1}\\ &=\dot{x}_{1}-\dot{\lambda}_{1}-\dot{s}_{1}\\ &=x_{2}-\lambda_{2}+\phi_{1}\lambda_{1}-\dot{s}_{1}\\ &=z_{2}+\alpha_{1}+\phi_{1}\lambda_{1}-\dot{s}_{1}\\ &=z_{2}+\alpha_{1}-\alpha_{1}^{0}+\alpha_{1}^{0}+\phi_{1}\lambda_{1}- \dot{s}_{1}\end{split}  \tag{29}\]where \(\alpha_{1}^{0}\) is the virtual control law to be designed and \(\alpha_{1}-\alpha_{1}^{0}\) is the filtering error generated by the command filter. The filtering error compensation dynamic is designed as follows to eliminate the influence of the filtering error:  
\[\dot{s}_{1}=-k_{1}s_{1}+\alpha_{1}-\alpha_{1}^{0} \tag{30}\]  
where \(k_{1}\) is a design parameter and its value is greater than constant 0. The initial value of the compensation variable \(s_{1}\) is set to constant 0.