2.2.1. Overall Program Design of Breakpoint Continuous Spraying System Based on Hysteresis Compensation
The software of the breakpoint continuous spraying system with hysteresis compensation for spraying needs to implement functions, including data acquisition of parameters, such as flow rate, vehicle speed, and position, recording, identification and distance calculation of breakpoint positions, calculation of hysteresis compensation distance, and pre-adjustment of the proportional control valve using a PID control algorithm. The main program flowchart is shown in
Figure 2.
After the system startup, it parses RTK-GNSS messages to obtain UTC, longitude, and latitude, displays them on the TFT screen, and stores them in the SD card. During normal operation, the system determines if breakpoints are stored or need to be stored based on the position information. When the nearest breakpoint is detected, the proportional control valve is automatically adjusted to the initial position set by the program. Then, the real-time distance between the current position and breakpoint is calculated. When the distance is less than the threshold, the threshold is the distance at which the wheel odometer has the smallest mileage error when accumulating mileage; the wheel odometer is activated to calculate the hysteresis compensation distance required to open the nozzles. The proportional control valve is pre-adjusted to the position closest to the target flow rate, and the nozzles are opened. The PID algorithm was used to adjust the opening degree of the proportional control valve to achieve the target flow rate. Once the target flow rate is reached, normal operation resumes, and the current breakpoint information is cleared. When the main control board switch is turned off, the system shuts down.
2.2.2. PID Control Program for Pre-Adjusting the Opening Degree of the Proportional Control Valve
The flow control of the system uses a PID control algorithm, which pre-adjusts the opening degree of the proportional control valve to reduce the time lag in flow adjustment. First of all, the control valve opening was calibrated by resetting the control valve to a fixed initial position every time it is started, so as to ensure that the flow rate is adjusted from the same position every time. This is the process of adjusting to the initial position: the control valve to the maximum flow rate for 5 s is adjusted to ensure that the control valve has been opened to the maximum, and then it is adjusted in the opposite direction for 2 s. The opening degree of the proportional control valve was pre-adjusted by adjusting it to the opening degree closest to the target flow rate, based on the equation relating the opening degree and flow rate. Then, the actual flow rate detected within the pipeline was fed back to the controller via a flow sensor. The controller compares the actual and target flow rates and calculates the deviation signal between the two through PID calculations. This deviation signal was used to adjust the opening degree of the proportional control valve, ensuring a match between the actual and target flow rates, thus achieving closed-loop control of pesticide flow. The closed-loop control structure is illustrated in
Figure 3. This method of flow rate adjustment offers advantages such as speed, stability, and accuracy [
20].
The controller output of the PID controller is calculated as follows:
where
is controller output;
is the deviation between the target flow rate and the actual flow rate;
is the proportional coefficient;
is the integral time constant;
is the derivative time constant.
The controller adjusts the proportional adjustment valve according to the output value. Once discretized, the PID equation becomes
where
is the integral coefficient;
is the derivative coefficient.
The feedback monitoring value is the main pipeline flow rate, which is affected by the vehicle speed and the rotational speed of the plunger pump, causing fluctuations during the operation process.
The main pipeline flowmeter outputs pulse signals. Its actual flow rate is calculated as
where
is the actual flow rate in the main pipeline, L/min;
is the number of pulses received by the controller per unit time;
is the time interval for flow rate detection;
is the flowmeter constant, taken as 90 pulses/L.
2.2.3. Hysteresis Compensation Distance Calculation Program
During continuous spraying, various factors, such as the time required by the switch valve to open to spray, droplet-fall time, vehicle speed, boom position, and time required to adjust the flow rate, cause the spraying and stable flow rate positions to lag behind the breakpoint position. This lag can result in repeated or missed spraying. By obtaining the aforementioned factors, calculating the position at which the valve should be opened in advance to compensate for this hysteresis in flow rate is possible.
GNSS has the ability to calculate latitude and longitude automatically, but without the ability to calculate distance from one point to another point. For ease of calculation, the Earth was approximated as a sphere. The schematic diagram is shown in
Figure 4. To determine the longitude and latitude
corresponding to points A and B, respectively, an isosceles trapezoid was constructed using points C
and D
at the same latitude as A and B. Given that ABCD is an isosceles trapezoid, the lengths of AD and CB were obtained, which helped determine the length of AB. Then, the central angle
of the concentric circle with AB as the chord was calculated, yielding
. The radian was multiplied by the radius of the Earth (R) to obtain the distance between points A and B as follows:
S is the distance between the two points, m.
When identifying breakpoints, the longitude and latitude are obtained by parsing the message on the main control board. The obtained longitude and latitude are the longitude and latitude of the RTK-GNSS installed on the boom sprayer, and the calculated S is the difference between this position and the breakpoint position.
A wheel odometer was mounted on the sprayer land wheels. By reading the number of pulse signals received within a unit of time, the traveling speed of the sprayer can be derived from known parameters, such as the wheel diameter and line count of the wheel odometer, as follows:
where
is the travel speed;
is the diameter of land wheel, m;
is the number of pulses output by the wheel odometer in time ;
is the number of lines on the wheel odometer;
is the time interval for speed reading, s.
The RTK-GNSS was installed at the center of the sprayer roof, which was the located position. However, a certain distance exists between the positions of the RTK-GNSS and nozzles, and this distance changes with variations in the boom height. To establish the relationship between the RTK-GNSS and nozzle positions, the change in the length of the electric push rod was obtained through a pull-wire sensor and known lengths of the four-bar linkage. This information was then used to derive the distance relationship between the RTK-GNSS and nozzles. The structure is depicted in
Figure 5.
is the distance between RTK-GNSS and the four-bar linkage, m;
is the length of the four-bar linkage, m;
is the height change of the four-bar linkage, m;
is the distance between the four-bar linkage and the nozzles, m;
is the distance between RTK-GNSS and the nozzles, m.
When the spray boom is 50 cm away from the ground, the actual value of in spraying is 1.63 m. The positioning error of RTK-GNSS data in static state is 2.5 mm + 1 ppm, and in RTK state it is 8 mm + 1 ppm. Under dynamic conditions, positioning accuracy is affected. However, as the height of the boom changes, the value also changes. Therefore, by monitoring the height of the boom and calculating different values, the positioning longitude of the nozzle position can be improved. The current position of the nozzle is the sum of S and .
The controller calculates the cumulative mileage to be recorded based on the received mileage base, travel speed, and time required to open the nozzles as follows:
where
is the cumulative mileage recorded by the odometer, m;
is the mileage base, m;
is the time for flow rate adjustment, s;
is the time for nozzle opening, s.
The mileage base is the first distance S obtained by the controller that is less than or equal to the intervention threshold of the wheel odometer. Assuming the threshold is 5 m, it is difficult to receive a longitude and latitude that is exactly 5 m away from the breakpoint due to the limitation of the RTK-GNSS update frequency. The received longitude and latitude are less than 5 m. At this time, the distance S between this longitude and latitude and the breakpoint position is the mileage base The flow rate adjustment time and nozzle opening time are the main reasons for the delay in the spraying position. Therefore, the mileage base deceleration is the product of the flow rate adjustment time and nozzle opening time, and the relative position of the RTK-GNSS and the nozzle is the accumulated mileage of the wheel odometer. When this mileage is accumulated, the main control board controls the relay module to open the nozzle for continued spraying operation.