PID Controller and Simulation Based on BP Neural Network

Publisher:闪耀星空Latest update time:2011-05-06 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Introduction
PID (proportional-integral-differential) controller is the earliest practical controller with a history of more than 50 years. It has been widely used in industrial process control and motion control due to its advantages such as simple algorithm, good robustness, high reliability and good intuitiveness [1]. The quality of conventional PID control depends not only on the accuracy of the control system model, but also on the relationship between the three parameters, which is not necessarily a simple linear combination. Actual industrial processes and motion processes often have uncertainties such as time-varying, variable parameters, variable structures and strong nonlinearity, making it difficult to establish an accurate mathematical model. In addition, conventional PID has the disadvantages of difficulty in online adjustment, mutual influence between parameters and long parameter setting time, making it difficult to achieve ideal control effects.
With the development of control theory, combining the widely used PID controller with intelligent control theory [2] has become a new direction in intelligent control research. Neural network algorithms have the ability to approximate arbitrary nonlinear expressions, strong self-learning ability and generalization and promotion ability, and have great potential in solving highly nonlinear and uncertain systems. By using neural networks, the best linear combination can be found from the complex combination of the three PID parameters, combining neural networks and PID in essence. This makes the controller have better adaptability, realizes automatic real-time adjustment of parameters, adapts to process changes, and improves the robustness and reliability of the system.
2. BP neural network
2.1 The composition and design of BP neural network [3]
BP neural network is a neural network with three or more layers, including input layer, hidden layer, and output layer. The upper and lower layers are fully connected, and there is no connection between neurons in each layer. When a pair of learning samples is provided to the network, the activation value of the neuron is propagated from the input layer to the output layer through the intermediate layers, and each neuron in the output layer obtains the input response of the network. Next, in the direction of reducing the error between the target output and the actual output, the connection weights are corrected layer by layer from the output layer through the intermediate layers, and finally returned to the input layer. This algorithm is called BP algorithm. As the error inverse propagation correction continues, the accuracy of the network's response to the input pattern continues to increase.
(1) Design of input and output layer
The design of the input layer can be determined according to the problem to be solved and the data representation method. If the input signal is an analog waveform, the dimension of the input unit can be determined according to the number of sampling points of the waveform, or one unit can be used for input. In this case, the input sample is a time series of samples. The dimension of the output layer can be determined according to the user's requirements. If the BP network is used as a classifier and there are m class patterns in total, the number of neurons in the output layer is m or .
(2) Design of hidden layer
The number of hidden layer units is directly related to the requirements of the problem and the number of input/output units. Too many hidden units will lead to long learning time, error may not be optimal, poor fault tolerance, inability to recognize previously unavailable samples, etc. Therefore, there must be an optimal number of hidden units. The following three formulas are usually used to select the optimal number of hidden units:
1) , where k is the number of samples and n is the number of input units.
2) , where m is the number of output neurons, n is the number of input units, and a is a constant between [1,10].
3) , where n is the number of input units.
2.2 Typical neural network structure
A typical three-layer neural network structure is shown in the figure below:

Figure 1 BP neural network structure diagram


Among them: , , …, are the inputs of the BP network; , , …, are the outputs of the BP network, corresponding to the three parameters of the PID controller; is the connection weight from the input layer to the hidden layer; is the connection weight from the hidden layer to the output layer. Through the self-learning of the neural network and the adjustment of the weighting coefficients, the output of the neural network corresponds to the PID controller parameters under a certain optimal control law.
The relationship between the parameters in Figure 1 [4] is as follows:
Input layer:

Hidden layer:
Output layer:
Take the performance index as: , and modify the network weights according to the gradient descent method to minimize . The modification method is as follows:
Hidden layer:
Output layer:

3. Neural network PID controller and control algorithm
1. The structure of BP neural network PID controller is shown in the figure below:

Figure 2: Neural network controller structure diagram

As can be seen from the figure: the controller consists of two parts, namely conventional PID control and neural network. Among them, conventional PID directly performs closed-loop control on the controlled object, and its control parameters Kp, Ki, and Kd are adjusted online; the neural network adjusts the parameters of the PID controller according to the operating status of the system in order to optimize certain performance indicators, so that the output of the output layer neurons corresponds to the three adjustable parameters of the PID controller. Through the self-learning of the neural network and the adjustment of the weighted coefficients, the output of the neural network corresponds to the parameters of the PID controller under a certain optimal control law.
2. Control algorithm
The control algorithm of neural network PID [5] is as follows:
(1). Determine the structure of the neural network, that is, determine the number of input nodes and the number of hidden layer nodes, and give the initial value of the weight coefficient of each layer and , and select the learning rate and inertia coefficient, set k = 1;
(2). Sample r(k) and y(k), calculate the current moment error error(k) = r(k)-y(k);
(3). Calculate the input and output of each neural network, and the output of its output layer is the three control parameters Kp, Ki, and Kd of the PID controller;
(4). Calculate the output of the PID controller;
(5). Perform neural network learning, adjust the weight coefficient online, and realize the adaptive adjustment of PID control parameters;
(6). Set k = k + 1 and return to step (1).
4. Simulation Example
4.1 Controlled Object
Assume that the approximate mathematical model of the controlled object is: , the selected input signal is a time-varying signal:
the structure of the neural network is 4-5-3, the learning rate is 0.55, the inertia coefficient is 0.04, the initial value of the weighting coefficient is a random number in the interval [-0.5, 0.5], and the sampling frequency is 1000Hz.
The Matlab simulation results are shown in Figure 3:

Figure 3-1 Input-output curve

Figure 3-2 Error curve

4.2 Analysis of simulation results
It can be seen from the simulation curve that the neural network PID has a small steady-state error, solves the problems of conventional PID overshoot and jitter, has high control accuracy, achieves almost identical tracking of control signals, and has good rapidity and adaptability.
5. Conclusion
The neural network PID controller realizes the combination of the essence of the two algorithms. With the help of the self-learning and self-organizing ability of the neural network, it can realize the online adjustment of PID parameters and the controller has good adaptability; the algorithm does not require the controlled object to have an accurate mathematical model, which expands the scope of application and has a good control effect; under the condition of a reasonable selection of the structure of the neural network, the algorithm has a strong generalization ability. Based on the above advantages, the neural network PID controller has a good development and application prospect.

Reference address:PID Controller and Simulation Based on BP Neural Network

Previous article:Large-size multi-touch control technology based on optical sensing
Next article:Development of audio control subsystem in intelligent acoustic prevention system for harmful animals

Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号