1. Introduction
In China, the use of traditional methods to irrigate crops is prone to the problem of water abuse and China’s fertilizer use rate ranks first in the world all the year round, but the utilization rate of chemical fertilizers is not high. The integrated water and fertilizer technology is a new technology that combines irrigation and fertilization. According to the nutritional needs of crops, the pH value of liquid fertilizers is precisely regulated so that the roots of crops can fully absorb nutrients [
1]. This technology can effectively reduce the pollution of fertilizers to soil and groundwater, and protect the ecological environment [
2].
However, there is often a time lag in the process of pH adjustment, and the change in pH value of liquid fertilizer is also nonlinear. Therefore, how to quickly and accurately adjust the pH value of fertilizer to an appropriate range in the process of fertilization is the key research field of water fertilizer integration technology [
3]. E. Ali et al. [
4] proposed an adaptive PI algorithm that uses a simple process model to predict the pH closed-loop response and its sensitivity to PI parameter settings, and finally, the obtained information was directly used to adjust the PI controller parameters on-line. G.Balasubramanian et al. [
5] proposed an adaptive control scheme based on Recurrent Neural Network (RNN). The scheme included an on-line adaptive RNN estimator and RNN controller, and the estimator weights were updated recursively by back-propagation algorithm. The controller weights were corrected by the steepest descent method. The proposed scheme was compared with the model-based IMC controller, and the results showed that the RNN-based controller had better performance in the nonlinear pH neutralization process.
Homero J. Sena et al. [
6] used a real-time adaptive algorithm based on the Extended Kalman Filter (EKF) to correct the artificial neural network predictions at process runtime, which reduced the sum of squared errors in pH by 64.3% compared to the MPC of the artificial neural network without model adaptation. Douglas Alves Goulart and Renato Dutra Pereira [
7] developed a Continuous Stirred-Tank Reactor (CSTR) neutralization simulator and an adaptive Particle Swarm Optimization (PSO) algorithm for automatic selection of Reinforcement Learning hyperparameters. During regulation and servo operation, the controller stabilized the effluent pH in the neutral range better than the PID controller. Shahin Salehi et al. [
8] proposed an adaptive control scheme for pH value based on a fuzzy logic system and verified the effectiveness of the controller through simulation and experimental research. The results showed that the controller performed well in setpoint tracking and was much better than the PI controller. Hui Wu et al. [
9] proposed a predictive control method based on Decentralized Fuzzy Inference (DFIPC), which locally linearized the nonlinear object model and predicted the future output of the control object according to its step response model. The method was applied to the pH neutralization process. The results showed that the method had better robustness than traditional model predictive control.
In the industrial field, Smith prediction compensation is mainly used to solve the pure lag of the system [
10]. Guangda Chen [
11] proposed a Smith predictor combined with Linear Active Disturbance Rejection Control (LADRC) and analyzed the stability of the Smith + LADRC time-delay control system from a theoretical point of view. Simulation and experimental results showed that the algorithm was superior to the traditional method in terms of overshoot and response time. Mahmoud Gamal et al. [
12] combined the classical Smith predictor and the adaptive Smith predictor in a networked control system and compared it with other delay compensation schemes. The results showed that the scheme significantly improved the performance of the networked control system and reduced the impact of delay on the system. Chenkun Qi et al. [
13] proposed a hybrid Smith predictor and phase lead compensation method. This method can achieve higher simulation fidelity with less convergence. The effectiveness of the compensation method was verified by the simulation of the undamped elastic contact process. Yonghui Nie et al. [
14] proposed an optimal wide-area damping controller considering delay, using the Smith predictor to provide delay compensation and using particle swarm optimization to further improve the controller. The simulation results showed that the method improved the delay tolerance of the closed-loop system and improved the dynamic stability of the power system.
In this paper, according to the characteristics of pH value regulation of liquid fertilizers, the prediction compensation controllers based on Smith, PID-Smith and BP-PID-Smith were designed respectively. They were simulated and analyzed under the conditions of model matching and mismatching, and step response curves were obtained respectively. The performance of the three controllers was evaluated from four aspects: rise time, peak time, maximum overshoot, and adjustment time [
15]. The results showed that the control effect of the BP-PID-Smith controller was the best. On this basis, an experimental platform was built to verify the practicability of the algorithm. The results showed that the BP-PID-Smith predictor compensator can effectively solve the adverse effects of the time delay and nonlinearity of the system in the fertilization process, and meet the control requirements for precise regulation of the pH value of liquid fertilizers.
The purpose of this paper is to design a BP-PID-Smith predictive compensation control algorithm, which can quickly adjust the pH value of water and fertilizer to the set value, and effectively solve the problems caused by factors such as time lag and nonlinearity in the pH adjustment process.
The contents of this paper are as follows: The first part introduces the research status of precise pH control and Smith prediction compensation. The second part explains the working principle of the pH regulation system, establishes the dynamic and static model of the pH regulation process, and reveals the nonlinear and time-delay characteristics of the pH regulation process. In the third part, the formulas of the Smith predictor compensator algorithm and BP neural network algorithm are derived, and the simulation models based on Smith, PID-Smith, and BP-PID-Smith predictor compensation are established by using the Simulink module in MATLAB. In the fourth part, the above three models are simulated and analyzed, respectively, and the models are evaluated according to the results. In the fifth part, experiments are carried out to verify the practicability of the controller. The sixth part gives the conclusion.
3. Design and Simulation of BP-PID-Smith Based Controller for pH Regulation System
3.1. Design of Time Lag Compensation for Smith’s Prognosticator Model
PID control can adjust the size of the control quantity in time according to the error between the actual value and the desired value so that the actual value gradually approaches the desired value, which is a kind of closed-loop control with high reliability and robustness and is widely used in industry [
21]. The PID closed-loop control system consists of two parts, the PID controller and the controlled object, as shown in
Figure 3.
The error value
between the expected value
and the actual output value
is obtained; in the second step, the error values obtained are subjected to proportional, integral, and differential operations, and the closed-loop control quantity
is obtained after linear combination; in the third step, the controlled object receives the control quantity
, and the output value
approaches the expected value
to complete the control of the controlled object within the error allowance. The mathematical expression of the control principle is:
where
is the proportionality constant,
is the integration time constant, and
is the differential time constant.
To discretize Equation (21), let
be the sampling period, perform
consecutive samples, and replace the continuous time
with the discrete sampling time point
Bringing Equation (22) into Equation (21) and assuming that
is sufficiently short, Equation (21) can be simplified to:
where
,
, and
are proportional, integral, and differential coefficients,
,
.
In the actual design of the controller, there are inevitably delays, including control delays and sensor delays, which may cause controller instability when the delays are relatively large. Therefore, the effect of delay needs to be considered when designing a controller. Smith predictor, as a classical solution, can offset and compensate for the delay effect of the system, significantly improve the control performance of the time-lag system, and reduce the instability of the system [
22].
Smith’s predictive compensation control structure is shown in
Figure 4.
Where
is the introduced Smith’s prediction compensation transfer function,
is the system with delay model, and
is the main controller transfer function, when the model matches exactly,
and
. The overall closed-loop transfer function of the system at this point is:
The characteristic equation of the system is:
In this paper, the Ziegler–Nichols parameter rectification method is used for the initial rectification of the proportional, integral, and differential constants of the PID, as shown in Equation (26).
The controlled object model in this paper is shown in Equation (20), where = 1.02, = 1.78, = 7.5, and the parameters are brought into Equation (26) to obtain the preliminary rectified values of the proportional, integral, and differential constants calculated by the Ziegler–Nichols method as = 0.28, = 0.02, = 1.05, respectively.
The simulation model of the pH regulation system based on Smith’s prediction compensation is shown in
Figure 5.
3.2. Design of PID-Smith Prediction Compensator
When the model cannot be matched exactly, at this time
,
, the overall closed-loop transfer function of the system is:
From the above equation, it can be seen that when the deviation between the actual model and the theoretical model is large, there is a lag term in the characteristic equation of the system, which makes the Smith controller unable to correct the error between the actual model and the theoretical model even though, which may eventually cause the output signal of the system to oscillate and diverge. Therefore, Smith’s prediction compensation is not suitable for the case where the theoretical model has a large deviation from the actual model.
The PID-Smith prediction control adds a suitable PID compensation controller to avoid the time lag term in the closed-loop characteristic equation and the model mismatch, which eventually leads to the oscillation and divergence of the output signal, thus reducing the effect of the time lag term on the system, and the structure of the PID-Smith prediction compensator is shown in
Figure 6.
Where and together form the compensation controller, is the system with delay model, and is the main controller model.
From
Figure 6, the closed-loop transfer function of the system is:
The characteristic equation of the system is:
If the mode of
is chosen to be small enough, then:
At this point the system characteristic equation simplifies to
From the above equation, it can be seen that the system stability is not affected by the time lag of the compensating controller and the controlled object, and the system characteristic equation does not contain the time lag term.
The simulation model of the pH regulation system based on PID-Smith prediction compensation is shown in
Figure 7.
3.3. Design of BP-PID-Smith Prediction Compensator
Because the pH control system in this paper is a large time-delay system, and the traditional PID control is easily affected by time-delay, it cannot be optimized and adjusted according to the overall changes of the system. Therefore, this paper combines BP neural network with traditional PID control, designs a predictive compensator based on BP-PID-Smith, reduces the impact of time delay on the system, improves its learning efficiency by optimizing PID controller parameters, and realizes the parameter tuning of the control system.
The structure of the PID control system based on the BP neural network is shown in
Figure 8.
The structure consists of a conventional PID and a BP neural network. The conventional PID realizes the closed-loop feedback control of the controlled object, and the BP neural network finally obtains the optimal PID control parameters of the system by continuously updating iterations according to the system state and learning algorithm. The neural network structure in
Figure 8 is shown in
Figure 9 below.
The neural network consists of an input layer, an implicit layer, and an output layer, in which the input layer contains three neurons, and the inputs are , , and ; to reduce the complexity of the system and improve the learning efficiency, the number of neurons in the implicit layer is set to five; the output layer contains three neurons, and the outputs correspond to the three parameters of the PID controller, , , and , respectively.
A neural network structure based on 3-5-3, where the input layer inputs are:
is the number of neurons in the input layer.
The implicit layer inputs and outputs are:
where
is the number of neurons in the hidden layer and
is the hidden layer connection weight,
.
The output layer inputs and outputs are:
where
is the number of neurons in the output layer and
is the output layer connection weight,
.
The control quantity
of the PID controller is calculated according to Equation (23),
,
, and
are
,
, and
as found in Equation (37). The selected performance metrics have the following functional form:
The gradient descent method is used to continuously and iteratively update the connection weights between the neurons in the neural network so that the error signal decreases in the negative gradient direction. In addition, to speed up the convergence of the BP neural network algorithm and to obtain better dynamic properties, an inertia term is added to obtain a new update of the output layer connection weights when the learning rate is
.
where
is the inertia factor.
can be split into:
After performing a series of simplifications, the updated output layer connection weights after learning by the neural network are obtained as:
Similarly, the update of the connection weights of the hidden layer after learning can be obtained as:
The mathematical model for adding BP neural network is established above.
The PID main controller parameters are fine-tuned and the compensation controller is written using the BP-PID algorithm with the S-Function in the Simulink module, and the error between the actual model and the theoretical model is used as the input to the BP-PID algorithm.
The simulation model of the pH regulation system based on BP-PID-Smith prediction compensation is shown in
Figure 10.
6. Conclusions
For the liquid fertilizer pH regulation system, this paper fitted its mathematical model, got the transfer function of the pH regulation system, combined BP neural network algorithm with the Smith prognosticator, designed a BP-PID-Smith prognostication compensation controller, and compared the performance of three controllers, BP-PID-Smith, PID-Smith, and Smith, in both simulation and practical application. The results showed that the BP-PID-Smith predictive compensation controller was able to bring the pH to the set value at a faster rate in both cases with a smaller overshoot compared to the other two controllers.
According to the experiments, the BP-PID-Smith controller showed excellent dynamic performance at different fertilizer application flow rates and was able to respond to the input signal at a faster rate and achieve the desired target pH value. The average maximum overshoot was 0.27% and the average regulation time was 71.39 s, which was significantly better than the PID-Smith and Smith controllers.
The BP-PID-Smith predictive compensator can reduce the adverse effects of the system in the fertilization process due to time lag and nonlinearity in practical applications while possessing excellent dynamic performance and robustness to meet the control requirements in practical applications.