Simulation Study on Coverage Path Planning of Autonomous Tasks in Hilly Farmland Based on Energy Consumption Model

-e hilly farmland in China is characterized by small farmland areas and dense farmland distribution, and the working environment is three-dimensional topographic farmland, so the working conditions in the field are relatively complex. In this working environment, the coverage path planning technique of a farmland autonomous task is harder than that of 2D farmland autonomous task. Generally, the path planning problem of 2D farmland is to construct the path cost model to realize the planning of agricultural machinery driving route, while for the path planning problem of three-dimensional terrain farmland in the hilly region, this paper proposes a covering path planning scheme that meets the requirements of autonomous work. Based on the energy consumption model, the scheme searches the optimal driving angle of agricultural machinery, prioritizes solutions to the problem of covering path planning within the scattered fields in the working area, and then searches through the genetic algorithm for the optimal order of traversing the paths of each field to complete the coverage path planning in the working area. On the one hand, the scheme optimizes the planning route in the fields from the angle of optimal energy consumption; on the other hand, through the genetic algorithm, the fields are connected in an orderly manner, which solves the comprehensive problems brought by the unique agricultural environment and farming system in China’s hilly areas to the agricultural machinery operation. -e algorithm program is developed according to the research content, and a series of simulation experiments are carried out based on the program using actual farmland data and agricultural machinery parameters. -e results show that the planned path obtained at the cost of energy consumption has a total energy consumption of 4771897.17J, which is 17.4% less energy consumption than the optimal path found by the path cost search; the optimization effect is evident.


Introduction
Coverage path planning (CPP) refers to a kind of static global path planning in which a robot can completely cover the entire work area through autonomous tasks [1]. Compared with dynamic, real-time path planning, the environmental conditions of the covered path planning are known, and the algorithm design of the path planning covering the entire operation area is completed. CPP has high practical application value in many fields, such as indoor area cleaning operations, unknown area coverage detection operations, and hazardous area operations [2][3][4]. Different areas have different requirements for coverage tasks, which makes CPP pertinent and unique in algorithm design. In the agricultural production field, CPP schemes are mainly to solve actual field production needs: on the one hand, demand is the result of agricultural machinery modernization; on the other hand, it is a combination of problems arising from the natural environment and agricultural system. us, the CPP technology in the field of agriculture has particularity and complexity.
Path planning is of great significance in the field of unmanned driving in the concept of future smart agriculture, so it has attracted widespread attention. In field operations, the application of path planning technology is mainly composed of two parts. First, path planning technology is used to statically plan the operation path from a global perspective; second, for emergency events such as small obstacles, dynamic, real-time local path planning can be achieved based on sensor technology, automatic control technology, and other technologies. At present, much research focuses on the latter, but there are few studies on CPP, and the research depth is insufficient. In the agricultural system, environmental factors and agronomic requirements are necessary factors for agricultural machinery operations, so the application of CPP in agricultural field production is targeted, practical, and complex. In order to complete an agricultural field operation, finding the optimal path to cover the entire field is a very difficult mathematical or algorithmic problem. According to current research, there is no exact evaluation standard to measure the advantages and disadvantages of the coverage path planning algorithm [5]. For example, in the study of two-dimensional farmland CPP, Oksanen and Visala [6], Zuo et al. [7], and Jin and Tang [8] all used the unit decomposition method to study the CPP problem of complex farmland in Finland, China, and the United States. Jensen et al. [9] studied the cooperative operation mode of transport units and harvesting units in the process of combined harvesting and studied the planning of internal field coverage path and the scheduling between different fields under this mode. Hameed [10][11][12] engaged in optimization research of CPP problems from the perspective of minimum overlap of operating area, minimum cost of nonworking path, and the presence of obstacles in the field, and developed specific and feasible planning algorithms. In addition, in terms of the details of the two-dimensional farmland CPP algorithm, Jin and Tang [8] and Meng et al. [13], respectively, analysed the cost of various headland turning methods and turning type decisions. erefore, considering the actual operation situation and operation requirements from different perspectives, the planning results obtained are only a certain aspect of field operations to achieve the optimization of the two-dimensional farmland CPP scheme. Compared with 2D plane farmland, 3D terrain farmland has a more complex field operation environment, and it has become a major difficulty in agricultural CPP research. Different scholars have in-depth thoughts on the problem of 3D terrain CPP from different angles. Hameed et al. [14,15] first studied the problem of large-scale farmland CPP with three-dimensional terrain based on a genetic algorithm from the perspective of energy consumption and then proposed a "side-to-side," three-dimensional coverage method for the problem of skips/ overlaps of the operating area by agricultural machinery. Both Jin's team and Dogru's team [16,17] divided the threedimensional farmland into plane areas and slope areas for zoning research. e difference is that Jin et al. analysed the optimal angle of the path covered in the field from the three perspectives of the cost of headland turning, the cost of soil flow, and the cost of the missing area, while Dogru et al. studied the optimal driving angle of the planned path based on energy consumption cost.
Field environment and terrain are the main influencing factors of field CPP. e farmland environment in hilly areas of China is unique: the fields are small and concentrated, and the fields are connected by field roads. Obviously, the 3D terrain farmland CPP scheme proposed by researchers in other regions is difficult to use in China, and the research on the 3D terrain CPP field in China is still in a nascent stage. Based on the background, the paper aims to develop a three-dimensional coverage path planning scheme that is compatible with the characteristics of farmland in hilly areas of China to meet the needs of autonomous operation of agricultural machinery in hilly fields. e contributions of this research mainly include the following three contents: (1) A mathematical model between the energy consumption of agricultural machinery and the driving direction angle on the three-dimensional terrain is constructed, and an exhaustive algorithm is used to search for the driving angle with the best energy consumption. Compared with the driving angle with the optimal path cost, the CPP obtained with the driving angle with the lowest energy consumption has little difference in path cost, but the energy consumption is significantly reduced. (2) e positions of the entrance and export nodes of each field are known, and the linear distance between the export node of any field and the entrance node of another field is taken as the heuristic function. e traversal sequence among fields was analysed by the genetic algorithm, and the connection between fields was realized. (3) Realized the visualization of the planned path and provided specific algorithms to realize the simulation of CPP scheme for specific farmland, which proved the feasibility and effectiveness of the scheme.

Actual Needs and Specific Issues
e farmland area of hilly and mountainous areas in China accounts for a large proportion of the total cultivated land area. In view of the fact that domestic agriculture is subject to objective factors, such as the agricultural system and environmental conditions, farmland in China's hilly areas has gradually developed the characteristics of small field areas and densely distributed fields. ese characteristics bring challenges to intelligent operations and even mechanized operations. erefore, in order to introduce the concept of autonomous driving in field operations in hilly and mountainous areas, 3D terrain static CPP technology is essential, and the technology is more difficult to implement than planar farmland CPP technology. e main difficulties include: (1) a series of problems caused by elevation in 3D terrain farmland to path planning technology need to be considered and (2) the obvious characteristics of farmland in hilly areas in China make it difficult for mechanized and intelligent operations.
Our research plan mainly considers the application of CPP technology from the perspective of energy consumption. At present, energy consumption in many fields has become a crucial factor that must be considered in research and development work [18,19], and agricultural production is even more focused on energy consumption. Agricultural mechanization in China follows the development direction 2 Mathematical Problems in Engineering of green agriculture and precision agriculture. However, when working in three-dimensional terrain, it is inevitable to have to consider energy consumption because whether driving uphill or downhill, machinery will consume additional energy. If we ignore this aspect, it will cause the decrease of mechanical operation efficiency and the increase of energy consumption, which will increase the cost of mechanized operation for farmers. erefore, it is reasonable and positive to evaluate the planned path in the field from the perspective of energy consumption.

Principle.
In order to better describe the proposed scheme, we herein will make a series of reasonable idealization assumptions based on the characteristics of the operation: (1) assume that the farmland is located on a hilly slope with a slope of 15°∼ 25°. (2) e plan will build a working area, which contains a number of irregularly distributed, small field blocks, and the field blocks are connected by field roads. (3) e surface of the farmland is linear; that is, the edge of the cross section at any angle is linear. (4) e contact between the surface of the field block and the wheel surface remains stable-that is, the rolling friction coefficient remains constant, and f � 0.1. (5) In the process of constructing the energy cost function, the energy consumption of the agricultural machinery in the headland turning area was ignored. e specific algorithm process of farmland coverage path planning is shown in Figure 1. First, the obtained field boundary data and DEM data are visualized, and, at the same time, the selection of the headland turning type is performed according to the headland width information provided by the data. en, the energy evaluation model is built and the optimal driving angle is searched based on the model. en, the path is visualized and the planned path is analysed. Finally, the operation path planning in each field is completed in turn. After the internal path planning of each field block is completed, the traversal order of each field block operation is sorted, and a genetic algorithm is used to search the traversal order with the lowest path cost. erefore, the scheme mainly solves three problems: (1) Farmland traversal sequence planning composed of multifield blocks (2) Single-field CPP (3) Visualizing the path of planning

Single-Field Coverage Path Planning Based on Energy
Consumption Model

Explanation of Angle
Relationship. e first parameter to deal with when building a three-dimensional terrain energy model is slope. e reason why three-dimensional terrain farmland is more difficult to design a path planning algorithm forthan two-dimensional farmland is the existence of slope. e inclination of agricultural equipment in the direction of field operation is different from the slope of 3D terrain. In actual operation, the relationship between the inclination and the slope of the driving direction can be known from e sloping angle of the driving direction is simplified to obtain where θ � the slope angle; α � the driving direction angle; δ � the angle between the farmland boundary and the horizontal direction; ψ � the angle between the working direction and the farmland boundary; and β � the inclination angle of the working direction ( Figure 2).

Analysis of Unit Path Energy Model in Straight Line
Sections. In the existing hypothesis, the surface of the farmland is linear. at is, the edge of the cross section at any angle is linear. e linearity of the field surface does not mean that the working inclination angle β remains unchanged during the up-/down-slope movement, but the working inclination angle β changes with the change of the slope angle θ. e farmland three-dimensional structure model constructed by DEM data has been linearized on the farmland surface. erefore, a section of the path surface driven at an angle in simulation research is shown in Figure 3. When describing a path, the unit path is taken as the research object, and each unit path is assigned three parameters: the operation angle β i of the unit section, the path length Δl i of the unit section, and the driving force F i of the unit section. According to these three parameters, the energy consumption W i of each cell path is obtained.
Assuming that the two nodes of a unit path i are N i (x i , y i , z i ) and N i+1 (x i+1 , y i+1 , z i+1 ), respectively, the slope angle of the unit section of the unit path i is calculated by the following formula: (3) erefore, the working inclination β i of the unit path is Driving direction

Mathematical Problems in Engineering
Euclidean distance is used to calculate the length of the unit path, which is formula (6): When equipment is operating in the actual operating area, it can be divided into an up-slope operation stage (β ≥ 0) and a down-slope operation stage (β < 0) according to the slope. When β ≥ 0, the mobile device keeps moving uphill.
e driving force of mobile devices in the uphill process is calculated as formula (4) [20]: where F t � driving force; F f � rolling friction; F w � air resistance; F i � slope resistance; and F j � acceleration resistance.
In formula (6), due to the low speed of field operation in hilly fields, air resistance is negligible, making F w � 0. In addition, the operating equipment completes the working process and the turning process at two different speed values, so there is an acceleration/deceleration transition stage between the working process and the turning process, but this stage can be completed in a short time, so this stage is incorporated into the uniform speed operation stage, making F j � 0. erefore, the force exerted on the mobile device during the uphill movement can be simplified as follows: e specific force analysis can be seen in Figure 4, where where f � rolling friction coefficient; f � 0.1 (new tire) or (old tire); and M � total mass of mobile device. Slope resistance is derived from the component of the mobile device's gravity on the slope, so According to equations (4), (7), (8), and (9), it can be obtained that Similarly, in the process of downhill, the driving force of mobile devices is expressed as en, the unit segment driving force is e power consumption of each unit path is calculated according to W i � F i Δl i , and the energy consumption model of the unit path is e example given in Figure 3 shows a complete path in the actual operation area of the field. Every two adjacent nodes are connected into a unit path, and several unit paths are connected to obtain a path. Several paths are connected through the turn of the ground to obtain complete coverage planning paths in the field. ere are several paths in the actual operation area of the field block, so the energy consumption model based on the unit path can obtain the total power consumption W of all paths in the actual operation area of the field block:

Selection of Headland Turn
Mode. e headland turning method is determined by the two parameters of the headland width and the minimum turning radius of the agricultural machine. ere has been much research on the selection method of the headland turn, the path cost calculation method, and the path generation method [8,13,21,22]. Jin and Tang [8] studied the decision-making and path cost calculation of several common ground turning modes, including "flat," "U," "light bulb," and "fishtail." Figure 5 shows the decision-making model of headland turning based on our research results. e path costs of different turning methods are different. In [8,13], the calculation method of the path costs of the turning process was proposed. Based on many studies, formula (15) can be obtained, which is the path cost of a single turning process: where ω � operating width; ψ � angle between operating direction and farmland boundary; r � minimum turning radius; S T � single turning path length; and W h � headland width.

Research on Field Traversal Sequence Based on Genetic
Algorithm. When the internal CPP of each field block is completed, the location of the entrance and export nodes of each field block are known, and the optimal path that traverses each field block without duplication is searched based on the known condition of the entrance and export node locations. At this time, the problem can be regarded as a traditional TSP problem, and GA is an ideal way to solve the TSP problem [23], in which the selection of heuristic function is crucial [24]. e positions of the entrance and export nodes of each field are known, and the linear distance between the export node of any field and the entrance node of another field is taken as the cost to calculate the total cost required to traverse each plot, so as to optimize the traversal order. e steps to solve this problem with the GA algorithm are as follows: Step 1: encode genes (field block number and entrance and exit number) and initialize required parameters, where the population number is set to 100, the number of chromosome genes (field number) is 9, crossover probability is 0.9, and mutation probability is 0.1.
Step 2: select the fitness function and judge the fitness of each chromosome. Because the import and export nodes of any field block have been determined, each chromosome (random arrangement of fields based on known import and export locations) can calculate the total cost based on the straight line distance between the exit of the front field block and the entrance of the back field block, and take the inverse of the total cost as the fitness function.
Step 3: according to the fitness, the Roulette method is used to select the chromosomes, and the selected chromosomes are crossed and mutated to generate a new population.
Step 4: continue evolution of new populations according to Step 2.
Step 5: iteration termination principle. When the maximum number of iterations is reached or the fitness no longer changes, the algorithm terminates.
e process of the genetic algorithm is shown in Figure 6.

Algorithm Implementation.
e above content describes the core content of the scheme, including energy consumption cost function, optimization of the field traversal order, and decision of the headland turning method. e research program was to design a complete path planning in an operation area from the perspective of energy consumption. For a given operation area, the specific algorithm flow is as follows: Input: FF (boundary of each subfield and internal node DEM data file), W h (headland width), r (minimum turning radius), ω (operating width), m (total agricultural machinery mass), Δ (driving angle search step), and origin (reference coordinate origin). Output: the resultant data and correlation graph of the optimal driving angle, energy consumption cost, and path cost of each field.
Step 1: input the data file FF, set working parameters, and complete the visualization of farmland data.
Step 2: the reference origin, origin, is selected, and the collected boundary data points and elevation data points within the field block are converted from latitude and longitude coordinates to rectangular coordinates.
Step 3: according to the function get single, each field is optimized to obtain the driving angle with the energy optimal. Set the driving direction angle, start from 0 ∘ , search 360 ∘ in order according to the step size Δ, calculate the energy cost C ei and path cost C li of each angle according to the cost model, store them in the variable history, and search for the most based on the energy cost C ei search optimal driving angle α o . Figure 4: Force analysis of the slope stage on a mobile device.
Step 4: according to the two parameters of the width of the headland W h and the minimum turning radius r, the function turn is called to select the turning mode of the headland inside the field.
Step 5: the function main plot is used to complete the visualization of the internal planning path results of each field block, and the entrance and export position data of each field block are recorded, and the data are stored in two variables, export, and entrance.
Step 6: based on the method described in Section 3, calculate the path cost value C AB between any two fields A and B, search for the optimal traversal order of the path cost by genetic algorithm, and finally output the search result, that is, the traversal order number.
Step 7: visualize the traversal path, complete the overall path planning, and the algorithm ends.

Analysis of Simulation Results
In order to verify the feasibility and effectiveness of the studied algorithm, a series of simulation tests were conducted using real farmland data and field operation parameters. e simulation experiment was conducted in the MATLAB 2019a programming environment on a Windows 10 Intel (R) Core (TM) i5-1035 PC. In 2D farmland, the energy consumption of agricultural machinery operations is related to the length of the path that the job travels, so path cost is a common indicator to solve the CPP problem of two-dimensional farmland. However, in the 3D CPP, the energy consumption of operations is not only affected by the length of the path but also closely related to the slope and elevation. erefore, it is necessary to construct an energy consumption model of agricultural machinery in the 3D farmland operation process, which will be used to solve the 3D CPP problem. In order to reflect the Mathematical Problems in Engineering advantages of the energy consumption model in solving the 3D CPP problem, the path cost corresponding to each angle will be recorded in the variable history during the experiment. In this way, it is possible to evaluate the advantages of using energy consumption cost as an indicator to complete the CPP of 3D terrain farmland by comparing with the path cost. e simulation analysis experiment takes Farmland A as the object of simulation, the hillside where the farmland is located is facing 80°, the satellite image of farmland is shown in Figure 7, and the farmland data parameters are shown in Table 1. Figure 7 shows the shape and location of the farmland, and the shape of each field is simple. e lengths of fields 2, 4, 8, and 9 are narrow. e long axis of field block 2 is perpendicular to the slope direction, whereas the long axes of fields 4, 8, and 9 are parallel to the slope direction. e remaining fields are not different in length and width. Farmland A consists of nine fields with an area of no more than 6000 m 2 , and the sum of each field area is 20025.4467 m 2 , of which the largest elevation difference is in field block 8, reaching 43.7826 m. e simulation test takes the developed hilly mountain tractor autonomous task equipment as the simulation operation vehicle, and the field operation parameters are shown in Table 2.
e simulation results of the CPP of fields 1∼9 are shown in Figure 8, and the simulation data of each field are shown in Table 3. Figure 8 shows that the driving directions of the optimal energy consumption paths of each field tend to be similar, and a feature also reflected in the data (Table 3). e optimal driving angle for energy consumption is concentrated at 175°and 355°, which are opposite directions. It is known that the direction of the hillside where the farmland is located is 80°. e orientation of the hillside fields has an important influence on the optimal energy drive angle, and the two have a vertical relationship.
When studying the path planning results of specific fields, some interesting phenomena will be found.      Mathematical Problems in Engineering blocks 8 and 9, respectively. e two fields are narrow in shape, and their long axes are parallel to the slope. eir areas are 5638.7717 m 2 and 3639.0857 m 2 , respectively, and the respective optimal energy consumption values are 938876.59 J and 583569.02 J. e areas of field blocks 6 and 5 are slightly larger than those of field blocks 8 and 9, respectively, and their optimal energy consumption values are 867792.54 J and 490368.71 J, respectively, a smaller values than those of field blocks 8 and 9. erefore, the shape of a three-dimensional landform has a certain influence on the energy consumption: when the shape of the field is narrow and the long axis is parallel to the slope, the narrow terrain will cause more energy consumption.
In the process of processing the variable history that stores the result data, the relationship between the route cost and the driving angle ( Figure 9) and the relationship between the energy cost and the driving angle ( Figure 9) can be obtained. It can be found from the resultant data of each field coverage path shown in Figure 9 that there is a sinusoidal relationship between energy consumption cost and driving angle for each field coverage path. e conclusions obtained are mutually verified with the correctness of the energy consumption model proposed in Section 3.
According to the information shown in Figure 9 and the data in Table 3, in terms of energy consumption, the path obtained by searching energy consumption cost is better than the path obtained by searching energy consumption cost, among which Field 8 can reduce energy consumption by 42.46%. Overall, the energy consumption model can reduce energy consumption by 17.4%. Besides, as shown in Figure 9, it can be found that the path costs of the planned paths at different travel angles do not vary significantly, so it is more valuable to use energy consumption cost as the evaluation scale in 3D terrain.
After the completion of the path planning results for each field, the complete CPP results in the operation area are shown in Figure 10, in which the sequence of the fields obtained by genetic algorithm optimization is 1 ⟶ 3 ⟶ 4 ⟶ 6 ⟶ 8 ⟶ 9 ⟶ 7 ⟶ 5 ⟶ 2. e node coordinates of each field cover path planning for the     Table 4 in which the coordinate data are transformed into coordinates of the rectangular coordinate system with (127.1563, 42.3230) as the reference origin. In the test results, the optimal coverage path of energy consumption for nine fields was successfully planned, and the orderly connection of each field was realized. It can be considered that the proposed scheme is feasible, and the required operation target can be achieved under certain conditions.

Conclusion and Future Research
e innovation of the scheme is mainly realized in the following three aspects: a path planning algorithm is developed to cover the operation area of nonstandard farmland in hilly areas of China, which are characterized by small areas, dense distributions, and irregular patterns. e algorithm uses the energy consumption model to plan the covering path of a single field. According to the   characteristics of the irregular distribution of each field in the working area, based on the known location of entrance and exit of each field, the order of traversing each field was optimized by the genetic algorithm. e simulation experiment is carried out by selecting actual farmland and actual operation parameters, and the algorithm proposed in this paper is verified, and its performance is evaluated. e experimental results show that the developed algorithm can realize the coverage path planning of farmland with multiple subfields. e algorithm also records the path cost data of different driving angles. Compared with the path planned by the optimal energy consumption and path cost, the path obtained by the former is better in terms of energy consumption, while the path cost differs little. erefore, taking energy consumption as an evaluation index is more suitable for path planning of 3D terrain. Besides, based on the optimal energy consumption of each field, the connection between multiple fields in the operation area was effectively completed.
e research in this article has important guiding significance for agricultural machinery field operations in hilly areas of China. Also, with the Chinese government increasing policy investment in the agricultural mechanization transformation of hilly and mountainous districts, the research can contribute to the field of intelligence of hilly farm machinery. It can be seen from the selected simulated farmland that the current study has a better effect on dealing with farmland with a simpler field environment and shape. However, the farmland environment is complex, and the planning scheme still needs to be improved in detail when dealing with complex farmland (such as obstacles and complex shapes). e comprehensiveness and complexity of agriculture is a normal phenomenon. Besides, the effective coordination between the job requirements and the job environment is also one of the directions of CPP's indepth research. On the one hand, according to the actual power output of farm machinery in the field operation process, the energy consumption model is optimized to make the model more accurate and reliable; on the other hand, specific operational requirements (such as unloading of harvesting operations and loading of seeding/fertilization operations) will be considered in the CPP scheme, which will involve multimachine collaborative scheduling.

Data Availability
CPP simulation data based on MATLAB used to support the findings of this study are included within the supplementary information files. e simulation data used to support the results of this study have not been provided because of project requirements.

Conflicts of Interest
e authors declare that there are no conflicts of interest regarding the publication of this paper.