## 4 Simulations and Experiments
### CNC System Simulation  
The experimental object in this paper is the X-axis servo system in the X-Y motion platform in Figure 5. The server driver and X-axis are controlled by the upper machine PC and lower machine GALIL multi-axis motion control card, as shown in Figure 6, and their parameters are listed in Table 4.  
Figure 4: Response curves of different references after G-PSO algorithm optimization: (**a**) Reference [7], (**b**) Reference [18], (**c**) Reference [21].  
Figure 5: Experimental platform.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & \multicolumn{2}{c}{**Reference [7]**} & \multicolumn{2}{c}{**Reference [18]**} & \multicolumn{2}{c}{**Reference [21]**} \\ \hline  & **Before** & **After** & **Before** & **After** & **Before** & **After** \\ \hline Rise & \multirow{2}{*}{0.11} & \multirow{2}{*}{0.042} & \multirow{2}{*}{1.8} & \multirow{2}{*}{0.039} & \multirow{2}{*}{1} & \multirow{2}{*}{0.219} \\ time/s & & & & & & \\ Settling & & & & & & \\ time/s & & & & & & \\ Overshoot/\% & & & & & & \\ Number of & & & & & & \\ iterations & & & & & & \\ \hline \hline \end{tabular}
\end{table}
Table 3: Comparison table of system performance parameters before and after G-PSO algorithm optimization.  
Using the ARX model identification system to obtain the number of zeros and poles, we then use the system identification toolbox in MATLAB to identify the servo system [34], and the X-axis servo system model is obtained, as follows:  
\[F(s)=\frac{1.17\times 10^{3}s+1.25\times 10^{4}}{s^{3}+37.98s^{2}+99.25s+1.88} \tag{20}\]  
The model is simulated in MATLAB/Simulink. The G-PSO algorithm-optimized NLPID controller (G-PSO NLPID) is compared to the initial PID system (INIT PID), G-PSO algorithm-optimized traditional PID controller (G-PSO PID) and PSO algorithm-optimized NLPID controller (S-PSO NLPID) to evaluate its control performance. The simulations are repeated ten times to avoid random interference, and the final convergence curve is obtained by averaging the values, as shown in Figure 7. The fitness value of G-PSO NLPID reaches 1.1564 in the 13 th generation, while the fitness of S-PSO NLPID reaches 1.4751 in the 45 th generation. It can be seen that the convergence speed of G-PSO NLPID is significantly faster than that of S-PSO NLPID.  
Then, we apply an input signal with an amplitude of 10 mm to the system, and at 1 s, a disturbance with an amplitude of 5 mm lasting 0.05 s is applied. Figure 8 shows the response curves, Table 5 shows the system performance indicators. G-PSO NLPID has a rise time and a settling time of 0.138 s and 0.182 s, respectively, which are 43.74% and 52.60% faster than those of G-PSO PID. In addition, overshoot is successfully suppressed after optimization. G-PSO NLPID responds faster to disturbance than G-PSO PID, has stronger  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Indicators** & **Parameters** \\ \hline Servomotor power rating & 400 W \\ Servo motor rated torque & 1.3 N \(\cdot\) m \\ Servo motor rated speed & 3000 r/min \\ Lead of ball screw & 5 mm \\ X-axis stroke & 200 mm \\ Motion control card & GALIL DMC-1886 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Parameters of experimental platform.  
Figure 6: Block diagram of the control system.  
Figure 7: Convergence comparison of S-PSO NLPID and G-PSO NLPID.  
ability to suppress disturbances, and adjusts quickly after disturbance is removed. At the same time, Fuzzy PID and model reference adaptive control (MRAC) PID are selected for simulation comparisons. The simulation results are shown in Figure 8, and the detailed performance parameters are shown in Table 5. The Fuzzy PID has a faster response speed, but it has overshoot and is extremely sensitive to disturbances. The MRAC PID has the greatest inhibitory effect on disturbances; however, the system response speed is slower. To avoid the influence of backlash in CNC systems with high precision requirements, the system should not have overshoot, so G-PSO NLPID has advantages.