0% found this document useful (0 votes)
37 views13 pages

Optimal Temperature and Humidity Control For Auton

The document discusses using a PSO-BP neural network method and sensor error compensation algorithm for optimal temperature and humidity control in an autonomous greenhouse system. The method uses PSO to optimize the parameters of a BP neural network PID controller. Experimental results show errors between measured and target values of less than 1°C and 1% humidity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views13 pages

Optimal Temperature and Humidity Control For Auton

The document discusses using a PSO-BP neural network method and sensor error compensation algorithm for optimal temperature and humidity control in an autonomous greenhouse system. The method uses PSO to optimize the parameters of a BP neural network PID controller. Experimental results show errors between measured and target values of less than 1°C and 1% humidity.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Received: 15 December 2022 Revised: 14 March 2023 Accepted: 26 June 2023 IET Control Theory & Applications

DOI: 10.1049/cth2.12467

ORIGINAL RESEARCH

Optimal temperature and humidity control for autonomous


control system based on PSO-BP neural networks

Weibin Wu1,2 Beihuo Yao1,2 Jiaxi Huang3 Shunli Sun1,2 Fangren Zhang1,2
Zhaokai He1,2 Ting Tang1,2 Ruitao Gao1

1
College of Engineering, South China Agricultural Abstract
University, Guangzhou, China
In order to solve the problems of difficult control, poor stability, and low control preci-
2
Division of Citrus Machinery, China Agriculture sion in complex autonomous non-linear systems, and some sensors have non-linear errors
Research System, Guangzhou, China
in special environments. Based on the PSO (Particle Swarm Optimization) algorithm, an
3
School of Mechanical and Automotive Engineering, PSO-BP-PID (Particle Swarm Optimization Back Propagation neural network PID) con-
South China University of Technology, Guangzhou,
China trol method and a sensor error compensation algorithm based on BP (Back Propagation)
neural network are designed for optimal temperature and humidity control and sensor error
Correspondence compensation in the autonomous greenhouse system. The error between the average tem-
Ruitao Gao, College of Engineering, South China perature value and the target value after steady state is 0.5◦ C, and the error between the
Agricultural University. Guang Zhou 510642, China.
Email: [email protected]
average humidity value and the target value is 1% RH. The results show that the control
method can effectively compensate the non-linear error of the sensor and improve the per-
Funding information formance of the control system in a complex environment, which is suitable for the stable
The development and application demonstration of and control of actuators in autonomous systems. The error of temperature and humid-
transportation and spraying equipment for Jiexi
ity sensor is compensated by BP neural network; PSO (Particle Swarm Optimization) was
alpine tea gardens, Grant/Award Number:
Dzxny0004; Guangdong Provincial Special Fund for used to optimize the BP-PID parameters of the automatic greenhouse system.
Modern Agriculture Industry Technology
Innovation Teams, Grant/Award Number:
2022KJ120; Research and development of smart
agricultural machinery and its control technology,
Grant/Award Number: 2022-SZNFY-1-3;
Guangdong Digital Smart Agricultural Service
Industrial Park, Grant/Award Number:
GDSCYY2022-046

1 INTRODUCTION the arrival of the era of modernization and intelligence, micro-


computer technology and sensor technology have developed at
In engineering applications and industrial scenarios, the accu- a high speed, meanwhile the control theory has enriched. There-
rate and stable control of nonlinear systems is always a difficult fore, a more perfect control algorithm combined with advanced
problem, which has attracted extensive attention from industry control theory is a necessary research direction in non-linear
and academia. In recent years, due to the large number of appli- systems.
cations of intelligent greenhouse systems, intelligent robots such In recent years, the research on non-linear system control has
as agricultural operation robots, and intelligent mobile devices, made remarkable achievements such as control method based
as well as the fusion of image processing and various sensors, on Lyapunov stability theory [3], input state feedback lineariza-
such as the introduction of semantic segmentation and 3D laser tion and Backstepping method based on differential geometry
radar in mobile robots [1, 2], which makes higher requirements theory [4, 5]. However, most of the theoretical results depend
for the control performance of non-linear systems, but the con- on the precise mathematical model of the systems, which is dif-
trol objectives of high precision, good stability and fast response ficult for most practical systems. With the rapid development of
can no longer be achieved by using classical control theory. With computer technology and the interdisciplinary application and

This is an open access article under the terms of the Creative Commons Attribution-NonCommercial-NoDerivs License, which permits use and distribution in any medium, provided the
original work is properly cited, the use is non-commercial and no modifications or adaptations are made.
© 2023 The Authors. IET Control Theory & Applications published by John Wiley & Sons Ltd on behalf of The Institution of Engineering and Technology.

IET Control Theory Appl. 2023;1–13. wileyonlinelibrary.com/iet-cth 1


2 WU ET AL.

development of artificial intelligence, information theory, sys- trol and recovery delay from a large change in setpoint [18].
tem theory and other multi-disciplinary fields, new vigour and Castañeda-Miranda et al. used BP neural network to model the
vitality was brought to the field of non-linear control, as well relationship between water consumption and tomato yield in
as new control methods that do not rely on the precise math- the greenhouse, and automatically detected data based on this
ematical model of the controlled system have been produced model [19]. Habaragamuwa et al. studied recurrent and feed for-
[6]. For example, Cui et al. [7] proposed a new integral sliding ward neural networks in greenhouses. Network control, and use
mode controller (ISMC), which effectively solves the problem the Elman neural network model in the greenhouse control to
of robot control in complex underwater environments. Cui et al. establish a neural network controller [20].
[8] proposed an evaluation neural network, an action neural net- Although BP-PID combines the advantages of BP neural
work, and an underwater AUV nonlinear error compensation network, there are still the disadvantages in it of slow conver-
control algorithm combined with two neural networks. Jiehao Li gence speed, long operation time, and easy to fall into local
et al. [9] provide theoretical and engineering guidance for lateral optima [21]. Chen, et al. proposed two neural network con-
stability under uncertain nonlinearity in a neurofuzzy-based reli- trol methods respectively in their papers, both of which have
able tracking control model. These algorithms greatly improve effectively overcome some of the shortcomings of neural net-
the controlled stability of non-linear systems, and proposed a work control. The one in [22] is an adaptive neural network
control method for a non-linear system of a four-wheel-legged consistency control method suitable for a class of non-linear
robot with the cubic Kalman algorithm and fuzzy compensation multi-agent systems with state time delays, while the other
[10]. in [23] is an adaptive neural network strict feedback control
Nonlinear system combined with particle swarm optimiza- method, applied to uncertain non-linear system for full state
tion algorithm is also an optimization direction [11]. Due to the constraints. Jiehao Li et al. [24] proposed a recurrent neural net-
high computational efficiency and strong robustness, the PSO work to eliminate uncertain interactions, which can effectively
(Particle Swarm Optimization) algorithm can find the global solve the neural network Some of the disadvantages of network
optimal solution to the problem with a high probability. It has control.
been widely used in the field of non-linear control system. In the general PSO control algorithm, the inertia weight is
In the field of intelligent greenhouse control, the optimiza- often introduced to update the particle velocity, and the lin-
tion for non-linear systems is more important. Combined with ear decrease is often used for optimization when adjusting
the neural network algorithm, in Asgharnia’s research, the PID [15–26]. In order to avoid the local minimum problem eas-
controller parameters are adjusted online using the RBF neu- ily caused by the BP neural network gradient descent, here,
ral network [12]. Wang et al. used the Hebb learning algorithm PSO is used to optimize the weight threshold of BP neural
to adjust the online parameters of two PID controllers, which network, and parameter setting of PID control is optimized
were used to control the fogging system and the greenhouse by the BP neural network. Thus, a particle swarm BP-PID
ventilation system respectively [13]. Wang et al. constructed a control algorithm is proposed. When adjusting the weight and
model by combining genetic algorithm, backpropagation neu- threshold of the neural network, the optimal particle population
ral network, and nonlinear autoregressive exogenous algorithm, obtained after the iteration of the particle swarm algorithm is
this model can predict the temperature internal parameters used as the weight and threshold of the network to optimize
within 7 days [14]. Ling et al. [15] used the PSO algorithm to the temperature and humidity PID control parameters., which
coordinate control of multiple environmental parameters and improves the intelligent degree of nonlinear greenhouse system
variables in multiple greenhouses, which improved the intelli- control.
gence of greenhouse control. Pérez-González et al. [16] utilized The following items are the main contributions:
PSO algorithm to identify the parameters of greenhouse model,
which improved the implementation efficiency of the controller. A sensor error compensation method based on BP neu-
Based on the generalization ability of BP neural network and the ral network is proposed, which improves the sensor
characteristics of global approximation under certain parameter perception accuracy of the non-linear system.
learning, a neural network compensation model is established The PSO-BP-PID algorithm is proposed, which can
here. The results collected by non-linear sensors is compensated find the optimal PID parameters for temperature
to solve the problem of low precision and difficult control in and humidity control more efficiently and accurately,
autonomous non-linear system. and improve the control accuracy of the autonomous
In the existing non-linear systems, most of the control tech- greenhouse system.
nologies used are conventional PID and BP-PID control, which
will make the complex control system fall into a local low point Section 2 introduces the principle of BP neural network sen-
and fail to reach the global optimal value. For example, in sor error compensation and the methodology of PSO-BP-PID
greenhouse control, greenhouse is a complex object with strong algorithm construction. Section 3 introduces the tempera-
time-varying, strong coupling, non-linearity and large parame- ture and humidity control experiment of the algorithm in
ter changes. PID control is unsuitable for advanced applications the autonomous greenhouse system and the analysis of the
in greenhouse, especially for non-linear, dynamic control. It is experimental results. The conclusions and future planning are
prone to wind-up errors [17] in which there is a loss of con- presented in Section 4.
WU ET AL. 3

2 METHODOLOGY

2.1 Mathematical model of temperature and


humidity in greenhouse

A greenhouse is a process of exchanging heat and substances


with the outside world, forming its own small climate envi-
ronment. The heat emitted by the greenhouse mainly includes
opening windows for ventilation, using air conditioners for heat
exchange, etc. The humidity in the greenhouse can come from
greenhouse humidifiers and the dehumidifier, from this ref- FIGURE 1 Structure diagram of BP neural network sensor error
compensation.
erence [27] we were establishing the mathematical model of
temperature and humidity.
Firstly, determine the constant pressure specific heat capacity
C p in the greenhouse, and its calculation formula is as follows:
2.2 BP neural network for sensor error
compensation
C p = Cv + R (1)
A typical multi-layer neural network model is the back Prop-
where Cv is the specific heat capacity at constant volume, and R agation neural network (BP Neural Network). It is based on
is the gas constant of air. the error back propagation algorithm and is widely used in
For the greenhouse temperature, there are many influencing scientific research and industry. In the process of sensor acquisi-
factors involved, we ignore the factors that have little influence tion error compensation network construction for autonomous
on the greenhouse temperature, and replace some variables with non-linear system, the data of sensor observation and true
the actual measured average value, and sort out the formula (2). value such as the AD value of temperature sensor and the
observed values of corresponding standard temperature instru-
dti 𝜂 ment in autonomous greenhouse system, or the sensor speed
= −Y1ti + ⋅ Ht (t − td ) + Y2 (2) and standard speed of the mobile robot, are used to train BP
dt 𝜌C p hAs
neural network. A three-layer BP neural network is constructed
to compensate the sensor acquisition error. Among them, the
In the formula (1), Y1 is the estimated value of relevant fac-
input layer is the sensor detection data, the output layer is the
tors such as temperature; Y2 is the mean of observed data; 𝜌 is
compensated and corrected data. The hidden layer unit number
the air density; h is the greenhouse temperature; As is the floor
is usually calculated by empirical formula as follows:
area inside the house; Ht is the indoor humidity at the current
temperature. √
In order to obtain the transfer function of the greenhouse l = n+m +a (5)
temperature, we perform Laplace transformation on the above
formula, and get the formula (3): In formula (5), where l is the number of hidden layer units; n
is the number of output layer units; m is the number of input
T (s ) Ke−td s K e−𝜏td s layer units; a is a constant with value range [1, 10]. In the
Gt (s ) = = = t (3)
Ht (s ) Ts + 1 Tt s + 1 process of the sensor acquisition error compensation network
construction, according to the relationship among the AD value
Formula (3), the transfer function of the greenhouse can be of the sensor, its value range and the true value observed by
regarded as a first-order inertial lag model, K is the gain, T is the standard high-precision instrument, a three-layer BP neu-
the time constant, and 𝜏 is the time lag. Similarly, the trans- ral network is established. In the network, the output layer is
fer functions used to describe the humidity in greenhouses are the corrected value. The sensor error compensation structure
all first-order large inertia hysteresis models, and we get the of BP neural network as shown in Figure 1. In different non-
formula (4). linear systems, usually the used sensor types are different, but
the nonlinear characteristics of most sensors will increase the
Kh e−𝜏hd s difficulty of displaying and processing signals. Large non-linear
Gh ( s ) = (4)
Th s + 1 errors would appear if directly using linear method to calculate
sensor observed value. To solve this problem, firstly BP neu-
Afterwards, K, T, and 𝜏 of Gt (s) and Gh (s) were calculated ral network is used to compensate the nonlinear sensor error
by using the MATLAB cftool tool based on the actual data of to obtain higher compensation accuracy, and then BP neu-
the greenhouse. Obtain the mathematical model of temperature ral network is to couple with the particle swarm optimization
and humidity. algorithm described below to optimize the PID control effect.
4 WU ET AL.

2.3 Particle swarm optimization algorithm 2.4 Particle swarm optimization BP-PID
(PSO-BP-PID)
The particle swarm optimization (PSO) algorithm was pro-
posed by two American experts, referred to as PSO algorithm. The basic workflow of PID control based on BP neural network
In the particle swarm optimization algorithm, each particle is: after entering the error value into the BP neural network, the
will calculate its own new position by combining its own neural network adjusts the proportional constant KP , integral
velocity, position movement experience and the velocity and time constant KI and differential time constant KD according
position movement experience of neighbouring particles, so to the internal learning algorithm and feeds back to the con-
as to get closer to the target position. The particle swarm trolled object. After continuous learning, when the error value
optimization algorithm is mainly composed of three compo- is below the set value or the error is eliminated, the optimal solu-
nents: particle velocity, particle position and fitness function. tion of the nonlinear combination of the three PID parameters
The optimal search model of the PSO algorithm is the is obtained.
velocity-position model. In the PSO algorithm, all particles In this paper, the output of PSO algorithm is used as the
have to go through the self-study phase to obtain the indi- weight and threshold of BP neural network, and then the net-
vidual optimum and the learning phase to obtain the global work is trained. That is, on the basis of determining the structure
optimum. of the neural network, the mapping between inputs and outputs
In the particle swarm of the PSO algorithm, the velocity of is established, and then the error of the neural network output
the particle determines the displacement to search for the opti- is taken as the fitness function of the PSO algorithm, which is
mal solution. A batch of particles randomly drawn from the iterated continuously. Taking the weight connection parameter
training sample is initialized. vij of the input layer and the hidden layer of the BP neural net-
Suppose that the velocity and position of the particle i in n- work, the weight connection parameter wjk of the hidden layer
dimensional space are: and the output layer, the hidden layer threshold 𝜃 and the out-
put layer threshold 𝜎 as the displacement components of each
[ [
vi = vi0 , vi1 , vi2 , ⋯, vin ] , xi = xi0 , xi1 , xi2 , ⋯, xin ] particle in the population, the ith particle in the population can
be expressed as formula (8).
Assume that from the beginning of training to the current
Xi (= (xi0 , xi1 , xi2 , … , xin )
number of iterations, the individual optimal value and the global
optimal value are respectively: = v11 , v12 , v13 , … , vi j , w11 , w12 , w13 , … , w jk (8)
In the iterative process of learning calculation of the PSO 𝜃1 , 𝜃2 , 𝜃3 , … , 𝜃m , 𝜎1 , 𝜎2 , 𝜎3 , … , 𝜎l )
algorithm, the internal parameters of the particles will be
optimized and adjusted, in which the velocity formula is: Thus, the weights and thresholds in the BP neural network
have been initialized to the particle swarm, and the fitness
( ) function is as follows:
vi (r + 1 ) = kvi (r ) + c1t1 pi − xi + c2t2 (g − xi ) (6)
n
∑j

In Equation (6), vi (r) is the current velocity of the ith parti- f (xi ) = (𝜙it − 𝜔it )2 ∕n j (9)
cle; vi (r+1) is the speed at which the ith particle moves from t =1
the current to the next position; c1 , c2 is the normal speed deter-
In Equation (9), n j is the number of samples used in the
mined by the experiment; t1 , t1 is a random number between
experiment; Xi is the position of the ith particle in the particle
[0,1]; r is the number of iterations, k is the particle weight
swarm;𝜑it is the final value of the ith particle in the t th training
value.
sample n j ; wit is the expected output value of the experiment.
The displacement formula is:
The specific calculation steps of PSO-BP-PID control are as
follows: Step1: Initialize the parameters of the PSO algorithm.
xi (r + 1 ) = xi (r ) + vi (r + 1 ) (7) If the number of neurons in the input neural layer, hidden
neural layer and output neural layer of the BP neural network
Particle internal parameters will be updated through repeated are n, l , m respectively, the number of optimizations needs to be
self-study phases and learning phases within the space range N = (n + 1) × l + (l + 1) × m. Then, determine the learning
where the solution can be obtained, until the specified number factor, particle swarm size and other parameters of the PSO
of iterations or error range is reached. Firstly, the particle fitness algorithm. Step2: Solution of fitness function value. Calculate
is calculated by combining the fitness function, the velocity and the solution of the fitness function value according to the fit-
the position of the particle. Then the individual optimal value ness function: After subtracting the output of the network from
and the global optimal value is calculated, and the parameters the expected value, take its absolute value, and then sum the
of these two extreme values are continuously updated through absolute values of these series of errors. Step3: The search for
iterative calculations. Last, when the extreme values reach the group extremum and individual extremum. The group extreme
specified number of iterations or error range, the algorithm will value is compared in the whole particle swarm, comparing the
end. global extreme value with the optimal individual extreme value
WU ET AL. 5

Step 1: Establish a mathematical model of the target tem-


perature and humidity, determine the controlled object
of the system (air conditioner, humidifier/dehumidifier)
through the established mathematical model. according
to different controlled objects and actuators of the sys-
tem, BP neural networks are established by using sensor
observation values and specific truth values (measured
by high-precision measuring instruments) respectively,
to determine the number of elements in the network
input and output layer and the hidden neural layer, and
to import data for training, so as to compensate the
errors of different sensors and obtain sensor data of
higher precision system.
Step 2: Initialize the relevant parameters of the PSO algo-
rithm of the system, input samples to calculate the
particle fitness, find the individual extremum and group
extremum, thereby updating the particle position and
velocity, and then continuously iterate to find the global
optimal particle position, revising the shortcomings of
BP neural network that is prone to fall into the local
optimum, to get the optimal BP neural network weights
FIGURE 2 The structure of BP PID control of particle swarm. and thresholds. Therefore, the PSO-BP algorithm for
different autonomous systems is constructed, and then
the PID parameters of the actuator controller of the
controlled object are adjusted in real time through this
calculated currently, and taking the extreme value with smaller algorithm.
fitness value as the new group extreme value.Step4:According Step 3: Inputting the PSO-BP algorithm into the IPC
to Equations (8) and (9), the particle velocity parameters and (Industrial Personal Computer), the PID parameters cal-
displacement parameters are continuously updated. Step5: culated by the algorithm are applied to each actuator of
When the training reaches the maximum number of iterations the system, and the output of the system is controlled
or the fitness function error is less than the set error, output the by the PCL controller. Under the coordination of differ-
results at this time, otherwise return to step 2. ent controllers, the stability of the non-linear system is
Call the newff() function to establish the neural network model adjusted to improve the control accuracy of the system.
in MATLAB, and set the input layer nodes to 3i + 1, which is
respectively the expected value Ei, the actual value Ri, the devi-
ation value Di and the offset value 1; The number of output 3 EXPERIMENT
layer nodes is 3i, which are PID control parameters kpi , kii and
kdi acting on different sensors; The number of neurons in the 3.1 Experiment platform
hidden layer was set to 3i + 2. The overall structure is shown in
Figure 2. In the Autonomous greenhouse of South China Agricultural
University, the autonomous non-linear system was tested based
on the PSO BP neural network PID algorithm designed above.
2.5 PSO-BP-PID actuator control process The greenhouse is a solar greenhouse surrounded by aluminium
alloy foam composite deck, concrete and insulating glass, with
In order to obtain the higher control accuracy of autonomous good sealing and thermal insulation. The greenhouse scale is 3
system, the parameters of PID will be adjusted in real time × 5 × 2 m, the schematic diagram of its working structure as
by combining PSO algorithm, BP neural network algorithm shown in Figure 3. In this system, temperature, humidity, CO2
and PID control system with the learning ability of BP neural and light sensors are integrated, and different crop mathematical
network, and the global search ability of particle swarm opti- model control sensors are used to build a suitable crop growth
mization algorithm will be used to improve the disadvantage environment, thus forming a complex non-linear system. Here,
that BP neural network is easy to fall into local optimization, so we used temperature factors and humidity factors to verify the
as to improve the overall control accuracy of the autonomous algorithm.
system. In order to solve the problem that the parameters In order to build a BP neural network sensor error compen-
of multi actuator PID control system are fixed and cannot sation model, it is necessary to collect accurate temperature and
be adjusted during operation, we propose a temperature and humidity data through high-precision equipment as the true
humidity PSO-BP-PID control process for the autonomous value of the training network, and build a BP neural network
greenhouse system. The specific control process is as follows: training model with the observed values collected by the sensor.
6 WU ET AL.

FIGURE 3 Schematic diagram of the test greenhouse environment.

So, the temperature and humidity sensor compensation data through the human-computer interface. The PLC controls the
acquisition experiment were carried out in a constant tempera- execution equipment.
ture and humidity box (model: Climacell 222L, Germany), and The sensor data and target set value of PLC can be read by
the box is shown in Figure 4. The performance parameters of the industrial computer through reading the protocol. After the
the constant temperature and humidity chamber are as follows, industrial computer obtains the optimal solution by running the
temperature control range: 0–99◦ C; temperature control accu- algorithm, it transmits the PID parameters to the PLC through
racy: ±0.1◦ C; humidity control range: 10−−95% RH; humidity writing the protocol. The PLC controls with the latest PID
control accuracy: ±1.5%. The remaining equipment includes parameters. Adjust the greenhouse temperature in real time by
PLC programmable controller, constant temperature and controlling the central air conditioner and ventilation fans, and
humidity chamber, temperature sensor, standard temperature adjust the humidity in the greenhouse in real time by controlling
meter and standard humidity meter. the humidifier and dehumidifier.
The internal equipment includes: industrial personal com- The system then controls the Air conditioner, skylight,
puter, central air conditioner, transformer box integrated with exhaust fan and humidifier to adjust the temperature and
Delta 32ES00T PLC, and humidifier HQ-JS825. The trained humidity of the greenhouse. The framework of greenhouse
PSO-BP-PID algorithm and BP sensor compensation model distributed system is shown in Figure 4.
are built in the IPC. The sensor observation parameters are
passed into the IPC to calculate the optimal parameters, and the
optimal parameters are transferred to the PLC central process- 3.2 Experimental parameters
ing unit. Finally, the PLC controls the actuator to optimize the
greenhouse environment. In the construction of the temperature and humidity sen-
The industrial personal computer interacts with the PLC data sor error compensation network, according to the relationship
through the Modbus read-write protocol. The PLC connects between the AD value of the temperature and humidity sensor
with the temperature and humidity sensor and reads its data. and the observed value of the corresponding standard tempera-
The set target values of temperature and humidity are read ture and humidity instrument, a three-layer BP neural network is
WU ET AL. 7

FIGURE 4 The framework of greenhouse distributed system.

established to compensate the acquisition error of the tempera- number of iterations r as 50, and the minimum particle weight
ture and humidity sensor, and the input layer is the temperature value k as 0.3 and the maximum as 0.9. Therefore, a control
and humidity value of the sensor, the output layer is the tem- algorithm suitable for autonomous greenhouse is constructed.
perature and humidity value after compensation and correction,
the output layer has two nodes (temperature and humidity AD
value), 8 neuron nodes are selected as the hidden layer, and the 3.3 PLC Actuator control system in
output layer is the compensation and correction temperature greenhouse
and humidity values.
In the control of autonomous greenhouse systems, the non- After the PSO-BP-PID and BP compensation algorithm model
linear characteristics of the temperature sensor will increase was established, the temperature and humidity data collected
the difficulty of displaying and processing temperature signals, by the sensor are input into the algorithm model to calcu-
which will result in observation errors. Similarly, the display of late and optimal the PID control parameters. After optimizing
relative humidity is greatly affected by temperature, so it is nec- these parameters, we need to use these parameters to con-
essary to add temperature conditions to the error compensation trol each actuator of the temperature and humidity in the
for the humidity sensor to obtain higher accuracy of compensa- greenhouse environment real-time. Therefore, the industrial
tion. First of all, using the BP neural network to compensate the controllers are needed as the intermediary of the embedded
non-linear error of the temperature and humidity sensor. algorithm model calculation computer to control the green-
Based on the compensation of the BP algorithm, we estab- house actuators. The traditional controller mainly relies on the
lished a neural network model and set the input layer nodes combination of different relays, the connection method is com-
to 7, which is respectively the expected temperature value, the plicated, the follow-up maintenance cost is high, and its stability
actual temperature value, the temperature deviation value, the is difficult to meet the requirements in the complex environ-
expected humidity value, the actual humidity value, the humid- ment of the greenhouse. The PLC controller is very stable and
ity deviation value and the offset value 1; the number of nodes in has strong anti-interference ability. Compared with general con-
the output layer was set to 6, which is PID parameters kpt ,kit , trollers, it can be used in extremely harsh environments and is
kdt for controlling temperature and PID parameters kph , kih , more stable. Therefore, here we use the PLC controller as the
kdh for controlling humidity; the number of neurons in the hid- algorithm model subsequent process to control the actuator of
den layer was set to 8. It can be concluded that the BP neural the greenhouse, and builds the corresponding control program
network adopts a 7-8-6 structure. The network weight uses the and interface of the system.
random value on [−1,1] as the initial value, and the learning The PLC processor selected in this paper is Delta 32ES00T,
rate was set to 0.3. Then, according to the principle of PSO with a maximum of 16 points of input and 256 points of
algorithm, set the learning factors c1 and c2 as 2, the maximum output, a program capacity of 16,000 steps, a data register
8 WU ET AL.

FIGURE 5 PLC program design flowchart.

size of 10,000 words, and a maximum PLC execution speed


of 0.35 𝜇s. For large programs, it can provide efficient pro-
cessing capability of processing 1000 steps in 1 ms, and also
provide protection for temperature and humidity data and
carbon dioxide concentration data collected by sensors in
greenhouse.
The PLC controller needs to receive the optimized param-
eters of the PSO-BP-PID and BP compensation algorithm
model in the IPC, and start the greenhouse equipment to regu-
late the temperature and humidity in the environment according
to the setting target temperature and humidity. At the same time,
it should monitor the operation of each equipment. When the
equipment fails, the operation of the equipment can be stopped
to prevent accidents. The flowchart of PLC program design is
shown in Figure 5. FIGURE 6 PLC temperature and humidity PID control program.
According to the control process, when the three parameters
of PID optimized by the model are input to the PLC controller,
the PID program in the PLC controller adjusts the work of the the construction of the PCL control greenhouse system, as
actuator in real time according to the inputting target tempera- shown in Figure 8.
ture and the current temperature detect by the sensor, and the
temperature PID program controls the central air conditioner
or ventilation fan, humidity PID program control humidifier or 3.4 Analysis of results 1
dehumidifier, the temperature and humidity PID control pro-
gram in PLC is shown in Figure 6. At the same time, the upper Use the error compensation platform to collect temperature
computer of the greenhouse system is designed to provide data. When measuring the temperature data, the data should
target temperature and humidity input and monitoring. Its func- be stable at the set temperature for 5 min before reading. In
tions include the control of temperature start and adjustment, addition, the data for the error compensation can be obtained
the control of humidity start and adjustment, the monitoring after ten times of data measurement in ten repeated tests and
of environmental factors such as temperature, humidity and the average operation of the ten times of data. In this experi-
carbon dioxide, display the temperature and humidity control ment, the data read are the temperature data displayed by the
curves, etc., as shown in Figure 7 shown. standard thermometer and the AD values after AD conversion
After the PLC controller program and the upper computer to the temperature analog signal after the PLC is connected to
program are designed, the PLC calculation processing unit, the temperature sensor. The experimental data are shown in
input device, electric box relay etc. are integrated to complete Table 1.
WU ET AL. 9

FIGURE 7 Upper computer interface.


FIGURE 9 Comparison of temperature error compensation between
linear model and BP neural network model.

FIGURE 8 Greenhouse PLC control system construction.


FIGURE 10 Comparison of temperature error compensation between
linear model and BP neural network model.
TABLE 1 Comparison of temperature sensor compensation model results
and display values.
TABLE 2 Comparison of temperature sensor compensation model results
BP (Back- and display values.
AD (Analog- Propagation)
to-Digital) Standard compensation BP
value value Linear model model Temperature AD Standard Linear compensation
Range/◦ C Value value /%RH model %/RH Mode /%RH
/◦ C /◦ C /◦ C
6340 33.5 33.33 33.57 15 5282 35 35.92 34.92

6160 31.5 31.22 31.49 15 9209 65 66.55 65.21

6084 30.7 30.33 30.55 20 5342 35 36.39 35.46

6061 30 30.06 30.27 20 9218 65 66.62 65.56

5973 29 29.03 29.17 25 5358 35 36.51 35.69

5465 23.5 23.08 23.5 25 9233 65 66.74 65.91

4998 19.5 17.62 18.86 30 5170 35 35.04 34.42

4783 15.5 15.11 16.27 30 9120 65 65.85 65.18

4447 12 11.17 11.71 35 5255 35 35.71 35.18

4186 8.5 8.12 8.26 35 9092 65 65.64 65.10


10 WU ET AL.

The BP neural network is used to compensate the error


between the AD value of the temperature sensor and the cor-
responding temperature value. According to the relationship
between the AD value of the temperature sensor and the
observed temperature value of corresponding, the structure
of BP neural network is three layers (input layer-hidden layer-
output layer), with 1 input node, 8 hidden layer nodes, and 1
output node. The learning rate was set to 0.01, and the maxi-
mum number of iterations is 5000 (it is found that the accuracy
will decrease when the number of iterations is greater than 5000
through multiple experiments). The target error was set to 1
× 10−2 . Divide the temperature data measured in the experi-
ment into a training set and a test set in a ratio of 9:1, normalize
the data, and use the training set to input the BP neural net-
work training to obtain the sensor error compensation model FIGURE 11 Comparison of Humidity Error Compensation between
Linear Model and BP Neural Network Mode.
of BP neural network, and then the test set is used to verify
the model. After using the verified model input test sample to
predict and output the temperature, summarize the data of tem-
perature measurement, the BP neural network prediction output
and the linear model comparison as shown in Figure 9.
After using the linear model to predict the display value of
the temperature sensor, compare the prediction results of the
temperature sensor’s error compensation model of BP neural
network with the temperature display value of the linear model.
The comparative analysis is shown in Figure 10. It can be seen
from the figure that the temperature prediction value of the
error compensation model of the BP neural network temper-
ature sensor is closer to the standard value, the error of the
temperature prediction value is smaller than that of the linear
model, and the compensation accuracy of temperature sensor’s
error compensation model of BP neural network is higher than
that of the linear model, it show that the compensating effect
of the BP neural network error compensation model is better. FIGURE 12 Comparison chart of relative error absolute value of
humidity sensor between BP neural network and linear mode.
After summing and averaging the absolute values of the rel-
ative errors obtained from the compensation results of the
temperature sensor’s error compensation model of BP neural The humidity data measured in the experiment is divided into
network and the linear model, it can be seen that the maximum training data and test data at a ratio of 9:1, normalize the data,
relative error of the BP neural network error compensation the training set input into the BP neural network for training
model is 4.97%, the average absolute value of the relative error to obtain the BP neural network humidity sensor’s error com-
is 1.37%, the average absolute value of the absolute error is 0.29, pensation model, and then the test data is used to verify the
while the maximum relative error of the linear model is 9.62%, model. The test samples input into the validated model to pre-
the average absolute value of the relative error is 2.69%, and the dict the humidity, the humidity prediction output results at 25◦ C
average absolute value of the absolute error is 0.51. It can be are shown in Figure 11. The curve of the compensation model
concluded that the BP neural network temperature sensor error almost coincides with the training data used in the test, indi-
compensation model has higher accuracy than the commonly cating that the error between the humidity sensor display value
used linear model. predicted by BP neural network model and the actual standard
The BP neural network is used to compensate the error value is smaller by using the BP neural algorithm. Compared
between the AD value of the humidity sensor and the with the linear model, the humidity sensor value predicted by
corresponding observed humidity value. According to the rela- the error compensation model of BP neural network has smaller
tionship between the AD value, temperature range and the error and higher accuracy.
corresponding observed value of the humidity sensor, the struc- After using the linear model to predict the display value
ture of the BP neural network was set to three layers (input of humidity sensor, compares with the prediction results of
layer–hidden layer–output layer), with 2 input nodes (temper- the humidity display value of the error compensation model
ature and humidity AD value), 8 hidden layer nodes, 1 output of BP neural network and the linear model, as shown in
node, a learning rate was set to 0.08, a maximum number Figure 12. After the humidity sensor is compensated by the
of iterations are 48,000, and a target error is 1 × 10−2 . The error compensation model of BP neural network, the error
experimental data are shown in Table 2. of humidity prediction is obviously less than that of linear
WU ET AL. 11

FIGURE 13 Particle swarm optimization BP neural network PID temperature and humidity control and PID control temperature curve comparison.

model. After summing and averaging the absolute values of temperature control is smaller, the steady state can be formed
the relative errors obtained from the compensation results of faster, and the maximum error in the steady state is only 0.5◦ C,
the BP neural network model and the linear model, it can be the rise time is shortened by 16.7%, the overshoot is reduced by
seen that the absolute value of the maximum relative error 33.3%, the maximum absolute error is reduced by 37.5%, and
of the BP neural network compensation model is 4.11%, the the temperature control effect is better. Compared with PID
average absolute value of the relative error is 0.97%, the average humidity control, the PSO-BP-PID humidity control curve is
absolute value of the absolute error is 0.32, and the absolute smoother, the response speed is faster, and it can form the
value of the maximum relative error of the linear model is steady state of control faster. The maximum error in the steady
4.32%, the average absolute value of relative error is 2.02%, and state is only 1%RH, the rise time is shortened by 11.9%, the
the average absolute value of absolute error is 0.79. Therefore, overshoot is reduced by 16.4%, the maximum absolute error is
the error compensation model of BP neural network is more reduced by 33.4%, and the humidity control effect is better.
accurate than the commonly used linear model.

4 DISCUSSION AND CONCLUSION


3.5 Analysis of results 2
Here, the BP neural network model is used to solve the problem
In order to confirm the effect of PSO-BP-PID algorithm on that it is difficult to describe the nonlinear relationship between
control of temperature and humidity actuator, we use the tradi- different sensors in an autonomous non-linear system. After
tional PID algorithm to control the temperature and humidity using the BP neural network trained the model to compensate
actuator of the greenhouse as a comparison, the experimental the sensor measurement data, the sensor detection error has
time was one hour, and the data were recorded every other been significantly reduced. Therefore, it is feasible to use BP
minute. At this time, the external environment of the green- neural network to approximate the nonlinear mapping relation-
house is 23.6◦ , and the external humidity is 47%RH. The ship and improve the detection accuracy of the sensor from the
temperature of the greenhouse is adjusted in real time by con- angle of error compensation.
trolling the central air conditioner and ventilation fans, and The PSO algorithm, BP neural network and PID algo-
the humidity of the greenhouse is adjusted in real time by rithm is combined to control the autonomous system, and the
controlling the humidifier and dehumidifier. PSO-BP-PID algorithm is verified on the autonomous green-
The target temperature was set to 26◦ C, and the target house system. Using the PSO-BP-PID algorithm applied to the
humidity was set to 40%RH.The temperature and humidity greenhouse system, and compared with the BP-PID control.
curve of the PID control algorithm is compared with curve Through the experiments of comparative, under the tempera-
of the PSO-BP-PID algorithm, compare with temperature and ture and humidity control algorithm of PSO-BP-PID designed
humidity control effects under different control methods, the in this paper, the response speed, overshoot and the time
results of the experiment are shown in Figures 13 and 14. entering the steady state of the greenhouse system has been
It can be seen from the curve in the figure that, compared improved, and the purpose of optimizing the greenhouse tem-
with PID temperature control, the overshoot of PSO-BP-PID perature and humidity control performance has been achieved,
12 WU ET AL.

FIGURE 14 Particle swarm optimization BP neural network PID temperature and humidity control and PID control humidity curve comparison.

which has certain practical application value. It provides a lower and uncertain nonlinearities. IEEE Trans. Ind. Electron. 64(8), 6785–6795
cost and better effect method for the measurement and control (2017)
8. Cui, R., Yang, C., Li, Y., et al.: Adaptive neural network control of AUVs
of a non-linear system in the greenhouse.
with control input nonlinearities using reinforcement learning. IEEE
Trans. Syst. Man Cybern.: Syst. 47(6), 1019–1029 (2017)
AUTHOR CONTRIBUTIONS 9. Li, J., Wang, J., Peng, H., et al.: Neural fuzzy approximation enhanced
Weibin Wu: Resources; Beihuo Yao: Methodology, Writing— autonomous tracking control of the wheel-legged robot under uncertain
original draft; Yaonan Wang: Supervision; Jiaxi Huang: Data physical interaction. Neurocomputing 410, 342–353 (2020)
10. Li, J., Wang, J., Peng, H., et al.: Fuzzy-torque approximation-enhanced slid-
curation; Shunli Sun: Visualization; Fangren Zhang: Investiga-
ing mode control for lateral stability of mobile robot. IEEE Trans. Syst.
tion; Zhaokai He: Formal analysis; Ting Tang: Investigation; Man Cybern.: Syst. 52(4), 2491–2500 (2021)
Ruitao Gao: Funding acquisition. 11. Ramírez-Ochoa, D.D., Pérez-Domínguez, L.A., Martínez-Gómez,
E.A., et al.: PSO, a Swarm intelligence-based evolutionary algo-
CONFLICT OF INTEREST STATEMENT rithm as a decision-making strategy: A review. Symmetry 14(3), 455
(2022)
The authors declare no conflicts of interest.
12. Hongkang, W., Li, L., Yong, W., et al.: Recurrent neural network model for
prediction of microclimate in solar greenhouse. IFAC-PapersOnLine 5117,
DATA AVAILABILITY STATEMENT 790–795 (2018)
Research data are not shared. 13. Wang, W., Xu, L., Hu, H.: Neuron adaptive PID control for greenhouse
environment. J. Ind. Prod. Eng. 325, 291–297 (2015)
14. Wang, H., Sánchez-Molina, J.A., Li, M., Berenguel, M., et al.: Leaf area
REFERENCES index estimation for a greenhouse transpiration model using external cli-
1. Li, J., Dai, Y., Su, X., et al.: Efficient dual-branch bottleneck networks of mate conditions based on genetics algorithms, back-propagation neural
semantic segmentation based on CCD camera. Remote Sens. 14(16), 3925 networks and nonlinear autoregressive exogenous models. Agric. Water
(2022) Manage. 183, 107–115 (2017)
2. Li, J., Zhang, X., Li, J., et al.: Building and optimization of 3D semantic 15. Leng, L., Wu, W.B., Zhang, W.J., et al.: Variable coordinated control method
map based on Lidar and camera fusion. Neurocomputing 409, 394–407 of multi greenhouse Internet of Things group control terminal based on
(2020) improved PSO algorithm. J. Chin. Agric. Mechanization 42(01), 179–185
3. Nguyen, N.T.: Lyapunov stability theory. In: Model-Reference Adaptive (2021). https://doi.org/10.13733/j.jcam.issn.2095-5553.2021.01.025
Control: A Primer, pp. 47–81, Springer, Cham (2018) 16. Pérez-González, A., Begovich-Mendoza, O., RuizLeón, J.: Modeling of
4. Lee, J.Y., Jung, K.D., Cho, S., et al.: Nonlinear time-varying control based a greenhouse prototype using PSO and differential evolution algorithms
on differential geometry. Int. J. Internet Broadcasting Commun. 6(2), 1–9 based on a real-time LabView™ application. Appl. Soft Comput. 62,
(2014) 86–100 (2018)
5. Alyoussef, F., Kaya, I.: A review on nonlinear control approaches: sliding 17. Iddio, E., Wang, L., Thomas, Y., et al.: Energy efficient operation and mod-
mode control back-stepping control and feedback linearization control. eling for greenhouses: A literature review. Renewable Sustainable Energy
In: International Engineering and Natural Sciences Conference (IENSC Rev. 117, 109480 (2020)
2019), Diyarbakir, Turkey, pp. 608-619 (2019) 18. Goodchild, M.S., Jenkins, M.D., Whalley, W.R., et al.: A novel dielectric
6. Mo, H., Farid, G.: Nonlinear and adaptive intelligent control techniques tensiometer enabling precision PID-based irrigation control of polytunnel-
for quadrotor UAV–A survey. Asian J. Control 21(2), 989–1008 (2019) grown strawberries in coir. Biosyst. Eng. 165, 70–76 (2018)
7. Cui, R., Chen, L., Yang, C., et al.: Extended state observer-based integral 19. Castañeda-Miranda, A., Castaño, V.M.: Smart frost control in greenhouses
sliding mode control for an underwater robot with unknown disturbances by neural networks models. Comput. Electron. Agric. 137, 102–114 (2017)
WU ET AL. 13

20. Habaragamuwa, H., Ogawa, Y., Suzuki, T., Shiigi, T., et al.: Detecting 26. Lalwani, S., Sharma, H., Satapathy, S.C., et al.: A survey on parallel particle
greenhouse strawberries (mature and immature), using deep convolutional swarm optimization algorithms. Arab. J. Sci. Eng. 44(4), 2899–2923 (2019)
neural network. Comput. Electron. Agric. 113, 127–138 (2018) 27. Yandong, J.: Research and Implementation of Temperature and Humidity
21. Wang, J.: Analysis of sports performance prediction model based on GA- Intelligent Control Strategy in Greenhouse. Shenyang University (2021)
BP neural network algorithm. Comput. Intell. Neurosci. 2021, 4091821 https://doi.org/10.27692/d.cnki.gsydx.2021.00106
(2021)
22. Chen, C.P., Wen, G.X., Liu, Y.J., et al.: Adaptive consensus control for a
class of nonlinear multiagent time-delay systems using neural networks.
IEEE Trans. Neural Networks Learn. Syst. 25(6), 1217–1226 (2014)
23. Liu, Y.J., Li, J., Tong, S., et al.: Neural network control-based adaptive learn-
ing design for nonlinear systems with full-state constraints. IEEE Trans. How to cite this article: Wu, W., Yao, B., Huang, J.,
Neural Networks Learn. Syst. 27(7), 1562–1571 (2016) Sun, S., Zhang, F., He, Z., Tang, T., Gao, R.: Optimal
24. Li, J., Wang, J., Wang, S., et al.: Human–robot skill transmission for mobile temperature and humidity control for autonomous
robot via learning by demonstration. Neural Computing and Applications, control system based on PSO-BP neural networks. IET
1–11 (2021)
Control Theory Appl. 1–13 (2023).
25. Elbes, M., Alzubi, S., Kanan, T., et al.: A survey on particle swarm opti-
mization with emphasis on engineering and network applications. Evol. https://doi.org/10.1049/cth2.12467
Intell. 12(2), 113–129 (2019)

You might also like