A temperature predictive control method using BP neural network

In the spray deposition system, there are problems such as inconvenient control methods and low adjustment accuracy for the substrate temperature. Based on the analysis of model, a predictive control method of BP neural network is proposed; and the established control model is tested in real time using STM32. The analysis of the results shows that the method is feasible and effective.


Introduction
Substrate temperature control is an important part of the spray deposition control system, which directly affects the quality of nanomaterial growth. Throughout the material growth process, precise control of the substrate temperature is always required. The substrate temperature, the speed of temperature rising and falling, and the constant temperature duration all have an effect on the growth quality of the material [1]. However, because the substrate has characteristics such as time delay and nonlinearity, it is difficult to obtain an accurate physical model, and conventional control methods cannot meet the control requirements of the system.
In this paper, a heating system for the substrate is designed. The performance of the system is evaluated by temperature error of the control. The BP neural network is used to establish the relationship model of historical temperature and control time series, the desired temperature at next moment and control at this moment. The model predicts the control at a certain moment to realize temperature prediction control.

Hardware design
Experimental equipment for temperature control of the substrate: PT100 temperature sensor, STM32, heating tube, adjustable power supply, temperature transmitter.
The STM32 functions mainly include: temperature data collecting, voltage output, algorithm calculation, and communication with the host computer. The STM32 output DAC voltage value, as the input signal of the adjustable power supply, which can be converted from 0-3.3VDC to 0-220VAC, and heating tube is heated with voltage. Due to heat conduction, the substrate is heated. The thermocouple PT100 is placed close to the top of substrate. The temperature transmitter is used to convert the resistance signal of the thermocouple into a voltage signal, which is collected by the STM32ADC and transmitted to the host computer via Ethernet for real-time display.

BP model
The most commonly used neural network training platforms are Matlab and Python. Before training the BP neural network, first set the parameters of the neural network, such as the training speed and the structure of the neural network, the selection of the neuron transfer function and the training error of the neural network [2][3][4][5].
The training functions of BP neural network mainly include: training, traingdm, trainrp, trainlm, traincgb, trainscg, etc. For small and medium-sized BP neural networks, the trainlm neural network training function has the fastest convergence rate. Therefore, in the general BP neural network, the tainlm function is usually used for training. According to the research of Han Min [6,7], the neural network processing is shown in Figure 2.

Sample input
Sample ouput

Mathematical model
The substrate is a nonlinear system. The Nonlinear Autoregressive Moving Average with Xogenous Inputs (NARMAX) proposed by Billings in 1982 is an excellent nonlinear input-output model. The mathematical expressions of the NARNAX model are very useful for modeling nonlinear systems [8]. Assume that the mathematical expression of the NARNAX model for a single-input single-output nonlinear system is as follows: Where u is the input value of the nonlinear system; y is the output value of the nonlinear system; e is the zero mean white Gaussian noise; f is the nonlinear input-output mapping relationship of the system. If you ignore the effect of noise on the system, you can simplify equation (1) as follows: In the general case, you can get: If the historical input and output information and the desired output information at next moment in the model shown in the equation (3) are used as input variables of the neural network, the input information of the system at this moment is taken as the output vector of the network. In this way, a predictive control model of temperature based on BP neural network can be established.

Training data collection
Taking into account the time lag of the system (about 30 second), the acquisition experiment changes the control every 1 minute, and control is random, while temperature data is transmitted to the host computer via ethenet. The host computer uses the LabVIEW platform. In order to ensure the accuracy of the sampling cycle time, the data is saved in the text file and used in the queue form.

BP network training
Through the above theoretical analysis, it can be concluded from the fly-up curve, u yn n are both 5. The collected data is further processed into a corresponding input and output structure of the neural network. The BP neural network had three layers: 10 neurons in the input layer, 21 neurons in the hidden layer, and 1 neuron in the output layer. The hidden layer used the tansig function and the output layer used the purelin function. The training function was trainlm. The training frequency is 10000, the training speed is 0.01, and the target error is 0.001. The BP neural network was trained using the neural network toolbox in Matlab. The training results are shown in Figure 3.

Temperature prediction control test
Most of the neural network calculations are performed on the computer, and then the results of the neural network calculation are transmitted to the microcontroller, and microcontroller executes the control. To make the control more real-time, the neural network calculation is carried out in the microcontroller STM32. After training the BP neural network, the trained BP neural network is transplanted to the STM32. The simplest method is to transplant the threshold and weight of each neuron, and the activation function to STM32.
Since the neural network control is not required at the beginning of the experiment, a queue which length is 4 is set for temperature and control to update in real time, and neural network predictive control is performed when necessary.
Test the performance of the control system. The results of a certain test are shown in Figure 5.

Figure 5. Test result
In the figure, the historical temperature and control amount in the first four minutes, and the control after 4 minutes is predicted by the neural network. Predict point is the desired temperature at the next moment, and actual point is the actual temperature at the next moment after applying neural network control. The absolute error average of all experiments was 0.83°C.

Conclusion
On the basis of the existing model, the temperature prediction control model is established by BP neural network. The result of neural network training shows that there is a high correlation between variables. By comparing the temperature error under the control of the neural network, it is concluded that the control model has a good control effect.