Introduction

As a typical nonlinear and unstable system, the magnetic levitation ball system has become a common experimental platform for scholars to study control methods1,2,3,4. At present, the control methods of magnetic levitation ball mainly include PID control5,6, sliding mode control7,8, robust control9,10, adaptive control11, etc., but these control methods are difficult to achieve high-precision position control of magnetic levitation ball.

The neural network has adaptive and self-learning capabilities12,13,14, can accurately approximate nonlinear systems15. It can directly estimate the unknown nonlinear function without prior information of the closed-loop system16, and can improve the position control accuracy of the magnetic levitation ball17. Chen et al. proposed a sliding mode control method based on radial basis function (RBF) neural network, which significantly improved the control accuracy and robustness of the magnetic levitation ball control system18. In response to the problems in neural network training, Patan et al. proposed an adaptive iterative learning control method, which greatly improved the convergence speed and stability of neural network controller in maglev control system19. Fatemimoghadam et al. designed a control structure based on a recurrent neural network, which effectively improved the tracking performance of the maglev closed-loop system by introducing a time sequence relationship to predict the control quantity20. Jafari et al. proposed a more effective recurrent neural network training method for the identification of unknown system, which effectively reduced the tracking error of maglev system21. Zhu et al. used neural network identifier to establish the dynamic model between control system error and control quantity in the control loop, and dynamically copied its training parameters to the neural network feedback compensation controller, which significantly improved the steady-state accuracy of magnetic levitation ball position control22.

Although the above methods can effectively improve the steady-state accuracy of the magnetic levitation ball control system, the neural network controller is difficult to effectively improve the dynamic performance of the control system because the modeling accuracy of the neural network depends heavily on the amount of the training samples. Especially when tracking a reference signal with fast mutation characteristics such as step and square signals, the signal jump moment lacks sufficient sample data to effectively train the neural network, which leads to the uncertainty of the output of the neural network controller at this time. However, there are few in-depth studies on the dynamic quality of neural network control in the existing literature. Therefore, it is necessary to adopt an intelligent algorithm to adaptively adjust the output of the neural network controller at the moment of signal transition to suppress the uncertainty interference of the undertrained neural network to the control system.

As an intelligent algorithm, fuzzy inference has the advantages of clear interpretation and reliable reasoning. It is often used to solve uncertain inference problems23,24,25,26,27. Naresh Kumar et al. proposed a fault location method based on fuzzy inference for the uncertainty of faults, compared with the existing location methods, the proposed solution has been obtained higher fault location accuracy28. Song et al. applied fuzzy inference to fault diagnosis, and verified the effectiveness of introducing fuzzy inference through the study of uncertainty interference in mechanical structure faults29. In terms of uncertainty inference of control system, Tong et al. designed a fuzzy state observer for the uncertainty of the nonlinear system to estimate the unmeasured state, the results show that the method effectively improved the control Performance30. Based on fuzzy inference, Hu et al. used an improved genetic algorithm to optimize the fuzzy rules, which effectively improved the control effect and anti-interference performance of micro-unmanned helicopter31. Ko et al. introduced fuzzy inference into the traditional linear quadratic regulator (LQR) control structure, and effectively improved the power quality of the wind-hybrid power generation system by estimating the uncertain factors in the LQR control32. Ali proposed a control structure based on fuzzy inference, which provided an effective solution for obtaining the best agricultural indoor temperature33. In the electric power steering control problem, Cao et al. used fuzzy inference mechanism to control it, which significantly improved the dynamic performance of the vehicle34. In order to solve the active power filter current control problem under uncertainty, Hou et al. used type-2 fuzzy approach to significantly improve system performance35. Although these studies show that fuzzy inference has the potential to solve control uncertainty, the current literature still lacks specific research on the dynamic quality of neural network control.

In order to address the problem of poor transient performance of the control system caused by the control uncertainty of the undertrained neural network, a neural network compensation control method based on fuzzy inference is proposed for magnetic levitation ball position control in this paper, and the simulation and experimental researches are carried out. The results show that this method can improve the transient quality of neural network control system.

The main innovations of the proposed method are as follows:

  1. (1)

    A magnetic levitation ball position control structure based on fuzzy inference to adaptively adjust neural network control is proposed, which improves the transient performance of the control system;

  2. (2)

    The fuzzy inference block is designed to adaptively adjust the compensation control quantity of the neural network controller, and the dynamic adjustment factor is added to enhance the stability of the control;

  3. (3)

    Simulation and experimental results show that the proposed method significantly reduces the overshoot and settling time of the control system without sacrificing the steady-state accuracy.

The rest of the paper is organized as follows. “Control principle” section introduces the control principle of the proposed control structure. “Fuzzy inference block design” section describes the design of fuzzy inference block. “Results and discussion” section verifies the effectiveness of the proposed control method through simulation and experiment. “Conclusion” section is the conclusion.

Control principle

Control structure

The principle of neural network compensation control based on fuzzy inference proposed in this paper is shown in Fig. 1. Its control structure is mainly composed of three parts: fuzzy inference block, neural network control block and basic control block. The fuzzy inference block is composed of fuzzy interface, rule base, fuzzy inference engine and defuzzification interface. The neural network control block is composed of identifier and controller. The basic control block selects PID controller with good adaptability and strong robustness. The main purpose of adding the basic control block is to ensure the stability of the control system when the neural network is not fully trained or is subject to large interference.

Figure 1
figure 1

Structure diagram of neural network compensation control based on fuzzy inference.

In each control cycle, the output \(y\) and input \(u\) of the controlled system sampled in real time are used as the training samples of the neural network identifier, and the error between the output \(u_{I}\) of the neural network identifier and the control variable \(u\) is used to back propagate and update the parameters of the neural network identifier, so as to establish the dynamic inverse model of the controlled system. The parameters of the neural network identifier will be dynamically copied to the neural network controller in each control cycle. The fuzzy inference engine infers the dynamic adjustment factor \(p\) according to the error \(e\) and the error change rate \(ec\). The control system adaptively adjusts the output of the neural network controller based on the dynamic adjustment factor. According to the expected output \(r\), the neural network controller obtains the feedforward control quantity \(u_{NN}\) through the feedforward calculation. After adaptive adjustment of fuzzy inference, it acts on the controlled system together with the output of the PID controller.

At the initial stage of control and the moment of tracking signal transition, the neural network lacks effective training samples. At this time, the feedforward control output by the undertrained neural network controller has strong uncertainty, and the transient performance of the control system is poor. Therefore, the fuzzy inference block is introduced to weaken the effect of the neural network controller in the insufficient training stage, and the influence of the instability of the undertrained neural network on the transient performance of control system is weakened through this adaptive adjustment mechanism.

As the control system enters a steady state, effective training samples gradually increase, the dynamics inverse model of the controlled system is more accurate, and the control error and error rate of change are getting smaller and smaller. At this time, in order to ensure the dominant role of the neural network controller in the steady state of the control system, the adaptive adjustment effect of the fuzzy inference block on the neural network controller is gradually weakening, which also ensures the steady state performance of the control system. The control structure in Fig. 1 significantly improves the transient performance of the control system while ensuring that the control system has good steady-state accuracy.

Control algorithm

Calculation of control quantity

The input of the controlled system consists of the output of PID controller and the adaptively adjusted output of neural network controller. The adaptively adjusted output of neural network controller is obtained by multiplying the output of the fuzzy inference block and the output of the neural network controller.

The total control quantity of the control system is calculated as follows:

$$ u = u_{PID} + u_{p} $$
(1)

where \(u_{PID}\) is the output of PID controller, and \(u_{P}\) is the output after adaptive adjustment of neural network controller.

The basic control output \(u_{PID}\) is calculated as follows:

$$ u_{PID} = k_{p} e(k) + k_{i} \sum\limits_{i = 0}^{k} {e(i)\Delta t + k_{d} \frac{(e(k) - e(k - 1))}{{\Delta t}}} $$
(2)

where \(k_{p}\), \(k_{i}\) and \(k_{d}\) are the three hyperparameters of the PID controller, and \(k\) represents the current sampling time.

The compensated control output \(u_{p}\) is calculated as follows:

$$ u_{p} = p \cdot u_{NN} $$
(3)

where \(u_{NN}\) is the output of the neural network controller after forward propagation, and \(p\) is the output of the fuzzy inference block.

The architecture of neural network controller is shown in Fig. 2. The neural network has three layers, namely input layer, hidden layer and output layer. The number of neurons in the hidden layer is 5, the activation function is Sigmod, and the input is the target value \(r\). The output of the neural network controller \(u_{NN}\) is calculated as follows:

$$ u_{NN} = \sum\limits_{j = 1}^{n} {[\omega_{2,j} \cdot \sigma (\omega_{1,j} \cdot r + b_{1,j} )]} + b_{2} $$
(4)

where j = 1, 2, …, n, n represents the number of hidden layer neurons, \(\omega_{1,j}\) represents the weight between the input layer and the jth neuron of the hidden layer, \(\omega_{2,j}\) represents the weight between the output layer and the jth neuron of the hidden layer, \(b_{1,j}\) represents the bias of the jth neuron in the hidden layer, \(b_{2}\) represents the bias of the output layer neuron, and the symbol \(\sigma\) represents the activation function.

Figure 2
figure 2

The architecture of neural network controller.

It is worthy noted that, the parameters of the neural network controller are obtained by passing the real-time parameters of the neural network identifier. At the Kth sampling time, the neural network identifier used the control quantity \(u\) and the output quantity \(y\) as a set of training samples for one training. The trained parameters will be used to calculate the output \(u_{NN}\) of the neural network controller at the next sampling time.

Training of neural network

The identifier and the controller in the neural network control block have the same network structure, and both use a three-layer BP neural network structure. The output of the controlled system \(y\) is used as the input of the neural network identifier, and the output of the neural network identifier \(u_{I}\) is obtained through the forward propagation of the neural network identifier. The parameters of the neural network identifier are updated by back propagation through the loss value between \(u_{I}\) and the target value \(u\), and the updated parameters are used as the parameters of the neural network controller at the next time.

The training of the neural network identifier is to establish an accurate inverse model of the controlled system, and the goal is to reduce the loss value between \(u_{I}\) and \(u\).

The definition of the loss function is as follows:

$$ V = \frac{1}{2}(u - u_{I} )^{2} $$
(5)

The update formula of weight and bias in neural network is as follows:

$$ \omega (k + 1) = \omega (k) - \alpha \frac{\partial V}{{\partial \omega }} + \beta [\omega (k) - \omega (k - 1)] $$
(6)
$$ b(k + 1) = b(k) - \alpha \frac{\partial V}{{\partial b}} + \beta [b(k) - b(k - 1)] $$
(7)

where \(\omega\) is the weight, \(b\) is the bias, \(\alpha\) is the learning rate and \(\beta\) is the parameter about the momentum of the gradient. The purpose of introducing this parameter is to make the controller have a certain prediction function.

Fuzzy inference block design

Existing research shows that adaptive neural network can effectively improve the steady-state accuracy of the control system, but due to its poor transient performance, it has not been widely used in the industry. Fuzzy inference effectively solves many uncertain problems, and is usually applied to adaptive control of unknown nonlinear systems36. Its principle is simple and easy to design, which can better improve the transient performance of the control system37. Therefore, fuzzy inference is introduced into neural network control to improve transient performance.

Fuzzy variables and membership functions

The error \(e\) and error change rate \(ec\) directly reflect the state of the magnetic levitation ball38, so the error and error change rate are selected as the input variables of the fuzzy inference block. After the calculation of fuzzification, fuzzy inference engine and defuzzification, the \(p^{*}\) used to calculate the final dynamic adjustment factor is obtained. The input variable is divided into seven fuzzy sets, namely: “Negative Big” (NB), “Negative Middle” (NM), “Negative Small” (NS), “Zero”(ZE), “Positive Small” (PS), “Positive Middle” (PM) and “Positive Big” (PB). The output variable is divided into five fuzzy sets, namely: “Small Small” (SS), “Small Big” (SB), “Middle” (M), “Big Small” (BS) and “Big Big” (BB). The value ranges of fuzzy input and output variables are shown in Table 1.

Table 1 Domain of fuzzy variables.

In real-time control process, the drastic changes in the output of fuzzy inference will lead to the instability of the control system. The Gaussian membership function can smooth the fuzzy inference output39, so the fuzzy set \(E\) and the fuzzy set \(EC\) contain 5 Gaussian types membership function, 1 Z-type membership function and 1 S-type membership function. Triangular membership function has the advantages of simple structure and easy operation, and is widely used in real-time calculation of large-scale systems40,41. In order to speed up the operation speed of defuzzification, the designed fuzzy set \(P\) includes 3 triangular membership functions, 1 Z-type membership function and 1 S-type membership function. The membership functions of fuzzy inference input and output are shown in Fig. 3.

Figure 3
figure 3

The membership functions of fuzzy inference.

Fuzzy rules and defuzzification

Fuzzy rules are the most important part of the magnetic levitation ball control system proposed in this paper. It consists of a series of fuzzy conditional sentences. The inputs of fuzzy inference are error and change rate of error, which are transformed into fuzzy output \(P\) through fuzzy rules. The fuzzy logic described in IF–THEN language is as follows:

$$ {\text{if}} E = A_{m} \;\;and\;\;EC = B_{n} ,\quad then\;P = C_{mn} $$
(8)

where \(E\), \(EC\) and \(P\) are fuzzy sets defined on fuzzy input and output domains respectively.

The design principle of fuzzy rules is as follows:

  1. (1)

    At the initial stage of control and at the moment of tracking signal transition, there are few effective samples for training neural network, and the neural network identifier is difficult to converge quickly, so its feedforward effect is poor and the error of control system is large. At this time, the neural network identifier has not accurately established the inverse model of the controlled system, which also means that the output of the neural network controller has a strong uncertainty at this time. Therefore, in order to reduce the impact of this uncertainty on the system, we need to reduce the output of fuzzy inference, that is, increase the suppression of the output of the neural network controller. The larger the absolute value of control error, the smaller the output value of fuzzy inference.

  2. (2)

    When the tracking signal changes violently, the state of the magnetic levitation ball system changes obviously. The inverse model of neural network cannot converge quickly and needs a certain time to adjust the change of control system state. At this time, the absolute value of error change rate is large, so it is necessary to appropriately weaken the control function of neural network, that is, reduce the output of fuzzy inference. Therefore, the larger the absolute value of error change rate, the smaller the output value of fuzzy inference should be.

  3. (3)

    With the increase of sampling, the neural network inverse model is more accurate, the feedforward control effect of neural network controller is better, and the error and error change rate are small. At this time, the output value of fuzzy inference should be increased and the adjustment of the output of neural network controller should be reduced. Therefore, the lower the absolute value of the error \(e\) and error change rate \(ec\), the smaller the output of fuzzy inference should be.

Based on the above expert experience, using fuzzy language and fuzzy logic to transform the above criteria into a fuzzy rule table as shown in Table 2.

Table 2 The list of fuzzy rules.

As shown in Table 2, the first fuzzy rule of \(P\) can be expressed as:

$$ R_{p1} = (u_{NB} (E) \times u_{SS} (P)) \cdot (u_{NB} (EC) \times u_{SS} (P)) $$
(9)

There are a total of 49 fuzzy rules, corresponding to 49 fuzzy relations. Taking the union operation of these fuzzy relations, the fuzzy relation formula of \(P\) is as follows:

$$ R_{p} = R_{p1} \cup R_{p2} \cdot \cdot \cdot \cup R_{p49} = \mathop \cup \limits_{i = 1}^{49} R_{pi} $$
(10)

According to the synthesis principle of fuzzy inference, the fuzzy set corresponding to \(P\) is obtained as follows:

$$ P = (E \times EC) \circ R_{p} $$
(11)

The defuzzification method in this paper adopts the center of gravity method, and the input–output surface of the fuzzy inference block is shown in Fig. 4.

Figure 4
figure 4

Fuzzy inference input and output surface.

Fuzzy inference gets the output \(p^{ * }\), \(p^{ * }\) is amplified by the gain block \(G\) to get \(p_{G}\). When the error and error rate of change are jittered severely, the output jitter of fuzzy inference is also obvious, which will cause the control system to be disordered. In order to avoid the unstable state of the system, a saturation block is added to limit the output change rate of the fuzzy inference block. The calculation expression is as follows:

$$ p(k) = \left\{ {\begin{array}{*{20}l} {p_{G} (k)} \hfill & {if\;\left| {p_{G} (k) - p(k - 1)} \right| \le \xi } \hfill \\ {p(k - 1) + \xi } \hfill & {if\;p_{G} (k) - p(k - 1) > \xi } \hfill \\ {p(k - 1) - \xi } \hfill & {if\;p_{G} (k) - p(k - 1) < - \xi } \hfill \\ \end{array} } \right. $$
(12)

where \(\xi\) is the change rate limit parameter of the fuzzy inference output, and the change rate of dynamic adjustment factor \(p\) does not exceed \(\xi\).

Results and discussion

Simulation results

In order to verify the effectiveness of the control method proposed in this paper, a simulation study is carried out on the magnetic levitation ball position control system. The transfer function of the magnetic levitation ball position control system is as follows42:

$$ G(s) = \frac{77.8421}{{0.0311s^{2} - 30.5250}} $$
(13)

Three different control structures are compared: PID controller, BP neural network controller + PID controller (BP + PID) and fuzzy inference + BP neural network controller + PID controller (FI + BP + PID). In addition, in order to test the effect of introducing fuzzy inference into neural network feedforward compensation control, the control parameters of PID controller used in the three control structures are the same, and the neural network structure and parameters are the same.

The tracking control targets are step signal and square signal. The simulation research will verify whether the introduction of fuzzy inference mechanism in the neural network feedforward compensation control can effectively improve the transient characteristics of the control system. The sampling time of the control system is 0.003 s, through multiple adjustments, a set of optimal PID parameters are determined, and their values are as follows: \(k_{p}\) = 8, \(k_{{\text{i}}}\) = 6, \(k_{{\text{d}}}\) = 0.2. This paper use some values in the range of -0.1 to 0.1 to initialize the neural network parameters randomly, and the range of parameter initialization should not be too large, otherwise it may cause the instability of the control system. Hyperparameters \(\alpha\) and \(\beta\) have an impact on the training of neural networks. In the real-time square signal tracking control, the optimal value is determined by comparing multiple groups of different values. To search for optimal hyperparameters as wide as possible, \(\alpha\) was varied from 0.006 to 0.015 in the simulation, and \(\beta\) was varied from 0.86 to 0.95 in the simulation. Five simulations were performed for each hyperparameter, and the average of the overshoots in the five simulations was finally obtained. The effects of hyperparameters \(\alpha\) and \(\beta\) on overshoot are shown in Table 3, and the hyperparameters of the neural network are set as follows: \(\alpha\) = 0.012, \(\beta\) = 0.9. The gain coefficient \(G\) of the fuzzy inference block is set to 1.13, and the fuzzy inference output change rate limit parameter \(\xi\) is set to 0.003.

Table 3 The effects of hyperparameters \(\alpha\) and \(\beta\) on overshoot in simulation.

Step signal tracking simulation

The value of the step signal is 1, and the simulation result of tracking control is shown in Fig. 5. Figure 5a and b are tracking comparison diagrams, and Fig. 5c and d are partial enlarged diagrams. In order to verify the instability of the control structure of BP + PID, three simulation experiments were performed to compare it. The transient performance comparison of the three control structures is shown in Table 4.

Figure 5
figure 5

Simulation results of step signal tracking control.

Table 4 Comparison of transient performance of step signal simulation.

The results in Fig. 5 show that the transient performance of the three simulations of BP + PID such control structure is poor and fluctuates greatly. This is because there are few training samples in the initial stage of control when tracking the step signal, which leads to the incomplete training of the neural network, and then leads to the uncertainty of the compensation output of the neural network controller. Table 4 compares the transient performance of the three structures mentioned above in the form of numbers, and the results show that the feedforward neural network compensation controller has a slight increase in overshoot and an unstable control state compared with the PID controller, but the settling time to stabilize is significantly reduced. When we introduce a fuzzy inference block to adaptively adjust the output of the neural network controller, the control system overshoot is reduced to 0.019 mm, and the settling time is shortened to 0.064 s.

Figure 6 shows the change of the dynamic adjustment factor. It can be seen form Fig. 6, in the early stage of control, due to the relatively large error and error rate of change, the fuzzy inference block adjusts the output of the neural network controller more obviously. With the online training of neural network, the error of neural network inverse model is getting smaller and smaller. The feedforward control output of the neural network controller is more accurate, and the error and error rate of the control system are also reduced. With the increase of online training samples, the restrictions of fuzzy inference block on neural network compensation control are becoming weaker and weaker. Therefore, the adjustment of the output of the neural network controller by the fuzzy inference block suppresses the uncertainty of neural network compensation control.

Figure 6
figure 6

Dynamic adjustment factor \(p\) of step signal tracking simulation.

This paper compared the output voltage changes of PID controller (PIDC) and neural network controller (NNC) in the two control structures of BP + PID and FI + BP + PID. The comparison result is shown in Fig. 7, where PIDC(BP + PID) represents the output of the basic control module in the control structure of BP + PID. As shown in Fig. 7, fuzzy inference mainly plays an important role in the early stage. The introduction of fuzzy inference mechanism reduces the oscillation of the neural network controller output, thereby improving the transient characteristics of the control system. Moreover, before and after the introduction of fuzzy inference mechanism, the steady-state output of neural network controller does not change, which also ensures the steady-state performance of the control system. By comparing the control effects of the two controllers, BP + PID and FI + BP + PID, it is shown that the introduction of fuzzy inference can bring better control effect under the condition of losing some brevity.

Figure 7
figure 7

Control quantities comparison of step signal tracking simulation.

Square signal tracking simulation

The amplitude of the square signal is 1, and the frequency is 0.03. The tracking control simulation result is shown in Fig. 8. The transient performance comparison of the three control structures is shown in Table 5. The results show that the state of the control system changes drastically at the moment of the square signal transition. At this time, the neural network controller cannot output the correct control quantity due to the lack of training samples, so the transient performance of BP + PID control structure is not ideal. The overshoot of the proposed structure is reduced to 0.034 mm, and the settling time is reduced to 0.075 s. The simulation results shown in Fig. 8 and Table 5 show that the control structure of FI + BP + PID still has better transient performance in square signal tracking.

Figure 8
figure 8

Simulation results of square signal tracking control.

Table 5 Comparison of transient performance of square signal simulation.

The change curve of the dynamic adjustment factor \(p\) is shown in Fig. 9. Figure 9 shows that the neural network controller output needs to be adjusted mainly during the period of the signal transition. After the neural network identifier has established an accurate inverse model of the controlled system, there is no need to adjust the output of the neural network controller, and the established inverse model is directly used for feedforward compensation control. When the two control structures of BP + PID and FI + BP + PID track the square signal, the output voltage changes of PIDC and NNC are shown in Fig. 10. It can be seen from Figs. 9 and 10 that the fuzzy inference block mainly plays an obvious role in the initial stage of control and where the tracking signal changes violently. The adaptive adjustment of the output of the neural network by the fuzzy inference block reduces the influence of the uncertainty in the neural network training process on the control system.

Figure 9
figure 9

Dynamic adjustment factor \(p\) of square signal tracking simulation.

Figure 10
figure 10

Control quantities comparison of square signal tracking simulation.

Figure 11 studies the influence of the output change rate limit parameter \(\xi\) on the overshoot of the control system. The simulation found that 0.003 is the optimal value.

Figure 11
figure 11

The influence of \(\xi\) on simulation overshoot.

Experimental results

In order to further verify the effectiveness of the proposed method in real-time control, this paper conducts an experimental study based on the magnetic levitation ball position control experimental platform. The experiment uses MATLAB / RTW software platform and PCI-1711 data acquisition card to collect the output signal of the control system. The magnetic levitation ball position control experimental platform is shown in Fig. 12.

Figure 12
figure 12

Experimental platform for position control of magnetic levitation ball.

The experiment compares the control effects of the above three control structures, and the control targets are continuous step signals and square signals.

The sampling time in the experiment is 0.003 s. A set of better PID parameters is selected through multiple experiments. The parameters of the PID controller are as follows: \(k_{p}\) = 1.05, \(k_{i}\) = 0.003, \(k_{d}\) = 16. The experiment use values between -0.1 and 0.1 to initialize the neural network parameters randomly. In the experiment, the effects of hyperparameter \(\alpha\) and \(\beta\) on overshoot are shown in Table 6, and the neural network hyperparameters are set as follows: \(\alpha\) = 0.015, \(\beta\) = 0.04. The gain coefficient \(G\) of the fuzzy inference block is set to 1.13, and the output change rate limit parameter \(\xi\) is set to 0.003.

Table 6 The effects of hyperparameters \(\alpha\) and \(\beta\) on overshoot in experiment.

Continuous step signal experiment

In the continuous step signal tracking experiment, the tracking signal stepped once every 10 s. The results of the continuous step signal tracking control experiment are shown in Fig. 13.

Figure 13
figure 13

Experimental results of continuous step signal tracking control.

The performance comparison of continuous step signal experiment tracking is shown in Table 7. It can be seen from the experimental results in Fig. 13 and Table 7 that when PID controller is used alone, the overshoot of the system is 0.557 mm. After adding neural network controller, the overshoot of the system is 0.118 mm. The introduction of fuzzy inference further reduces the overshoot of the control system to 0.054 mm, and the settling time is shortened to 0.065 s. Fuzzy inference does not affect the steady-state error, and the control system still has good steady-state accuracy. The transient performance of the control system has been greatly improved, and the steady-state accuracy was also maintained.

Table 7 Comparison of performance of continuous step signal experiment tracking.

Figure 14 is the change curve of the dynamic adjustment factor. The output voltage changes of PIDC and NNC in the two control structures of BP + PID and FI + BP + PID are shown in Fig. 15. From the analysis of Figs. 14 and 15, it can be seen that when the continuous step signal jumps, the fuzzy inference block increases the adjustment of the neural network controller output. With the training of the neural network, the adjustment of the fuzzy inference block is gradually weakened, which also ensures the steady-state accuracy of the control system.

Figure 14
figure 14

Dynamic adjustment factor \(p\) of continuous step signal tracking experiment.

Figure 15
figure 15

Control quantities comparison of continuous step signal tracking experiment.

Square signal experiment

The experimental results of square signal tracking control are shown in Fig. 16, and the performance comparison of square signal experimental tracking is shown in Table 8.

Figure 16
figure 16

Experimental results of square signal tracking control.

Table 8 Comparison of performance of square signal experimental tracking.

It can be seen from Fig. 16 and Table 8 that after introducing the fuzzy inference block to adaptively adjust the output of the neural network controller, the overshoot and settling time of the control system are greatly reduced without loss of steady-state accuracy. The control system obtains better transient quality.

Figure 17 is the change curve of the dynamic adjustment factor. The output voltage changes of PIDC and NNC in the two control structures of BP + PID and FI + BP + PID are shown in Fig. 18. In Fig. 18, when the tracking signal jumps, the output of PID controller will increase significantly. At this time, fuzzy inference suppresses the output of the neural network controller, and the PID controller mainly ensures the stability of the control system. When the neural network training is completed, the output of the PID controller will gradually approach to zero. At this time, the stability of the system is mainly guaranteed by the neural network controller. From the analysis of Figs. 17 and 18, it can be seen that in the face of sudden changes in the tracking signal, the fuzzy inference block effectively adjusts the output of the neural network controller and ensures the steady-state accuracy.

Figure 17
figure 17

Dynamic adjustment factor \(p\) of continuous square signal tracking experiment.

Figure 18
figure 18

Comparison of square signal experiment tracking control quantities.

Figure 19 shows that the optimal parameter \(\xi\) in the experiment is 0.003, which is consistent with the simulation results.

Figure 19
figure 19

The influence of \(\xi\) on experiment overshoot.

Robustness experiment

In order to analyze the anti-interference ability of the proposed control structure, a fixed-value interference with an amplitude of 0.6 mm and a duration of 0.1 s was added at the 40 s of the square signal tracking experiment. Figure 20 verifies the anti-interference ability of the control structure. In addition, the robustness experimental results also show that the control system can remain stable when subjected to external disturbances. It can be seen from the Fig. 20 that the control structure of FI + BP + PID can recover to a stable state faster, and the control system has better robustness.

Figure 20
figure 20

Robustness experimental results.

Discussion

At present, there are many researches on neural network controllers. Neural network control has been proven to be effective in improving the steady-state accuracy of control systems. However, in practical industrial applications, there are not many scenarios where neural networks are used. One of the main reasons is its poor transient performance. When the tracking signal has strong mutation or the control system faces some external disturbances, the undertrained neural network controller has strong uncertainty. In this manuscript, we provide an approach for the industrial application of neural networks in the control field, which effectively improves the transient performance of control systems by combining fuzzy inference with neural networks. The controller proposed in this paper is suitable for second-order systems that are not very time-critical. The disadvantage of this controller is that its control period cannot be too small, because the neural network needs to be trained in each control period. In the future, we will apply this controller to higher order systems. This is of great significance for the industrial implementation of neural network controllers.

Conclusion

This paper takes the position control of the magnetic levitation ball as the research object, and proposes a neural network compensation control method based on fuzzy inference. This method designs a fuzzy inference mechanism based on the control error and the error rate of change to adaptively adjust the neural network compensation control quantity, and suppress the uncertain interference of the undertrained neural network to the control system. Moreover, the method adds a dynamic adjustment factor to enhance the control stability at the initial stage of network learning or at the moment of signal transition.

The simulation and experimental results show that compared with the traditional neural network compensation control under the same parameter conditions, when tracking step signal and square signal, the overshoot of the proposed method is reduced by 54.24% and 69.18% respectively, and the settling time is reduced by 68.29% and 71.16% respectively. Therefore, the proposed method significantly improves the transient quality of the control system without sacrificing the steady-state accuracy of the control system.

The proposed control method is feasible and effective. The control algorithm has reliable reasoning and stable performance, and is easy to track the reference signals with fast transition characteristics such as step and square wave.

Consent to publish

The data used in this article have been approved by the author. The copyright to the article is transferred to Springer effective if and when the article is accepted for publication.