# Optimization Algorithm for PID Control Parameters of Electrical Equipment in Rural Electric Drainage and Irrigation Stations

Authors: Zheng Haiyan
Journal: Mobile Information Systems
 (2022)

---

## Abstract

Currently, the proportional integral derivative (PID) control algorithm is most commonly used in the field of industrial control. People are not satisfied with the existing basic theory of control theory and have started to integrate it with other disciplines. Therefore, most scholars combine control theory with a neural network, which is the product of integrating biology and computer by forming a new control theory. Similar to the above, this research work combines the neural BP network with a PID controller by making the PID control parameters of electrical equipment of rural electric drainage and irrigation stations in the experimental environment. This work first briefly introduces the structure and principle of the PID controller. After that, it analyzes the incremental PID by introducing the Z-N method of rectifying PID parameters. Finally, it selects the neural network implicit layer, activation function, network initial weights, and learning rate, and then it drives the BP neural network PID algorithm. The experiment demonstrates that the system employing the BP neural network speed PID regulator has low overshoot, quick dynamic response, high immunity, and fast regulation speed.


---

## Body

## 1. Introduction

The traditional control strategy technology has been very mature and has achieved good results in the process of actual strategy control in various fields. However, with the progress and development of modern information society, traditional industrial control technology is increasingly difficult to meet the actual control strategy needs, and researchers have put forward higher standards for control performance and indicators [1]. In recent years, the field of control technology has gradually recognized and paid attention to these complex strategic control methods and systems and has conducted fruitful applied scientific research on their application [2]. Apart from this, these days process control is an important factor in design and manufacturing engineering all around the world [3]. The primary goal of control systems is to direct the system in a way that the predicted dynamic response and static criteria of a closed-loop system are met [4]. Engineers and technicians are interested in ensuring that the actual performance meets the predetermined results in every manufacturing environment. A certain level of control measures is necessary to do this. This progress has resulted in the emergence of several process control approaches. Some of these methods are numerical, while others are cognitive, adaptable, heuristic, or fuzzy control procedures, among others [5]. The most common of these strategies are the proportional-integral-derivative (PID) control systems.Among them, the PID control algorithm is broadly speaking a technical abbreviation for the integrated control of the relationship between proportional, integral, and proportional differentiation [6], and its robustness is better than others, but its most outstanding benefit is that it does not need to rely on the precise system control model of the control object [7]. And through years of research and use, scholars and control system engineers have accumulated a large number of successful experiences in using this controller to regulate the controlled object in practice. However, with the continuous development of industrial process control systems and the progress of related technologies, the controlled objects have gradually become more complex and abstract. In this regard, a series of complex industrial process control devices and systems with large hysteresis, time variation, time lag, and nonlinearity have emerged, which are difficult for traditional PID controllers to make accurate regulation of such complex systems [8]. Furthermore, owing to the PID control concept, if the control object in the process changes after the PID parameters is selected, the process can only be stopped and the PID parameters reset.With the continuous development of control theory, people gradually combined process control theory with other advanced intelligent algorithms to form a new intelligent control theory [9]. From the time the concept of intelligent control was formally proposed to the present widespread use, the development of intelligent control has been very rapid, and in just a few decades, its theory. The technical practice has produced many remarkable research results, such as the typical neural network control, genetic algorithm control, fuzzy control and particle swarm algorithm control, which have achieved great success in many fields [10]. The neural network algorithm is one of the intelligent algorithms, which is especially suitable for some complex nonlinear control systems because of its self-learning, adaptive, and nonlinear capabilities, and also has strong robustness and good fault tolerance. [11].Moreover, the most difficult aspect of using PID overall, and manual-based PID in specific, is tuning its parameters. Proper adjustment of manual PID settings necessitates technical knowledge. When procedures look complicated, standard tuning approaches demand that they be decreased [12]. Failure to handle this topic appropriately results in incorrect tuning, which causes system burst, system latencies, and steady-state mistakes, eventually affecting the stability of the system [13]. Because of these problems, this paper uses neural networks to optimize PID control parameters based on the electrical equipment of rural electric drainage and irrigation stations. This makes the neural network in the PID regulation and adjustment have a very broad prospect and technical application development.


### 1.1. Key Contributions of This Paper

(i)
First, the construction and operation of a PID controller are described briefly. The properties, advantages, and disadvantages of position-based PID controllers and incremental PID are discussed, as well as the Z-N technique of correcting PID parameters and its limits and weaknesses.(ii)
Second, the BP neural network PID controller is introduced and constructed. Furthermore, the neural network implicit layer, activation function, network starting weights, and learning rate are all chosen individually.(iii)
Finally, the BP neural network PID algorithm is derived and its flow is introduced, and the simulation results show that the designed BPPID is well regulated.


### 1.2. Organization of Remaining Sections

The following is how this paper is structured. “Related Work” presents the work of local and international scholars in the selected domain. The “Materials and Methodology” presents the design parameters of a PID control algorithm in rural electric drainage and irrigation stations, the establishment of an optimization model, and a solution based on the proposed scheme. The suggested technique is tested on several parameter variation curves in the section “Experimental Work and BP Neural Network PID Controller Simulation.”” The final section contains brief conclusions.


## 1.1. Key Contributions of This Paper

(i)
First, the construction and operation of a PID controller are described briefly. The properties, advantages, and disadvantages of position-based PID controllers and incremental PID are discussed, as well as the Z-N technique of correcting PID parameters and its limits and weaknesses.(ii)
Second, the BP neural network PID controller is introduced and constructed. Furthermore, the neural network implicit layer, activation function, network starting weights, and learning rate are all chosen individually.(iii)
Finally, the BP neural network PID algorithm is derived and its flow is introduced, and the simulation results show that the designed BPPID is well regulated.


## 1.2. Organization of Remaining Sections

The following is how this paper is structured. “Related Work” presents the work of local and international scholars in the selected domain. The “Materials and Methodology” presents the design parameters of a PID control algorithm in rural electric drainage and irrigation stations, the establishment of an optimization model, and a solution based on the proposed scheme. The suggested technique is tested on several parameter variation curves in the section “Experimental Work and BP Neural Network PID Controller Simulation.”” The final section contains brief conclusions.


## 2. Related Work

### 2.1. The Development of PID Controller Parameter Tuning Technology

The parameter tuning of PID controllers has been one of the important issues in PID control research. There are several parameter tuning methods, including the Z-N parameter tuning method proposed by Zieler and Nichols, which are widely used for the tuning of PID parameters [8].The Z-N approach, proposed by Ziegler and Nichols in 1942, is one of the world's oldest methods for accurate parameter tuning of PID controllers. The characteristics of this control method are that it makes full use of the lag time constants of all controlled objects and uses the method of empirical formulas to calculate each parameter of the PID controller based on previous experiments. This method applies to all controlled objects whose average value of the ratio of lag time to a time constant in the control process is within 0.1–1 [12]. Although this traditional PID parameter tuning method has played an important technical role in the formation and development of industrial equipment production processes, it has been increasingly challenged in recent years as people pay more attention to the performance of control systems and their requirements have also become higher.Marsik and Strejc introduced a nondiscriminatory adaptive PSD (containing proportional, summation, and differential) control technique in 1983, which is not dependent on any physical model of the controlled item. In addition, they established the corresponding performance indicators according to the basic definition of the process error of the adaptive control system. Its characteristics and relationships with geometry and physics, respectively, and the implementation process used the nondiscriminatory adaptive control algorithm [14]. Astrom, a Swedish scientist, invented a control mechanism for rectifying the differential parameters of relay feedback PID. When the traditional relay function and feedback system fluctuate, this approach primarily employs the eigenvalues and differential functions of the relay function and feedback to precisely compute and rectify the parameters of fractional-order PID [1]. Similarly, Podlubny in 1994 proposed a so-called fractional-order PID controller, which is a special case of fractional-order PID that can describe the dynamic system with a complex mathematical model containing fractions and can achieve good results. However, the use in industrial control is not so good because its control practice is more cumbersome, and the control system is more complex and vulnerable to interference [13].In recent years, with the increasing attention to the PID controller tuning parameters by domestic research workers, many advanced optimization methods for tuning PID parameters have been proposed. Wang Ping proposed a method in 1999 to approximate the controlled object as a first-order inertial pure hysteresis control system and then modify the PID parameters to the estimated control system; however, this method was ineffective for higher-order control objects [15]. In their research, Zhang Enqin et al. developed a TS-based fuzzy model, and the system structure design of this model is more systematic than the generic fuzzy model. Lixiang Li et al. presented the ant colony parameter algorithm based on fuzzy dynamics in 2006, combining the mechanism of system and optimization of ant colony fuzzy dynamics and the swarm parameter algorithm with the particle swarm technique. Fengping Ding introduced a novel fuzzy PID controller based on predictive estimate control in 2007. Their suggested solution enhanced and optimized the fuzzy PID issue; however, it is unable to forecast the system with a significant time lag. The problem of imprecise fuzzy PID prediction for systems with high time lags was addressed and optimized, giving an efficient solution to industrial process control challenges such as time-varying huge delays [16].


### 2.2. Development and Research Status of Neural Networks

Neural networks also known as artificial neural networks are composed of a large number of artificial neurons interconnected [17]. Its concept was initially further proposed based on the study of modern biology and information processing of human nerves, and this algorithm has strong adaptively, good deep learning capability, and nonlinear mapping capability in addition to strong robustness and high fault tolerance [18]. With the increasing complexity of the controlled objects, the requirements for control systems have become more stringent, especially in some control objects with nonlinearity, uncertainty, time-varying, etc. The complexity of control systems is more demanding [19]. The functions and characteristics of artificial neural networks are fully applied in the field of modern control technology and system intelligence, which can make the traditional control technology and system engineering construction to a new era.A neural network, as the name suggests, is an intelligent algorithm that allows mechanical devices to stimulate the nervous system of the human brain to achieve visual and auditory perception, as well as higher-level learning and logical judgment. The neural network is designed to be highly reliable, robust, adaptive, and easy to use to handle complex control systems with high dimensionality, nonlinearity, strong disturbances, large time lags, and difficult modeling [20]. The BP neural network has strong adaptability to external disturbances and environmental changes. It has been used widely in some industrial control in addition to the self-learning, self-adaptive, and approximation to nonlinear function features of the BP neural network [21]. The BP network PID controller, which is parallel to the BP neural network, and the three PID parameters are regulated by the BP network so that the controlled object may be altered indirectly, allowing the controlled item to achieve dynamic balance more rapidly. Since the BP algorithm employs the gradient descent approach, its advantages and disadvantages are readily apparent; the primary benefits are depicted in Figure 1.(i)
Nonlinear mapping capability. The activation function added to the neural network increases the nonlinear capability of the neural network, thus enabling the network to approximate any complex function, no matter how complex the actual problem is, the BP neural network can handle it(ii)
Self-learning and self-adaptive capability. The neural network can automatically compare the reasonable connection between input samples and output results (weight change) during the process of sample training, and then adaptively add this connection to the network's weights(iii)
Generalization capability. The neural network extracts the corresponding laws (stored in the weights) based on the known input sample features and categories, and then if unknown samples are input to the network again, the network can classify the new unknown samples based on the previously obtained laws, that is, the ability to apply the learning results to the new samples(iv)
Fault tolerance. When there is a certain degree of local problem in the neural network, the neural network can still work normally [22]Figure 1
BP neural network.


### 2.3. Rural Electricity Drainage and Irrigation Stations

The benefits of electric power drainage and irrigation stations are not only related to water prices, electricity prices, energy consumption, and personnel wages but also related to the way pumping stations are charged. At present, the majority of pumping stations are using two-part charging, that is, the power supply department according to the pumping station into the main transformer capacity of the monthly charge for basic electricity, and then according to the power consumed by the pumping station to charge electricity tariffs. This charging method makes the transformer a big horse-drawn pumping station each year to pay a considerable value of the basic electricity bill. Over the years, the pumping station electrical equipment selection and configuration characteristics have been based on experience, ranging from fulfilling power supply and the drive needs to determining the concept of rather large than tiny. In addition, these are rarely considered the charge of electricity and the impact of equipment energy consumption on the pumping station costs. As a result, practically all of the pumping stations in operation today have a big main transformer capacity, leading to a high cost of raising water, an undue burden on farmers, and a loss in pumping station benefits.


## 2.1. The Development of PID Controller Parameter Tuning Technology

The parameter tuning of PID controllers has been one of the important issues in PID control research. There are several parameter tuning methods, including the Z-N parameter tuning method proposed by Zieler and Nichols, which are widely used for the tuning of PID parameters [8].The Z-N approach, proposed by Ziegler and Nichols in 1942, is one of the world's oldest methods for accurate parameter tuning of PID controllers. The characteristics of this control method are that it makes full use of the lag time constants of all controlled objects and uses the method of empirical formulas to calculate each parameter of the PID controller based on previous experiments. This method applies to all controlled objects whose average value of the ratio of lag time to a time constant in the control process is within 0.1–1 [12]. Although this traditional PID parameter tuning method has played an important technical role in the formation and development of industrial equipment production processes, it has been increasingly challenged in recent years as people pay more attention to the performance of control systems and their requirements have also become higher.Marsik and Strejc introduced a nondiscriminatory adaptive PSD (containing proportional, summation, and differential) control technique in 1983, which is not dependent on any physical model of the controlled item. In addition, they established the corresponding performance indicators according to the basic definition of the process error of the adaptive control system. Its characteristics and relationships with geometry and physics, respectively, and the implementation process used the nondiscriminatory adaptive control algorithm [14]. Astrom, a Swedish scientist, invented a control mechanism for rectifying the differential parameters of relay feedback PID. When the traditional relay function and feedback system fluctuate, this approach primarily employs the eigenvalues and differential functions of the relay function and feedback to precisely compute and rectify the parameters of fractional-order PID [1]. Similarly, Podlubny in 1994 proposed a so-called fractional-order PID controller, which is a special case of fractional-order PID that can describe the dynamic system with a complex mathematical model containing fractions and can achieve good results. However, the use in industrial control is not so good because its control practice is more cumbersome, and the control system is more complex and vulnerable to interference [13].In recent years, with the increasing attention to the PID controller tuning parameters by domestic research workers, many advanced optimization methods for tuning PID parameters have been proposed. Wang Ping proposed a method in 1999 to approximate the controlled object as a first-order inertial pure hysteresis control system and then modify the PID parameters to the estimated control system; however, this method was ineffective for higher-order control objects [15]. In their research, Zhang Enqin et al. developed a TS-based fuzzy model, and the system structure design of this model is more systematic than the generic fuzzy model. Lixiang Li et al. presented the ant colony parameter algorithm based on fuzzy dynamics in 2006, combining the mechanism of system and optimization of ant colony fuzzy dynamics and the swarm parameter algorithm with the particle swarm technique. Fengping Ding introduced a novel fuzzy PID controller based on predictive estimate control in 2007. Their suggested solution enhanced and optimized the fuzzy PID issue; however, it is unable to forecast the system with a significant time lag. The problem of imprecise fuzzy PID prediction for systems with high time lags was addressed and optimized, giving an efficient solution to industrial process control challenges such as time-varying huge delays [16].


## 2.2. Development and Research Status of Neural Networks

Neural networks also known as artificial neural networks are composed of a large number of artificial neurons interconnected [17]. Its concept was initially further proposed based on the study of modern biology and information processing of human nerves, and this algorithm has strong adaptively, good deep learning capability, and nonlinear mapping capability in addition to strong robustness and high fault tolerance [18]. With the increasing complexity of the controlled objects, the requirements for control systems have become more stringent, especially in some control objects with nonlinearity, uncertainty, time-varying, etc. The complexity of control systems is more demanding [19]. The functions and characteristics of artificial neural networks are fully applied in the field of modern control technology and system intelligence, which can make the traditional control technology and system engineering construction to a new era.A neural network, as the name suggests, is an intelligent algorithm that allows mechanical devices to stimulate the nervous system of the human brain to achieve visual and auditory perception, as well as higher-level learning and logical judgment. The neural network is designed to be highly reliable, robust, adaptive, and easy to use to handle complex control systems with high dimensionality, nonlinearity, strong disturbances, large time lags, and difficult modeling [20]. The BP neural network has strong adaptability to external disturbances and environmental changes. It has been used widely in some industrial control in addition to the self-learning, self-adaptive, and approximation to nonlinear function features of the BP neural network [21]. The BP network PID controller, which is parallel to the BP neural network, and the three PID parameters are regulated by the BP network so that the controlled object may be altered indirectly, allowing the controlled item to achieve dynamic balance more rapidly. Since the BP algorithm employs the gradient descent approach, its advantages and disadvantages are readily apparent; the primary benefits are depicted in Figure 1.(i)
Nonlinear mapping capability. The activation function added to the neural network increases the nonlinear capability of the neural network, thus enabling the network to approximate any complex function, no matter how complex the actual problem is, the BP neural network can handle it(ii)
Self-learning and self-adaptive capability. The neural network can automatically compare the reasonable connection between input samples and output results (weight change) during the process of sample training, and then adaptively add this connection to the network's weights(iii)
Generalization capability. The neural network extracts the corresponding laws (stored in the weights) based on the known input sample features and categories, and then if unknown samples are input to the network again, the network can classify the new unknown samples based on the previously obtained laws, that is, the ability to apply the learning results to the new samples(iv)
Fault tolerance. When there is a certain degree of local problem in the neural network, the neural network can still work normally [22]Figure 1
BP neural network.


## 2.3. Rural Electricity Drainage and Irrigation Stations

The benefits of electric power drainage and irrigation stations are not only related to water prices, electricity prices, energy consumption, and personnel wages but also related to the way pumping stations are charged. At present, the majority of pumping stations are using two-part charging, that is, the power supply department according to the pumping station into the main transformer capacity of the monthly charge for basic electricity, and then according to the power consumed by the pumping station to charge electricity tariffs. This charging method makes the transformer a big horse-drawn pumping station each year to pay a considerable value of the basic electricity bill. Over the years, the pumping station electrical equipment selection and configuration characteristics have been based on experience, ranging from fulfilling power supply and the drive needs to determining the concept of rather large than tiny. In addition, these are rarely considered the charge of electricity and the impact of equipment energy consumption on the pumping station costs. As a result, practically all of the pumping stations in operation today have a big main transformer capacity, leading to a high cost of raising water, an undue burden on farmers, and a loss in pumping station benefits.


## 3. Material and Methodology

At present, PID control algorithm is one of the most widely used algorithms in traditional process control engineering, and its derivative algorithms built with intelligent control are also widely used, and the BP neural network PID control algorithm is one of the most representative derivative PID control algorithms [23].


### 3.1. PID Controller

PID controller is one of the most classic, simple, and reflective of the feedback idea of automatic control. For general R&D designers, design and development to implement a PID control system is the basic technical requirement to complete the automatic control system.


#### 3.1.1. The Basic Principle of the PID Controller

The PID control system shown in Figure2 get the input signal after the proportional, integral, differential regulation of the control amount to the controlled object and then the signal output, the output signal through the measurement element and the input signal for comparison, and then get the deviation signal through the three regulators to adjust until the deviation signal is zero. Here the proportional, integral, and differential regulators together form the PID controller, and the PID control system is composed of the PID controller and the controlled object [24].Figure 2
PID controller system structure diagram.The basic control law of the PID controller is analyzed below. Assuming that at a particular momentt, when the input quantity is rint and the output quantity is routt, the deviation can be calculated as et=rint−routt, and the basic control law of the PID can be expressed by(1)Ut=KPet+1T1∫etdt+TDdetdt,where KP is the proportional band, TI is the integration time, and TD is the differentiation time. These parameters are based on the control parameters of the PID controller, and their effects on the PID control system’s performance are affected as explained in Figure 3.(i)
The effect of proportional action on the control performance.The proportional effect mainly reflects the speed of the controller on the signal regulation, which is the rapidity of the control system performance; when the control system deviation signals, the proportional effect can make the system quickly respond. In addition, a proportional, integral, and derivative proportionate action generates a controller output that is proportional to the error signal. This action generates a controller output that switches to decrease a constant error. A derivative action generates a control output based on the deviation's orientation and rate of change. Once all of these are merged into a single controller (PID), automated control facilities are available to remedy any necessary change(ii)
The effect of integration on the control performance.The integral part is the sum of the term error over time. As a result, even the slightest misleading term causes the integral part to grow slowly. Because the integral reaction will continue to increase indefinitely until the error is zero, the result is that the steady-state error is pushed to zero. A properly selected integration time allows the response output to track the desired value indistinguishably(iii)
Effect of differential action on control performance.derivative action is used in conjunction with a proportional action controller to provide a phasing advancement in the controller output voltage, allowing for a control adjustment to be made earlier than would be feasible with proportional action only. It is frequently seen as offering an anticipatory action. The role of differentiation shows the dynamic stability of PID control, which can predict the trend of the error signal to effectively predict and improve the error dynamic control characteristics of the closed-loop system with differential action in advance [24]Figure 3
Performance PID control system.


### 3.2. Conventional PID Controller Parameter Tuning Method

Convolutional PID controllers are widely utilized in industrial control applications due to their practicality and ease of installation. Nevertheless, PID controllers are not ideal and can operate inadequately in complicated, nonlinear, or time/delayed linear systems. Figure4 depicts the conventional PID controller, which is a basic three-term controller.Figure 4
Structure of a conventional PID controller.Parameter tuning of PID controllers has always been one of the important issues in the study of PID control. It refers to the modification of the three PID controller parameters to produce the dynamic characteristics of the control loop composed of the control object, controller, and so on. Furthermore, when the controller law is developed in the form of a PID, it fulfills the appropriate index requirements to create the desired control effect [24]. In practical applications, it is usually necessary to avoid the direct use of complex physical and mathematical formulas. In this regard, the PID adjustment method, which relies on a large amount of experience, is both simple and hassle-free, so it is still widely used in some simple control [25]. For example, the most common is the Z-N method in PID control, and this method is mainly applied to industrial objects for the first-order inertia pure delay model (FOPDT model) [26].Transfer function approaches use a polynomial proportion to express the relationship between a system's outputs and inputs. The order of the model is the same as the order of the denominator polynomial. The denominator polynomial roots are known as the modeling poles. The minimum model transfer function of the industrial object is assumed as(2)Gs=Ke−τsTS+1,where K, τ, and T are the open-loop gain, pure lag time constant, and inertia time constant, respectively. The Z-N technique has two stages: one is a closed-loop control loop using proportional control to find the stability limit, while the other calculates the controller parameters using equation (2).The proportional adjustment factor P gives the stability limit. In the control system, only the proportional regulator is used, after continuously increasing the proportional gainKp, the proportional gain at this time is called the critical proportional coefficient Ku and wave crests is the critical oscillation period Tu . With Ku and Tu, the other parameters are calculated separately according to the table of empirical formulas for PID parameter tuning by the Z-N method, as shown in Table 1.Table 1
Empirical formula for Z-N method PID parameter tuning.
HardwareConfigurationTiTdKiKdIntegration timeDifferential timeIntegral coefficientDifferential coefficientP0.5ku————PD0.8ku—0.12Tu—Kp∗TdPI0.45ku0.85Tu—Kp/Ti—PID0.6ku0.5Tu0.12TuKp/TiKp∗TdWhen faced with a noninertial pure hysteresis controlled item, the premise of the Z-N technique is to require the controlled object to be a first-order inertial pure hysteresis system. It can only be approximated as a first-order inertial pure hysteresis system; however, this approximation transformation is more difficult, and measurement errors are highly common, resulting in substantial variances in the derived PID parameters.Therefore, even though the Z-N method is simple and suitable for most simple industrial process control systems, in practice, it still produces significant deviations and cannot be well regulated in the face of time-varying, nonlinear, and other controlled objects, let alone in the presence of noise, load, and disturbances [27]. In this case, the traditional Z-N parameter tuning method cannot fully meet the performance requirements of engineering practice and shows great technical limitations [28].


### 3.3. PID Controller Based on the BP Neural Network

The BP neural network-based PID controller is a real-time online intelligent PID controller with self-learning and adaptive capability; the BP neural network enables the system to self-learn online, as well as to express any nonlinear system, so that the BP neural network can achieve the best performance combination of control parameters for PID.


#### 3.3.1. PID Controller with the BP Neural Network

The neuronal network of BPPID is a control method that improves system settings through self-learning. Depending on PID control, BP neural network PID derives the stability and robustness of classic PID control while combining the BP neural network's rapid learning and adaptable capacity. The two control approaches work quite well together. As a result, they have a position in the nonlinear control scheme. The traditional PID controller provides closed-loop control on the control system directly, and the three parameterskp, ki, and kd are modified constantly. However, these three characteristics combine and strengthen or eliminate each other within a particular range, making them difficult to govern. A PID controller depending on BP neural network is presented in the literature to handle this problem [29]. Figure 5 displays the controller of the BP neural network-based PID control system.Figure 5
Sketch of the PID control system structure of the BP neural network.The first part is the conventional PID controller, which still regulates the controlled object directly, whilekp, ki, and kd parameters are adjusted online by a BP neural network. The second part is the BP neural network, in which as the control system changes in real-time, the output layer nodes adjust their weights to match the three tunable PID controller parameters kp, ki, and kd [30].The design of the BP neural network PID controller first needs to determine the PID control algorithm, which is selected as the incremental digital PID control algorithm suitable for computer systems, and its control algorithm formula is given as(3)Δuk=Kpek−eek−1+kieek−ek−1−ek−1−ek−2Δk−KpΔek+kiek+kdΔek−Δek−1.Here,Δk=ek−ek−1,Δek−1=ek−1−ek−2.After determining the PID controller, the structural framework of the BP neural network needs to be determined to be applied to the PID controller, and the neural network structure, the activation function of the neuron nodes in each layer, the initial weights of the network, and the network learning rate are selected one by one in the following.


#### 3.3.2. Selection of the Number of Nodes in the Hidden Layer

Understanding the basic structure of the BP neural network is a prerequisite for applying the BP neural network to solve practical problems. The number of neuron nodes in the input and output layers can usually be determined according to the actual problem, but there is no uniformity in the design of the hidden layer. Very few nodes in the hidden layer are likely to cause large deviations in the results and may produce oscillations and fluctuations; too many nodes are too difficult to design and are prone to overfitting, which will instead make the output of the network perform worse. The structure of the hidden layers mainly includes the number of hidden layers and the number of nodes in each hidden layer, which have a great impact on whether the network converges, how fast it converges, and so on. However, there is no sufficient theoretical basis to determine the number of hidden layers and the number of nodes in the hidden layers of the BP neural network but only relies on experience. There are also significant differences in the laws that the network needs to satisfy when dealing with different problems [31]. After extensive experiments and continuous exploration, researchers have summarized several common empirical formulas for the determination of the number of hidden layers as calculated as follows: (4)m=n+l+am=log2nm=nl.In order to avoid the phenomenon of “overfitting” of the neural network during training as much as possible and to ensure a high enough generalization ability of the neural network, the number of nodes in the hidden layer is taken as small as possible to meet the requirements of accuracy and reliability of the neural network [32]. In this chapter, the empirical formula based on the implicit layer nodes n+m+a is chosen as 9. The input layer is set as four neurons, which are the three parameters in the incremental PID algorithm Δek, ek, eΔek−1, and a constant factor of 1 for the stabilized BP neural network, the output layer is set to three output neurons in order to correspond to the three parameters of the proportional integral differentiation.


#### 3.3.3. Activation Function Selection

Generally, any function that satisfies continuous, bounded, and nonconstant values are available as an activation function for neurons. However, when considering how to apply neural networks to design and control systems, the activation functions of neuron nodes need to satisfy the complexity issues of practical system design and training applications, etc. In general, the activation functions of neurons should be designed to satisfy the following three points.(i)
Point 1: (X) should be simple and easy to compute, satisfying the conditions of differentiable, bounded, and nonconstant values, and the output given at bounded values of the input should also be bounded(ii)
Point 2: the partial derivatives of (X) should also be simple since their partial derivatives are also an important parameter in the training of the analytic network(iii)
Point 3: (X) should be made to match the nonlinear system as closely as possible as a way to make the network structure smaller and easier to trainThe Sigmoid function and hyperbolic tangent function (tanh) are both among the commonly used activation functions. The Sigmoid function has the advantage of squeezing a larger range of input values into the (0, 1) output range. The tanh function is similar to the Sigmoid function, but it is a hyperpolar function, which has an output range of (−1, 1).


#### 3.3.4. Selection of Initial Weights

The size of the initial weights is also one of the important factors that affect whether the network can eventually reach a certain acceptable error range. Typically, once the input signal enters the network, the network should reply as rapidly as possible to ensure that the output reaches the typical target value or so, and the initial weights are used to ensure that the network responds quickly at first. For example, if the output of the tanh function is a number between (−1, 1), the initial weight must be a random number between (−1 and 1) and not the same, where the rate of change is relatively high, and the beginning weight might be close to 0 to prevent redundant repeating of the output value. Therefore, to speed up the response of the network at the beginning, but not infinitely close to 0 that will make the weight changeΔw too small at the beginning, which will lead to too slow training. Of course, the above analysis is based on the premise of selecting a definite activation function. If the activation function is selected differently, the initial value range of each neuron will also be different. The starting weights of the implicit and output layers are selected as random integers close to 0 in this research to accelerate training at the start of the network.


#### 3.3.5. Determination of Learning Rate

Learning rate is a hyperparameter that governs the weights of our neural network concerning the loss slope. It specifies how frequently the neural network's learned notions are updated. The learning rate is also an important factor that affects the change of the network during the learning process. The learning rate governs the network's training pace; a higher learning rate enables the system to train quicker, but the output may not be as expected, and a lower learning rate helps the network to approach the ideal value more smoothly, but it takes more time to train.Researchers have not yet derived the optimal learning rate for a given data set but only experimentally concluded that the learning rate is in the range of (10-6,1). Some scholars have proposed a method to gradually reduce the learning rate by selecting a larger value at the beginning and then decreasing it after the network works and becoming 0 when the network reaches stability. It is also easy to generate large errors after the disturbance. In this paper, the learning rate is chosen to be 0.2.


### 3.4. BP Neural Network PID Controller Control Design Steps

The BP neural network is a three-layer advanced artificial neural network with input, hidden, and output layers. In this research, there are three neurons in the input layer and two neurons in the output layer, and the number of hidden levels and the number of neurons in the hidden layer are left to the simulated results. Figure6 depicts the architecture of the BP neural network.Figure 6
Structure of the BP neural network.


#### 3.4.1. Network Structure Setting

The BP network is determined as four input layer nodes, nine implicit layer nodes, and three output layer nodes. In addition, the four inputs to the neural network are the three parameters in the incremental PID algorithmΔk, ek, ∆ ek−1, and the constant 1 of the stabilization network. The implied layer is the minimum number to satisfy the system performance, and the output is the PID controller's three configurable parameters, with each layer's initial value set to 0.2.The learning rateη is selected, the initial weights in the implied layer weight matrix (2) (K) and the output layer weight matrix w (3) (k) are set to random numbers between (−1, 1). The implied layer activation function is set to bipolar tanh function. The output layer activation function is set to the Sigmoid function, the transfer function of the input conditioning object, the sampling period Ts is set, and the input expectation value rk.


#### 3.4.2. Neural Network Training Process

At the instantk, the network samples obtain the system expectation value r(k) and the actual output value y(k). It computes the error e(k) at that moment = r(k) − y(k), as well as the input and output of each network layer, in turn, using equations 1–4, and the output of the output layer is Kp, Ki, Kd . According to the weight correction formula (5) to adjust the implied layer weight matrix (2) (k) and the output layer weight matrix w (3) (k), the learning times are added by one, that is, k = k + 1, and Step (3) is repeated until the end of sampling.


## 3.1. PID Controller

PID controller is one of the most classic, simple, and reflective of the feedback idea of automatic control. For general R&D designers, design and development to implement a PID control system is the basic technical requirement to complete the automatic control system.


### 3.1.1. The Basic Principle of the PID Controller

The PID control system shown in Figure2 get the input signal after the proportional, integral, differential regulation of the control amount to the controlled object and then the signal output, the output signal through the measurement element and the input signal for comparison, and then get the deviation signal through the three regulators to adjust until the deviation signal is zero. Here the proportional, integral, and differential regulators together form the PID controller, and the PID control system is composed of the PID controller and the controlled object [24].Figure 2
PID controller system structure diagram.The basic control law of the PID controller is analyzed below. Assuming that at a particular momentt, when the input quantity is rint and the output quantity is routt, the deviation can be calculated as et=rint−routt, and the basic control law of the PID can be expressed by(1)Ut=KPet+1T1∫etdt+TDdetdt,where KP is the proportional band, TI is the integration time, and TD is the differentiation time. These parameters are based on the control parameters of the PID controller, and their effects on the PID control system’s performance are affected as explained in Figure 3.(i)
The effect of proportional action on the control performance.The proportional effect mainly reflects the speed of the controller on the signal regulation, which is the rapidity of the control system performance; when the control system deviation signals, the proportional effect can make the system quickly respond. In addition, a proportional, integral, and derivative proportionate action generates a controller output that is proportional to the error signal. This action generates a controller output that switches to decrease a constant error. A derivative action generates a control output based on the deviation's orientation and rate of change. Once all of these are merged into a single controller (PID), automated control facilities are available to remedy any necessary change(ii)
The effect of integration on the control performance.The integral part is the sum of the term error over time. As a result, even the slightest misleading term causes the integral part to grow slowly. Because the integral reaction will continue to increase indefinitely until the error is zero, the result is that the steady-state error is pushed to zero. A properly selected integration time allows the response output to track the desired value indistinguishably(iii)
Effect of differential action on control performance.derivative action is used in conjunction with a proportional action controller to provide a phasing advancement in the controller output voltage, allowing for a control adjustment to be made earlier than would be feasible with proportional action only. It is frequently seen as offering an anticipatory action. The role of differentiation shows the dynamic stability of PID control, which can predict the trend of the error signal to effectively predict and improve the error dynamic control characteristics of the closed-loop system with differential action in advance [24]Figure 3
Performance PID control system.


## 3.1.1. The Basic Principle of the PID Controller

The PID control system shown in Figure2 get the input signal after the proportional, integral, differential regulation of the control amount to the controlled object and then the signal output, the output signal through the measurement element and the input signal for comparison, and then get the deviation signal through the three regulators to adjust until the deviation signal is zero. Here the proportional, integral, and differential regulators together form the PID controller, and the PID control system is composed of the PID controller and the controlled object [24].Figure 2
PID controller system structure diagram.The basic control law of the PID controller is analyzed below. Assuming that at a particular momentt, when the input quantity is rint and the output quantity is routt, the deviation can be calculated as et=rint−routt, and the basic control law of the PID can be expressed by(1)Ut=KPet+1T1∫etdt+TDdetdt,where KP is the proportional band, TI is the integration time, and TD is the differentiation time. These parameters are based on the control parameters of the PID controller, and their effects on the PID control system’s performance are affected as explained in Figure 3.(i)
The effect of proportional action on the control performance.The proportional effect mainly reflects the speed of the controller on the signal regulation, which is the rapidity of the control system performance; when the control system deviation signals, the proportional effect can make the system quickly respond. In addition, a proportional, integral, and derivative proportionate action generates a controller output that is proportional to the error signal. This action generates a controller output that switches to decrease a constant error. A derivative action generates a control output based on the deviation's orientation and rate of change. Once all of these are merged into a single controller (PID), automated control facilities are available to remedy any necessary change(ii)
The effect of integration on the control performance.The integral part is the sum of the term error over time. As a result, even the slightest misleading term causes the integral part to grow slowly. Because the integral reaction will continue to increase indefinitely until the error is zero, the result is that the steady-state error is pushed to zero. A properly selected integration time allows the response output to track the desired value indistinguishably(iii)
Effect of differential action on control performance.derivative action is used in conjunction with a proportional action controller to provide a phasing advancement in the controller output voltage, allowing for a control adjustment to be made earlier than would be feasible with proportional action only. It is frequently seen as offering an anticipatory action. The role of differentiation shows the dynamic stability of PID control, which can predict the trend of the error signal to effectively predict and improve the error dynamic control characteristics of the closed-loop system with differential action in advance [24]Figure 3
Performance PID control system.


## 3.2. Conventional PID Controller Parameter Tuning Method

Convolutional PID controllers are widely utilized in industrial control applications due to their practicality and ease of installation. Nevertheless, PID controllers are not ideal and can operate inadequately in complicated, nonlinear, or time/delayed linear systems. Figure4 depicts the conventional PID controller, which is a basic three-term controller.Figure 4
Structure of a conventional PID controller.Parameter tuning of PID controllers has always been one of the important issues in the study of PID control. It refers to the modification of the three PID controller parameters to produce the dynamic characteristics of the control loop composed of the control object, controller, and so on. Furthermore, when the controller law is developed in the form of a PID, it fulfills the appropriate index requirements to create the desired control effect [24]. In practical applications, it is usually necessary to avoid the direct use of complex physical and mathematical formulas. In this regard, the PID adjustment method, which relies on a large amount of experience, is both simple and hassle-free, so it is still widely used in some simple control [25]. For example, the most common is the Z-N method in PID control, and this method is mainly applied to industrial objects for the first-order inertia pure delay model (FOPDT model) [26].Transfer function approaches use a polynomial proportion to express the relationship between a system's outputs and inputs. The order of the model is the same as the order of the denominator polynomial. The denominator polynomial roots are known as the modeling poles. The minimum model transfer function of the industrial object is assumed as(2)Gs=Ke−τsTS+1,where K, τ, and T are the open-loop gain, pure lag time constant, and inertia time constant, respectively. The Z-N technique has two stages: one is a closed-loop control loop using proportional control to find the stability limit, while the other calculates the controller parameters using equation (2).The proportional adjustment factor P gives the stability limit. In the control system, only the proportional regulator is used, after continuously increasing the proportional gainKp, the proportional gain at this time is called the critical proportional coefficient Ku and wave crests is the critical oscillation period Tu . With Ku and Tu, the other parameters are calculated separately according to the table of empirical formulas for PID parameter tuning by the Z-N method, as shown in Table 1.Table 1
Empirical formula for Z-N method PID parameter tuning.
HardwareConfigurationTiTdKiKdIntegration timeDifferential timeIntegral coefficientDifferential coefficientP0.5ku————PD0.8ku—0.12Tu—Kp∗TdPI0.45ku0.85Tu—Kp/Ti—PID0.6ku0.5Tu0.12TuKp/TiKp∗TdWhen faced with a noninertial pure hysteresis controlled item, the premise of the Z-N technique is to require the controlled object to be a first-order inertial pure hysteresis system. It can only be approximated as a first-order inertial pure hysteresis system; however, this approximation transformation is more difficult, and measurement errors are highly common, resulting in substantial variances in the derived PID parameters.Therefore, even though the Z-N method is simple and suitable for most simple industrial process control systems, in practice, it still produces significant deviations and cannot be well regulated in the face of time-varying, nonlinear, and other controlled objects, let alone in the presence of noise, load, and disturbances [27]. In this case, the traditional Z-N parameter tuning method cannot fully meet the performance requirements of engineering practice and shows great technical limitations [28].


## 3.3. PID Controller Based on the BP Neural Network

The BP neural network-based PID controller is a real-time online intelligent PID controller with self-learning and adaptive capability; the BP neural network enables the system to self-learn online, as well as to express any nonlinear system, so that the BP neural network can achieve the best performance combination of control parameters for PID.


### 3.3.1. PID Controller with the BP Neural Network

The neuronal network of BPPID is a control method that improves system settings through self-learning. Depending on PID control, BP neural network PID derives the stability and robustness of classic PID control while combining the BP neural network's rapid learning and adaptable capacity. The two control approaches work quite well together. As a result, they have a position in the nonlinear control scheme. The traditional PID controller provides closed-loop control on the control system directly, and the three parameterskp, ki, and kd are modified constantly. However, these three characteristics combine and strengthen or eliminate each other within a particular range, making them difficult to govern. A PID controller depending on BP neural network is presented in the literature to handle this problem [29]. Figure 5 displays the controller of the BP neural network-based PID control system.Figure 5
Sketch of the PID control system structure of the BP neural network.The first part is the conventional PID controller, which still regulates the controlled object directly, whilekp, ki, and kd parameters are adjusted online by a BP neural network. The second part is the BP neural network, in which as the control system changes in real-time, the output layer nodes adjust their weights to match the three tunable PID controller parameters kp, ki, and kd [30].The design of the BP neural network PID controller first needs to determine the PID control algorithm, which is selected as the incremental digital PID control algorithm suitable for computer systems, and its control algorithm formula is given as(3)Δuk=Kpek−eek−1+kieek−ek−1−ek−1−ek−2Δk−KpΔek+kiek+kdΔek−Δek−1.Here,Δk=ek−ek−1,Δek−1=ek−1−ek−2.After determining the PID controller, the structural framework of the BP neural network needs to be determined to be applied to the PID controller, and the neural network structure, the activation function of the neuron nodes in each layer, the initial weights of the network, and the network learning rate are selected one by one in the following.


### 3.3.2. Selection of the Number of Nodes in the Hidden Layer

Understanding the basic structure of the BP neural network is a prerequisite for applying the BP neural network to solve practical problems. The number of neuron nodes in the input and output layers can usually be determined according to the actual problem, but there is no uniformity in the design of the hidden layer. Very few nodes in the hidden layer are likely to cause large deviations in the results and may produce oscillations and fluctuations; too many nodes are too difficult to design and are prone to overfitting, which will instead make the output of the network perform worse. The structure of the hidden layers mainly includes the number of hidden layers and the number of nodes in each hidden layer, which have a great impact on whether the network converges, how fast it converges, and so on. However, there is no sufficient theoretical basis to determine the number of hidden layers and the number of nodes in the hidden layers of the BP neural network but only relies on experience. There are also significant differences in the laws that the network needs to satisfy when dealing with different problems [31]. After extensive experiments and continuous exploration, researchers have summarized several common empirical formulas for the determination of the number of hidden layers as calculated as follows: (4)m=n+l+am=log2nm=nl.In order to avoid the phenomenon of “overfitting” of the neural network during training as much as possible and to ensure a high enough generalization ability of the neural network, the number of nodes in the hidden layer is taken as small as possible to meet the requirements of accuracy and reliability of the neural network [32]. In this chapter, the empirical formula based on the implicit layer nodes n+m+a is chosen as 9. The input layer is set as four neurons, which are the three parameters in the incremental PID algorithm Δek, ek, eΔek−1, and a constant factor of 1 for the stabilized BP neural network, the output layer is set to three output neurons in order to correspond to the three parameters of the proportional integral differentiation.


### 3.3.3. Activation Function Selection

Generally, any function that satisfies continuous, bounded, and nonconstant values are available as an activation function for neurons. However, when considering how to apply neural networks to design and control systems, the activation functions of neuron nodes need to satisfy the complexity issues of practical system design and training applications, etc. In general, the activation functions of neurons should be designed to satisfy the following three points.(i)
Point 1: (X) should be simple and easy to compute, satisfying the conditions of differentiable, bounded, and nonconstant values, and the output given at bounded values of the input should also be bounded(ii)
Point 2: the partial derivatives of (X) should also be simple since their partial derivatives are also an important parameter in the training of the analytic network(iii)
Point 3: (X) should be made to match the nonlinear system as closely as possible as a way to make the network structure smaller and easier to trainThe Sigmoid function and hyperbolic tangent function (tanh) are both among the commonly used activation functions. The Sigmoid function has the advantage of squeezing a larger range of input values into the (0, 1) output range. The tanh function is similar to the Sigmoid function, but it is a hyperpolar function, which has an output range of (−1, 1).


### 3.3.4. Selection of Initial Weights

The size of the initial weights is also one of the important factors that affect whether the network can eventually reach a certain acceptable error range. Typically, once the input signal enters the network, the network should reply as rapidly as possible to ensure that the output reaches the typical target value or so, and the initial weights are used to ensure that the network responds quickly at first. For example, if the output of the tanh function is a number between (−1, 1), the initial weight must be a random number between (−1 and 1) and not the same, where the rate of change is relatively high, and the beginning weight might be close to 0 to prevent redundant repeating of the output value. Therefore, to speed up the response of the network at the beginning, but not infinitely close to 0 that will make the weight changeΔw too small at the beginning, which will lead to too slow training. Of course, the above analysis is based on the premise of selecting a definite activation function. If the activation function is selected differently, the initial value range of each neuron will also be different. The starting weights of the implicit and output layers are selected as random integers close to 0 in this research to accelerate training at the start of the network.


### 3.3.5. Determination of Learning Rate

Learning rate is a hyperparameter that governs the weights of our neural network concerning the loss slope. It specifies how frequently the neural network's learned notions are updated. The learning rate is also an important factor that affects the change of the network during the learning process. The learning rate governs the network's training pace; a higher learning rate enables the system to train quicker, but the output may not be as expected, and a lower learning rate helps the network to approach the ideal value more smoothly, but it takes more time to train.Researchers have not yet derived the optimal learning rate for a given data set but only experimentally concluded that the learning rate is in the range of (10-6,1). Some scholars have proposed a method to gradually reduce the learning rate by selecting a larger value at the beginning and then decreasing it after the network works and becoming 0 when the network reaches stability. It is also easy to generate large errors after the disturbance. In this paper, the learning rate is chosen to be 0.2.


## 3.3.1. PID Controller with the BP Neural Network

The neuronal network of BPPID is a control method that improves system settings through self-learning. Depending on PID control, BP neural network PID derives the stability and robustness of classic PID control while combining the BP neural network's rapid learning and adaptable capacity. The two control approaches work quite well together. As a result, they have a position in the nonlinear control scheme. The traditional PID controller provides closed-loop control on the control system directly, and the three parameterskp, ki, and kd are modified constantly. However, these three characteristics combine and strengthen or eliminate each other within a particular range, making them difficult to govern. A PID controller depending on BP neural network is presented in the literature to handle this problem [29]. Figure 5 displays the controller of the BP neural network-based PID control system.Figure 5
Sketch of the PID control system structure of the BP neural network.The first part is the conventional PID controller, which still regulates the controlled object directly, whilekp, ki, and kd parameters are adjusted online by a BP neural network. The second part is the BP neural network, in which as the control system changes in real-time, the output layer nodes adjust their weights to match the three tunable PID controller parameters kp, ki, and kd [30].The design of the BP neural network PID controller first needs to determine the PID control algorithm, which is selected as the incremental digital PID control algorithm suitable for computer systems, and its control algorithm formula is given as(3)Δuk=Kpek−eek−1+kieek−ek−1−ek−1−ek−2Δk−KpΔek+kiek+kdΔek−Δek−1.Here,Δk=ek−ek−1,Δek−1=ek−1−ek−2.After determining the PID controller, the structural framework of the BP neural network needs to be determined to be applied to the PID controller, and the neural network structure, the activation function of the neuron nodes in each layer, the initial weights of the network, and the network learning rate are selected one by one in the following.


## 3.3.2. Selection of the Number of Nodes in the Hidden Layer

Understanding the basic structure of the BP neural network is a prerequisite for applying the BP neural network to solve practical problems. The number of neuron nodes in the input and output layers can usually be determined according to the actual problem, but there is no uniformity in the design of the hidden layer. Very few nodes in the hidden layer are likely to cause large deviations in the results and may produce oscillations and fluctuations; too many nodes are too difficult to design and are prone to overfitting, which will instead make the output of the network perform worse. The structure of the hidden layers mainly includes the number of hidden layers and the number of nodes in each hidden layer, which have a great impact on whether the network converges, how fast it converges, and so on. However, there is no sufficient theoretical basis to determine the number of hidden layers and the number of nodes in the hidden layers of the BP neural network but only relies on experience. There are also significant differences in the laws that the network needs to satisfy when dealing with different problems [31]. After extensive experiments and continuous exploration, researchers have summarized several common empirical formulas for the determination of the number of hidden layers as calculated as follows: (4)m=n+l+am=log2nm=nl.In order to avoid the phenomenon of “overfitting” of the neural network during training as much as possible and to ensure a high enough generalization ability of the neural network, the number of nodes in the hidden layer is taken as small as possible to meet the requirements of accuracy and reliability of the neural network [32]. In this chapter, the empirical formula based on the implicit layer nodes n+m+a is chosen as 9. The input layer is set as four neurons, which are the three parameters in the incremental PID algorithm Δek, ek, eΔek−1, and a constant factor of 1 for the stabilized BP neural network, the output layer is set to three output neurons in order to correspond to the three parameters of the proportional integral differentiation.


## 3.3.3. Activation Function Selection

Generally, any function that satisfies continuous, bounded, and nonconstant values are available as an activation function for neurons. However, when considering how to apply neural networks to design and control systems, the activation functions of neuron nodes need to satisfy the complexity issues of practical system design and training applications, etc. In general, the activation functions of neurons should be designed to satisfy the following three points.(i)
Point 1: (X) should be simple and easy to compute, satisfying the conditions of differentiable, bounded, and nonconstant values, and the output given at bounded values of the input should also be bounded(ii)
Point 2: the partial derivatives of (X) should also be simple since their partial derivatives are also an important parameter in the training of the analytic network(iii)
Point 3: (X) should be made to match the nonlinear system as closely as possible as a way to make the network structure smaller and easier to trainThe Sigmoid function and hyperbolic tangent function (tanh) are both among the commonly used activation functions. The Sigmoid function has the advantage of squeezing a larger range of input values into the (0, 1) output range. The tanh function is similar to the Sigmoid function, but it is a hyperpolar function, which has an output range of (−1, 1).


## 3.3.4. Selection of Initial Weights

The size of the initial weights is also one of the important factors that affect whether the network can eventually reach a certain acceptable error range. Typically, once the input signal enters the network, the network should reply as rapidly as possible to ensure that the output reaches the typical target value or so, and the initial weights are used to ensure that the network responds quickly at first. For example, if the output of the tanh function is a number between (−1, 1), the initial weight must be a random number between (−1 and 1) and not the same, where the rate of change is relatively high, and the beginning weight might be close to 0 to prevent redundant repeating of the output value. Therefore, to speed up the response of the network at the beginning, but not infinitely close to 0 that will make the weight changeΔw too small at the beginning, which will lead to too slow training. Of course, the above analysis is based on the premise of selecting a definite activation function. If the activation function is selected differently, the initial value range of each neuron will also be different. The starting weights of the implicit and output layers are selected as random integers close to 0 in this research to accelerate training at the start of the network.


## 3.3.5. Determination of Learning Rate

Learning rate is a hyperparameter that governs the weights of our neural network concerning the loss slope. It specifies how frequently the neural network's learned notions are updated. The learning rate is also an important factor that affects the change of the network during the learning process. The learning rate governs the network's training pace; a higher learning rate enables the system to train quicker, but the output may not be as expected, and a lower learning rate helps the network to approach the ideal value more smoothly, but it takes more time to train.Researchers have not yet derived the optimal learning rate for a given data set but only experimentally concluded that the learning rate is in the range of (10-6,1). Some scholars have proposed a method to gradually reduce the learning rate by selecting a larger value at the beginning and then decreasing it after the network works and becoming 0 when the network reaches stability. It is also easy to generate large errors after the disturbance. In this paper, the learning rate is chosen to be 0.2.


## 3.4. BP Neural Network PID Controller Control Design Steps

The BP neural network is a three-layer advanced artificial neural network with input, hidden, and output layers. In this research, there are three neurons in the input layer and two neurons in the output layer, and the number of hidden levels and the number of neurons in the hidden layer are left to the simulated results. Figure6 depicts the architecture of the BP neural network.Figure 6
Structure of the BP neural network.


### 3.4.1. Network Structure Setting

The BP network is determined as four input layer nodes, nine implicit layer nodes, and three output layer nodes. In addition, the four inputs to the neural network are the three parameters in the incremental PID algorithmΔk, ek, ∆ ek−1, and the constant 1 of the stabilization network. The implied layer is the minimum number to satisfy the system performance, and the output is the PID controller's three configurable parameters, with each layer's initial value set to 0.2.The learning rateη is selected, the initial weights in the implied layer weight matrix (2) (K) and the output layer weight matrix w (3) (k) are set to random numbers between (−1, 1). The implied layer activation function is set to bipolar tanh function. The output layer activation function is set to the Sigmoid function, the transfer function of the input conditioning object, the sampling period Ts is set, and the input expectation value rk.


### 3.4.2. Neural Network Training Process

At the instantk, the network samples obtain the system expectation value r(k) and the actual output value y(k). It computes the error e(k) at that moment = r(k) − y(k), as well as the input and output of each network layer, in turn, using equations 1–4, and the output of the output layer is Kp, Ki, Kd . According to the weight correction formula (5) to adjust the implied layer weight matrix (2) (k) and the output layer weight matrix w (3) (k), the learning times are added by one, that is, k = k + 1, and Step (3) is repeated until the end of sampling.


## 3.4.1. Network Structure Setting

The BP network is determined as four input layer nodes, nine implicit layer nodes, and three output layer nodes. In addition, the four inputs to the neural network are the three parameters in the incremental PID algorithmΔk, ek, ∆ ek−1, and the constant 1 of the stabilization network. The implied layer is the minimum number to satisfy the system performance, and the output is the PID controller's three configurable parameters, with each layer's initial value set to 0.2.The learning rateη is selected, the initial weights in the implied layer weight matrix (2) (K) and the output layer weight matrix w (3) (k) are set to random numbers between (−1, 1). The implied layer activation function is set to bipolar tanh function. The output layer activation function is set to the Sigmoid function, the transfer function of the input conditioning object, the sampling period Ts is set, and the input expectation value rk.


## 3.4.2. Neural Network Training Process

At the instantk, the network samples obtain the system expectation value r(k) and the actual output value y(k). It computes the error e(k) at that moment = r(k) − y(k), as well as the input and output of each network layer, in turn, using equations 1–4, and the output of the output layer is Kp, Ki, Kd . According to the weight correction formula (5) to adjust the implied layer weight matrix (2) (k) and the output layer weight matrix w (3) (k), the learning times are added by one, that is, k = k + 1, and Step (3) is repeated until the end of sampling.


## 4. Experimental Work and BP Neural Network PID Controller Simulation

After doing the above work, take the simplified model of the motor as an example, and set its transfer function difference equation as.(5)youtk=akyoutk−11+yout2k−1+uk−1,where the coefficient (k) is the slow time variation and (k) = 1.2(2–1.8 e - 0.01 k). The technique and equation obtained in the previous section are simulated using the MATLAB code. The tanh and Sigmoid functions are used to activate the implicit layer and output layer, respectively. The initial weights of both the implicit layer and the input layer are chosen as different nonzero numbers between (−1, 1), and the initial learning rate is chosen as 0.2. The input motor signal (k) is set as a unit step signal, and the response curve of the system is shown in Figure 7 (horizontal coordinate). From the figure, it can be seen that the rise time of the system is about 0.009 s, the overshoot is 5.3%, the regulation time is 0.322 s, and the system reaches the steady-state after 0.513 s.Figure 7
Response curve of BPPID.The parameter variations affect the type of the signals, the computation time step, and the breadth of the torque categories. Figure8 shows the change curves of the three parameters of the system, which start to stabilize at about 0.13 s and stop changing after 0.493 s.Figure 8
Parameter variation curve of BPPID.Figure9 shows the error signal variation graph, from which it can be seen that the error signal basically tends to zero after 0.454 s. In the overall regulation process, the system overshoot is less than ideal, larger than the ±5% in the industry standard, and the regulation time is also longer.Figure 9
BPPID error signal variation curve.The most natural depiction of how many objects in the environment alter status is a sinusoidal signal. A sinusoidal signal demonstrates how the amplitude of a variable varies over time. For instance, the variable may be an audible sound. A sinusoidal signal is a single pure note, though it would sound extremely simple and flat, without any of the harmonics we often hear in nature. A sinusoidal signal can also indicate a simple oscillation within a wire. The frequency is defined as the number of times the sinusoidal signal completes one cycle in one second. Figure10 shows the BPPID response curve for the input sinusoidal signal from which it can be seen that the output curve of the system is the same as the input sinusoidal signal.Figure 10
Input sinusoidal signal system response curve.Figure11 shows the parameter variation curves of the system, and all three parameters show periodic variations.Figure 11
System parameter variation curve of input sinusoidal signal.Figure12 shows the system error variation curve with sinusoidal signal input. According to this figure, the error variation curve of the system shows that the error signal varies within a range of about 0.013, and in general, the tracking response of the system to the curve is quite satisfactory, and the error variance of about 0.013 has no effect on the system.Figure 12
System error variation curve with sinusoidal signal input.


## 5. Conclusions

This paper combines the neural BP network and PID controller and takes the PID control parameters of electrical equipment of rural electric drainage and irrigation stations as the experimental environment. First, the structure and principle of a PID controller are briefly introduced by analyzing the characteristics, advantages, and disadvantages of position-based PID controllers and incremental PID. Afterward, the BP neural network PID controller is introduced and designed. Furthermore, the neural network implicit layer, activation function, network starting weights, and learning rate are chosen one by one, resulting in the suggested BP neural network PID algorithm and its flow. Finally, the simulation results show that the designed BPPID is well regulated.



---

*Source: 4268662-2022-08-11.xml*