Next Article in Journal
Influence of Processing Steps on Structural, Functional, and Quality Properties of Beef Hamburgers
Next Article in Special Issue
Semantic Segmentation of Agricultural Images Based on Style Transfer Using Conditional and Unconditional Generative Adversarial Networks
Previous Article in Journal
Groundwater Contaminant Transport Solved by Monte Carlo Methods Accelerated by Deep Learning Meta-Model
Previous Article in Special Issue
Spatial Location of Sugarcane Node for Binocular Vision-Based Harvesting Robots Based on Improved YOLOv4
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Fuzzy Neural Network PID Strategy Based on PSO Optimization for pH Control of Water and Fertilizer Integration

School of Mechanical and Electrical Engineering, Shihezi University, Shihezi 832003, China
*
Author to whom correspondence should be addressed.
Appl. Sci. 2022, 12(15), 7383; https://doi.org/10.3390/app12157383
Submission received: 15 June 2022 / Revised: 9 July 2022 / Accepted: 21 July 2022 / Published: 22 July 2022
(This article belongs to the Collection Agriculture 4.0: From Precision Agriculture to Smart Farming)

Abstract

:
In the process of crop cultivation, the application of a fertilizer solution with appropriate pH value is more conducive to the absorption of nutrients by crops. If the pH of the irrigation water and fertilizer solution is too high, it will not only be detrimental to the absorption of nutrients by the crop, but will also damage the structure of the soil. Therefore, the precise regulation of pH in water and fertilizer solutions is very important for agricultural production and saving water and fertilizer. Firstly, the article investigates the hybrid control of fertilizer and water conditioning systems, then builds a fuzzy preprocessing controller and a neural network proportional–integral–differential controller, and optimizes the neural network parameters by means of an improved particle swarm algorithm. The effectiveness of the controller was verified by comparison with the common proportional–integral–differential control and fuzzy algorithm control for fertilizer control and fuzzy preprocessing neural network control. Simulation experiments for this study were designed through the MATLAB/Simulink simulation platform, and the simulation results show that the algorithm has good tracking and regulation capabilities in the system. Finally, the four control algorithms are experimentally validated under different pH regulations using designed field experiments. The results show that, compared with other control algorithms, the control algorithm in this paper has a smaller overshoot and good stability with a shorter rise time, which can achieve the purpose of better regulating the fertilizer application system.

1. Introduction

Water and fertilizer integration technology is widely used in agricultural production, in which the concentration ratio and proper application of water and fertilizer are crucial to the growth of crops [1]. Currently, fertilizer and irrigation water use has gradually increased worldwide without a proportional increase in crop yields [2]. A qualitative analysis of fertilizer application methods shows that the main cause of this situation is the improper distribution of fertilizers, which affects the efficiency of fertilizer uptake and the normal growth of the crop at all stages. Excessive fertilizer application can also damage soil structure, affecting the growing environment and survival of crops [3,4,5,6]. Therefore, in order to enhance the rationality of crop growth and the utilization rate of water and fertilizer resources, and to ensure the normal development and application of agricultural resources, more accurate and reasonable water and fertilizer blending integration technology should be adopted to realize the transformation of agricultural technology from being crude to intensive.
The root systems of different crops require different levels of acidity and alkalinity, and most mono-textured fertilizers are alkaline; thus, the pH of the fertilizer needs to be explicitly adjusted at the fertilizer blending stage [7,8]. However, the process of blending liquid fertilizer for pH is often affected by factors such as time lag and nonuniformity of fertilizer delivery, and the variation in liquid fertilizer pH is also nonlinear in nature. Therefore, fast and accurate adjustment of liquid fertilizer pH to set requirements is an important research area in precision agriculture [9,10]. The research on pH values mainly includes algorithm optimization research and fertilizer system pH model building research. The current modeling research on pH process regulation mainly includes linear and nonlinear models and artificial intelligence models [11]. In the study of optimization of nonlinear control, methods such as adaptive regulation, feedback linearized transformation control and sliding mode control are generally used. Considering that the traditional PID control strategy has difficulty dealing with the complex nonlinearity and time lag in the control of water and fertilizer environments, more intelligent algorithms for optimal control need to be investigated [12].
At this stage, most water and fertilizer controllers use conventional PID control algorithms internally. However, in the actual fertilizer application process, the fertilizer concentration and flow rate have a complex impact on the water–fertilizer mixing system, which leads to problems such as time-varying and lagging system control objects always existing. The use of PID control algorithms is usually not effective for regulation [13,14]. In view of this, the authors in [15] used the application of a fuzzy adaptive control to regulate the water–fertilizer system. The simulation results show that the fuzzy PID adaptive control method is able to track and regulate the dynamic changes of the nutrient preparation process more accurately than the traditional PID method. In [16], a single-neuron PID learning algorithm based on quadratic optimization was proposed for the strongly nonlinear pH process. The effectiveness of the algorithm was verified by the simulation control results of the strongly nonlinear pH process. In [17], a self-tuning fuzzy PID control algorithm was introduced into the control system to regulate the frequency of the fertilizer pump, and hence, the water and fertilizer through the fuzzy PID control algorithm. An expert system PID control was developed by the authors in [18]. The parameters of the controller can be adjusted according to the deviation of the pH value and the deviation rate. Simulation experiments showed that the expert PID control has good control performance. The authors in [19] studied and established a grey prediction model for water and fertilizer irrigation and used MATLAB software to simulate fuzzy PID control in irrigation and fertilizer application, which effectively improved the accuracy of water and fertilizer concentration according to experimental verification. The authors in [20] used quantitative feedback theory, a particle swarm optimization algorithm and a genetic algorithm to optimize PID control. The nonlinear problem of pH control was optimized. Additionally, the control performance was verified by simulation experiments. A wavelet-BP neural network-based method for accurate fertilizer application to maize was proposed in [21]. The accuracy of the optimal fertilizer amount was improved by establishing a wavelet-BP neural network to calculate the nonlinear problem of fertilizer application. The authors in [22] used an incremental PID algorithm to control the water and fertilizer ratios and constructed a simulation model with online parameter settings using RBF neural networks. According to the experimental verification, the RBF-PID model was more accurate and stable than the incremental PID model. The authors in [23] proposed a nonlinear model predictive control method based on an elastic BP neural network and hybrid grey wolf optimizer. Simulation results showed that the proposed controller performed well and could reduce the disturbance caused by nonlinearity.
In summary, the main work carried out in this paper to improve the accuracy and rapidity of fertilizer pH regulation, based on water and fertilizer integration, is as follows: (a) An improved neural network controller is proposed which improves control by fuzzifying the inputs and optimizing the network parameters. (b) Particle swarm algorithms are applied for the optimization of two-layer weight parameters of neural networks. (c) PID control, fuzzy control, fuzzy neural network PID control and the control proposed in this paper are simulated and verified on the MATLAB/Simulink platform, and it is concluded that the algorithm proposed in this study is better than other control algorithms. (d) In order to verify the practicality and reliability of the proposed algorithm, the experimental verification of the data acquisition, the transfer function, and the upper computer reading and decision controls are designed in this paper, and the results prove that the control algorithm proposed in this paper has better results and performance compared with other control methods.
The paper is structured as follows. The first portion of this paper analyses the pH regulation process and develops a mathematical model of water and fertilization through the equilibrium equation. In the second part, a fuzzy preprocessing controller and a neural network controller are constructed, and the neural net controller is optimized using a particle swarm algorithm. The second part firstly constructs the controller that fuzzily preprocesses the input signal, then constructs the neural network controller, and finally uses the particle swarm algorithm to optimize the neural network controller. The third part compares the control effects of the four control algorithms through software simulation and experimental verification, and finally obtains the verification results based on the water and fertilizer system in this study.

2. pH Control Equipment and Control Model

2.1. Equipment System Components

The structure of the water and fertilizer integration control equipment is shown in Figure 1. When mixing fertilizer, the main control module with a computer as the core controls the opening and closing time of the solenoid valves at the outlets of the fertilizer tank, irrigation water source and acid tank, thus regulating the proportion of irrigation water and fertilizer in the mixing tank. A stirring pump is used to mix the water and fertilizer in the tank. The fertilizer tank is judged by a pH sensor to determine whether the pH value of the liquid inside meets the pH value for crop growth, and if not, the solenoid valve of the acid tank is opened to replenish the tank with acid. Fertilizer application is carried out mainly through the computer-based main control module, which controls the fertilizer pump and solenoid valve.

2.2. Analysis of the Water and Fertilizer pH Adjustment Process

In order to obtain the water and fertilizer mixture, fertilizer and water are fed into the mixing tank on a cyclical basis. The configuration of aqueous fertilizer mixing solutions requires the periodic opening and closing of valves to feed fertilizer and water into the mixing tank. In the actual fertilizer mixing process, in addition to the process of agitation and mixing, delayed factors such as changes in the flow rate of the liquid in the pipeline and the use of the monitoring module can introduce time lags into the pH adjustment.
Both water and fertilizer are usually weakly alkaline; thus, an acidic regulating liquid is required to adjust the pH. When the three liquids of water, fertilizer and a regulating liquid, are mixed, it can be seen as a neutralization process between a strong acid and a weak base. The pH of the fertilizer in the mixture is made to be similar to the pH set by the system. The inherent nonlinearity of the acid–base neutralization process also has an impact on the pH adjustment process. As the pH adjustment in the actual fertilizer mixing process is influenced by a variety of variable disturbances, a simplified control model is developed to analyze it qualitatively from a mechanistic point of view. It is assumed that the fertilizer drum is fed with raw fertilizer, acid and pure water as inputs to the pH model so that the fertilizer is rapidly integrated with the water and that the concentration of the mixed solution is used as an output, and that the mixed fertilizer in the drum is always full and of the same concentration at the top and bottom, as shown in Figure 2.
According to the material balance principle and the law of atomic conservation, the equilibrium state of the system should comply with the conservation of fertilizer and volume conservation, as to construct the soil conductivity and acidity concentration control process equation.
V d H 1 d t = L a H a L 1 H 1 V d x 2 d t = L n H n + L w H w L 1 H 2 L 1 = L n + L w + L a 10 p H 10 p H 14 H 1 + 1 1 + 10 p K b + p H 14 H 2 = 0
where V is the volume of mixed liquid, L a is the acid input flow, C a is the acid concentration, L n is the fertilizer input flow, H n is the fertilizer concentration, L w is the water input flow, H w is the water input concentration, L o u t is the output flow of the system, H 1 is the concentration of acid in the mixture, H 2 is the concentration of alkali in the mixture, K b is the weak-base ionization equilibrium constant, p K b = log ( K b ) , pH is the output variable of the process, K b is the ionization constant of the weak base and K w is the ionization constant of water ( 10 14 ) .

2.3. System Model Building

Considering the control characteristics of the liquid fertilizer pH value control system comprehensively, the first-order system transfer function and delay link are used to describe the mathematical model of the fertilizer solution’s pH value. The parameters to be identified in the model include the system gain K, delay time τ and time constant T. The transfer function is shown in Equation (2):
G s = K T s + 1 e τ s
Given the step response of pH = 6.5 as the input signal of the open-loop system, the sampling time interval is set to 1 s, the initial pH value of the mixed liquid is 7.6 and the step response curve of the system is fitted using the first-order approximation method of the computer-fitted system according to the data change of the pH value, then it is identified that the system gain K is 0.56, the delay time τ is 4 and the time constant T is 39. The pH regulation process has a time lag.

3. Construction of the Control Strategy

3.1. PID Control Algorithms

The block diagram of a conventional PID control system is shown in Figure 3. PID control is the differential between the actual output signal of the control object and the given signal for making differences and tracking. The control rate u of the system is derived from the proportional P, the integral I and the differential D as a means of regulating the performance indicators of the fertilizer. However, due to the effects of time lag and nonlinearity in the fertilizer mixing process, the effect of using a PID control strategy to regulate pH is often unsatisfactory and it is difficult to track the changes in the pH of the fertilizer solution [24].

3.2. Fuzzy-BPNN-PID Controller Design

Compared with the PID control algorithm, the fuzzy control algorithm has the advantages of good robustness, fault tolerance, etc. The operator can set appropriate fuzzy rules to regulate the output based on the existing knowledge and experience of fertilizer regulation, and the input signal of the system is targeted to facilitate the control link to achieve the structured regulation requirements; however, the fuzzy algorithm relies on simpler fuzzy rules due to the lack of the self-learning capability, which leads to lower control accuracy and poor dynamic quality of the system, and adaptive regulation cannot be achieved [25].
Compared with the above two algorithms, the BP neural network control algorithm has the feature of adaptive learning, meaning that it can learn and adjust adaptively for the input, complete the adjustment of its own network parameters, and finally, realize the optimal adjustment of the output signal [26]. The block diagram of the BPNN-PID controller is shown in Figure 4.
In order to obtain better control performance, combined with the advantages of the above fuzzy algorithm and BP neural network control algorithm, we chose to use fuzzy control to fuzzify and normalize the system state variables e and ec in advance, before using the BP neural network, to avoid the situation that the output is saturated due to the excessive direct input when the neural network activation sigmoid function is sampled, and reduce the situations where the network output is no longer sensitive to the input [27]. Then, the neural network was used to learn and control the output signal of the fuzzy module, as to achieve the purpose of accurately adjusting the pH value of water and fertilizer.

3.2.1. Design of Fuzzy Preprocessing Controller

In this paper, The error of pH E and the deviation of change of pH error EC were selected as input variables for the input of the fuzzy preprocessing control module, and the fuzzed system output v(k) was taken as the output variable. The role of this module is to fuzzify and normalize the system state variables e and ec. The error of pH e, the deviation of change of pH error ec and the output quantity v(k) of the fuzzification processing module all adopt the triangular membership function, and the area centroid method was chosen as the clearing method of the fuzzy controller. The controller sets the fuzzy linguistic values for both the pH deviation e and the rate of change of deviation ec of water and fertilizer as {NB, NM, NS, ZO, PS, PM, PB}, where NB, NM, NS, ZO, PS, PM and PB represent negative large, negative medium, negative small, 0, positive small, positive medium and positive large, respectively. The fuzzy domain takes on the value of the eigenpoints corresponding to {−6, −4, −2, 0, 2, 4, 6}. The fuzzy language values of the output signal v(k) of the fuzzy controller are set as {NB, NS, ZO, PS, PB}, and the fuzzy theoretical domain takes the value points {−4, −2, 0, 2, 4}. The fuzzy control rules for the controller output are shown in Table 1. The fuzzified output v(k) is determined according to the fuzzy theoretical domain and the affiliation function, and then the obtained values are sent to the input layer of the neural network. The subordination functions of the input and output of the fuzzy processing and the fuzzy surface diagrams between them are shown in Figure 5, Figure 6 and Figure 7.
In Figure 5, each triangle is part of the affiliation function. For example, the blue triangles represent input variables e and ec with a theoretical domain between −4 and 0 and output linguistic variables of NS. The work is based on the theoretical domain of the input quantities and the area centre of gravity method to determine their output linguistic variables. In Figure 6, each triangle is used to determine the output linguistic variable for the fuzzy variable v(k). For example, the red triangle indicates that the theoretical domain of v(k) is between −2 and 2 and the output linguistic variable is Z. Figure 7 represents a surface plot of the fuzzy algorithm design, from which it can be seen that when e and ec are small, the output is in the yellow peak portion; when e and ec are large, the output is in the blue low portion; and when the values of e and ec are in the middle of the theoretical domain, the output is in the green stable portion.

3.2.2. Design of BP Neural Network PID Controller

A BP neural network is a multi-layer, feed-forward neural network, which contains three layers of a network structure, namely, the input layer, hidden layer and output layer. The number of nodes in the input and output layers is determined by the dimensionality of the input vector and output vector, respectively, and the hidden layer plays an important role in the function and structure of the network [28].
The neural network controller in this paper used a three-layer BP neural network, the inputs to which are fuzzy-processed system state variables. The network contains three input layer nodes, nine implicit layer nodes and three output layer nodes. The structure of the fuzzy preprocessed neural network is shown in Figure 8. The role of each layer of the neural network and the input–output relationship between the layers are as follows.
The first layer is the input layer, where the input is the system state variable after fuzzy processing; the second layer is the hidden layer, and the input is:
n e t i 2 k = j = 1 3 ω i j 2 O j 1 k O j 2 k = f n e t i 2 k i = 1 , 2 9
where ω i j 2 is the implied layer weighting factor. f   · is the hidden layer activation function, selected as f x = tan h x .
The final layer is the output layer, with the following inputs and outputs:
n e t l i 3 k = i = 1 9 ω l i 3 O i 2 k O l 3 k = g n e t l 3 k l = 1 , 2 , 3 O 1 3 k = k p O 2 3 k = k i O 3 3 k = k d
where ω l i 3 is the output layer weighting factor. f   · is the output layer activation function, selected as g x = e x / e x + e x .
After determining the neural network outputs k p , k i and k d , they are brought into the incremental PID formula for calculation. The incremental PID control is able to remember and maintain the state of the system at the previous moment, thus making the impact of possible errors minimal; therefore, incremental PID is used to obtain the optimal control signal, and the incremental PID formula is:
Δ u k = K P e k e k 1 + K I e k + K D e k 2 e k 1 + e k 2 u k = u k 1 + Δ u
where Δ u k is the control signal increment and k is time; k P is the proportionality factor; k i is the integration factor; and k d is the differentiation factor.

4. Improved PSO-Optimized Fuzzy-BPNN Control Algorithm

The learning process of a BP neural network consists of continuously adjusting the weighting parameters of each layer of the network and then using the weighting coefficients to calculate the optimal control parameters. Therefore, the BP neural network needs to learn and continuously update the weighting coefficient matrix of each layer of the network.

4.1. BP Neural Network Weight Coefficient Update

According to the BP learning algorithm, first define the objective cost function J :
J = 1 2 e 2 k = 1 2 r k y k 2
After determining the target cost function J , perform a negative gradient direction search with the objective of minimizing the target function J , with an additional inertia term that accelerates the convergence of the search to a global minimum as follows:
Δ ω l i 3 k + 1 = η u k ω l i 3 + α Δ ω l i 3 k
where η is the learning rate; α is the inertia coefficient.
The correction formula for the weighting coefficient of the output layer of the BP neural network is further obtained as:
Δ ω l i 3 k + 1 = η δ l 3 O i 2 k + α Δ ω l i 3 k δ l 3 = e k + 1 s g n y k + 1 u × u k O l 3 k     l = 1 , 2 , 3 × g n e t l 3 k
Based on the above derivation, the correction formula for the implied layer weighting factor can be obtained as follows:
Δ ω i j 2 k + 1 = η δ i 2 O j 1 k + α Δ ω i j 2 k δ i 2 = f n e t i 2 k l = 1 3 δ l 3 ω l i 3 k i = 1 , 2 , 9
which sets up: g x = g x 1 g x ; f x = 1 f 2 x / 2 .
Therefore, the workflow of the Fuzzy-BPNN-PID controller can be summarized as follows: Set the initial values of the network parameters of each layer of the BPNN, as well as the learning rate and inertia coefficient of the network; use the fuzzy controller to fuzz the acquired e and ec; input the fuzzified output v(k) to the BPNN; then, calculate the input and output of each layer of neurons through the BPNN; and finally, calculate the three adjustable parameters k p , k i and k d of the PID controller, which are calculated by Equation (5). The output control signal is u(k). The system continuously updates u(k) and the network weight parameters according to the updates of e and ec. The control schematic is shown in Figure 9.

4.2. Improved Particle Swarm Algorithm

The optimization search process of the Fuzzy-BPNN-PID controller is as follows: firstly, the fuzzy rules are used to preprocess the two input signals e and ec; then, the fuzzy processed and normalized signals are fed into the neural network for training and learning; and finally, the optimal output control signal and the corresponding network weight parameters are obtained. However, the initial weight parameters for each layer of the BP neural network are usually chosen as random numbers of [−1, 1], and choosing random numbers as the initial values causes the algorithm to converge slowly, greatly affecting the training efficiency of the network and causing the algorithm to converge to local extremes [29]. Therefore, in order to obtain better network training accuracy, this paper used the particle swarm algorithm to calculate and find the optimal parameters as the initial network weights of the BP neural network, as to improve the iterative convergence speed of the network and the efficiency of finding the optimal control signal.

4.2.1. Standard Particle Swarm Algorithm

The particle swarm algorithm (PSO) is an algorithm for population intelligence optimization. It works by constructing a population of M particles in a D-dimensional space, where each particle represents a potential optimal solution to the desired value. The system sets each particle (i = 1, 2, …, M) to have a position parameter x i and a velocity parameter v i , as well as a fitness value obtained according to the objective function. The particle evaluates the individual optimal position P i d k and the population optimal position G i d k of the particle based on the fitness value, and each time the particle is updated, it obtains a new fitness value as well as P i d k and G i d k , thus gradually finding the historical optimal position P i d k   of the particle and the historical optimal position P g d k of the particle population [30]. The updated iterative equation is calculated as:
V i d k + 1 = ω V i d k + c 1 r 1 P i d k X i d k + c 2 r 2 P g d k X i d k
X i d k + 1 = X i d k + V i d k + 1
where ω is the inertia weight; d = 1, 2, …, D; i = 1, 2, …, M; V i d is the velocity of the particle; c 1 and c 2 are acceleration factors; and r 1 and r 2 are random numbers in the interval [0, 1].
When using the PSO algorithm for parameter optimization, the performance evaluation index of the fitness function needs to be specified. The purpose of the algorithm in this paper is to reduce the value of deviation; therefore, this paper selected the time multiplied by the absolute value error integral criterion index as the fitness function J of the particle swarm algorithm, and the calculation formula is:
J = 0 n t · e t d t
where n is the total number of iterative steps of the particle swarm.

4.2.2. Improved Particle Swarm Algorithm

The inertia weight ω has a balanced role in the global search for the optimal and development direction of the particle swarm algorithm and has an important impact on the performance of the algorithm. The adjustment of the inertia weight has a strong correlation with the number of iterations of the algorithm, and the inertia weight tends to decrement nonlinearly with the increase in the number of iterations; if the particles enter the optimal solution range during the iteration but the inertia coefficient does not reach the expected value due to the decrement, the particles deviate from the optimal. If the particle enters the optimal solution range during the iteration but the inertia coefficient does not reach the expected value due to decreasing, the particle deviates from the limit of the solution [31]. In order to make up for the shortcomings of the inertia weight parameter adjustment strategy, this paper improves the inertia weights of the particles with the expression:
ω = ω m i n ω m a x ω m i n × f i f z 3 f a f z
where ω m a x is the maximum value of the set inertia weight; ω m i n is the minimum value of the set inertia weight d; f i is the current fitness value of the ith particle; f a is the average fitness value of the population particles; and f z is the optimal fitness value of the current particle.
Equation (13) shows that the value of ω is dynamically adjusted according to the difference between the particle runtime fitness value and the optimal fitness, thus improving the performance of the algorithm.

4.3. Fuzzy-BPNN Optimal Control Algorithm Based on Improved Particle Swarm

The main principle of the improved particle swarm-based Fuzzy-BPNN-PID control algorithm is that the initial weights of the BP neural network can be optimized accurately and quickly by introducing an improved particle swarm algorithm with an inertia weight adjustment strategy to improve the search efficiency of the network. At the same time, the state variables at the input of the neural network are fuzzily preprocessed to reduce the output of the network, which is insensitive to the input and easy to saturate. The steps are as follows:
(1)
Initialization of particle swarm, where parameters such as population size, particle dimension, number of iteration steps, initial inertia weight and learning factor are set according to neural network factors.
(2)
Using the global search capability of the particle swarm algorithm, the approximate optimal solution of the network weight parameters is preferentially obtained, and the particles are updated according to the particle fitness. If the particle swarm meets the requirements of the optimal fitness value, the corresponding network parameters are transmitted to the BP network.
(3)
The BP neural network uses the network weights of the improved particle swarm optimization to process the fuzzy preprocessed signal, updates the network parameters through back propagation, and finally, outputs the optimal k p , k i and k d , which are calculated according to the incremental PID formula that also calculates the control signal u(k). Its control principle diagram is shown in Figure 10.
When the IPSO algorithm is used to obtain the network weight parameter matrix, the particle swarm population size is M = 20, the number of iteration steps is N = 100, the learning factor is c 1 = c 2 = 2, the initial inertia weight is ω 0 = 0.9, the particle velocity interval is set to [−5, 5], the structure of the neural network in this paper is 3-9-3 and the number of adjustable network parameters is 2 × 3 × 9 = 54; therefore, the particle dimension D = 54 is set, and each dimension represents a variable-adjusted parameter.

5. Simulation Experiment of pH Control of Fertilizer Solution

In order to verify the performance of the composite control scheme, the Simulink simulation interface of the fuzzy controller was first designed through MATLAB, and then the BP-PID control algorithm based on PSO optimization was written using the S-function module of the Simulink module. PID control, fuzzy control, BPNN-PID control with fuzzy preprocessing and BPNN-PID control system models based on improved PSO and fuzzy preprocessing were established in MATLAB/Simulink, as shown in Figure 11. The workflow of the model running is shown in Figure 12. The pH value of pure water was 8, the acid used to adjust pH was dilute hydrochloric acid with a concentration of 0.2 mol/L, the flow rate of water entering the mixing tank was 1.1 L/s and the system delay time was 4 s.
The pH value of the fertilizer solution was tracked with a simulation time of 1000 s; the tracking curves of different control algorithms are shown in Figure 13. According to Figure 13, it was found that the PID controller has a fast response but a large overshoot, the fuzzy control has a small overshoot but a slow rise time, the fuzzy neural network controller has a faster response time but there is still a certain amount of overshoot, and the IPSO-Fuzzy-BPNN-PID controller has a faster response time with a small overshoot and can respond to changes in the set pH value in a short time. Compared with the other three control algorithms, it is more conducive to improving the accuracy of the fertilization process. In theory, this composite controller could optimize the pH regulation of fertilizers and water. In order to further analyze the optimization performance of the controller in this paper, the process of adjusting the pH value of the water and fertilizer mixture from 7.5 to 6.5 was simulated according to the actual situation. The simulation time was 500 s. The control curves of several control algorithms are shown in Figure 14. According to Figure 14, the fuzzy control and PID control have the largest response time and overshoot, respectively, and the fuzzy neural network response is faster, but there is a certain amount of overshoot over a period of time. The performance parameters of the four algorithms are shown in Table 2. From Table 2, it was found that in terms of overshoot amount, it is reduced by 7.0, 2.0 and 1.7 percentage points compared to the first three algorithms. The steady times are reduced by 60 s, 235 s and 88 s. The IPSO-Fuzzy-BPNN-PID controller performed well in terms of overshoot and response time, and was able to reach the set pH value in a short time. In the next phase, the algorithm is tested.

6. Tests and Analysis

In order to confirm the stability of the algorithm, intelligent fertilization trials were carried out. The schematic diagram of the test device structure is shown in Figure 15 and Figure 16. The test system structure mainly consisted of a main control module, a signal transmission module, a sensor monitoring module and a drive module. The main control module was mainly composed of a computer, PLC controller and touch screen configuration interface. The signals were transmitted via an RS485 bus. The drive control module was divided into the fertilizer-proportioning drive module and irrigation control drive module. The tests took the set pH value as input value and used PLC as the control core to receive the actual feedback signal from the pH sensor and perform calculations. When blending the fertilizer, the system master control module controlled the fertilizer output frequency of the fertilizer-proportioning drive module by changing the analogue voltage signal, controlled the input volume of the regulating liquid as it was added to the mixing tank according to the calculated volume and completed the mixing, and the system maintained a stable state when the pH reached the set value.
The control algorithm used float accuracy with a sampling period of 2 s. Two groups of pH adjustment processes were set up; the initial pH values of the two water and fertilizer regulation tests were 7.1 and 6.9, respectively, the target pH values of the water and fertilizer regulations were adjusted to 6.3 and 5.3, respectively, and an electromagnetic flow meter was selected to determine the instantaneous flow rate. The variable control test was read by sensors and data acquisition cards to test and compare different control strategies, setting the system flow rate to 4 m3/h. The purpose of conducting this test was to regulate the accuracy of fertilizer pH control by the four controllers. The results of the test comparison are shown in Figure 17 and Figure 18. The indicator performance of the four controllers is shown in Table 3 and Table 4. As can be seen from Figure 17 and Figure 18, as the fertilizer flow rate increased, the performance of all four controllers gradually improved. Although the PID controller rose faster, it had the highest overshoot and a longer oscillation time, with a larger difference to the set pH value in a short time. The fuzzy controller had a smaller overshoot, but the response time was slow and could not keep track of the set pH value in time. The fuzzy neural network controller was considerably higher in rise time, overshoot and adjustment time compared to the first two controllers, but it had a significantly higher overshoot than the controller proposed in this paper, with the performance parameters tabulated as shown in Table 3. When the pH value was reduced from 7.1 to 6.3, the control proposed in this paper was the smallest in both overshoot and steady-state time. In terms of overshoot, the reductions compared to the first three algorithms were 8.1, 4.6 and 1.5 percentage points. In terms of steady time, the reductions were 39 s, 120 s and 34 s.
The pH value was reduced from 6.9 to 5.3, with the performance parameters shown in Table 4. Compared to the first three algorithms, the controller in this paper reduced the amount of overshoot by 13.8, 5.4 and 3.3 percentage points. The IPSO-FBPNN-PID controller can, therefore, respond to the set pH value in a short time with minimal overshoot and can meet the control requirements.

7. Conclusions

In this study, a neural network PID controller with improved particle swarm optimization network parameters and fuzzy preprocessed input signals was proposed to achieve a better response to the problems of nonlinearity and hysteresis of the fertilizer system and, thus, improve the accuracy of pH regulation of the fertilizer solution.
Through the simulation and practical application of pH control in the aqueous fertilizer solution, the excellent dynamic performance of the controller in this paper was verified step by step by comparing the data of response time, regulation time, rise time and overshoot of the four controllers with the current common control methods (PID control, fuzzy control) and fuzzy preprocessed neural network PID control.
The experimental results showed that the BP neural network PID algorithm based on improved particle swarm and fuzzy preprocessing optimization had better dynamic performance. Compared to the other three algorithms, the IPSO-FBPNN-PID control algorithm was significantly better in terms of overshoot and steady-state time. Additionally, the steady-state performance was also better. This controller is able to reduce the effects of time lag and nonlinearity in the actual fertilizer application process, which can produce better satisfying results in the work of fertilizer pH-worthy regulation within the fertilizer application system. In the future, the optimization of other intelligent algorithms and the combination of advantages with each other will also be further considered to greatly adapt to more complex regulation processes.

Author Contributions

This study was conceptualized by R.Z. and L.Z. The software was designed by R.Z. and validated by Z.M., C.D. and C.F. R.Z. provided resources and R.Z. curated the data. The original draft of the manuscript was prepared by R.Z. and C.F. H.W. reviewed and edited the manuscript. C.D., Y.S. and H.B. assisted with project administration. H.W. and Z.M. 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, and Provincial and Ministerial Projects No. 2021JS004.

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.

Acknowledgments

We are grateful to Changxin Fu, Zihao Meng and Huan Wang for their data recording and checking work during the process. We are also grateful to Chanchan Du, Yongchao Shan and Haoran Bu for their help in project management. We also thank Shihezi University for providing the experimental conditions for us to successfully complete this experiment. Finally, we thank the instructor for his constructive comments on the earlier version of the manuscript.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Ortas, I. Influence of potassium and magnesium fertilizer application on the yield and nutrient accumulation of maize genotypes under field conditions. J. Plant Nutr. 2018, 41, 330–339. [Google Scholar] [CrossRef]
  2. Anthony, P.M.; Malzer, G.L.; Sparrow, S.D.; Zhang, M. Corn and Soybean Grain Phosphorus Content Relationship with Soil Phosphorus, Phosphorus Fertilizer, and Crop Yield. Commun. Soil Sci. Plant Anal. 2013, 44, 1056–1071. [Google Scholar] [CrossRef]
  3. Wang, H.F.; Takematsu, N.; Ambe, S. Effects of soil acidity on the uptake of trace elements in soybean and tomato plants. Appl. Radiat. Isot. 2000, 52, 803–811. [Google Scholar] [CrossRef]
  4. Tlustos, P.; Hejcman, M.; Hůlka, M.; Patáková, M.; Kunzová, E.; Száková, J. Mobility and plant availability of risk elements in soil after long-term application of farmyard manure. Environ. Sci. Pollut. Res. 2016, 23, 23561–23572. [Google Scholar] [CrossRef]
  5. Adaev, N.L.; Amaeva, A.G.; Zanilov, A.K.; Adaev, I.N. Distribution of trace elements in soil and plants under the action of bio-organic and mineral fertilizers. In Proceedings of the International Conference on World Technological Trends in Agribusiness, Omsk City, Russia, 4–5 July 2020. [Google Scholar]
  6. Carrillo-Gonzalez, R.; Cerón-Lazcano, M.; González-Chávez, M.; García-Cué, J.L.; Cruz-Díaz, J. Trace elements added to agricultural soils with wastewater are accumulated in stable fractions. Tecnol. Cienc. Del Agua 2018, 9, 1–31. [Google Scholar]
  7. Meng, H.Q.; Xu, M.G.; Lü, J.L.; He, X.H.; Li, J.W.; Shi, X.J.; Chang, P.; Wang, B.R.; Zhang, H.M. Soil pH Dynamics and Nitrogen Transformations Under Long-Term Chemical Fertilization in Four Typical Chinese Croplands. J. Integr. Agric. 2013, 12, 2092–2102. [Google Scholar] [CrossRef] [Green Version]
  8. Vašák, F.; Cerny, J.; Buráňová, Š.; Kulhanek, M.; Balik, J. Soil pH Changes in Long-Term Field Experiments with Different Fertilizing Systems. Soil Water Res. 2015, 10, 19–23. [Google Scholar] [CrossRef] [Green Version]
  9. Zhang, Y.; Wei, Z.; Zhang, L.; Jia, W. The control strategy and verification for precise water-fertilizer irrigation system. In Proceedings of the 2018 Chinese Automation Congress (CAC), Xi’an, China, 30 November–2 December 2018; pp. 4288–4292. [Google Scholar]
  10. Mikula, K.; Izydorczyk, G.; Skrzypczak, D.; Mironiuk, M.; Moustakas, K.; Witek-Krowiak, A.; Chojnacka, K. Controlled release micronutrient fertilizers for precision agriculture—A review. Sci. Total Environ. 2020, 712, 136365. [Google Scholar] [CrossRef]
  11. Chen, Z.; Wang, D. A Prediction Model of Forest Preliminary Precision Fertilization Based on Improved GRA-PSO-BP Neural Network. Math. Probl. Eng. 2020, 2020, 1356096. [Google Scholar]
  12. Hu, X.; Chen, X. Uniform fertilization method based on differential pressure tank with optimal fertilizer concentration and constant fertigation flux. Irrig. Sci. 2021, 39, 347–362. [Google Scholar] [CrossRef]
  13. Zhang, J.; Hou, S.; Wang, R.; Ji, W.; Zheng, P.; Wei, S. Design of variable-rate liquid fertilization control system and its stability analysis. Int. J. Agric. Biol. Eng. 2018, 11, 109–114. [Google Scholar] [CrossRef]
  14. Sikora, J.; Niemiec, M.; Tabak, M.; Gródek-Szostak, Z.; Szeląg-Sikora, A.; Kuboń, M.; Komorowska, M. Assessment of the Efficiency of Nitrogen Slow-Release Fertilizers in Integrated Production of Carrot Depending on Fertilization Strategy. Sustainability 2020, 12, 1982. [Google Scholar] [CrossRef] [Green Version]
  15. Liu, X.; Zhou, J.; Xiao, J.; Chen, Y.; Zhang, C. Application of fuzzy adaptive PID control in integrated water and fertilizer system. In Proceedings of the 2018 IEEE CSAA Guidance, Navigation and Control Conference (CGNCC), Xiamen, China, 10–12 August 2018. [Google Scholar]
  16. Yu, M.; Zou, Z.; Wang, Z. Single Neuron PID Controller Based on Quadratic Optimization and its Application on pH Process Control. In Proceedings of the 38th Chinese Control Conference (CCC), Guangzhou, China, 27–30 July 2019; pp. 2868–2873. [Google Scholar]
  17. Zhu, D.L.; Ruan, H.C.; Wu, P.T.; Li, J.H.; Lu, L.Q. Remote fuzzy PID control strategy for fertilizer conductivity of water-fertilizer machine. J. Agric. Mach. 2022, 53, 186–191. [Google Scholar]
  18. Liu, X.; Ma, Q.; Yu, W.; Liu, K. Research on the PH Value Neutralization Control Strategy of Sewage Treatment Based on the Expert PID Algorithm. In Proceedings of the 2017 Chinese Automation Congress (CAC), Jinan, China, 20–22 October 2017; pp. 1812–1815. [Google Scholar]
  19. Bi, P.; Zheng, J. Study on Application of Grey Prediction Fuzzy PID Control in Water and Fertilizer Precision Irrigation. In Proceedings of the 2014 IEEE International Conference on Computer and Information Technology (CIT), Xi’an, China, 11–13 September 2014; pp. 789–791. [Google Scholar]
  20. Aparna, V.; Jamal, D.N. Real-time implementation of QFT, GA, and BFTPSO controller for pH neutralization system. J. Appl. Res. Technol. 2021, 19, 263–278. [Google Scholar] [CrossRef]
  21. Dong, Y.; Fu, Z.; Peng, Y.; Zheng, Y.; Yan, H.; Li, X. Precision fertilization method of field crops based on the Wavelet-BP neural network in China. J. Clean. Prod. 2020, 246, 118735. [Google Scholar] [CrossRef]
  22. Wang, B.; Cai, Z.; Yuan, H.; Suo, X. Control Model and Experiment of Water and Fertilizer Proportion of Fertilizer Machine Based on RBF Neural Network. In Proceedings of the 2018 International Conference on Sensing, Diagnostics, Prognostics, and Control (SDPC), Xi’an, China, 15–17 August 2018; pp. 648–653. [Google Scholar]
  23. Xiao, L.; Xu, M.; Chen, Y.; Chen, Y. Hybrid Grey Wolf Optimization Nonlinear Model Predictive Control for Aircraft Engines Based on an Elastic BP Neural Network. Appl. Sci. 2019, 9, 1254. [Google Scholar] [CrossRef] [Green Version]
  24. Wu, Y.; Li, L.; Li, S.; Wang, H.; Zhang, M.; Sun, H.; Sygrimis, N.; Li, M. Optimal control algorithm of fertigation system in greenhouse based on EC model. Int. J. Agric. Biol. Eng. 2019, 12, 118–125. [Google Scholar] [CrossRef] [Green Version]
  25. Ashraf, A.; Akram, M.; Sarwar, M. Fuzzy decision support system for fertilizer. Neural Comput. Appl. 2014, 25, 1495–1505. [Google Scholar] [CrossRef]
  26. Saleem, M.H.; Velayudhan, K.K.; Potgieter, J.; Arif, K.M. Weed Identification by Single-Stage and Two-Stage Neural Networks: A Study on the Impact of Image Resizers and Weights Optimization Algorithms. Front. Plant Sci. 2022, 13, 850666. [Google Scholar] [CrossRef]
  27. Bozorg-Haddad, O.; Zarezadeh-Mehrizi, M.; Abdi-Dehkordi, M.; Loáiciga, H.A.; Mariño, M.A. A self-tuning ANN model for simulation and forecasting of surface flows. Water Resour. Manag. 2016, 30, 2907–2929. [Google Scholar] [CrossRef]
  28. Lin, Y.; Chen, X. BP Neural Network Learning Algorithm and Its Software Implementation. Appl. Mech. Mater. 2014, 513, 738–741. [Google Scholar] [CrossRef]
  29. Li, X.; Xiang, S.; Zhu, P.; Wu, M. Establishing a Dynamic Self-Adaptation Learning Algorithm of the BP Neural Network and Its Applications. Int. J. Bifurc. Chaos 2015, 25, 1540030. [Google Scholar] [CrossRef]
  30. Kulkarni, M.N.; Patekar, M.S.; Bhoskar, M.T.; Kulkarni, M.O.; Kakandikar, G.M.; Nandedkar, V.M. Particle Swarm Optimization Applications to Mechanical Engineering—A Review. Mater. Today-Proc. 2015, 2, 2631–2639. [Google Scholar] [CrossRef]
  31. Adewumi, A.O.; Arasomwan, A.M. An improved particle swarm optimiser based on swarm success rate for global optimisation problems. J. Exp. Theor. Artif. Intell. 2016, 28, 441–483. [Google Scholar] [CrossRef]
Figure 1. Water and fertilizer integration and control equipment structure diagram: 1—check valve; 2—flow meter; 3—computer control; 4—water source; 5—solenoid valve; 6—acid tanks; 7—hose pump; 8—mixing tank; 9—level meter; 10—pH sensor; 11—monitoring and adjustment of the upper side; 12—pressure gauge; 13—irrigation and fertilization pump; 14—holding valve; 15—drip irrigation belt; 16—filter; 17—stirring pump; 18—fertilizer tank.
Figure 1. Water and fertilizer integration and control equipment structure diagram: 1—check valve; 2—flow meter; 3—computer control; 4—water source; 5—solenoid valve; 6—acid tanks; 7—hose pump; 8—mixing tank; 9—level meter; 10—pH sensor; 11—monitoring and adjustment of the upper side; 12—pressure gauge; 13—irrigation and fertilization pump; 14—holding valve; 15—drip irrigation belt; 16—filter; 17—stirring pump; 18—fertilizer tank.
Applsci 12 07383 g001
Figure 2. Fertilizer pH adjustment concentration analysis chart.
Figure 2. Fertilizer pH adjustment concentration analysis chart.
Applsci 12 07383 g002
Figure 3. PID control schematic.
Figure 3. PID control schematic.
Applsci 12 07383 g003
Figure 4. Schematic diagram of neural network PID control.
Figure 4. Schematic diagram of neural network PID control.
Applsci 12 07383 g004
Figure 5. Plot of the error and the affiliation function for the rate of change of the error.
Figure 5. Plot of the error and the affiliation function for the rate of change of the error.
Applsci 12 07383 g005
Figure 6. Fuzzy output v(k) subordinate degree function.
Figure 6. Fuzzy output v(k) subordinate degree function.
Applsci 12 07383 g006
Figure 7. Fuzzy control surface diagram.
Figure 7. Fuzzy control surface diagram.
Applsci 12 07383 g007
Figure 8. Fuzzy-BPNN-PID structure diagram.
Figure 8. Fuzzy-BPNN-PID structure diagram.
Applsci 12 07383 g008
Figure 9. Fuzzy-BPNN-PID algorithm control schematic.
Figure 9. Fuzzy-BPNN-PID algorithm control schematic.
Applsci 12 07383 g009
Figure 10. IPSO-Fuzzy-BPNN-PID system schematic diagram.
Figure 10. IPSO-Fuzzy-BPNN-PID system schematic diagram.
Applsci 12 07383 g010
Figure 11. Simulation model of fertilizer–liquid mixing pH control system.
Figure 11. Simulation model of fertilizer–liquid mixing pH control system.
Applsci 12 07383 g011
Figure 12. The flowchart of proposed controller.
Figure 12. The flowchart of proposed controller.
Applsci 12 07383 g012
Figure 13. Simulation comparison and analysis diagram of different controllers.
Figure 13. Simulation comparison and analysis diagram of different controllers.
Applsci 12 07383 g013
Figure 14. Control analysis and comparison chart of different controllers.
Figure 14. Control analysis and comparison chart of different controllers.
Applsci 12 07383 g014
Figure 15. Fertilizer pH adjustment and detection experimental platform.
Figure 15. Fertilizer pH adjustment and detection experimental platform.
Applsci 12 07383 g015
Figure 16. Structure of the fertiliser pH adjustment test system.
Figure 16. Structure of the fertiliser pH adjustment test system.
Applsci 12 07383 g016
Figure 17. Comparative analysis of different control algorithms when regulating pH from 7.1 to 6.3.
Figure 17. Comparative analysis of different control algorithms when regulating pH from 7.1 to 6.3.
Applsci 12 07383 g017
Figure 18. Comparative analysis of different control algorithms when regulating pH from 6.9 to 5.3.
Figure 18. Comparative analysis of different control algorithms when regulating pH from 6.9 to 5.3.
Applsci 12 07383 g018
Table 1. Fuzzy rule tables based on fuzzy control.
Table 1. Fuzzy rule tables based on fuzzy control.
ECNBNMNSONSNMNB
E
NBNBNBNMNMNMNBNB
NMNBNBNMNMNMNBNB
NSNMNMNSNSNSNMNB
ONMNMNSNSNSNMNM
PSNMNMNSNSNSNMNM
PMNBNBNMNMNMNBNB
PBNBNBNMNMNMNBNB
Table 2. Comparison table of performance parameters of four control algorithms.
Table 2. Comparison table of performance parameters of four control algorithms.
The Controller TypeRise Time (s)Peak Time (s)Steady-State Time (s)Maximum
Overshot (%)
PID59807.9%
Fuzzy801222552.9%
FBPNN-PID9141082.6%
IPSO-FBPNN-PID1113200.9%
Table 3. Table of performance parameters for pH from 7.1 to 6.3.
Table 3. Table of performance parameters for pH from 7.1 to 6.3.
The Controller TypeRise Time (s)Peak Time (s)Steady-State Time (s)Maximum
Overshot (%)
PID5.57.7528.2%
Fuzzy75991334.7%
FBPNN-PID8.415471.6%
IPSO-FBPNN-PID1012130.1%
Table 4. Table of performance parameters for pH from 6.9 to 5.3.
Table 4. Table of performance parameters for pH from 6.9 to 5.3.
The Controller TypeRise Time (s)Peak Time (s)Steady-State Time (s)Maximum
Overshot (%)
PID68.44213.8%
Fuzzy58881345.6%
FBPNN-PID914503.5%
IPSO-FBPNN-PID1113220.2%
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Zhou, R.; Zhang, L.; Fu, C.; Wang, H.; Meng, Z.; Du, C.; Shan, Y.; Bu, H. Fuzzy Neural Network PID Strategy Based on PSO Optimization for pH Control of Water and Fertilizer Integration. Appl. Sci. 2022, 12, 7383. https://doi.org/10.3390/app12157383

AMA Style

Zhou R, Zhang L, Fu C, Wang H, Meng Z, Du C, Shan Y, Bu H. Fuzzy Neural Network PID Strategy Based on PSO Optimization for pH Control of Water and Fertilizer Integration. Applied Sciences. 2022; 12(15):7383. https://doi.org/10.3390/app12157383

Chicago/Turabian Style

Zhou, Runmeng, Lixin Zhang, Changxin Fu, Huan Wang, Zihao Meng, Chanchan Du, Yongchao Shan, and Haoran Bu. 2022. "Fuzzy Neural Network PID Strategy Based on PSO Optimization for pH Control of Water and Fertilizer Integration" Applied Sciences 12, no. 15: 7383. https://doi.org/10.3390/app12157383

APA Style

Zhou, R., Zhang, L., Fu, C., Wang, H., Meng, Z., Du, C., Shan, Y., & Bu, H. (2022). Fuzzy Neural Network PID Strategy Based on PSO Optimization for pH Control of Water and Fertilizer Integration. Applied Sciences, 12(15), 7383. https://doi.org/10.3390/app12157383

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