Introduction

Literature review

The PID control algorithm has been used in industrial process control applications for many years1. Although the PID control algorithm has existed for a long time2, it is still the most popular control algorithm in the process and manufacturing industry today3. While effective in various industrial applications4, the traditional PID algorithm faces challenges with complex and nonlinear systems5. Parameter tuning often relies on trial and error6. Additionally, it lacks stability and robustness against disturbances and parameter changes7. In the context of DC motor control, traditional PI controllers have been widely applied and studied. However, traditional PI controllers also have limitations in managing nonlinearity and dynamic uncertainty, such as overshoot, response time delay, and difficulty in adjusting control parameters. These issues become more prominent in complex systems with different loads and speeds8.

Several studies have focused on improving the structure of the traditional PID controller by integrating neural networks and other advanced methodologies. Zhu et al. developed a hybrid-optimized BP neural network PID controller for agricultural applications, improving control performance by enhancing the efficiency of initial weights9. Maraba and Kuzucuoglu introduced a PID neural network controller for speed control of asynchronous motors, combining the benefits of artificial neural networks with the strengths of the classic PID controller10. Cong and Liang developed a nonlinear adaptive PID-like neural network controller using a mix of locally recurrent neural networks, enhancing the controller’s ability to adapt to nonlinear and time-variant system dynamics11. Ambroziak and Chojecki designed a PID controller optimized for air handling units (AHUs) by combining nonlinear autoregressive models, fuzzy logic, and FST-PSO metaheuristics, achieving superior performance in HVAC systems12. Aygun et al. presented a PSO-PID controller for regulating the bed temperature in a circulating fluidized bed boiler, leveraging the strengths of particle swarm optimization (PSO) to improve control precision13. Dahiya et al. proposed a hybrid gravitational search algorithm optimized PID and fractional-order PID (FOPID) controller to address the automatic generation control problem, demonstrating enhanced system stability and performance14. In recent years, several advanced PID variants have also been developed to handle nonlinear and complex systems. Suid and Ahmad designed a sigmoid-based PID (SPID) controller for the Automatic Voltage Regulator (AVR) system, employing a Nonlinear Sine Cosine Algorithm (NSCA) to optimize its parameters, which significantly improved the transient response and steady-state errors of the AVR system15. Sahin et al. proposed a sigmoid-based fractional-order PID (SFOPID) controller for the Automatic Voltage Regulator (AVR) system16. Ghazali et al. proposed a multiple-node hormone regulation neuroendocrine-PID (MnHR-NEPID) controller for nonlinear MIMO systems, improving control accuracy by introducing interactions between hormone regulation nodes based on adaptive safe experimentation dynamics (ASED)17. Kumar and Hote proposed a PIDA controller design using an improved coefficient diagram method (CDM) for load frequency control (LFC) of an isolated microgrid, enhancing control stability through maximum sensitivity constraints18.

Various optimization tools have been developed to dynamically adjust PID parameters for improved control performance. Shi et al. introduced the RBF-NPID algorithm, utilizing radial basis function (RBF) neural networks to dynamically adjust PID parameters, leading to more effective contrsol in complex systems19. Hanna et al. developed an adaptive PID algorithm (APIDC-QNN) that uses quantum neural networks combined with Lyapunov stability criteria for stable parameter optimization, enhancing system robustness20. Zhao and Gu proposed an adaptive PID method for car suspensions, where a radial basis function neural network is used to fine-tune the PID parameters, improving ride quality and suspension control21. Kebari et al. optimized PID parameter values based on real-time task demand and the cumulative sum of previous demands, providing a more responsive control system22. Similarly, Gupta et al. employed a hybrid swarm intelligence algorithm to adjust PID gains for stabilizing the active magnetic bearing (AMB) system under unstable conditions23. Faria et al. found that a PSO-based PID tuning strategy offers a practical solution for enhancing the effectiveness of radiofrequency ablation (RFA) techniques, demonstrating the utility of swarm intelligence in medical applications24. Nanyan et al. proposed an improved Sine Cosine Algorithm (ISCA) to optimize PID controllers for DC-DC buck converters, demonstrating enhanced transient response and robustness compared to traditional algorithms25. Mourtas et al. utilized the beetle antennae search (BAS) algorithm for robust tuning of PID controllers, achieving superior performance in stabilizing feedback control systems with significantly reduced computational time26. Ghith and Tolba introduced a hybrid Arithmetic Optimization Algorithm (AOA) and Artificial Gorilla Troop Optimization (GTO) for tuning PID controllers in micro-robotics systems27.

Recent swarm intelligence algorithms28,29,30,31,32,33 have shown superior performance compared to traditional genetic algorithms34 and particle swarm optimization35. These novel algorithms effectively balance global exploration and local exploitation, featuring fast convergence and high solution accuracy, making them suitable for optimizing PID algorithm parameters driven by neural network models36,37,38,39. While significant advancements have been made in PID variants like the sigmoid-based fractional-order PID16 and multiple-node hormone regulation neuroendocrine-PID (MnHR-NEPID)17, which excel in specific application scenarios, the proposed control algorithm extends these capabilities by providing dynamic, real-time adjustments in complex control systems. This combination of enhanced search strategies and neural network integration allows for superior performance in scenarios that demand rapid responses and robust stability under parameter variations. The enhanced DBO incorporates a novel search state adjustment mechanism oriented towards preferred positions to enhance exploration diversity. It also introduces a sinusoidal learning factor to balance global exploration and local exploitation and adopts a dynamic spiral search method to improve search efficiency. To enhance population diversity and search accuracy, an adaptive \(t\)-distribution disturbance is used for more effective global search capabilities. In comparison to the conventional PI controllers, which often rely on fixed parameter settings and exhibit sensitivity to parameter uncertainties8, the proposed PID control algorithm offers dynamic adjustment capabilities and improved robustness. Through the incorporation of adaptive tuning mechanisms such as the merit-oriented search and sine learning factor, our approach addresses the overshoot, long response times, and tuning difficulties associated with traditional PI control methods. Additionally, the hybrid integration of the enhanced Dung Beetle Optimizer (EDBO) with Back Propagation Neural Network (BPNN) allows the system to handle nonlinear system dynamics more effectively, achieving faster response and lower steady-state errors in complex control systems such as DC motors.

Innovative contributions

Many controllers have been developed for industrial control processes in the existing literature and this study introduces new aspects that set it apart from the rest of the literature. The main contributions of this paper are as follows:

  • Hybrid optimization algorithm framework. This study proposes a unique combination of the enhanced Dung Beetle Optimizer (EDBO) and Back Propagation Neural Network (BPNN) to optimize PID control parameters. This hybrid approach leverages the strengths of both heuristic algorithms and neural networks to enhance the optimization process.

  • Development of an enhanced Dung Beetle Optimizer. This study develops an enhanced DBO with a novel multi-strategy combined location update mechanism that addresses the limitations of traditional Dung Beetle Optimizer (DBO) by improving global search capability, local exploitation, and search precision.

  • Multistrategy innovations. EDBO incorporates a merit-oriented mechanism, a sine learning factor, a dynamic spiral search strategy, and adaptive \(t\)-distribution disturbance. These improvements ensure that EDBO is efficient and reliable when addressing complex optimization problems.

BPNN PID control algorithm

PID control

As a linear control method, PID control has the advantages of simple structure and easy implementation. The PID control law consists of three links: proportional control, integral control, and differential control, which is expressed as follows:

$$u(t)={K_p}\left[ {e(t)+\frac{1}{{{T_i}}}\int {e(t)dt+{T_d}\frac{{de(t)}}{{dt}}} } \right]$$
(1)

where \({K_p}\) is the proportional coefficient, \({T_i}\) is the integration time constant, and \({T_d}\) is the differential time constant. \(e(t)\) is the deviation signal of the system. \(u(t)\) is the control quantity of the system.

In actual operation, the control law is usually implemented using the incremental PID control algorithm. The basic structure of the PID control system is shown in Fig. 1.

Fig. 1
figure 1

Basic structure of PID control system.

The incremental PID control algorithm is expressed as follows:

$$\begin{gathered} \Delta u(k)={K_p}\left[ {e(k) - e(k - 1)} \right]+{K_i}e(k)+ \hfill \\ {\text{ }}{K_d}\left[ {e(k) - 2e(k - 1)+e(k - 2)} \right] \hfill \\ \end{gathered}$$
(2)

where \(e(k)\) is the deviation value of the control system at the \(k\)-th sampling time. \(e(k - 1)\)is the deviation value of the control system at the \(k - 1\)st sampling time. \({K_p}\) is the proportional coefficient. \({K_i}\) is the integral coefficient, and \({K_d}\) is the differential coefficient. \(\Delta u(k)\) is the difference between the control quantity at the \(k\)-th sampling time and the \(k - 1\)st sampling time. The PID control law’s performance heavily depends on the tuning of its parameters. Traditional tuning methods, while effective, often require trade-offs between stability, responsiveness, and robustness.

According to the basic principles of PID control, proportional control accelerates the system’s response by reflecting the magnitude of the current error, enabling real-time adjustments that bring the system closer to the desired value. Integral control reduces accumulated past errors, thereby eliminating steady-state errors. The derivative term predicts future error trends, accelerating response times and minimizing overshoot. These three control actions combine to form a closed-loop PID control, which stabilizes the system. Accurate tuning of these parameters is key to ensuring controller stability. Therefore, this study focuses on optimizing these parameters to enhance system robustness and stability.

BPNN PID control

Back propagation neural network (BPNN) is one of the most utilized neural network models currently. BPNN deals with the arbitrary nonlinear relation between input and output variables by simulating the human brain’s intelligence. It shows incomparable advantages in complex model fitting and distribution approximation over the traditional statistical methods. The underlying reason may be that BPNN has self-learning and generalization ability, which constitute its high prediction accuracy, simple structure, self-organization, and self-adaptive capabilities. BP neural network can learn the system performance according to the operating status of the controlled system to achieve optimal PID control. The block diagram of the PID control structure based on BPNN is shown in Fig. 2.

Fig. 2
figure 2

PID control structure based on BPNN.

The input signal \(r(k)\), deviation signal \(e(k)\), and actual output signal \(y(k)\) of the control system are used as the input of the BPNN. After being trained by the BPNN, the three parameters \({K_p}\), \({K_i}\) and \({K_d}\) are sent to the control system. Then, the \(u(k)\) is sent to the controlled object to realize the real-time online adjustment of three parameters. The BPNN structure is shown in Fig. 3.

Fig. 3
figure 3

Design of BPNN structure.

In the figure, \(j\) represents the input layer, \(i\) represents the hidden layer, and \(l\) represents the output layer. The input layer neurons are \(r(k)\), \(e(k)\), and \(y(k)\). The output layer neurons are the three parameters of PID control \({K_p}\), \({K_i}\) and \({K_d}\). The output of each neuron in the input layer of the neural network \(O_{j}^{{(1)}}(k)\) is expressed as follows:

$$O_{j}^{{(1)}}(k)=x(j){\text{ }}j=1,2,3$$
(3)

The input \(net_{i}^{{(2)}}(k)\) and output \(O_{i}^{{(2)}}(k)\) of each neuron in the hidden layer are represented as follows:

$$\left\{ \begin{gathered} net_{i}^{{(2)}}(k)=\sum\limits_{{j=1}}^{3} {{w_{ij}}^{{(2)}}O_{j}^{{(1)}}(k)} \hfill \\ O_{i}^{{(2)}}(k)=f(net_{i}^{{(2)}}(k)){\text{ }}i=1,2, \cdot \cdot \cdot ,8 \hfill \\ \end{gathered} \right.$$
(4)

where \({w_{ij}}^{{(2)}}\) is the weight connecting the input layer neurons and the hidden layer neurons. \(f(x)\) is the activation function in the hidden layer, which is expressed as follows:

$$f(x)=\tanh (x)=\frac{{{e^x} - {e^{ - x}}}}{{{e^x}+{e^{ - x}}}}$$
(5)

The input \(net_{l}^{{(3)}}(k)\) and output \(O_{l}^{{(3)}}(k)\) of each neuron in the output layer are represented as follows:

$$\left\{ \begin{gathered} net_{l}^{{(3)}}(k)=\sum\limits_{{i=1}}^{8} {w_{{li}}^{{(3)}}O_{i}^{{(2)}}(k)} \hfill \\ O_{l}^{{(3)}}(k)=g(net_{l}^{{(3)}}(k)){\text{ }}l=1,2,3 \hfill \\ \end{gathered} \right.$$
(6)
$$\left\{ \begin{gathered} O_{1}^{{(3)}}(k)={K_p} \hfill \\ O_{2}^{{(3)}}(k)={K_i} \hfill \\ O_{3}^{{(3)}}(k)={K_d} \hfill \\ \end{gathered} \right.$$
(7)

where \(w_{{li}}^{{(3)}}\) is the weight connecting the hidden layer neurons and the output layer neurons. \(g(x)\) is the activation function in the output layer.

The three output nodes of the output layer respectively correspond to \({K_p}\), \({K_i}\) and \({K_d}\). The activation function \(g(x)\) is expressed as follows:

$$g(x)=\frac{1}{2}(1+\tanh (x))=\frac{{{e^x}}}{{{e^x}+{e^{ - x}}}}$$
(8)

The performance index function of the control system is defined as follows:

$$E(k)=\frac{1}{2}{(r(k) - y(k))^2}$$
(9)

The weights of the neural network are adjusted using the gradient descent method, which iteratively updates the weights to minimize the error between the predicted and actual outputs.

Additionally, an inertia term is included in the weight adjustment process to accelerate convergence. The weight adjustment from the hidden layer to the output layer can be expressed as follows:

$$\Delta w_{{li}}^{{(3)}}(k)= - \eta \frac{{\partial E(k)}}{{\partial w_{{li}}^{{(3)}}}}+\alpha \Delta w_{{li}}^{{(3)}}(k - 1)$$
(10)

where \(\eta\) is the learning rate and \(\alpha\) is the inertia coefficient. According to the chain rule of derivatives, the gradient descent can be expressed as follows:

$$\begin{gathered} \frac{{\partial E(k)}}{{\partial w_{{li}}^{{(3)}}}}=\frac{{\partial E(k)}}{{\partial y(k)}} \cdot \frac{{\partial y(k)}}{{\partial u(k)}} \cdot \frac{{\partial u(k)}}{{\partial O_{l}^{{(3)}}(k)}} \hfill \\ {\text{ }} \cdot \frac{{\partial O_{l}^{{(3)}}(k)}}{{\partial net_{l}^{{(3)}}(k)}} \cdot \frac{{\partial net_{l}^{{(3)}}(k)}}{{\partial w_{{li}}^{{(3)}}}} \hfill \\ \end{gathered}$$
(11)
$$\left\{ \begin{gathered} \frac{{\partial u(k)}}{{\partial O_{1}^{{(3)}}(k)}}=e(k) - e(k - 1) \hfill \\ \frac{{\partial u(k)}}{{\partial O_{2}^{{(3)}}(k)}}=e(k) \hfill \\ \frac{{\partial u(k)}}{{\partial O_{3}^{{(3)}}(k)}}=e(k) - 2e(k - 1)+e(k - 2) \hfill \\ \end{gathered} \right.$$
(12)

Finally, the learning algorithm for the weights of the output layer and hidden layer is obtained as follows:

$$\left\{ \begin{gathered} \Delta w_{{li}}^{{(3)}}(k)=\alpha \Delta w_{{li}}^{{(3)}}(k - 1)+\eta \delta _{l}^{{(3)}}O_{i}^{{(2)}}(k) \hfill \\ \delta _{l}^{{(3)}}=e(k)\operatorname{sgn} \left( {\frac{{\partial y(k)}}{{\partial u(k)}}} \right)\frac{{\partial u(k)}}{{\partial O_{l}^{{(3)}}(k)}}{g^{\prime}}(net_{l}^{{(3)}}(k)) \hfill \\ \Delta w_{{ij}}^{{(2)}}(k)=\alpha \Delta w_{{ij}}^{{(2)}}(k - 1)+\eta \delta _{l}^{{(2)}}O_{j}^{{(1)}}(k) \hfill \\ \delta _{l}^{{(2)}}={f^{\prime}}(net_{i}^{{(2)}}(k))\sum\limits_{{l=1}}^{3} {\delta _{l}^{{(3)}}w_{{li}}^{{(3)}}(k)} \hfill \\ \end{gathered} \right.$$
(13)

where \(g^{\prime}(x)=g(x)(1 - g(x))\), \(f^{\prime}(x)=(1 - {f^2}(x))/2\), \(\eta\) is the learning rate of neural network and \(\alpha\) is the inertia coefficient of neural network.

Dung beetle optimizer

Basic dung beetle optimizer

The dung beetle optimizer (DBO) is a novel population based technique. It is inspired by the ball-rolling, dancing, foraging, stealing, and reproduction behaviors of dung beetles. The DBO algorithm considers both global exploration and local exploitation, thereby having the characteristics of a fast convergence rate and satisfactory solution accuracy in complex optimization problems across various research domains.

(1) Rolling behavior.

During the rolling process, the position of the ball-rolling dung beetle is updated and can be expressed as follows:

$$\left\{ \begin{gathered} {x_i}(t+1)={x_i}(t)+\alpha \times k \times {x_i}(t - 1)+b \times \Delta x \hfill \\ \Delta x=\left| {{x_i}(t) - {X^w}} \right| \hfill \\ \end{gathered} \right.$$
(14)

where \(t\) represents the current iteration number, \({x_i}(t)\) denotes the position information of the \(i\)th dung beetle at the \(t\)th iteration, \(k \in (0,0.2]\) denotes a constant value which indicates the deflection coefficient, \(b\)indicates a constant value belonging to (0, 1), \(\alpha\) is a natural coefficient which is assigned − 1 or 1, \({X^w}\) indicates the global worst position, \(\Delta x\) is used to simulate changes of light intensity. A conceptual model of a dung beetle’s rolling behavior is shown in Fig. 4.

Fig. 4
figure 4

Conceptual model of rolling behavior.

(2) Dancing behavior.

To mimic the dance behavior, the tangent function is used to get the new rolling direction. The position of the ball-rolling dung beetle is updated and defined as follows:

$${x_i}(t+1)={x_i}(t)+\tan (\theta )|{x_i}(t) - {x_i}(t - 1)|$$
(15)

where \(\theta\) is the deflection angle belonging to \([0,\pi ]\). Conceptual model of the tangent function and the dance behavior of a dung beetle is shown in Fig. 5. Once the dung beetle has successfully determined a new orientation, it should continue to roll the ball backward.

Fig. 5
figure 5

Conceptual model of the tangent function and the dance behavior.

(3) Reproduction behavior.

A boundary selection strategy is proposed to simulate the areas where female dung beetles lay their eggs, which is defined by:

$$\left\{ \begin{gathered} L{b^ * }=\hbox{max} ({X^ * } \times (1 - R),Lb) \hfill \\ U{b^ * }=\hbox{min} ({X^ * } \times (1+R),Ub) \hfill \\ \end{gathered} \right.$$
(16)

where \({X^ * }\) denotes the current local best position, \(L{b^ * }\)and \(U{b^ * }\) mean the lower and upper bounds of the spawning area respectively, \(R=1 - t/{T_{\hbox{max} }}\) and \({T_{\hbox{max} }}\) indicate the maximum iteration number, \(Lb\) and \(Ub\) represent the lower and upper bounds of the optimization problem, respectively. As shown in Fig. 6, the current local best position \({X^*}\) is indicated by using a large circle, while the small circles around \({X^*}\) indicate the brood balls. In addition, the small red circles represent the upper and lower bounds of the boundary.

Fig. 6
figure 6

Conceptual model of the boundary selection strategy.

The position of the brood ball is also dynamic in the iteration process, which is defined by:

$${B_i}(t+1)={X^ * }+{b_1} \times ({B_i}(t) - L{b^ * })+{b_2} \times ({B_i}(t) - U{b^ * })$$
(17)

where \({B_i}(t)\) is the position information of the \(i\)th brood ball at the \(t\)th iteration, \({b_1}\) and\({b_2}\)represent two independent random vectors by size \(1 \times D\), \(D\) indicates the dimension of the optimization problem.

(4) Foraging behavior.

The boundary of the optimal foraging area is defined as follows:

The position of the brood ball is also dynamic in the iteration process, which is defined by:

$$\left\{ \begin{gathered} L{b^b}=\hbox{max} ({X^b} \times (1 - R),Lb) \hfill \\ U{b^b}=\hbox{min} ({X^b} \times (1+R),Ub) \hfill \\ \end{gathered} \right.$$
(18)

where \({X^b}\) denotes the global best position, \(L{b^b}\) and \(U{b^b}\) mean the lower and upper bounds of the optimal foraging area respectively. Therefore, the position of the small dung beetle is updated as follows:

$${x_i}(t+1)={x_i}(t)+{C_1} \times ({x_i}(t) - L{b^b})+{C_2} \times ({x_i}(t) - U{b^b})$$
(19)

where \({x_i}(t)\) indicates the position information of the \(i\)th small dung beetle at the \(t\)th iteration, \({C_1}\) represents a random number that follows normally distributed, and \({C_2}\) denotes a random vector belonging to (0, 1).

(5) Stealing behavior.

During the iteration process, the position information of the thief is updated and can be described as follows:

$${x_i}(t+1)={X^b}+S \times g \times (|{x_i}(t) - {X^ * }|+|{x_i}(t) - {X^b}|)$$
(20)

where \({x_i}(t)\) denotes the position information of the \(i\)th thief at the \(i\)th iteration, \(g\) is a random vector by size \(1 \times D\) that follows normally distributed, and \(S\) indicates a constant value.

Enhanced dung beetle optimizer

While the Basic Dung Beetle Optimizer (DBO) provides a foundation for global exploration and local exploitation, certain limitations such as susceptibility to local optima require enhancement for complex optimization tasks. To address these limitations, the Enhanced Dung Beetle Optimizer (EDBO) introduces advanced strategies that significantly improve performance and reliability.

The rolling behavior plays an important role in the DBO algorithm, but the dung beetle cannot communicate with other dung beetles when rolling the ball, which makes it easy to fall into a local optimal situation. Based on the original rolling ball behavior, a merit-oriented mechanism is introduced. When the dung beetle rolls the ball, it will select a nearby excellent position based on the current position as a guide for the rolling ball path. The new position of the ball-rolling dung beetle is defined as:

$${x_i}(t+1)={x_i}(t)+h \times ({x_i}^{s}(t) - I \times {x_i}(t))$$
(21)

where \(h\) is a uniformly distributed random number with \(h \in (0,1)\). \({x_i}^{s}\) denotes the excellent position information of the \(i\)th dung beetle at the \(t\)th iteration, and \(i\) is a random number in the set \(\left\{ {1,2} \right\}\). The conceptual model of merit-oriented mechanism is shown in Fig. 7. The blue arrow indicates the final rolling direction.

Fig. 7
figure 7

Conceptual model of merit-oriented mechanism.

Dancing behavior is an important exploration mechanism. To balance the ability of global exploration and local development, a sine learning factor \(r\) is introduced in the position update of dancing behavior. In the early iteration, the sine factor \(r\) can promote global exploration, whereas in the later iteration, it helps to refine local development and optimize search behavior at different stages. The sine learning factor and the new position equation for the dancing behavior are defined as:

$$r={r_{\hbox{min} }}+({r_{\hbox{max} }} - {r_{\hbox{min} }}) \times \sin (\frac{{\pi t}}{{{T_{\hbox{max} }}}})$$
(22)
$${x_i}(t+1)=r \times {x_i}(t)+(1 - r)\tan (\theta )|{x_i}(t) - {x_i}(t - 1)|$$
(23)

where \({r_{\hbox{max} }}\) is the maximum value. \({r_{\hbox{min} }}\) is the minimum value. \(t\) represents the current iteration number, and \({T_{\hbox{max} }}\) represents the maximum iteration number.

To ensure the convergence speed of the algorithm and increase the diversity of individuals in the population, a dynamic spiral search method is proposed to improve the original breeding behavior. As the iteration proceeds, the shape of the spiral changes dynamically from large to small, and the dynamic nonlinear search mode helps to improve the population diversity and search accuracy of the entire search process. The proposed dynamic spiral search method is defined as follows:

$$q={e^{\cos (\frac{{\pi t}}{{{T_{\hbox{max} }}}})}}$$
(24)
$$\begin{gathered} {B_i}(t+1)={X^ * }+{e^{ql}} \times \cos (2\pi l) \times {b_1} \times ({B_i}(t) - L{b^ * })+{e^{ql}} \hfill \\ {\text{ }} \times \cos (2\pi l) \times {b_2} \times ({B_i}(t) - U{b^ * }) \hfill \\ \end{gathered}$$
(25)

where \(q\) is the spiral factor used to adjust the intensity of spiral search, \(l\) is a uniformly distributed random number with \(l \in ( - 1,1)\). The conceptual model of the dynamic spiral search method is shown in Fig. 8. The curves of the sine learning factor \(r\) and the spiral factor \(q\) are shown in Fig. 9.

Fig. 8
figure 8

Conceptual model of dynamic spiral search.

Fig. 9
figure 9

Sine learning factor and spiral factor.

In order to adapt to complex search spaces or multimodal problems, adaptive \(t\)-distribution disturbances with heavier tails than normal distributions are introduced. It is a probability distribution that achieves a smooth transition from Gaussian distribution to Cauchy distribution by adjusting its degree of freedom parameters. This adaptive approach enables the algorithm to dynamically adjust its search behavior, providing a more effective exploration of the solution space. The foraging behavior based on adaptive \(t\)-distributed disturbance is defined as follows:

$$\left\{ \begin{gathered} {x_i}(t+1)={x_i}(t)+{C_1} \times ({x_i}(t) - L{b^b}){\text{ }}if{\text{ }}rand<0.5 \hfill \\ {\text{ +}}{C_2} \times ({x_i}(t) - U{b^b}) \hfill \\ {x_i}(t+1)={X^*}+{X^*} \times trnd({e^{{{\left( {4\left( {\frac{t}{{{T_{\hbox{max} }}}}} \right)} \right)}^2}}}){\text{ }}else \hfill \\ \end{gathered} \right.$$
(26)

where \(trnd\) is \(t\)-distribution function, the degrees of freedom in the distribution function represent disturbance probability, which changes dynamically with the number of iterations.

As the iteration proceeds, the concentration of the probability density reduces the variability of the perturbation values, and the perturbations are mainly generated around the current best solution. The probability density distribution heatmap and corresponding distribution function images of adaptive \(t\)-distribution disturbance at different iterations are shown in Fig. 10.

Fig. 10
figure 10

Probability density of adaptive t-distribution disturbance. (a) t = 10. (b) t = 50. (c) t = 70. (d) t = 90. (e) t = 100.

EDBO-BP hybrid optimization

Building upon the improvements introduced by the enhanced dung beetle optimizer, the integration with a BPNN further refines the optimization process. This hybrid approach leverages the strengths of both the EDBO and BP to deliver superior adaptability and precision in PID control systems.

To balance the speed and stability of the BPNN learning process, this paper employs the EDBO to globally optimize the learning rate and inertia coefficient. Hybrid optimization combining EDBO and BPNN is designed based on the BPNN PID control. The PID control structure optimized by the hybrid algorithm is shown in Fig. 11.

Fig. 11
figure 11

The PID control structure based on EDBO-BP hybrid algorithm.

Application of EDBO-BP to tune the PID controller

BP neural networks (BPNN) have certain advantages in tuning PID controllers. Through the forward propagation of its input, hidden, and output layers, the values of \({K_p}\), \({K_i}\), and \({K_d}\) can be obtained. After applying the gradient descent algorithm, the weight coefficients of the neurons in each layer are adjusted through backpropagation, and then forward propagation is used again to obtain a new set of values. However, setting the learning rate and inertia coefficient is challenging, as these parameters significantly affect optimization results. In simulation experiments, it was found that these two parameters had a considerable impact on the results, which is why the Enhanced Dung Beetle Optimizer (EDBO) was introduced to adjust these two parameters of the BP neural network, forming the EDBO-BP-PID method. This method allows the algorithm to quickly find an optimal set of \({K_p}\), \({K_i}\), and \({K_d}\), which are then fed into the simulation model for ITAE (Integral of Time-weighted Absolute Error) analysis. Based on changes in the fitness value, the superiority of the algorithm can be demonstrated.

The proposed algorithm formulates a mathematical model for the PID control system and defines its optimization objective. The optimization problem is centered around enhancing the PID control algorithm through the integration of EDBO and BPNN. The topology of the BPNN is determined. The EDBO algorithm initializes the network parameters. Then, parameter combinations are iteratively optimized. The EDBO algorithm adapts to real-time network performance. Finally, the BPNN and EDBO algorithms are applied alternately to globally optimize the PID parameter set. This hybrid optimization combines model-based optimization and data-driven learning. After defining the structure and optimization process of the BPNN, the fitness function of the EDBO is linked to the ITAE (Integral of Time-weighted Absolute Error) as the objective function of the algorithm. During the optimization process, the position of the dung beetle corresponds to the PID parameters and network parameters to be optimized. The flowchart of the PID control algorithm with EDBO-BP is shown in Fig. 12.

Fig. 12
figure 12

Flowchart of PID control algorithm with hybrid optimization of EDBO-BP.

In order to obtain satisfactory dynamic characteristics of the transition process, the system performance evaluation index ITAE is introduced as the objective function of the algorithm. ITAE is a widely accepted performance index for control systems. The discrete equation of the ITAE is expressed as follows:

$$ITAE=\sum\limits_{{k=0}}^{n} {\left| {e(kT)} \right| \cdot kT \cdot T}$$
(27)

where \(T\) is the sampling period and \(K\) is the sampling time.

Experiments and result analysis

EDBO performance test

Comparison of convergence curves

To show the convergence effect of each algorithm in test functions, the corresponding algorithm convergence curves were drawn according to the generated data. Figure 13 shows the fitness curves of EDBO and other algorithms in the optimization process of the partial benchmark functions. The comparison algorithm includes dung beetle optimizer (DBO), dwarf mongoose optimization algorithm (DMOA), marine predator algorithm (MPA), gazelle optimization algorithm (GOA), and particle swarm optimization (PSO). It can be seen that the EDBO was superior to other algorithms in terms of optimization speed and convergence accuracy.

Fig. 13
figure 13

Convergence curves on test function.

Wilcoxon sign rank test

To further compare the differences between the EDBO and other optimization algorithms, a statistical test called the Wilcoxon signed-rank test was conducted. The significance of the statistical results was determined by calculating the \(p\)-value. If the \(p\)-value was < 0.05, it was concluded that there was a significant difference between the two algorithms. The results of the calculation are shown in Table 1. Table 1 presents the performance differences between EDBO and other optimization algorithms, including dung beetle optimizer (DBO), dwarf mongoose optimization algorithm (DMOA), marine predator algorithm (MPA), gazelle optimization algorithm (GOA), and particle swarm optimization (PSO), across 23 benchmark functions. DBO, DMOA, MPA, and GOA are optimization algorithms recently proposed for addressing optimization problems, while PSO is a widely used classic optimization algorithm.

Table 1 Wilcoxon sign rank test.

The results indicate that the proposed EDBO algorithm has a lower similarity in search outcomes compared to its competitors. Therefore, the optimization performance of the proposed EDBO across the 23 benchmark functions shows significant differences from other metaheuristic algorithms.

DC motor control system

The motor control system represents a quintessential and widely adopted paradigm within the realm of industrial control systems. To rigorously discuss and validate the efficacy of the control algorithm proposed in this paper, a DC motor control system has been selected as the controlled object for the simulation experiment. This choice is predicated on the DC motor’s prevalent application in various industrial scenarios due to its simplicity and robustness. The simplified DC motor model utilized is shown in Fig. 14.

Fig. 14
figure 14

Simplified DC motor model.

The DC motor transfer function with armature voltage as input and speed as output can be expressed as:

$$G(s)=\frac{{\omega (s)}}{{u(s)}}=\frac{{\frac{1}{{{k_1}}}}}{{\frac{{LJ}}{{{k_1}{k_2}}}{s^2}+\frac{{RJ}}{{{k_1}{k_2}}}s+1}}$$
(28)

The specific parameters of the DC motor mathematical model are shown in Table 2. Finally, the DC motor transfer function can be calculated as:

Table 2 Mathematical model of DC motor.
$$G(s)=\frac{{20}}{{0.04{s^2}+6s+1}}$$
(29)

Results and analysis

The BP neural network takes \(r(k)\), \(e(k)\), and \(y(k)\) as inputs and predicts successive values of PID parameters. In the training process of the BPNN, data collection is first performed, including \(r(k)\), \(e(k)\), and \(y(k)\), and the optimal \({K_p}\), \({K_i}\), and \({K_d}\) values under various conditions. Then the BPNN is initialized with random weights, followed by backpropagation to compute the output of the network for each training sample. After that, error computation is carried out to measure the errors between the predicted and the actual optimal parameters of the PID parameters. Finally, the weights are adjusted using the gradient descent method to minimize the error. In the EDBO optimization process, a random location representing the candidate solution is initialized. The optimization is performed by multiple search strategies. BPNN and EDBO are used alternately to iteratively find the optimal PID parameters under different conditions.

The simulation scheme consists of implementing the BPNN and EDBO algorithms to optimize the PID parameters of the DC motor control system and simulating and testing the performance under various conditions including disturbances, step changes, and noise variations. The PID control system is modeled by Simulink. The BPNN structure for predicting the PID parameters is defined through .m files and the EDBO algorithm is implemented through .m files to optimize the BPNN. These codes work together to iteratively improve the PID parameters and the performance of the control system.

For the control group, the particle swarm optimization (PSO) and dung beetle optimizer (DBO) were selected as comparison targets. PSO is easy to implement and performs well in the optimal design of neural networks and PID control. Additionally, DBO serves as the foundation for the EDBO proposed in this paper. By comparing the performance of the control system optimized by the traditional DBO, the superiority of the proposed method can be verified.

Particle optimization trajectories for DBO and EDBO

This section aims to illustrate the improvements made by the EDBO in tuning PID parameters by comparing the optimization trajectories. By plotting the three-dimensional optimization trajectories of particles for the PID controller parameters \({K_p}\), \({K_i}\), and \({K_d}\), it visually explains why the original DBO tends to get trapped in local optima and how EDBO addresses this limitation. Representative runs of both the DBO and EDBO optimization algorithms were selected, each running for 100 iterations, with particle trajectories recorded in the \({K_p}\), \({K_i}\), and \({K_d}\) parameter space during each iteration. Three-dimensional scatter plots were then generated to showcase the differences in exploration and exploitation behaviors between the two algorithms.

From the three-dimensional trajectory plot of DBO, it is clear that the optimization particles quickly converge around \({K_i}=4\), indicating that DBO tends to get trapped in local optima. This premature convergence reduces the search range and limits the algorithm’s ability to find better solutions in the global search space. This behavior demonstrates the imbalance between the exploration and exploitation phases in the original DBO. In contrast, the optimization trajectory of EDBO shows a much broader search range, covering more areas in the parameter space. The particles do not converge prematurely at local optima, and the global exploration capability is significantly enhanced. The wider search range indicates that EDBO can overcome the local optima problem and significantly improve global optimization performance. The particle optimization trajectory of DBO is shown in Fig. 15, while that of EDBO is shown in Fig. 16.

Fig. 15
figure 15

Particle optimization trajectories for DBO.

Fig. 16
figure 16

Particle optimization trajectories for EDBO.

Fitness convergence results

The ITAE fitness curve represents the cumulative weighted value of the error between the system output and the expected reference signal over time. By calculating the integral of the error and weighting it according to time, the overall performance of the control system can be comprehensively evaluated. The fitness value convergence curves are shown in Fig. 17.

Fig. 17
figure 17

Convergence curve of fitness value.

DBO has the fastest initial convergence speed and quickly achieves a decrease in the value of the fitness function in the first five rounds of the search. In addition, as the number of iterations increases, EDBO can continue to identify new solutions that are better than the previous stage solution, which is manifested in the fitness value convergence curve sloping toward the lower right corner. The statistical results of the optimal, worst, mean, and standard deviation values of the fitness for each algorithm are given in Table 3.

Table 3 Comparison results of fitness.

EDBO achieved the smallest fitness value of 0.00028, followed by DBO with an optimal fitness of 0.00424. PSO obtained the highest fitness value. In terms of the worst fitness value, the worst fitness of the EDBO is 0.000776, which is significantly smaller than DBO and PSO. The above results show that the EDBO can achieve better control performance and stability than DBO and PSO in terms of global optimal solution identification ability, convergence speed, and performance robustness.

Parameter optimization results

Table 4 presents the tuning results of the three output layer parameters and the hyperparameters across 20 rounds of repeated experiments. By examining the best, worst, mean, and standard deviation values, the differences and performances of different algorithms in parameter optimization are highlighted.

Table 4 Output results of neural networks optimized by different algorithms.

Under the EDBO-BP-PID algorithm, the standard deviation of each parameter is relatively smaller, indicating that this algorithm can achieve more precise parameter tuning during the optimization process. In contrast, the DBO-BP-PID and PSO-BP-PID algorithms exhibit larger standard deviations, suggesting greater variability in their optimization processes. The reduced standard deviation in EDBO-BP-PID demonstrates its capability to consistently find parameter combinations close to the global optimum across multiple experiments, further proving its superior tuning performance.

Figures 18 and 19 respectively illustrate the tuning processes of PID parameters and neural network parameters over 100 iterations for the three algorithms. As shown in the figures, the EDBO-BP-PID algorithm quickly converges and maintains stability in the early stages of iteration. In contrast, while the DBO-BP-PID and PSO-BP-PID algorithms also converge rapidly initially, they exhibit significant fluctuations in parameter adjustments as iterations increase, making further optimization difficult.

Fig. 18
figure 18

Comparison of PID parameters tuning. (a) EDBO-BP-PID. (b) DBO-BP-PID. (c) PSO-BP-PID.

Fig. 19
figure 19

Comparison of neural network parameters tuning. (a) EDBO-BP-PID. (b) DBO-BP-PID. (c) PSO-BP-PID.

In real industrial production processes, the stability, accuracy, and responsiveness of control systems are crucial. Due to its precise parameter adjustments during tuning, the EDBO-BP-PID algorithm better adapts to the demands of actual working environments and enhances the overall performance of the system. Specifically, by optimizing the hyperparameters of the neural network, the EDBO-BP-PID algorithm not only ensures control accuracy but also improves the system’s response speed and robustness, maintaining high control performance even in the face of disturbances and parameter variations.

EDBO-BP-PID algorithm achieves optimal tuning of the control system by seeking a balance among multiple performance indices. The principles of the ESO method are reflected in the EDBO-BP-PID’s optimization strategy, where a systematic adjustment mechanism ensures that the control system consistently delivers superior performance in complex and variable industrial environments.

Sensitivity analysis

Sensitivity analysis is the study of uncertainty in the output of a mathematical model and how it is divided and assigned to different sources of uncertainty in the input. During the simulation experiment data is recorded and sensitivity analysis is performed, after traversing the two parameters such as learning rate \(\eta\) and inertia coefficient \(\alpha\) in the BP neural network, both of which are taken from 0 to 0.2, the relationship between the two parameters and the adaptation value is obtained and the sensitivity analysis graph of the parameters is shown in Fig. 20.

Fig. 20
figure 20

Sensitivity analysis graph of the parameters.

Therefore, the two parameters have a greater influence on the whole control system, and if they are set to a fixed value, it reduces the algorithm’s optimization-seeking effect, so we chose to adjust the parameters of the BP neural network with EDBO.

Control system performance results

In order to more fully verify the performance of the control algorithm in this paper, a series of performance evaluation experiments are further set up. Under the settings of the nondisturbance experiment, disturbance experiment, step change experiment, and noise variation experiment, the performance of the control algorithm such as step response state and error distribution are observed.

1) In this experiment, the control system is only affected by the predetermined set value, excluding all external disturbances, to observe the performance of the control strategy under ideal conditions. The step output response curve of the control system under the nondisturbance experimental setting is shown in Fig. 21. The error curve of the control system is shown in Fig. 22.

Fig. 21
figure 21

System output curve.

Fig. 22
figure 22

System error curve.

Table 5 shows the performance metrics of various control algorithms applied to the control system. These performance indicators are typical indicators used to evaluate the effectiveness of control systems.

Table 5 Comparison of control algorithm performance metrics.

In the EDBO-BP-PID control algorithms, the system can obtain the lowest overshoot value (0.5), the lowest rising time value (0.012), the lowest settling time value (0.02), the lowest peak value (1.005) and the lowest state error value (0.001), and in these five evaluation dimensions, the results of the remaining control groups are significantly different from the optimal results. Its peak time is slightly longer than DBO-BP-PID and PSO-BP-PID, indicating that although it may take longer to reach peak response, it can self-correct faster and have smaller overall errors.

Figures 21 and 22, and Table 5 show that the system under the EDBO-BP-PID control algorithm has better response speed, stability, and accuracy. It can achieve control requirements more effectively and improve control quality.

2) The amplitude of this disturbance is set to 20% of the system’s stable output value to represent a moderately strong external disturbance. The selection of this disturbance is based on some real industrial processes, such as chemical reactors and power systems, where disturbances of similar proportions may be experienced. Figures 23 and 24 show the results of the output response curve and error curve of different control algorithms in the control system when a disturbance is added.

Fig. 23
figure 23

System output curve at 20% disturbance.

Fig. 24
figure 24

System error curve at 20% disturbance.

Traditional PID control shows a large deviation. This is because traditional PID control is designed based on the mathematical model of the system. When external disturbances interfere with the system, traditional PID control cannot adjust the control quantity in a timely and accurate manner, causing the system to deviate from the desired trajectory. In contrast, the control algorithm proposed in this paper shows a more stable and accurate control effect.

The EDBO-BP-PID algorithm demonstrates optimal steady-state response and rapid error correction. After the disturbance, the system output shows minimal deviation from the setpoint and quickly returns to the desired output, highlighting its excellent disturbance rejection and system stability. In contrast, traditional PID and BP-PID algorithms exhibit larger overshoot and longer recovery times, with noticeable oscillations, especially in the PID controller, indicating its vulnerability to external disturbances.

While the PSO-BP-PID and DBO-BP-PID algorithms improve stability and recovery speed to some extent, they still fall short of the EDBO-BP-PID’s performance. These algorithms show some fluctuations in output response and less smooth error correction, indicating limited effectiveness in handling external disturbances.

3) In order to further evaluate the tracking ability of the control system to external changes and the robustness of the control algorithm, a step change experiment was set up on the system’s step response. Set the control system to simulate a step change at the 1st and 2nd seconds respectively. The input of the given system is 1. The dynamic behavior of the system output under different PID control algorithms when the system input undergoes a predetermined step change is shown in Fig. 25.

Fig. 25
figure 25

System output curve under step change.

As shown in Fig. 25, there are significant differences in the dynamic behavior of the system output under various PID control algorithms when the system input undergoes step changes. The EDBO-BP-PID algorithm demonstrates the fastest response and the smallest overshoot at each step change point. The system output almost immediately follows the setpoint adjustment and stabilizes within a short time, showcasing its excellent tracking ability and strong robustness in response to external changes.

In contrast, traditional PID and BP-PID algorithms exhibit noticeable overshoots and oscillations when the step changes occur, particularly at the 1-second and 2-second step change points. The output signal shows a significant overshoot and takes longer to return to a stable state, indicating slower response speed and poorer stability when dealing with rapidly changing external inputs. While the PSO-BP-PID and DBO-BP-PID algorithms somewhat improve the overshoot issue, their response speed and final stability still do not match that of the EDBO-BP-PID algorithm.

4) In real industrial environments, control systems often need to operate in changing and unpredictable environments. Therefore, noise variation experiments are crucial to verify the effectiveness and robustness of control strategies. Introduce random noise signals into the control system to simulate the random interference that the control system may encounter in actual working conditions, and further evaluate the performance of the PID controller under nonideal and nondeterministic conditions. The noise signal is set to white noise with known statistical characteristics. The noise amplitude varies within the range of [0.95, 1.05]. The sampling time of the noise fluctuation is 0.001 s, and the simulation time of the entire system is set to 1 s. The system input after adding the external noise signal is shown in Fig. 26.

Fig. 26
figure 26

System input curve under external noise.

In Fig. 27, the system output performance under the influence of noise is shown for different PID control algorithms. The EDBO-BP-PID control algorithm demonstrates the smallest disturbance error when dealing with external noise, indicating its significant advantages in control accuracy and stability. Despite the noise interference, the system output quickly approaches the reference input value and maintains high stability. In contrast, other control algorithms, such as PID, BP-PID, PSO-BP-PID, and DBO-BP-PID, exhibit greater fluctuations under noise, with the traditional PID algorithm showing the most noticeable deviation.

Fig. 27
figure 27

System output curve under external noise.

Study case of DC motor with parameter uncertainties

Based on the previous model, the transfer function is replaced with a brushless DC motor simulation model. This model is characterized by nonlinearity and a complex control system, which is convenient to test the robustness of the proposed algorithm in this paper. Uncertainties such as changes in the desired speed of the motor and changes in the load of the motor are also introduced in the later experiments to analyze the following of the motor speed in this case. The brushless DC motor in this model is driven by an H-bridge, and four power tubes and an inductor are used to form an inverter circuit, with each phase of the windings being independent of each other, which can flexibly change the current size and direction of the windings.

After building the simulation model of a brushless DC motor, the effects of three algorithms such as BP-PID, DBO-BP-PID, and EDBO-BP-PID are compared. No-load acceleration and deceleration experiments, loaded acceleration and deceleration experiments, and uniform speed loading and unloading experiments of the motor were carried out to compare the motor speed following the three algorithms. The motor speed response curves of the controllers are shown in Figs. 28, 29, 30, 31 and 32. It can be concluded from the simulation experiments of the brushless DC motor that the motor speed response under the EDBO-BP-PID algorithm is faster and the overshoot is minimized, and the robustness is better than the other two algorithms.

Fig. 28
figure 28

Speed response curve of motor no-load acceleration experiment.

Fig. 29
figure 29

Speed response curve of motor no-load deceleration experiment.

Fig. 30
figure 30

Speed response curve of motor loaded acceleration experiment.

Fig. 31
figure 31

Speed response curve of motor loaded deceleration experiment.

Fig. 32
figure 32

Speed response curve of motor uniform speed loading and unloading experiments.

A concise quantitative and qualitative comparative analysis of the experimental results is shown in Table 6. The quantitative analysis of five simulation experiments on DC motors concludes that the EDBO-BP-PID algorithm provides the best optimization of the PID controller parameters, with the lowest overshoot and the shortest response time of the control system.

Table 6 Quantitative and qualitative comparative analysis of five experiments on DC motor.

Conclusions

This paper presents a PID control algorithm based on the hybrid optimization of the EDBO and BPNN. Unlike existing PID control systems, the proposed algorithm uses BPNN to identify parameter combinations without prior information on the PID control parameters. To alleviate overfitting and improve the generalization ability of the optimal parameter combination, EDBO incorporates enhanced strategies into the DBO. This approach optimizes the neural network parameters, enhancing the effectiveness and robustness of the overall optimization mechanism. Simulation experiment results demonstrate that the proposed algorithm offers faster and more accurate adjustment capabilities, improved control robustness, and greater practical usability.

The proposed adaptive PID control algorithm has broad application potential in industrial systems, robotics, and energy management. It can adjust PID parameters in real time to adapt to complex, nonlinear systems. This approach enhances precision in robotic motor control, allows for real-time adjustments in industrial automation, and ensures load frequency control in microgrids, providing robustness and stability under changing conditions.