## 4 Simulation and Comparative Analysis  
In this section, we will verify the control algorithm proposed in Section 3 by simulation. In order to facilitate the simulation, we consider 2 DOF flexible manipulator as the controlled object. Firstly, the IHSMC algorithm proposed in this paper is simulated and compared with the traditional HSMC algorithm. The superiority of the control strategy is verified. Then, a PID-IDA-PBC proposed in this paper is simulated and implemented with the IDA-PBC algorithm. In comparison, it is verified that the PID-IDA-PBC algorithm has better steady state performance and disturbance-resistance ability. In the end, we proceed simulations using hybrid control. We use the parameter values of robot manipulator reported in [29]. In this simulation we assume that each joint of the flexible-joint robot is driven by PMSM. The parameters of PMSM are given as \(R_{s}=0.901\;\Omega\), \(L_{q}=L_{d}=0.0065\;\mathrm{H},n_{p}=4\), \(\Phi=0.031\;\mathrm{Wb},f=0.00012\;\mathrm{Kg}\cdot\mathrm{m}^{2},r=0.01\). The initial state is set as \(q_{1}(0)=q_{2}(0)=\theta_{1}(0)=\theta_{2}(0)=0\), we require the expected position vector to be \(q_{d}=[\sin t,\sin t]^{T},\theta_{d}=K^{-1}g(q)+q_{d}\). Lastly, we agree that the counterclockwise direction is the positive direction of the rotation of robot. For the IHSMC algorithm, the selected controller parameters are \(a_{1}=diag\{1,1\},a_{2}=diag\{20,20\}\), \(a_{3}=diag\{15,14\}\), \(b_{1}=diag\{0.5,0.1\}\), \(b_{2}=diag\{0.5,0.1\}\), \(b_{3}=diag\{30,30\},r_{1}=diag\{20,10\},r_{2}=diag\{1,0.8\}\), \(k_{1}=2\), \(k_{2}=0.8\), \(k_{3}=2\), \(k_{4}=diag\{0.00005,0.00005\}\),9, \(p_{2}=p_{4}=5\), \(q_{1}=q_{3}=7,q_{2}=q_{4}=3\). The parameter selection of the joint 1 current controller are \(\mu=2,\mu_{1}=\mu_{2}=40\). The original HSMC control law can be expressed as [24]  
\[ \begin{array}{c}\tau^{\prime}_{sm}=-\frac{a_{1}\mu_{2}}{\beta}\left\{M^{-1}(q )\left[K(\theta-q)+D(\dot{\theta}-\dot{q})-C(q,\dot{q})q-G(q)\right]-\ddot{q}_ {d}+a_{1}\dot{q}_{e}\right\}\\ \hskip 14.226378 pt+\frac{1\mu_{2}}{\beta}\left[-r_{1}\|s\|^{k_{1}}\text{sgn}(s )-r_{2}\|s\|^{k_{2}}\text{sgn}(s)-\frac{2}{\|s\|+k_{4}}(s_{d}^{T}\ddot{s}_{q})- k_{5}s\right]\\ \hskip 14.226378 pt+K(\theta-q)+D(\dot{\theta}-\dot{q})+J_{m}(\ddot{\theta}_{d} -a_{2}\dot{\theta}_{e})\end{array}  \tag{30}\]  
where \(k_{5}=diag\{10,10\}\). According to the results shown in Figure 2, joint 1 and joint 2 enter a steady state after a dynamic process of about 0.4 s, but there is still a small chattering in the system at steady state. Compared with the original HSMC algorithm, the IHSMC algorithm has a faster response speed and chattering is effectively suppressed. Figure 3 shows the simulation curves of \(u_{d},u_{q}\) under IHSMC and HSMC method. The simulation experiment of the PID-IDA-PBC algorithm is divided into two parts. Firstly, the performance difference between the algorithm and the traditional IDA-PBC algorithm is  
Figure 3: Control voltage of each joint motor. Figure 2: Improved hierarchical sliding mode control (IHSMC) and HSMC position tracking comparison curve. compared without disturbance. Then, a constant value disturbance signal of 2 N\(\cdot\)m is added at the System dynamic Equation (2) at 4 s to verify the disturbance-resistance performance of the algorithm. Parameters of PID-PBC-PCH controller: \(k_{d}=diag\{1200,100\}\), \(\lambda_{1}=diag\{1,1\}\), \(\lambda_{2}=diag\{100,100\}\), \(\eta_{1}=diag\{0.95,0.93\}\), \(\eta_{2}=diag\{1,1\}\), \(\eta=diag\{1.08,1.02\}\). According to Figure 4, it can be concluded that the PID-IDA-PBC has improved dynamic performance and steady-state performance compared to the conventional IDA-PBC control. The PID-IDA-PBC control algorithm can improve the steady-state performance by adjusting \(v\). Figure 5 shows the simulation curves of \(u_{d},u_{q}\) under IDA-PBC and PID-IDA-PBC method. At the same time, it will reduce the dynamic performance.