## 3 Design and Simulation of BP-PID-Smith Based Controller for pH Regulation System  
### 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}\bigg{[}e(t)+\frac{1}{T_{i}}\int_{0}^{t}e(\tau)d\tau+T_{d}\frac{de( t)}{dt}\bigg{]} \tag{21}\]  
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 \(kT\)  
\[ \begin{cases}t\approx kT\\ \int_{0}^{t}e(t)dt\approx T\sum_{j=0}^{k}e(jT)=T\sum_{j=0}^{k}e(j)\\ \frac{de(t)}{dt}\approx\frac{e(kT)-e(k-1)T}{T}\end{cases}  \tag{22}\]  
Figure 3: PID control structure diagram. 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}\sum_{j=0}^{k}e(j)+K_{d}[e(k)-e(k-1)] \tag{23}\]  
where \(K_{p}\), \(K_{i}\), and \(K_{d}\) are proportional, integral, and differential coefficients, \(K_{i}=K_{p}\frac{T}{T_{i}}\), \(K_{d}=K_{p}\frac{T_{d}}{T_{d}}\). 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]. [PERSON]'s predictive compensation control structure is shown in Figure 4.  
Where \(G_{p}^{*}(s)e^{-\tau_{1}s}\) is the introduced [PERSON]'s prediction compensation transfer function, \(G_{p}(s)e^{-\tau_{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 \(\tau_{1}=\tau_{2}=\tau\). The overall closed-loop transfer function of the system at this point is:  
\[\frac{Y(s)}{X(s)}=\frac{G_{c}(s)G_{p}(s)e^{-\tau s}}{1+G_{c}(s)G_{p}(s)} \tag{24}\]  
The characteristic equation of the system is:  
\[D(s)=1+G_{c}(s)G_{p}(s)=0 \tag{25}\]  
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). \[\left\{ \begin{aligned} K_{p}=1.2\frac{T}{K^{\times\tau}}\\ T_{l}=2.2\tau\\ T_{d}=0.5\tau\end{aligned} \right. \tag{26}\]  
The controlled object model in this paper is shown in Equation (20), where \(K=1.02\), \(T=1.78\), \(\tau=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.