## 2 Materials and Methods
### Static Analysis
#### 2.3.3 PID Control Method  
The real-time pressure within the system is automatically adjusted using a PID controller, and the PLC uses real-time pressure sensors in the pipeline system to measure the pressure values output to the controller, which can be compared with the pressure and the actual theoretical flow rate values. The error information between the two was calculated to determine the amount of control, and the amount of pressure in the spray pumps was adjusted appropriately to make the theoretical pressure and the actual pressure measured on-site basically the same in order to achieve the closed-loop control of the spray pressure and the closed-loop control system structure shown in Figure 8. The basic- and field-measured pressures were basically the same, thus achieving the closed-loop control of the spray pressure and the closed-loop control system structure schematic shown in Figure 8. The use of the control method for the automatic adjustment of pressure parameters is more sensitive and accurate [29; 30].  
The control relation equation for the PID controller is as follows [31]:  
\[M(t)=K_{p}\bigg{(}e(t)+\frac{1}{T}\int_{0}^{t}e(t)dt+T_{D}\frac{de(t)}{dt} \bigg{)} \tag{9}\]  
where \(M(t)\)--the output value of the controller;  
\(e(t)\)--the theoretical pressure and actual pressure deviation value;  
\(K_{p}\)--the proportionality coefficient;  
\(T_{l}\)--the integral time constant;  
\(T_{D}\)--the differential time constant.  
The Delta PLC executes the PID algorithm according to the sampling time in the setup program. The control quantity is derived according to the PID operation law, and the spray pump pressure is adjusted using PWM. After discretizing the above equation, the PID algorithm is  
\[M_{n}=K_{p}(SP_{n}-PV_{n})+K_{p}\frac{T_{S}}{T_{I}}(SP_{n}-PV_{n})+M_{x}+K_{p} \frac{T_{D}}{T_{S}}(PV_{n-1}-PV_{n}) \tag{10}\]  
where \(M_{n}\)--the output value of the PID controller at the nth sampling;  
\(SP_{n}\)--the given value at the nth sampling;  
\(PV_{n}\)--the value of the process variable at the nth sampling;  
\(PV_{n-1}\)--the value of the process variable at the \(n-1\)st sampling moment;  
Figure 8: Closed-loop system structure sketch.  
Figure 7: Automatic/Manual Control Flowchar.  
\(M_{x}\)--the integral term at the \(n-1\)st sampling moment; \(T_{S}\)--the sampling time interval, s.  
The main flow of the PID control program is illustrated in Figure 9. A ladder diagram of the PID instructions is shown in Figure 10.  
After the system is started, initialization is first carried out: First, the level of the barrel is determined. If the level is lower than the set value, an alarm is sounded, and the stirred whitening liquid is poured into the barrel; if the level is normal, it starts to work. Then, when the spraying pump switch is opened, the spraying pump extracts the whitening liquid, and the pressure sensor starts to record the pressure change; when the pressure is larger than the set value, the system sets the pressure of the spraying pump. The theoretical flow rate is calculated, and the pressure and flow rate are set via the PID command module to control the size of the spray pump pressure. When the spray switch is turned off, the system shuts down and stops spraying the whitewashing liquid. The system is also set to manual mode. In manual mode, the spray pump can be manually controlled using the switch controller. Among other things, when in the automatic mode, the spray pump can be manually controlled using the switch controller, and, according to the size of the different tree diameters, the spray pump can be adjusted to increase or decrease the brushing pressure to change the local spraying of the brushing liquid. In addition, during the spraying process, a spraying pressure of less than 0.1 MPa has a very poor spraying effect, and, when the spray pump has a pressure of 0.4 MPa or so, the nozzle fogging effect is the best.  
Figure 9: Main program flowchart.