1. Introduction
As of 2023, the area of China’s facility-based agriculture has reached 3.7 million hectares, which is the largest in the world and accounts for nearly 80% of the world’s total area of facility-based agriculture. In the southern region of China, glass greenhouses and plastic greenhouses are common agricultural facilities that produce flowers, seedlings, fruits, and vegetables. [
1]. The light penetration of the greenhouse directly affects how well the crop grows and ultimately affects the economic returns [
2]. However, even plastic film or glass by itself will block at least 10% of the sunlight. In addition, plastic film and glass will inevitably be covered by various kinds of dust, moss, and other debris that accumulate during usage, which further reduces the light transmission rate of the greenhouse [
3,
4]. The combined effect of dirt and the greenhouse materials themselves can result in large reductions in light transmission through the greenhouse, which results in crops not receiving sufficient light, leading to low greenhouse yields and failure to produce the expected economic benefits. Therefore, sufficient sunlight is an important factor for planting high-yield crops [
5]. In order to ensure that the greenhouse has a sufficient sunlight transmission rate and that the crops can receive enough light to increase crop yield and improve economic benefits, it is necessary to regularly clean the greenhouse surface [
6].
In China, the cleaning of glass greenhouses still mainly relies on manual labor, with a low level of mechanization and automation. Workers must carry cleaning tools and climb up onto the roof of the greenhouse with the help of an escalator before cleaning the surface of the greenhouse [
7]. Workers cleaning greenhouse roofs are not protected by safety devices, and the water needed for cleaning can pose a safety hazard to workers by making the surface of the greenhouse slippery. This hazard can be reduced by using a machine that can automatically clean the greenhouse roof, rather than relying on manual labor.
At present, most of the scientific research institutions have focused on the design of the mechanical structure of the glass greenhouse cleaner machine; however, the motion control of the cleaner machine has not yet received in-depth attention [
7,
8,
9,
10,
11]. Overall, the current control systems suffer from poor reliability, poor adaptability, and low intelligence.
Because the control effect of the glass greenhouse roof cleaner directly determines the cleaning effect and efficiency of the greenhouse roof, this paper focused on the control system of the cleaner. Nowadays, the traditional PID controller is widely used in many control systems. However, because there are only a fixed set of PID parameters which cannot be adjusted according to the changes in working conditions [
12,
13], the anti-interference ability is poor and it is impossible to produce the desired adjustment effect [
14,
15,
16,
17,
18,
19]. Fuzzy PID can make up for the shortcomings of traditional PID, and the PID parameters can be adjusted according to the fuzzy rules [
20,
21]. However, the establishment of the fuzzy rule table relies heavily on personal experience [
22,
23], and it is difficult to achieve the ideal control effect. PSO fuzzy PID can calculate the increment of PID control parameters through the system deviation and the rate of change of deviation [
24,
25]. The combination of fuzzy PID control parameters can make up for the shortcomings of the previous two control methods and achieve the ideal control effect. Mechanized and automated greenhouse cleaning can increase the yield of greenhouse fruits and vegetables and reduce labor costs. Moreover, the simulation technology applied in the practical industry is a very useful method [
26,
27]. In this paper, a glass greenhouse roof cleaner system is designed to perform round-trip movement with the top of the greenhouse automatically through the track, and a fuzzy PID control method optimized by particle swarm algorithm is proposed. By comparing the simulation of the cleaner under different controllers and different working conditions, the use of particle swarm fuzzy PID can significantly improve the stability of the cleaner in the process of operation, improve its anti-interference ability, and adapt to a variety of working conditions. The PSO-Fuzzy-PID algorithm in this paper provides a feasible control algorithm for glass greenhouse cleaning.
2. Establishment of Cleaner Model
The glass greenhouse cleaner in this research has a total length of 4200 mm and a left–right symmetrical structure with five disc brushes arranged on each side (the diameter of a single brush is 600 mm). On each side, there is a motor controlling the rotation of the wheel of the cleaner, a motor controlling the rotation of the disc brushes, and two pusher motors controlling the lifting and lowering of the brushes. The five disc brushes are connected by means of gears, shafts, and telescopic cardanic couplings. The purpose of the lifting mechanism of the cleaner is twofold: (1) when the cleaner walks to the skylight which is higher than the roof surface, it can raise the brushes to avoid collision; (2) to ensure positive pressure between the brushes and the glass surface for optimal cleaning. An overall schematic of the cleaner is shown in
Figure 1.
The cleaner has two pairs of wheels on both the front and back, and the left and right sides each have a motor to drive the wheels. The cleaner walks with the radial arrangement along the greenhouse on the track, and the wheels start to move when the cleaning motor controls the disc brush to rotate. While the cleaner walks on the glass surface, the pusher clicks to control the brush to descend and fit the glass surface. After cleaning a span of the greenhouse, the scissor lift truck will transfer it to another span of the greenhouse.
Glass greenhouse cleaners have a large variety and number of parts, making it difficult to establish an accurate mathematical model. At the same time, the research in this paper involves a variety of working conditions (such as friction changes, sudden strong wind, and other factors), which further complicates modeling efforts. Adams dynamic simulation software (Version 2019) can easily perform the dynamic analysis of the whole machine movement, friction changes, and sudden strong wind; thus, the Adams software is used to provide specific models except for the motor and then calculate the motor transfer function, combined with a Matlab control model for simulation.
The Adams model of the cleaner is shown in
Figure 2.
In this paper, the wheels on both sides of the cleaner are driven by three-phase asynchronous motors, and the forward and backward movement and angle control of the cleaner are realized by adjusting the motor speed. Therefore, the power source of the glass greenhouse cleaner can be simplified to a mathematical model of a three-phase asynchronous motor and an inverter.
In the control system of the glass greenhouse roof washer, the inverter is used to regulate the rotational speed of the three-phase asynchronous motor, where the mathematical model between the input voltage and the output rotational speed of the three-phase asynchronous motor can be approximated as an inertial link [
28]:
where
G1 is the output speed of the three-phase asynchronous motor,
K1 is the motor speed ratio input frequency, and
T1 is the system time constant, the value of which is about a quarter of the motor start-up time. The three-phase asynchronous motor used in this paper is BWD-B0-0.75. The specific parameters of this motor are shown in
Table 1.
Let the starting time of the motor be 0.8 s. Substituting the relevant data into Equation (1), the expression for the transfer function of a three-phase asynchronous motor can be written as:
Similarly, the mathematical model between the inverter input voltage and output frequency can be approximated as an inertial link [
29]:
where
G2 is the output frequency of the inverter,
K2 is the ratio of inverter frequency to external set voltage,
T2 is the inverter delay time, and
is the inverter acceleration time.
By setting the acceleration time of the inverter to 0.1 s, setting
T2 to 0.06, and substituting the relevant data into Equation (3), the transfer function expression of the inverter can be derived as:
In summary, the transfer function of the glass greenhouse cleaner control system can be derived as:
3. Design of Fuzzy PID Controller
The control principle of a conventional PID controller is shown in
Figure 3.
In the above figure, e(t) = r(t) − c(t), where e(t) is the control deviation, r(t) is the given target value, and c(t) is the output of the controlled object. The above diagram can also be converted into the following mathematical expression:
where
Kp is the coefficient of proportion,
Ki is the coefficient of integration, and
Kd is the coefficient of differential.
For the cleaner’s multiple working conditions environment, the traditional PID controller adopts a single PID parameter, which is difficult to adapt to the changes in the environment and ensure the stable operation of the machine. For this situation, a fuzzy PID control system is designed. The control principle of the system is shown in
Figure 4.
According to the schematic diagram, the parameters of
Kp,
Ki and
Kd are calculated as follows:
where
are the original parameters in the traditional PID controller, and where ∆
Kp, ∆
Ki, and ∆
Kd are the real-time corrected PID parameters.
The seven levels of variable values are set as “NB, NM, NS, ZO, PS, PM, PB”, the domain corresponding to the input difference E and the rate of change of the difference EC is [−6, 6], and the domain corresponding to the outputs
Kp,
Ki,
Kd is [−3, 3]. Each variable adopts the triangular state relationship function, whose corresponding function curves are shown in
Figure 5. A fuzzy rule table is established empirically, as shown in
Table 2.
4. PSO Fuzzy PID Controller
The PSO was proposed by Dr. Eberhart and Dr. Kennedy in 1995, for which the algorithm convergence speed is fast and the algorithm is simple. Therefore, it is easy to program and the PSO was selected in this study. In this algorithm, the solution of the problem to be optimized is considered as a particle, which iterates to find the optimal solution and optimize the parameters [
30,
31].
The position and velocity update formulas for the PSO algorithm are as follows:
where
is the inertia weight, which determines the size of the current velocity inheritance of particles,
is the particle velocity,
is the current particle position,
is the location of the optimal solution found by the particle itself,
is a random number between (0, 1),
is the location of the optimal solution found by the whole population, and
is the factor of learning. The influence of
and
on particle attraction can be adjusted by changing the values of
c1 and
c2.
The PSO fuzzy PID controller is optimized by the PSO algorithm for the three parameters Kp, Ki and Kd. At the same time, the increments of the three parameters Kp, Ki and Kd (in other words, ΔKp, ΔKi, ΔKd) are obtained from the difference E between the actual wheel speed and the desired wheel speed, and the rate of change of the difference EC (according to the fuzzy rule table). The optimized parameters are obtained according to Equation (7).
The control schematic and simulation flowchart of the PSO fuzzy PID controller are shown in
Figure 6 and
Figure 7.
The inertia weight of the PSO is set to 0.6, the learning factors c1 and c2 are both 2, the dimension is 3, the particle swarm size is 100, the maximum number of iterations is 100, and the search range is set to the upper and lower space of the parameters of the traditional PID controller.
5. Multi-Working Condition Simulation Analysis
This paper focuses on the simulation of the operation of the washing machine under three working conditions. These three working conditions are as follows:
- (1)
Both sides of the track are dry.
In the Adams software, the contact force stiffness coefficient is set to 100,000, the damping coefficient is 50, the force index is 1.5, the penetration depth is 0.1, the static friction speed is 0.1, the dynamic friction speed is 10, the static friction coefficient is 0.3, and the dynamic friction coefficient is 0.25.
- (2)
One of the tracks is wet with water.
In the Adams software, the contact force stiffness factor was set to 100,000, the damping factor to 50, the force index to 1.5, the penetration depth to 0.1, the static friction speed to 0.1, the dynamic friction speed to 10, the static friction coefficient to 0.08, and the dynamic friction coefficient to 0.05.
- (3)
The washing machine was suddenly disturbed by wind while traveling on a dry track.
The Adams software friction force was set the same as in the first case, and a spatial fixation force was added to simulate the wind force when the machine was running for 40 s. According to the wind data of Rui’an City, Zhejiang Province, in the past ten years, 90% of the wind force is less than class 5, which is equivalent to 120 N (±10%) of oblique force.
Taking the first case as an example, the PSO fuzzy PID simulation model built in Simulink is shown in
Figure 8. The specific sub-modules are shown in
Figure 9,
Figure 10 and
Figure 11.
The main function of the wheel speed conversion module is to calculate the input RPM of the wheels on both sides of the cleaning vehicle according to the desired speed set by the user, as well as the angular difference between the axis of the cleaner and the axis of the greenhouse during operation.
The angular error calculation module is responsible for taking the absolute value of the difference in angle between the washer axis and the greenhouse axis as output by Adams and combining it with the axis orientation to input the real-time angular error value into the wheel speed conversion module.
The scaling factors k of the fuzzy controller outputs ∆Kp, ∆Ki, and ∆Kd are set to 0.001, 0.01, and 0.001, respectively. The scaling factors of the deviation E and the rate of change of deviation EC are 0.5 and 1.2, respectively.
5.1. Simulation Analysis of Working Condition I
The simulation data when both sides of the track are in the dry state are as follows. The velocity curve under the three controllers is shown in
Figure 12, the angle error curve is shown in
Figure 13, and the left and right wheel speed error curve is shown in
Figure 14.
According to the velocity curve, the curve overshoot under the PID controller is 37.5%, and the response time is 11 s. Under the fuzzy PID controller, the curve overshoot is 31.1% and the response time is 8 s. Compared with the traditional PID controller, the overshoot is reduced by 6.4% and the response time is reduced by 3 s. Under the PSO fuzzy PID controller, the curve overshoot is 2% and the response time is 8 s. Compared with the traditional PID controller, the overshoot is reduced by 35.5% and the response time is reduced by 3 s.
According to the angle error curve, the maximum absolute error of the PID controller is 1.844 × 10−3 deg, and the adjustment period is 2.96 s. Under the fuzzy PID controller, the maximum absolute error is 1.844 × 10−3 deg, and the adjustment cycle is 2.04 s. Compared with the traditional PID controller, the maximum absolute error is not reduced, but the adjustment cycle is shortened by 0.92 s. Under the PSO fuzzy PID controller, the maximum absolute error is 1.324 × 10−3 deg, and the adjustment period is 0.22 s. Compared with the traditional PID controller, the maximum absolute error is reduced by 0.52 × 10−3 deg, and the adjustment period is shortened by 2.74 s. It can be seen from the angle error curve that the PID controller and fuzzy PID controller both have angle abrupt phenomena in the control process, while the PSO fuzzy PID controller has almost no abrupt phenomenon, so the machine runs more stably.
According to the wheel speed error curve, the maximum speed error under the PID controller is 0.026°/s, the maximum speed error under the fuzzy PID controller is 0.024°/s, and the maximum speed error under the PSO fuzzy PID controller is 0.002°/s. With the PSO fuzzy PID controller, the error of wheel speed on both sides of the machine is the lowest, and the machine runs stably.
5.2. Simulation Analysis of Working Condition II
When one side of the track is in the wet state, the simulation data are as follows. The velocity curve under the three controllers is shown in
Figure 15, the angle error curve is shown in
Figure 16, and the left and right wheel speed error curve is shown in
Figure 17.
According to the velocity curve, the curve overshoot under the PID controller is 35.8%, and the response time is 11 s. Under the fuzzy PID controller, the curve overshoot is 30.9% and the response time is 8 s. Compared with the traditional PID controller, the overshoot is reduced by 4.9% and the response time is reduced by 3 s. Under the PSO fuzzy PID controller, the curve overshoot is 2% and the response time is 8 s. Compared with the traditional PID controller, the overshoot is reduced by 33.8% and the response time is reduced by 3 s.
According to the angle error curve, the maximum absolute error of the PID controller is 1.502 × 10−3 deg, and the adjustment period is 2.95 s. Under the fuzzy PID controller, the maximum absolute error is 1.79 × 10−3 deg, and the adjustment cycle is 2.03 s. Compared with the traditional PID controller, the maximum absolute error is increased by 0.288 × 10−3 deg, but the adjustment cycle is shortened by 0.92 s. Under the PSO fuzzy PID controller, the maximum absolute error is 0.9534 × 10−3 deg and the adjustment period is 0.23 s. Compared with the traditional PID controller, the maximum absolute error is reduced by 0.5486 × 10−3 deg and the adjustment period is shortened by 2.72 s.
According to the wheel speed error curve, the maximum speed error under the PID controller is 0.023°/s, the maximum speed error under the fuzzy PID controller is 0.02°/s, and the maximum speed error under the PSO fuzzy PID controller is 0.003°/s. With the PSO fuzzy PID controller, the error of wheel speed on both sides of the machine is the lowest, and the machine runs stably.
5.3. Simulation Analysis of Working Condition III
The simulation data of the cleaner when it suddenly encounters wind disturbance while walking on the dry track are as follows. The velocity curve under the three controllers is shown in
Figure 18, the angle error curve is shown in
Figure 19, and the left and right wheel speed error curve is shown in
Figure 20.
According to the velocity curve, the curve overshoot under the PID controller is 36.2%, and the response time is 10 s. Under the fuzzy PID controller, the curve overshoot is 31.4% and the response time is 8 s. Compared with the traditional PID controller, the overshoot is reduced by 4.8% and the response time is reduced by 2 s. Under the PSO fuzzy PID controller, the curve overshoot is 2.5% and the response time is 8 s. Compared with the traditional PID controller, the overshoot is reduced by 33.7% and the response time is reduced by 2 s.
According to the angle error curve, the maximum absolute error of the PID controller is 6.04 × 10−3 deg, and the adjustment period is 2.93 s. Under the fuzzy PID controller, the maximum absolute error is 5.808 × 10−3 deg, and the adjustment cycle is 2.03 s. Compared with the traditional PID controller, the maximum absolute error is reduced by 0.232 × 10−3 deg, and the adjustment cycle is shortened by 0.9 s. Under the PSO fuzzy PID controller, the maximum absolute error is 5.869 × 10−3 deg and the adjustment period is 0.4 s. Compared with the traditional PID controller, the maximum absolute error is reduced by 0.171 × 10−3 deg and the adjustment period is shortened by 2.53 s.
According to the wheel speed error curve, the maximum speed error under the PID controller is 0.09°/s, the maximum speed error under the fuzzy PID controller is 0.075°/s, and the maximum speed error under the PSO fuzzy PID controller is 0.004°/s. With the PSO fuzzy PID controller, the error of wheel speed on both sides of the machine is the lowest, and the machine runs stably.
It can be seen from the simulation data of three working conditions that the PSO fuzzy PID controller has smaller output curve overshot, shorter response time, better stability, and better control performance.
The performance comparison with different conditions is shown in
Table 3. In general, the overshoot of the PSD fuzzy PID for all conditions does not exceed 5%. The angle error adjustment cycle of the PSD fuzzy PID for all conditions is less than 1s. The response time of the PSD fuzzy PID for all conditions is 8 s, and the speed error of the PSD fuzzy PID for all conditions is less than 0.005°/s. Therefore, the PSO fuzzy PID controller control effect is superior to the other controllers, which results in high stability, fast regulation speed, and robustness.