Next Article in Journal
Asymmetric Quantum Multicast Network Coding: Asymmetric Optimal Cloning over Quantum Networks
Next Article in Special Issue
Real-Time Strawberry Plant Classification and Efficiency Increase with Hybrid System Deep Learning: Microcontroller and Mobile Application
Previous Article in Journal
Game-Theory-Based Task Offloading and Resource Scheduling in Cloud-Edge Collaborative Systems
Previous Article in Special Issue
CFD Analysis and Validation of a Foreign Material Winnowing Machine for Pepper Harvester
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Design and Application of Liquid Fertilizer pH Regulation Controller Based on BP-PID-Smith Predictive Compensation Algorithm

School of Mechanical and Electrical Engineering, Shihezi University, Shihezi 832003, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2022, 12(12), 6162; https://doi.org/10.3390/app12126162
Submission received: 11 May 2022 / Revised: 7 June 2022 / Accepted: 16 June 2022 / Published: 17 June 2022
(This article belongs to the Special Issue Engineering of Smart Agriculture)

Abstract

:
The pH value of liquid fertilizer is a key factor affecting crop growth, so it is necessary to regulate its pH value. However, the pH regulation system has the characteristics of nonlinearity and time lag, which makes it difficult for the conventional controller to achieve accurate pH control. By analyzing the regulation process, this paper designs a BP-PID-Smith prediction compensator, which compensates for the error between the actual model and the theoretical model and improves the control accuracy. The pH regulation system with STM32F103ZET6 as the control core was also developed, and the performance tests were carried out under different flow rates to compare with the regulation system of PID-Smith and Smith algorithms. The experimental results showed that the maximum overshoot of the BP-PID-Smith prediction compensator was 0.27% on average, and the average adjustment time for pH value reduction from 7.5 to 6.8 was 71.39 s, which had good practicality and robustness to meet the actual control demand.

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.

2. Introduction of pH Value Regulation System and Analysis of Regulation Process

2.1. pH Control System Structure Composition

Figure 1 is the structural block diagram of the pH value regulation system of liquid fertilizer. The regulation system includes a water storage tank, solenoid valve, fertilizer tank, regulating liquid tank, flowmeter, pH value sensor, hose pump, mixing tank, and other main devices. The liquid in the water storage tank, fertilizer tank, and regulating liquid tank finally flows into the mixing tank and is stirred inside. A pH sensor is installed inside the mixing tank to monitor the pH value. The outlet of the mixing tank is connected with the field drip irrigation belt to transport the adjusted fertilizer to the field. The dilution ratio of liquid fertilizer is set to 1:8, the pH value of fertilizer before dilution is 7.5, and dilute hydrochloric acid with a concentration of 0.2 mol/L is used as the regulating liquid. Flowmeter and pressure gauge are installed at the inlet and outlet of the mixing tank. The hose pump is used as the conveying device of the regulating system. The three-phase asynchronous motor is connected with the pump body of the hose pump. The pressure formed by squeezing the hose by the roller is used to transport the materials. The system adjusts the outlet flow of the hose pump by changing the frequency of the frequency converter connected with the hose pump, to accurately adjust the pH value.
In this paper, the STM32F103ZET6 microcontroller is used as the control core, and the BP-PID-Smith prediction compensation algorithm is written in it. The set pH value is used as the input value, and the pH value of the liquid fertilizer collected by the pH sensor is used as the actual feedback value for calculation. The required regulating liquid flow is calculated, and the flow is converted into the working frequency of the hose pump, to achieve the purpose of efficiently regulating the pH value of liquid fertilizer.
When the pH value regulation system of liquid fertilizer is working, the monitoring end will input the set pH value of liquid fertilizer and fertilization flow into the system, the hose pump at the fertilizer tank and the hose pump at the water storage tank will pump liquid fertilizer and water to the mixing tank in corresponding proportion for mixing. When the regulation system monitors the pH value in the mixing tank and the set value, the solenoid valve opens and the hose pump at the regulating liquid tank starts to run to extract the regulating liquid into the mixing tank, and the stirring pump stirs the liquid in the mixing tank, and when the regulation system monitors the pH value of liquid fertilizer in the mixing tank reaches the set value, the system maintains a stable state.

2.2. Analysis of Liquid Fertilizer pH Regulation Process

Usually, water and liquid fertilizer are weakly basic, while the regulating liquid generally uses dilute hydrochloric acid. Therefore, the mixing of fertilizer, regulating liquid, and water can be considered a neutralization process of a strong acid and a weak base [16], which can be represented by a static pH equation describing the neutralization titration curve and a dynamic equation describing the state variables.

2.2.1. Objective Function and Design Variables

The ionization process of m-membered acid is described below.
First level ionization
H m A H m 1 A + H +
K a 1 = [ H + ] [ H m 1 A ] [ H m A ]
Secondary ionization
H m 1 A H m 2 A 2 + H +  
K a 2 = [ H + ] [ H m 2 A 2 ] [ H m 1 A ]
m-level ionization
H A ( m 1 ) A m + H +  
K a m = [ H + ] [ A m ] [ H A ( m 1 ) ]
The ionization process of n-membered bases in liquid fertilizer can be expressed as:
First level ionization
B ( O H ) n B ( O H ) n 1 + + O H  
K b 1 = [ B ( O H ) n 1 + ] [ O H ] [ B ( O H ) n ]
Secondary ionization
B ( O H ) n 1 + B ( O H ) n 2 2 + + O H  
K b 2 = [ B ( O H ) n 2 2 + ] [ O H ] [ B ( O H ) n 1 + ]
n-level ionization
B ( O H ) ( n 1 ) + B n + + O H  
K b n = [ B n + ] [ O H ] [ B ( O H ) ( n 1 ) + ]
where K b 1 , K b 2 ,…, K b n are the ionization equilibrium constants.
The ionization equilibrium of water can be expressed as:
H 2 O H + + O H  
K w = [ H + ] [ O H ]
where K w = 10−14.
Let x i be the total ionic concentration of the acid or the total ionic concentration of the base in the fertilizer mixture, then
When i is an acid:
x i = [ H m A ] + [ H m 1 A ] + + [ A m ]
When i is a base:
x i = [ B ( O H ) n ] + [ B ( O H ) n 1 + ] + + [ B n + ]
Since the solution must always remain electrically neutral, the charge balance equation yields:
i = a c i d { [ H p i 1 A ] + 2 [ H p i 2 A 2 ] + + p i [ A p i ] } + [ O H ] = i = b a s e { [ B ( O H ) n i 1 + ] + 2 [ B ( O H ) n i 2 2 + ] + + n i [ B n i + ] } + [ H + ]
The pH equation can be derived from Equations (1)–(10) as:
i = 1 n a i ( [ H + ] ) x i + [ H + ] K w [ H + ] = 0
When i is an acid:
          a i ( [ H + ] ) = m i + ( m i 1 ) [ H + ] K a m i + + [ H + ] m i 1 K a 2 i K a 3 i K a m i 1 + [ H + ] K a m i + + [ H + ] m i 1 K a 2 i K a 3 i K a m i + [ H + ] m i K a 1 i K a 2 i K a m i
When i is a base:
a i ( [ H + ] ) = n i [ H + ] n i + ( n i 1 ) K w K b n i [ H + ] n i 1 + + K w n i 1 [ H + ] K b 2 i K b 3 i K b n i [ H + ] n i + K w K b n i [ H + ] n i 1 + + K w n i 1 [ H + ] K b 2 i K b 3 i K b n i + K w n i K b 1 i K b 2 i K b n i
Since the whole pH neutralization process can be considered as the neutralization of a strong acid and a weak base, thus
a 1 ( [ H + ] ) = 1
a 2 ( [ H + ] ) = [ H + ] [ H + ] + K w K b = 1 1 + [ O H ] K b
The above analysis leads to the fact that the pH equation can be rewritten as:
x 1 + 1 1 + 10 p K b + p H 14 x 2 + 10 p H 10 p H 14 = 0
where p K b = log K b , x 1 , x 2 are the total ionic concentrations of acid and base in the fertilizer mix, respectively.
This equation is the static model of pH neutralization.
As can be determined from Equation (16), the control process of pH described by this static equation is strongly nonlinear.

2.2.2. Dynamic Model

Assuming that the liquid volume in the mixing tank is constant and uniformly mixed, ignoring the influence of liquid temperature on pH, the dynamic process of pH neutralization reaction can be represented by a CSTR process [17,18,19]. The dynamic process of acid-base neutralization is shown in Figure 2.
In the figure, V is the mixing tank volume; F w is the irrigation water flow rate; C w is the irrigation water input concentration; F a is the acid flow rate input into the mixing tank; C a is the regulating liquid input concentration; F f is the liquid fertilizer flow rate input into the mixing tank; C f is the liquid fertilizer input concentration; F m is the fertilizer mixture flow rate output from the mixing tank; x 1 , x 2 are the acid and alkali concentrations in the output fertilizer mixture, respectively.
According to the principle of material conservation, the dynamic equation of each state variable is obtained when the fertilizer mixing process reaches equilibrium.
{ V d x 1 d t = F a C a F m x 1 V d x 2 d t = F f C f + F w C w F m x 2
The input and output flows should be dynamically balanced, then:
F m = F a + F w + F f
Equations (16)–(18) together form a mathematical model of the pH neutralization process.
{ x 1 + 1 1 + 10 p K b + p H 14 x 2 + 10 p H 10 p H 14 = 0 V d x 1 d t = F a C a F m x 1 V d x 2 d t = F f C f + F w C w F m x 2 F m = F a + F w + F f
From Equation (19), it can be seen that the mathematical model of the pH neutralization process consists of a static model and a dynamic model, and the dynamic process exhibits a slight nonlinearity, which is negligible when it is assumed that the input flow rate of the liquid fertilizer in the mixing tank is much larger than the input flow rate of the conditioning fluid.
However, Equation (16) expresses the inherent nonlinearity of the pH neutralization process. And in the actual fertilizer mixing process, besides the stirring and mixing process, the delay factors such as the slow flow of liquid in the pipeline and the time lag in the measurement link also have an impact on the pH regulation process.
Therefore, the pH regulation process is characterized by nonlinearity and time lag, which place higher demands on the performance of the controller.

2.2.3. Determination of the System Transfer Function

In this paper, the pH regulation system of liquid fertilizer is studied to analyze the process of pH regulation when mixing fertilizers.
The pH regulation characteristics and the complexity of the model are taken into account, and the mathematical model of the pH regulation system is described using a first-order system transfer function with a delay link [20].
G ( s ) = K e τ s T s + 1
A step response with a pH value of 6.8 was used as the input of the open-loop system. The sampling time interval of the system was set to 1 s. The initial pH value of the liquid in the mixing tank was 7.5, and the data of pH value changing with time was obtained. The first-order approximation method was used to input data into the computer and fit the step response curve of the system. The gain coefficient K of the system is 1.02, the delay time is obtained τ is 7.5 and the time constant T is 1.78. Therefore, the pH control process of liquid fertilizer has a time lag.

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 e ( t ) between the expected value r ( t ) and the actual output value y ( t ) is obtained; in the second step, the error values obtained are subjected to proportional, integral, and differential operations, and the closed-loop control quantity u ( t ) is obtained after linear combination; in the third step, the controlled object receives the control quantity u ( t ) , and the output value y ( t ) approaches the expected value r ( t ) to complete the control of the controlled object within the error allowance. The mathematical expression of the control principle is:
u ( t ) = K p [ e ( t ) + 1 T i 0 t e ( τ ) d τ + T d d e ( t ) d t ]
where K p is the proportionality constant, T i is the integration time constant, and T d is the differential time constant.
To discretize Equation (21), let T be the sampling period, perform k consecutive samples, and replace the continuous time t with the discrete sampling time point k T
{ t k T 0 t e ( t ) d t T j = 0 k e ( j T ) = T j = 0 k e ( j ) d e ( t ) d t e ( k T ) e [ ( k 1 ) T ] T
Bringing Equation (22) into Equation (21) and assuming that T is sufficiently short, Equation (21) can be simplified to:
u ( k ) = K p e ( k ) + K i j = 0 k e ( j ) + K d [ e ( k ) e ( k 1 ) ]
where K p , K i , and K d are proportional, integral, and differential coefficients, K i = K p T T i , K d = K p T d T .
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 G p * ( s ) e τ 2 s is the introduced Smith’s prediction compensation transfer function, G p ( s ) e τ 1 s is the system with delay model, and G c ( s ) is the main controller transfer function, when the model matches exactly, G p * ( s ) = G p ( s ) and τ 1 = τ 2 = τ . The overall closed-loop transfer function of the system at this point is:
Y ( s ) X ( s ) = G c ( s ) G p ( s ) e τ s 1 + G c ( s ) G p ( s )
The characteristic equation of the system is:
D ( s ) = 1 + G c ( s ) G p ( s ) = 0
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).
{ K P = 1.2 T K × τ T i = 2.2 τ T d = 0.5 τ
The controlled object model in this paper is shown in Equation (20), where K = 1.02, T = 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 K P = 0.28, K i = 0.02, K d = 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 G p * ( s ) G p ( s ) , τ 1 τ 2 , the overall closed-loop transfer function of the system is:
Y ( s ) X ( s ) = G c ( s ) G p ( s ) e τ 1 s 1 + G c ( s ) [ G p * ( s ) + G p ( s ) e τ 1 s G p * ( s ) e τ 2 s ]
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 G c 2 ( s ) and G p * ( s ) together form the compensation controller, G p ( s ) e τ s is the system with delay model, and G c 1 ( s ) is the main controller model.
From Figure 6, the closed-loop transfer function of the system is:
Y ( s ) X ( s ) = G c 1 ( s ) G p ( s ) e τ s 1 + G c 1 ( s ) G p * ( s ) 1 + G p ( s ) G c 2 ( s ) e τ s 1 + G c 2 ( s ) e τ s G p * ( s )
The characteristic equation of the system is:
D ( s ) = 1 + G c 1 ( s ) G p * ( s ) 1 + G p ( s ) G c 2 ( s ) e τ s 1 + G c 2 ( s ) e τ s G p * ( s ) = 0
If the mode of G c 2 ( s ) is chosen to be small enough, then:
1 + G p ( s ) G c 2 ( s ) e τ s 1
1 + G c 2 ( s ) e τ s G p * ( s ) 1
At this point the system characteristic equation simplifies to
D ( s ) = 1 + G c 1 ( s ) G p * ( s ) = 0
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 r ( k ) , y ( k ) , and e ( k ) ; 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, K p , K i , and K d , respectively.
A neural network structure based on 3-5-3, where the input layer inputs are:
O j ( 1 ) = x ( j )               ( j = 1 , 2 , , M )
M is the number of neurons in the input layer.
The implicit layer inputs and outputs are:
n e t i ( 2 ) = j = 0 M w i j ( 2 ) O j ( 1 )
O i ( 2 ) ( k ) = f ( n e t i ( 2 ) ( k ) )           ( i = 1 , 2 , , Q )
where Q is the number of neurons in the hidden layer and w i j ( 2 ) is the hidden layer connection weight, f ( x ) = tanh ( x ) = e x e x e x + e x .
The output layer inputs and outputs are:
n e t l ( 3 ) ( k ) = i = 0 Q w l i ( 3 ) O i ( 2 ) ( k )
O l ( 3 ) ( k ) = g ( n e t l ( 3 ) ( k ) )             ( l = 1 , 2 , , N )
where N is the number of neurons in the output layer and w l i ( 3 ) is the output layer connection weight, g ( x ) = 1 2 [ 1 + tanh ( x ) ] = e x e x + e x .
The control quantity u ( t ) of the PID controller is calculated according to Equation (23), K p , K i , and K d are O 1 ( 3 ) ( k ) , O 2 ( 3 ) ( k ) , and O 3 ( 3 ) ( k ) as found in Equation (37). The selected performance metrics have the following functional form:
E ( k ) = 1 2 [ r ( k ) y ( k ) ] 2
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 η .
w l i ( 3 ) ( k ) = η E ( k ) w l i ( 3 ) + α w l i ( 3 ) ( k 1 )
where α is the inertia factor.
E ( k ) w l i ( 3 ) can be split into:
E ( k ) w l i ( 3 ) = E ( k ) y ( k ) × y ( k ) u ( k ) × u ( k ) O l ( 3 ) ( k ) × O l ( 3 ) ( k ) n e t l ( 3 ) ( k ) × n e t l ( 3 ) ( k ) w l i ( 3 ) ( k )
After performing a series of simplifications, the updated output layer connection weights after learning by the neural network are obtained as:
w l i ( 3 ) ( k ) = α w l i ( 3 ) ( k 1 ) + η δ l ( 3 ) O i ( 2 ) ( k )
δ l ( 3 ) = e ( k ) s g n ( y ( k ) u ( k ) ) u ( k ) O l ( 3 ) ( k ) g ( n e t l ( 3 ) ( k ) )       ( l = 1 , 2 , , N )
Similarly, the update of the connection weights of the hidden layer after learning can be obtained as:
w i j ( 2 ) ( k ) = α w i j ( 2 ) ( k 1 ) + η δ i ( 2 ) O j ( 1 ) ( k )
δ i ( 2 ) = f ( n e t i ( 2 ) ( k ) ) l = 1 3 δ l ( 3 ) w l i ( 3 ) ( k )           ( i = 1 , 2 , Q )
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.

4. Analysis of Simulation Results

4.1. Model Match

In this paper, based on BP neural network algorithm and Smith prediction compensation principle, the liquid fertilizer pH adjustment system based on the Smith prediction compensator, PID-Smith prediction compensator, and BP-PID-Smith prediction compensator were designed, respectively, and the final obtained simulation results were compared and analyzed. According to the actual situation, the initial pH value of liquid fertilizer was 7.5, the pH value of adjusted liquid fertilizer was set to 6.8, and the simulation time was set to 500 s. The focus of this paper is on the dynamic process of the system, and this process is described by the dynamic performance metrics, which are composed of rise time, peak time, regulation time, and overshoot of the controller. The rise time is the time required for the response to rise from zero to the final value for the first time; the peak time is the time required for the response to exceeding its final value to reach the first peak; the regulation time is the minimum time required for the response to reach and remain within ±5% (or ±2%) of the final value; and the overshoot is the percentage of the ratio of the maximum deviation of the response c(tp) to the final value c(∞), i.e., σ % = C ( t p ) C ( ) C ( ) × 100 % . The rise time, peak time and regulation time are important indicators to evaluate the response speed of the system, and the overshoot reflects the stability of the system control process. The response curves of the three controllers when the models are matched are shown in Figure 11, the training error curves of the BP-PID-Smith controller are shown in Figure 12, and the dynamic performance comparisons are shown in Table 1.
According to the data in Table 1, the dynamic performance index of the BP-PID-Smith controller is significantly better than the other two controllers, so the BP-PID-Smith controller has a faster response and better steady-state performance compared with the PID-Smith controller and Smith controller. The Smith controller has a slow regulation time and rise time, reflecting its slow response time. The rise time and regulation time of the modified PID-Smith controller become shorter compared with the Smith controller, but at the same time, a certain amount of overshoot is generated, and the overall control effect is not as good as that of the BP-PID-Smith controller.

4.2. Model Mismatch

The above prediction compensator is based on the accurate mathematical model of the controlled object, however, in the actual process of pH regulation of liquid fertilizer, the accurate mathematical model of the system was difficult to obtain because of the complexity inside the system, which led to the actual model’s inability to completely match with the theoretical controlled object model, thus seriously affecting the control effect of the controller and making the controller unable to operate stably. In this paper, three controllers were simulated under the conditions of model mismatch to examine the performance of the controllers.
In this paper, the actual model was set to K = 1.5, T = 1.5, τ = 12, and a perturbation of amplitude 0.1 was added. The step response curves of the three controllers under the model mismatch condition are shown in Figure 13, the training error curves of the BP-PID-Smith controller are shown in Figure 14, and the dynamic performance comparison is shown in Table 2.
According to the data in Table 2, even though the Smith controller had a smaller maximum overshoot of 0.28%, its response speed was the slowest, the PID-Smith controller had a great improvement in response speed and stability compared to the Smith controller but there was still a higher overshoot, and the BP-PID-Smith controller had a better performance than the other two controllers both in terms of response speed and stability. The performance of the BP-PID-Smith controller was better than the other two controllers in terms of response speed and stability, and it had a smaller overshoot. Therefore, the BP-PID-Smith controller can meet the control requirements in the actual regulation process.

5. pH Regulation Experiment

5.1. Construction of the Experimental Platform for pH Regulation

In this paper, a pH regulation platform was built according to the system structure to further test the practicality of the BP-PID-Smith control algorithm. The STM32F103ZET6 microcontroller was used as the control core to receive the signal from the pH sensor using the I/O port, and the microcontroller adjusted the output frequency of the inverter by changing the magnitude of the analog voltage, thus changing the flow rate at the hose pump of the regulating liquid tank. The delivery flow rate of the hose pump was 1 m3/h, rated power was 1.5 kW, and rated voltage was 380 V. The inverter’s rated power was 2.2 kW, the output frequency can be adjusted from 0 to 400 Hz, rated voltage was 380 V. A pH sensor of RMD-ISSF-5 was used, with an accuracy of 0.01. The volume of the fertilizer mixture was kept at 40 L during the experiment. The pH adjustment experiment platform is shown in Figure 15.
The regulation platform used USB-1252A to collect the data needed for the regulation process. The collector was equipped with an advanced measurement and control system with 16 analog input channels, 12-bit vertical resolution, and up to 500 kSa/s analog acquisition capability. The schematic diagram of the data acquisition and control system is shown in Figure 16.

5.2. Analysis of Experimental Results

The fertilizer was diluted using dilute hydrochloric acid to maintain the pH of the fertilizer mixture at 7.5, and the flow rate of the hose pump at the fertilizer tank was adjusted to 0.35 m3/h, 0.58 m3/h, and 0.73 m3/h. The performance of the three controllers was tested. The experimental results are shown in Figure 17, Figure 18 and Figure 19, and the performance indexes of the three controllers are shown in Table 3, Table 4 and Table 5.
From Table 3, Table 4 and Table 5, it can be found that the performance of all three controllers improved as the flow rate of fertilizer increased. Although the Smith controller had the smallest overshoot, its rise time was slow and it could not respond quickly to the input pH setting value; the PID-Smith controller was a significant improvement in terms of rise time, peak time, and adjustment time compared with the Smith controller, but with the increase of flow rate, the overshoot amount also increased gradually. The BP-PID-Smith controller had the advantages of the other two controllers: it can reach the set pH value in a short time and the overshoot was also reduced compared with the PID-Smith controller; therefore, it can meet the control demand well even in the case of high flow rate.

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.

Author Contributions

This study was conceptualized by Z.M. and L.Z. The software was designed by Z.M. and validated by H.L., R.Z. and R.M. Z.M. provided resources and Z.M. curated data. The original draft of the manuscript was prepared by Z.M., Y.S. and X.M. reviewed and edited the manuscript. H.B., R.Z. and R.M. assisted with project administration. X.M. and H.L. managed funding acquisition. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the National Natural Science Foundation of China, grant number 52065055.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

All relevant data presented in the article are stored according to institutional requirements and, as such, are not available on-line. However, all data used in this Manuscript can be made available upon request to the authors.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Kuzman, B.; Petković, B.; Denić, N.; Petković, D.; Ćirković, B.; Stojanović, J.; Milić, M. Estimation of optimal fertilizers for optimal crop yield by adaptive neuro fuzzy logic. Rhizosphere 2021, 18, 100358. [Google Scholar] [CrossRef]
  2. Ajdary, K.; Singh, D.K.; Singh, A.K.; Khanna, M. Modelling of nitrogen leaching from experimental onion field under drip fertigation. Agric. Water Manag. 2007, 89, 15–28. [Google Scholar] [CrossRef]
  3. Hermansson, A.W.; Syafiie, S. Model predictive control of pH neutralization processes: A review. Control Eng. Pract. 2015, 45, 98–109. [Google Scholar] [CrossRef]
  4. Ali, E. pH Control Using PI Control Algorithms with Automatic Tuning Method. Chem. Eng. Res. Des. 2001, 79, 611–620. [Google Scholar] [CrossRef]
  5. Balasubramanian, G.; Hariprasad, K.; Sivakumaran, N.; Radhakrishnan, T. Adaptive Control of Neutralization Process Using Recurrent Neural Networks. Instrum. Sci. Technol. 2009, 37, 383–396. [Google Scholar] [CrossRef]
  6. Sena, H.J.; Silva, F.V.D.; Fileti, A.M.F. ANN model adaptation algorithm based on extended Kalman filter applied to pH control using MPC. J. Process Control 2021, 102, 15–23. [Google Scholar] [CrossRef]
  7. Alves Goulart, D.; Dutra Pereira, R. Autonomous pH control by reinforcement learning for electroplating industry wastewater. Comput. Chem. Eng. 2020, 140, 106909. [Google Scholar] [CrossRef]
  8. Salehi, S.; Shahrokhi, M.; Nejati, A. Adaptive nonlinear control of pH neutralization processes using fuzzy approximators. Control Eng. Pract. 2009, 17, 1329–1337. [Google Scholar] [CrossRef]
  9. Wu, H.; Yan, F.; Wang, G.; Lv, C. A predictive control based on decentralized fuzzy inference for a pH neutralization process. J. Process Control 2022, 110, 76–83. [Google Scholar] [CrossRef]
  10. Chen, H.; Zouaoui, Z.; Chen, Z. Neuro-Fuzzy Modified Smith predictor for IPDT and FOPDT Processes Control. IFAC Proc. Vol. 2013, 46, 839–844. [Google Scholar] [CrossRef] [Green Version]
  11. Chen, G.D.; Liu, D.J.; Mu, Y.X.; Xu, J.; Cheng, Y. A Novel Smith Predictive Linear Active Disturbance Rejection Control Strategy for the First-Order Time-Delay Inertial System. Math. Probl. Eng. 2021, 2021, 5560123. [Google Scholar] [CrossRef]
  12. Gamal, M.; Sadek, N.; Rizk, M.R.; Abou-Elsaoud, A.K. Delay compensation using Smith predictor for wireless network control system. Alex. Eng. J. 2016, 55, 1421–1428. [Google Scholar] [CrossRef] [Green Version]
  13. Qi, C.; Gao, F.; Zhao, X.; Wang, Q.; Ren, A. Hybrid Smith predictor and phase lead based divergence compensation for hardware-in-the-loop contact simulation with measurement delay. Acta Astronaut. 2018, 147, 175–182. [Google Scholar] [CrossRef]
  14. Nie, Y.; Zhang, P.; Cai, G.; Zhao, Y.; Xu, M. Unified Smith predictor compensation and optimal damping control for time-delay power system. Int. J. Electr. Power Energy Syst. 2020, 117, 105670. [Google Scholar] [CrossRef]
  15. Jin, X.; Chen, K.; Zhao, Y.; Ji, J.; Jing, P. Simulation of hydraulic transplanting robot control system based on fuzzy PID controller. Measurement 2020, 164, 108023. [Google Scholar] [CrossRef]
  16. Wright, R.A.; Kravaris, C. Nonlinear control of pH processes using the strong acid equivalent. Ind. Eng. Chem. Res. 1991, 30, 1561–1572. [Google Scholar] [CrossRef]
  17. Heckenthaler, T.; Engell, S. Fuzzy Logic Controller Design for Ph-Control in a CSTR. IFAC Proc. Vol. 1995, 28, 27–32. [Google Scholar] [CrossRef]
  18. Sira-Ramírez, H.; Verónica Pernía-Espinoza, A. On the pH Control of a CSTR System: An Invariant Stabilization Approach. IFAC Proc. Vol. 2001, 34, 1337–1342. [Google Scholar] [CrossRef]
  19. Tyagi, R.; Davison, E.J. Control of pH in a Continuous Stirred Tank Reactor (CSTR). IFAC Proc. Vol. 1993, 26, 115–126. [Google Scholar] [CrossRef]
  20. Estofanero, L.; Edwin, R.; Claudio, G. Predictive Controller Applied to a pH Neutralization Process. IFAC-PapersOnLine 2019, 52, 202–206. [Google Scholar] [CrossRef]
  21. Bu, Q.; Cai, J.; Liu, Y.; Cao, M.; Dong, L.; Ruan, R.; Mao, H. The effect of fuzzy PID temperature control on thermal behavior analysis and kinetics study of biomass microwave pyrolysis. J. Anal. Appl. Pyrolysis 2021, 158, 105176. [Google Scholar] [CrossRef]
  22. Mejía, C.; Salazar, E.; Camacho, O. A comparative experimental evaluation of various Smith predictor approaches for a thermal process with large dead time. Alex. Eng. J. 2022, 61, 9377–9394. [Google Scholar] [CrossRef]
Figure 1. Structural block diagram of pH value regulation system of liquid fertilizer: 1, regulating liquid tank; 2, fertilizer tank; 3, water storage tank; 4, check valve; 5, solenoid valve; 6, hose pump; 7, flowmeter; 8, pressure gauge; 9, mixing tank; 10, liquid level gauge; 11, Y-type filter; 12, pressure holding valve; 13, drip irrigation belt; 14, pH sensor; 15, mixing pump.
Figure 1. Structural block diagram of pH value regulation system of liquid fertilizer: 1, regulating liquid tank; 2, fertilizer tank; 3, water storage tank; 4, check valve; 5, solenoid valve; 6, hose pump; 7, flowmeter; 8, pressure gauge; 9, mixing tank; 10, liquid level gauge; 11, Y-type filter; 12, pressure holding valve; 13, drip irrigation belt; 14, pH sensor; 15, mixing pump.
Applsci 12 06162 g001
Figure 2. The dynamic process of acid-base neutralization.
Figure 2. The dynamic process of acid-base neutralization.
Applsci 12 06162 g002
Figure 3. PID control structure diagram.
Figure 3. PID control structure diagram.
Applsci 12 06162 g003
Figure 4. Smith prediction compensation control structure diagram.
Figure 4. Smith prediction compensation control structure diagram.
Applsci 12 06162 g004
Figure 5. Simulation model of pH regulation system based on Smith’s prediction compensation.
Figure 5. Simulation model of pH regulation system based on Smith’s prediction compensation.
Applsci 12 06162 g005
Figure 6. Structure of PID-Smith predictive compensator.
Figure 6. Structure of PID-Smith predictive compensator.
Applsci 12 06162 g006
Figure 7. Simulation model of pH regulation system based on PID-Smith prediction compensation.
Figure 7. Simulation model of pH regulation system based on PID-Smith prediction compensation.
Applsci 12 06162 g007
Figure 8. Structure of PID control system based on BP neural network.
Figure 8. Structure of PID control system based on BP neural network.
Applsci 12 06162 g008
Figure 9. Optimization of PID parameters based on BP neural network.
Figure 9. Optimization of PID parameters based on BP neural network.
Applsci 12 06162 g009
Figure 10. Simulation model of pH regulation system based on BP-PID-Smith prediction compensation.
Figure 10. Simulation model of pH regulation system based on BP-PID-Smith prediction compensation.
Applsci 12 06162 g010
Figure 11. Step response curves of the three controllers under model matching.
Figure 11. Step response curves of the three controllers under model matching.
Applsci 12 06162 g011
Figure 12. Training error curve of BP-PID-Smith controller under model matching.
Figure 12. Training error curve of BP-PID-Smith controller under model matching.
Applsci 12 06162 g012
Figure 13. Step response curves of the three controllers under model mismatch.
Figure 13. Step response curves of the three controllers under model mismatch.
Applsci 12 06162 g013
Figure 14. Training error curve of BP-PID-Smith controller under model mismatch.
Figure 14. Training error curve of BP-PID-Smith controller under model mismatch.
Applsci 12 06162 g014
Figure 15. pH regulation experimental platform.
Figure 15. pH regulation experimental platform.
Applsci 12 06162 g015
Figure 16. Schematic diagram of data acquisition and control system.
Figure 16. Schematic diagram of data acquisition and control system.
Applsci 12 06162 g016
Figure 17. Regulation curves of three controllers for a fertilizer flow rate of 0.35 m3/h.
Figure 17. Regulation curves of three controllers for a fertilizer flow rate of 0.35 m3/h.
Applsci 12 06162 g017
Figure 18. Regulation curves of three controllers for a fertilizer flow rate of 0.58 m3/h.
Figure 18. Regulation curves of three controllers for a fertilizer flow rate of 0.58 m3/h.
Applsci 12 06162 g018
Figure 19. Regulation curves of the three controllers for a fertilizer flow rate of 0.73 m3/h.
Figure 19. Regulation curves of the three controllers for a fertilizer flow rate of 0.73 m3/h.
Applsci 12 06162 g019
Table 1. Comparison of the dynamic performance of the three controllers for model match.
Table 1. Comparison of the dynamic performance of the three controllers for model match.
Controller TypeRise Time(s)Peak Time(s)Regulation Time (s)Maximum Overshoot
Smith397.541397.541178.1970
PID-Smith115.902163.94783.7700.13%
BP-PID-Smith56.71266.89136.2300.03%
Table 2. Comparison of the dynamic performance of the three controllers for the model mismatch.
Table 2. Comparison of the dynamic performance of the three controllers for the model mismatch.
Controller TypeRise Time(s)Peak Time(s)Regulation Time (s)Maximum Overshoot
Smith232.228449.377170.2160.28%
PID-Smith96.494141.38384.0430.53%
BP-PID-Smith73.23191.35457.8310.13%
Table 3. Comparison of the dynamic performance of the three controllers at a fertilizer flow rate of 0.35 m3/h.
Table 3. Comparison of the dynamic performance of the three controllers at a fertilizer flow rate of 0.35 m3/h.
Controller TypeRise Time (s)Peak Time (s)Regulation Time (s)Maximum Overshoot
Smith285.395333.145178.6440.06%
PID-Smith176.957218.060131.6230.25%
BP-PID-Smith111.479179.13780.8930.13%
Table 4. Comparison of the dynamic performance of the three controllers at a fertilizer flow rate of 0.58 m3/h.
Table 4. Comparison of the dynamic performance of the three controllers at a fertilizer flow rate of 0.58 m3/h.
Controller TypeRise Time (s)Peak Time (s)Regulation Time (s)Maximum Overshoot
Smith235.547288.110174.8190.05%
PID-Smith139.638178.810110.4450.37%
BP-PID-Smith94.403121.18070.6950.31%
Table 5. Comparison of the dynamic performance of the three controllers at a fertilizer flow rate of 0.73 m3/h.
Table 5. Comparison of the dynamic performance of the three controllers at a fertilizer flow rate of 0.73 m3/h.
Controller TypeRise Time(s)Peak Time(s)Regulation Time (s)Maximum Overshoot
Smith178.436235.560111.3200.02%
PID-Smith107.892156.37080.8970.46%
BP-PID-Smith80.949111.60262.5780.38%
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Meng, Z.; Zhang, L.; Li, H.; Zhou, R.; Bu, H.; Shan, Y.; Ma, X.; Ma, R. Design and Application of Liquid Fertilizer pH Regulation Controller Based on BP-PID-Smith Predictive Compensation Algorithm. Appl. Sci. 2022, 12, 6162. https://doi.org/10.3390/app12126162

AMA Style

Meng Z, Zhang L, Li H, Zhou R, Bu H, Shan Y, Ma X, Ma R. Design and Application of Liquid Fertilizer pH Regulation Controller Based on BP-PID-Smith Predictive Compensation Algorithm. Applied Sciences. 2022; 12(12):6162. https://doi.org/10.3390/app12126162

Chicago/Turabian Style

Meng, Zihao, Lixin Zhang, He Li, Runmeng Zhou, Haoran Bu, Yongchao Shan, Xiao Ma, and Ruihao Ma. 2022. "Design and Application of Liquid Fertilizer pH Regulation Controller Based on BP-PID-Smith Predictive Compensation Algorithm" Applied Sciences 12, no. 12: 6162. https://doi.org/10.3390/app12126162

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop