The local and global optimization capabilities of the ASO and SO algorithms on single-peak and multi-peak functions are evaluated through 48 independent comparison experiments between other algorithms under the same conditions using six benchmark functions. To verify the advantages of the ASO-TFLANN nonlinear compensation method, the LVDT voltage–displacement test bench was constructed for testing, and the displacement–voltage data of the LVDT under four different frequencies of primary excitation were obtained. The displacement and voltage data of the LVDT under the primary excitation of the four different frequencies were fed to the four models for iterative training, which are the SO-TFLANN, the Advanced Snake Optimization–Sine–Cosine Functional Linked Network Chain (ASO-SCFLANN), the Tangent Functional Linked Artificial Neural Network (TFLANN), and the Sine–Cosine Functional Artificial Neural Linked Network (SCFLANN). The optimal parameters obtained from the training are given to the above four models for comparative analysis in simulation experiments.
4.1. ASO Performance Test
To evaluate the optimization performance of ASO, Particle Swarm Optimization (PSO), Ant Lion Optimization (ALO), and Moth Flame Optimization (MFO) by six benchmark functions with a swarm size of 30 and an iteration number of 500, Sine–Cosine Algorithm (SCA), Salp Swarm Algorithm (SS), Chameleon Search Algorithm (CSA), snake optimization (SO), and ASO conducted 70 independent comparison experiments. The six benchmark functions are listed in
Table 1. F1, F2, and F3 functions are single-peak functions that can be used to test the local optimization ability of the algorithms. F4, F5, and F6 functions are multi-peak functions that can be used to test the global optimization ability of the algorithms. The resultant data use the mean value which measures the accuracy of the algorithm. The above algorithm was run on Lenovo Savior R7000P with the Windows 10 system and MATLAB version 2023b.
The test data of the eight algorithms for the above benchmark functions are given in
Table 2.
Figure 4,
Figure 5,
Figure 6,
Figure 7,
Figure 8,
Figure 9,
Figure 10,
Figure 11,
Figure 12,
Figure 13,
Figure 14 and
Figure 15 display 3D plots of the benchmark functions F1, F2, F3, F4, F5, and F6, along with the average fitness curves of the algorithms following optimization.
Figure 5 shows that ASO, SO, and SS optimize the F1 function better compared to PSO, ALO, MFO, SCA, and CSA. At about the 250th iteration, the value of the objective function for ASO drops dramatically, far below that of the other algorithms, and eventually reaches a value close to the order of magnitude of −100. Among them, ASO is 1000 times more accurate than SO and 90 orders of magnitude higher than SS. As shown in
Figure 7, ASO shows outstanding performance throughout. Initially, all algorithms have relatively close objective function values, but as the number of iterations increases, ASO quickly shows a significant advantage after about 300 iterations, with the objective function value rapidly decreasing to be much lower than the other algorithms. At the end of 500 iterations, the objective function value of ASO is close to
, and the objective function value of SO is close to
, indicating that ASO has very high accuracy and excellent convergence on this function. In contrast, the other algorithms perform mediocrely on the F2 function, especially the objective function values of MFO and CSA decrease only slightly in the late iteration. Taken together, ASO shows excellent global search capability on the F2 test function and can quickly converge to very small values, far exceeding the performance of the other algorithms. In the optimization tests for the F3 function, ASO still had the best results, followed by SO (see
Figure 9). At the end of 250 iterations, SO drops rapidly, and the value is the same as that of ASO; at the end of 400 iterations, ASO drops rapidly again to 2.6087, breaking through the local optimum. Comprehensively, ASO shows excellent global search ability in the late iteration of the F3 test function using Levy flight, which can break through the local optimum and far outperforms the performance of other algorithms.
Figure 11 shows that in the F4 function optimization test, both ASO and SO reach the theoretical optimal value of 0 on average, but ASO finds the optimal solution relatively faster; the second-ranked PSO has an average of 11, and SS and MFO are both in the third place with 14.
Figure 13 shows that ASO, SO, and CSA outperform PSO, ALO, MFO, SCA, and SS in the optimization test for F5 functions. ASO has the value of the objective function that is three orders of magnitude lower than that of SO, after four fast drops at iterations 250-350. At iterations 450-500, there is one fast drop for both SO and ASO, but ASO is still 100 times more accurate than SO.
Figure 15 shows that ASO, SO, and CSA are better optimized in the optimization test of the F6 function, and ASO and SO have the same performance. Overall, the convergence trend of ASO is more obvious from
Figure 4 to
Figure 15. Especially when the number of iterations exceeds 200, the average fitting curves of F3 and F5 of ASO can find better solutions than the other algorithms after several step-downs. This indicates that ASO has faster convergence speed and higher search accuracy than SO and other algorithms, and is less likely to fall into local optimization, thus showing stronger competitiveness.
4.2. ASO-TFLANN Model Training and Comparative Simulation
The LVDT voltage–displacement test bench consists of a high-precision stepping motor, a grating sensor, a stepping motor driver, a signal generator, an oscilloscope, and DC power supply. High-precision stepping motor’s stepping angle is 1.8°/step, the lead range is 1 mm, repeatable positioning accuracy is ±0.005 mm. The stepping motor is connected with the primary coil of LVDT. The grating sensor’s pitch is 20
m, accuracy is 1
m, the displacement signal is fed back to the stepping motor to achieve closed-loop regulation, model ATOM4TO-300. The stepper motor driver converts the displacement command into a stepping angle, enabling the precise control of the stepper motor in a closed-loop system. The signal generator (model DG1022G) provides sinusoidal voltage signals to the primary coil of the LVDT. The computer sends non-integer displacement commands to the stepper motor driver to generate the desired displacement of the LVDT’s primary coil, which helps avoid integer displacement values in the test results. The oscilloscope (model DS1102E) is used to record the differential voltage across the secondary coil, capturing the secondary displacement of the stepper motor. A visual representation of the setup used for the tests at four different frequencies, namely 10 kHz, 20 kHz, 30 kHz, and 50 kHz, is shown in
Figure 16. The same setup was used for the subsequent online experiments as well.
Under the primary excitation of four different frequencies, namely 10 kHz, 20 kHz, 30 kHz, and 50 kHz, 17 sets of experimental data for each frequency are presented in
Table 3.
is the virtual displacement accepted by the LVDT voltage–displacement test bench, and is dimensionless;
is the secondary coil differential voltage in volts. The displacement-voltage output curve is shown in
Figure 17.
To verify the advantages of the ASO-TFLANN nonlinear compensation method, the collected voltage–displacement data of four primary excitations at 10 kHz, 20 kHz, 30 kHz, and 50 kHz were input into four models (such as ASO-TFLANN, SO-SCFLANN, TFLANN, and SCFLANN) for offline comparative simulation experiments and analysis. The error
, maximum absolute error
, and maximum full-scale error
[
30] of the four methods in the LVDT measurement range were obtained through Equations (
28)–(
30).
Table 4 shows the
of the four methods at different frequencies, and
Table 5 shows the
of the four methods at different frequencies.
Figure 18a shows the comparison of output error images of different methods at 10 kHz. From
Figure 18a,
Table 4 and
Table 5, it can be seen that when the primary excitation is 10 kHz, the
using ASO-TFLANN, ASO-SCFLANN, and TFLANN are 84.40
m, 96.89
m, 365.74
m, respectively, which are lower than the 560.13
m using SCFLANN, and the ASO-TFLANN calculates the smallest
of 0.61%, which is 84.9% lower than that of SCFLANN, followed by ASO-SCFLANN and TFLANN, which are 82.7% and 34.7% lower, respectively.
Figure 18b shows the comparison of output error images of different methods at 20 kHz. As shown in
Figure 18b,
Table 4 and
Table 5, when the primary excitation is 20 kHz, the SCFLANN’s
is 668.33
m, the ASO-TFLANN’s is the smallest, 42.41
m, which is 93.65% lower than that of the SCFLANN, the ASO- SCFLANN is the next smallest at 150.62
m, which is 77.46% lower, and the TFLANN’s
is 463.51
m, which is 30.64% lower; furthermore, the ASO-TFLANN’s
is smallest among the four frequencies of the four methods, which is only 0.27%; taking the optimization effect of SCFLANN as a benchmark,
is reduced by 93.7%, 77.5%, and 30.6% after using ASO-TFLANN, ASO-SCFLANN, and TFLANN, in that order.
Figure 18c shows the comparison of output error images of different methods at 30 kHz. From
Figure 18c,
Table 4 and
Table 5, it can be seen that when the primary excitation is 30 kHz, the
of the four methods, ASO-TFLANN, ASO-SCFLANN, TFLANN, and SCFLANN, are 89.98
m, 90.64
m, 505.47
m, 90.64
m, 505.47
m, 968.15
m;
computed by ASO-TFLANN and ASO-SCFLANN are very similar to each other, respectively, 0.56% and 0.57%; the optimization effect of TFLANN is the worst, with the
of only 3.15%, which is 47.8% lower than that of SCFLANN.
Figure 18d compares output error images of different methods at 50 kHz. As can be seen from
Figure 18d,
Table 4 and
Table 5, when the primary excitation is 50 kHz, the
of ASO-TFLANN and ASO-SCFLANN are 244.41
m, 293.65
m, respectively, which are lower than that of the value of SCFLANN, 902.14
m; and ASO-TFLANN’s
is the smallest, and the calculated
is only 1.53%; TFLANN outputs the largest
, which is 1562.04
m, and higher than SCFLANN’s 902.14
m. Using SCFLANN’s optimization effect as a benchmark, ASO-TFLANN’s and ASO-SCFLANN’s
decrease by 72.9% and 67.4%, respectively, while TFLANN’s
increases by 73.1%. It is found that when the primary excitation is 50 kHz, the errors of all four methods are larger than 10 kHz, 20 kHz, and 30 kHz, which occurs because the position of the voltage zero point of the NC-LVDT is subsequently shifted when the frequency is increased. Taking the voltage origin position at 10 kHz as a reference, the 20 kHz offset is +0.075 mm, the 30 kHz offset is +0.1545 mm, and the 50 kHz offset is 1.775 mm. After cutting down the offsets and re-running the analog test simulation, the error range of the 50 kHz frequency is narrowed down to within ±60
m, as shown in
Figure 19.
From
Figure 18a–d, in the region of small displacement (−4 mm to 4 mm), the output errors of each method are small, especially ASO-TFLANN and ASO-SCFLANN show a smoother error trend. However, when the displacement increases to near the ends (±8 mm), the error gradually increases, especially the error fluctuation of SCFLANN is larger. This indicates that as the displacement increases, the nonlinear effect of the system gradually increases, leading to an increase in the error, whereas at smaller displacements, the system has stronger linear properties, and thus the methods are better able to compensate. In addition, the maximum errors all occur at displacements of 4 mm to 8 mm. This further verifies that ASO-TFLANN and ASO-SCFLANN have good nonlinear error handling capability in different displacement ranges and outperform the conventional methods in overall error control.
4.3. On-Line Test Validation
To assess the practicality and effectiveness of the ASO-TFLANN nonlinear compensation method, the LVDT is connected to an oscilloscope, which is then connected to a laptop. The data received by the oscilloscope from the LVDT are transmitted to the laptop for online experimental verification. The voltage–displacement test bench adjusts the displacement of the LVDT primary coil, and the output error
of the model, after the series connection with the actual displacement, is presented in
Table 6. The variance and mean of the error (both calculated using the absolute values of the errors) are shown in
Table 7. From
Table 6, when the primary excitation is 10 kHz, the maximum output error measured in the online experiment is −55.47
m; when the primary excitation is 20 kHz, the maximum output error measured in the online experiment is −29.67
m; when the primary excitation is 30 kHz, the maximum output error measured in the online experiment is 57.55
m; when the primary excitation is 50 kHz, the maximum output error measured in the online experiment is 105.27
m. The maximum errors in the online experiment at the four frequencies are smaller than those measured in the offline experiment, which proves that the introduced method can effectively improve the nonlinearity of the LVDT. When the primary excitation frequency is 50 kHz, the error is still the largest under the four frequencies; when the primary excitation frequency is 20 kHz, the error is still the smallest under the four frequencies, which is consistent with the offline simulation experiments. From
Table 7, we can see that the mean and variance of the output errors are smallest at 20 kHz. The mean error at 20 kHz is 10.42
m, and the variance is 92.06
, making it the most stable frequency compared to the other frequencies. This suggests that the system performs most consistently at 20 kHz, with minimal error and variability.