# Smart Garden Planning and Design Based on the Agricultural Internet of Things

Authors: Yi Xun; Guangpei Ren
Journal: Computational Intelligence and Neuroscience
 (2022)

---

## Abstract

To improve the effect of urban agricultural garden landscape planning and design, this paper combines the agricultural Internet of Things technology to construct a smart garden planning and design system. Moreover, this paper selects the LEACH protocol that can support monitoring for a long time according to actual application needs, introduces the latest swarm intelligence optimization algorithm, the gray wolf algorithm, to optimize some of the problems in the LEACH protocol, and conducts simulation experiments on the improved algorithm. The simulation experiment results show that the improved algorithm has obvious advantages in cluster head selection, data transmission within the cluster, and route maintenance. After constructing a smart garden planning system based on the agricultural Internet of Things, the effect of the agricultural Internet of Things data processing in this paper is evaluated. Finally, this paper constructs a garden simulation system and analyzes the performance of the system. The results verify that the agricultural Internet of Things has a good effect in the planning and design of smart gardens.


---

## Body

## 1. Introduction

Ecological culture is a new cultural outlook that represents new trends and trends in the world. It represents the awakening of human beings from the ignorant concept of ruling and conquering nature, seeking a way to respect and coexist in harmony with nature. It is the “ecological” and “natural” transformation of the central values of mankind [1].Regarding the definition of the term landscape, many scholars have put forward different interpretations. In the field of landscape ecology, it studies the ecosystem of the entire natural world, and it focuses on the interaction between ecological subsystems such as climate, geology, soil, vegetation, hydrology, animal and human activities, and their impact on nature. In addition to studying the characteristics of the objective laws of the generation, development, and evolution of the landscape ecosystem itself, it also seeks measures and ways to rationally utilize, protect, and manage the landscape. The field of landscape geography focuses on the changes of natural landscape morphology, emphasizes the natural characteristics of the landscape, and pays attention to the development and evolution of landscape morphology and landform. From the perspective of landscape architecture, it focuses on the relationship between humanity and nature from the relationship between human and landscape and social attributes. The connotation of the landscape shows obvious characteristics of dynamic changes with the influence of human activities and the change of regional form. From the perspective of the entire development history of human society, the landscape on the Earth is the result of human adaptation and transformation of the natural world [2]. From the definitions of the three major disciplines mentioned above, it can be summarized that landscape is the trace left on the land by human activities or the interaction between humans and nature. The landscape can be regarded as an organic collection composed of a series of symbolic landscape elements. The landscape elements are the unit elements that make up this large collection of landscapes. Therefore, landscape elements can be divided into two categories: natural landscape elements and artificial landscape elements. Natural landscape elements include terrain, soil, vegetation, and Fengshui patterns, and artificial landscape elements include road paving, sketches, and buildings [3].In recent years, rural revitalization has been a key work and policy measure in my country. Rural complexes are an important measure to realize rural revitalization. Since the concept of rural complexes was put forward, many cities and towns in my country have been put into practice. However, research on rural complexes and the development of on-site projects is not perfect, and the aspects involved are relatively limited, mainly including leisure and entertainment, physiotherapy, sightseeing agricultural picking, and specialty catering. There are relatively few research studies and analyses on building a smart pastoral complex from the perspective of global tourism combined with the Internet of Things. Global tourism is not the same as previous tourism, blindly pursuing the growth of tourist visits, but focusing more on the improvement of tourism quality. Above all, global tourism aims to build tourism into tourism that can improve people’s quality of life and also pursue the value of tourism in people’s new wealth revolution.Taking the agricultural pastoral as the theme, this paper combines the agricultural Internet of Things technology to carry out smart garden planning and design, so as to promote the development of the industry and raise people’s awareness of ecological protection and bring people a good pastoral scenery experience.


## 2. Related Work

With the continuous development of spatial geographic information acquisition technology and computer communication technology, the amount of geographic information data continues to expand, and the difficulty of information extraction and analysis continues to increase. Geographic information has gradually changed from a “digital city” to a “smart city” [4]. At present, various countries are developing smart city projects in line with their own national conditions, such as smart grids in the United States and smart communities in the European Union. With the gradual maturity of 3D geographic information technology, 3D geographic information data have finally entered a wide range of applications in recent years, new stage [5]. In terms of data acquisition methods, noncontact rapid batch acquisition of large-scale data has been achieved at home and abroad. Oblique photography technology, which uses multisensor or dynamic sensors to synchronously collect images from the air, can collect rich high-resolution texture data on the surface and side of buildings and is an upgrade to the traditional single-sensor acquisition method of aerial photography [6]. Literature [7] shows a 3D map made with oblique photography data. At present, the AOS system in the United States, the Penta-DigiCam system in Germany, the A3 system in Israel, and the RCD30 in Leica in Germany are widely used internationally [8].With the popularization of drone technology, tilt photography technology has also shown explosive growth [9]. Now, in the smart city 3D modeling project, the oblique photography 3D modeling program has taken a place [10]. In addition, LiDAR technology, namely, laser scanning, has also emerged in many fields. It can quickly obtain high-precision point cloud data and is widely used in many fields such as surveying and mapping, architecture, deformation monitoring, mechanical engineering, archaeology, cultural relics protection, and autonomous driving [11]. At present, common international laser scanners include German ATOS 3D optical scanner, Swiss Leica 3D laser scanner, Austria RIEGL laser measurement system, and American Trimble 3D laser scanner [12].In recent years, high-resolution satellite remote sensing technologies have also been continuously developed, such as QuickBird and WorldView in the United States. In my country, the Chinese “High Score Family” represented by Gaofen No. 2, No. 3, and No. 4 also provides reliable DOM (Digital Orthophoto) and DEM (Digital Elevation Model) for smart city 3D modeling projects data [13]. In the use of oblique photography data for 3D automatic modeling, there are foreign Smart3DCapture, Pixel Factory, PhotoMesh, PohtoScan, etc., which are all powerful tools suitable for the rapid production of smart city 3D models [14]. In the use of laser point cloud data for 3D automatic modeling, the current use of refined reverse engineering modeling software is mainly not suitable for the automatic production of large-area smart city 3D model data [15].The massive data of smart cities need to be supported by software platforms with spatial management and analysis functions, such as SkylineGlobe, ArcGlobe, CityEngine, etc., which are all currently used smart city geographic information platforms [16].Smart city 3D models have a wide range of data sources, different production methods, and data structures. Only when a unified standard specification is formulated, can the data interoperability be realized [17]. The Open Geospatial Consortium (OGC) has established the 13S standard as a new international three-dimensional standard, which is a standard specifically designed for three-dimensional spatial geographic information data [18].


## 3. Agricultural Wireless Sensor Network Model

In order to make the research on wireless sensor networks more targeted, the research content in this article is based on the following assumptions:(i)
The sink node is located in the monitoring area, and its energy is continuously supplied by an external power source. It has stronger computing and storage capabilities than ordinary nodes, can connect to the external network, send data to remote observers, and maintain communication with at least one node in the network.(ii)
The scale of the sensor network is designed to be 200 nodes, and they are randomly and evenly distributed in the monitored area. The nodes have limited energy and are supplied by their own batteries. They have certain computing and storage capabilities, and can sense their own remaining energy, and follow the network operation. As time progresses, the energy consumption of each node is not the same, and the energy of the nodes will be inconsistent.(iii)
After the node is deployed, once the network is started, the position of the node will no longer change, and the node can know the distance between itself and other nodes through RSSI.(iv)
All nodes have similar communication capabilities and data processing capabilities, there is no super node, the channels between the nodes are symmetrical, the node’s transmission power is limited, and it has a unique ID code.(v)
The communication success rate of all nodes conforms to formula (1). There is a communication path with a hop count of h in the network. If it is assumed that the communication distance of the i-th hop is d and the effective communication distance of the node is r, then the communication success rate obeys the following formula [19]:(1)Psuch=∏i=1hpdi=0.2hdh,dh,…,dhrh≤0.2h.It can be seen from formula (1) that the fewer the number of hops, the shorter the path and the higher the communication success rate [20].The wireless sensor network communication channel is a random channel.(2)ETxkd=Eeleck+Empkd=kEelec+kεd2,d≤d0,kEelec+kεd4,d≥d0.Here,Eelec is the receiving module to complete a complete transceiver, εfs and εmp depend on the parameters of the transmitting circuit and the receiving circuit, d is the distance between the transmitting node and the receiving node, and the calculation formula of d0 is as follows:(3)d0=εfsεmp.d0 is the distance threshold. When d is less than d0, the communication of the node obeys the free space model.(4)Erxk=kEelec.The LEACH protocol is a WSN hierarchical routing protocol, which occupies a very important position in the research of WSN routing protocol. Figure1 is a schematic diagram of LEACH protocol clustering. Clustering algorithms such as DCHS, TEEN, and APPTEEN, all borrow the idea of LEACH algorithm. The LEACH algorithm first puts forward the idea of “round.” Each round is divided into two stages: cluster establishment and data transmission.Figure 1
Schematic diagram of LEACH protocol clustering.During the formation of the cluster, if the node randomly chooses a number between 0 and 1 and if the selected number is less than the thresholdT(n), it is selected as the cluster head. The calculation formula of T(n) is as follows [21]:(5)Tn=xl−xrmodl/x,ifn∈S,0,otherwise.At this point, one cycle is over and preparations for the next cycle are started.Figure2 is the LEACH protocol flowchart. First, the algorithm selects the cluster head node. After this cluster head is determined, a broadcast message is sent to other nodes. The message includes the cluster head location, cluster head ID, and energy information. The noncluster head node selects the cluster head closest to its position to join according to the received message to form a cluster, and the cluster establishment phase is completed. The cluster head manages the nodes in the cluster, collects data collected by the members, and establishes a TDMA timing table for the member nodes. Then, send the timing table to the nodes in the cluster. All nodes send the collected data to the cluster head according to the time slot specified in the timetable. The cluster head performs simple preprocessing on the data in the cluster and then sends it to the upper node. At this point, one “round” is over and the next cycle begins.Figure 2
LEACH protocol flowchart.Although the LEACH protocol has a very good performance in long-term monitoring, it also has some shortcomings, mainly including the following aspects:(1)
In each round of cluster establishment, all nodes must participate, and the amount of calculation is very large, which is a great waste of resources(2)
The selection of the cluster head is random(3)
All cluster capitals communicate directly with sink nodes and do not consider the resource loss caused by long-distance communication between cluster heads far away from sink nodesThis paper introduces a new meta-inspired optimization algorithm—gray wolf algorithm—to solve the above-mentioned problems of LEACH algorithm, so that it can better serve agricultural applications. Meta-heuristic algorithms are favored by researchers because of their simplicity and flexibility. The gray wolf (GWO) algorithm is currently the most popular meta-heuristic algorithm in theoretical research. The main idea of the algorithm is to simulate the social hierarchy and group hunting behavior of the gray wolf family in nature. Gray wolves belong to the canine family and like to live in groups. On average, each group consists of 5–12 gray wolves and follows a strict hierarchy, as shown in Figure3.Figure 3
Schematic diagram of the gray wolf population hierarchy.The social status of wolves in the gray wolf family can be divided into 4 levels from top to bottom, namely,α wolves, β wolves, δ wolves, and ω wolves. Alpha wolf is a wolf, mainly responsible for deciding the time and place of sleeping, hunting, and tactics. The second level of the gray wolf class is β wolves. β wolves are subordinate wolves, mainly responsible for assisting the wolves to manage the wolf pack. When the wolf pack lacks alpha wolves, beta wolves will replace alpha wolves. The delta wolf is on the third level. The delta wolf obeys the instructions of the alpha wolf and the beta wolf, but it can command the ω wolf at the bottom. The ω wolf is mainly responsible for balancing the relationships within the population.The collective hunting of gray wolves is an important part of the social activities of gray wolves. Scholars such as Muro have introduced the hunting behavior of gray wolves in detail in the literature, as shown in Figure4.Figure 4
Gray wolf hunting behavior. (a) Chasing, approaching, and tracking prey. (b) Pursuit, harassment, and encirclement. (c) Static state and attack.
(a)(b)(c)Mathematical model of gray wolf algorithm: (1) to establish a mathematical model of gray wolf’s social hierarchy, we named the solution with the best fitness asα wolf. Therefore, the second and third best solutions are named β wolves as well as ω wolves, respectively.


### 3.1. Hunting Model

In order to simulate the encircling behavior of gray wolves with a mathematical model, equations (6) and (7) are introduced.(6)D⟶=C⟶XP⟶t−X⟶t,(7)X⟶t+l=Xp⟶t−A⟶D⟶.The calculation formulas for vectorsA⟶ and C⟶ are as follows [22]:(8)A⟶=2a⟶r1⟶−a⟶,C⟶=2r2⟶.


### 3.2. Attack Model

GWO hunts are led byα, and β and 8 occasionally participate. In order to mathematically simulate the hunting behavior of gray wolves, we assume that α (the best candidate solution) and β and 6 have a more accurate understanding of the potential location of the prey. Therefore, the algorithm saves the first three optimal solutions obtained so far and forces other search agents (include o) to update their positions according to the position of the best search agent. And its update formula is as follows:(9)Dα⟶=C1⟶Xα⟶−X⟶,(10)Dβ⟶=C2⟶Xβ⟶−X⟶,(11)Dδ⟶=C3⟶Xδ⟶−X⟶,(12)X1⟶=Xα⟶−A1⟶Dα⟶,(13)X2⟶=Xβ⟶−A2⟶Dβ⟶,(14)X3⟶=Xδ⟶−A3⟶Dδ⟶,(15)X⟶t+l=X1⟶+X2⟶+X3⟶3.Equations (12) to (14) define the length and direction of the advancement of ω wolf toward α, β, and δ, respectively. Equation (15) represents the current α position. And the specific process is shown in Figure 5.Figure 5
Schematic diagram of the gray wolf algorithm.The general steps of the GWO algorithm are as follows:Step 1: the algorithm initializes the wolf packStep 2: the algorithm calculates the fitness value of each wolfStep 3: the algorithm selects the top three wolves with the best fitness asα, β, and 8Step 4: the algorithm uses formulas (9) to (14) to update other wolves ωStep 5: the algorithm updates parameters, a, A, and CStep 6: if the end condition is not met, the algorithm goes to step 2Step 7: the algorithm outputs the position ofαIn this paper, sensor nodes represent individual wolves, and base station BS represents prey.HCGW adopts a round-robin mechanism similar to LEACH, and each round performs the following steps: ①According to the relationship between signal reception and transmission and distance, the simulated gray wolf algorithm divides the network into multiple layers. Each node determines which layer it is in based on the distance between its position and the base station. ②The fitness function includes the remaining energy of the node. ③After the cluster head is determined, all member nodes choose the cluster head to form a cluster. ④ The GWO communication route is established between the cluster heads to avoid long-distance transmission. ⑤Establishes a new route for route maintenance.


#### 3.2.1. Network Layering

As shown in Figure6, this paper assumes that the network can be divided into L layers. According to energy model formulas (2)–(4), nodes with a distance less than d0 from the base station are classified as the first layer, and they are marked as layer α according to their priority. And the rest are β layer and 6 layer in order.Figure 6
Schematic diagram of network layering.The nodeSNi is in the lth layer:(16)l=2×did0.By layering the nodes, the communication distance between cluster heads is less than or equal tod0 during data transmission, which can effectively avoid the energy loss caused by long-distance communication.


#### 3.2.2. Cluster Head Selection Method Based on Fitness Principle

After the sensor nodes are layered, in each layer, the fitness function and fitness rules are used to calculate the fitness of the node, and one or several nodes with high fitness are selected as the cluster head of this layer.(1) Node Remaining Energy. The node’s remaining energy ERE represents the maximum energy left by the node after a number of rounds in the network.(17)ERE=Einit−Er.(2) Node Density. The greater the node density, the more neighbor nodes of the node, and the less energy it consumes when exchanging data with surrounding nodes. The node density is represented by PSNi, and its calculation company is as follows:(18)PSNi=Nπ⋅d02.Here, N is the number of nodes in the communication range ofd0.(3) Node Centrality C. The centrality C represents the average distance between a certain node SN and its neighboring nodes. The smaller C is, the closer it is, the less energy is needed for communication, and vice versa.(19)Ci=xi−1n∑jnxj2+yi−1n∑jnyj2.Here,xi represents the abscissa of node SNi, and yi represents the ordinate of node SNi.(4) Fitness Function. The cluster head selection is determined by the fitness function. In the GWO algorithm, the fitness function plays a very important role in finding the prey mechanism. The input of this function is the characteristics of the node, including node residual energy ERE, node density, and node centrality. And, the output is the fitness value of whether the node can become the cluster head.(20)fCHi=q1PSNiCi+q2∑ERE.Here,q1 and q2 are random numbers in the range of [0, 1]. A certain threshold is set for the fitness, and the node with a fitness value greater than this threshold will be selected as the cluster head.(5) Fitness Rules. The HCGW algorithm uses adaptive criteria for comprehensive evaluation. The nodes with more residual energy, higher node density, and higher centrality have very high priority. HCGW contains a total of 3 3∗3∗=27 fitness criteria, as shown in Table 1.Table 1
Fitness rules.
Fitness rulesRemaining energyNode densityCentralityAdaptability1FewSecondarySecondaryVery secondary2FewSecondaryCommonlyVery secondary3FewSecondaryHighVery secondary4FewCommonlySecondaryVery secondary5FewCommonlyCommonlyVery secondary6FewCommonlyHighVery secondary7FewHighSecondaryVery secondary8FewHighCommonlyVery secondary9FewHighHighVery secondary10CommonlySecondarySecondarySlightly secondaryer11CommonlySecondaryCommonlySlightly secondaryer12CommonlySecondaryHighCommonly13CommonlyCommonlySecondarySlightly secondaryer14CommonlyCommonlyCommonlyCommonly15CommonlyCommonlyHighSlightly higher16CommonlyHighSecondarySlightly secondaryer17CommonlyHighCommonlyCommonly18CommonlyHighHighSlightly higher19ManySecondarySecondarySlightly secondaryer20ManySecondaryCommonlyCommonly21ManySecondaryHighSlightly higher22ManyCommonlySecondaryCommonly23ManyCommonlyCommonlySlightly higher24ManyCommonlyHighHigh25ManyHighSecondaryCommonly26ManyHighCommonlyHigh27ManyHighHighVery high


#### 3.2.3. Formation of the Family

After receiving the Invite.Msg message, the member node calculates the approximate distanced from itself to each CH and selects the cluster head with the smallest distance to join to form a cluster structure.


#### 3.2.4. Route Establishment and Maintenance

The cluster head performs preprocessing steps such as compression and optimization of the data. Then, the algorithm sends the data head node of the upper layer with higher priority according to the priority order of the hierarchy and then transmits it in turn until the first layer. At this time, a multihop routing similar to the gray wolf hierarchy is established.After a long enough timeT, the routing of the entire network will be updated. Compared with the LEACH protocol’s global mechanism, proposed by the HCGW algorithm, it can greatly save computational and broadcast costs and at the same time achieve local optimality.


## 3.1. Hunting Model

In order to simulate the encircling behavior of gray wolves with a mathematical model, equations (6) and (7) are introduced.(6)D⟶=C⟶XP⟶t−X⟶t,(7)X⟶t+l=Xp⟶t−A⟶D⟶.The calculation formulas for vectorsA⟶ and C⟶ are as follows [22]:(8)A⟶=2a⟶r1⟶−a⟶,C⟶=2r2⟶.


## 3.2. Attack Model

GWO hunts are led byα, and β and 8 occasionally participate. In order to mathematically simulate the hunting behavior of gray wolves, we assume that α (the best candidate solution) and β and 6 have a more accurate understanding of the potential location of the prey. Therefore, the algorithm saves the first three optimal solutions obtained so far and forces other search agents (include o) to update their positions according to the position of the best search agent. And its update formula is as follows:(9)Dα⟶=C1⟶Xα⟶−X⟶,(10)Dβ⟶=C2⟶Xβ⟶−X⟶,(11)Dδ⟶=C3⟶Xδ⟶−X⟶,(12)X1⟶=Xα⟶−A1⟶Dα⟶,(13)X2⟶=Xβ⟶−A2⟶Dβ⟶,(14)X3⟶=Xδ⟶−A3⟶Dδ⟶,(15)X⟶t+l=X1⟶+X2⟶+X3⟶3.Equations (12) to (14) define the length and direction of the advancement of ω wolf toward α, β, and δ, respectively. Equation (15) represents the current α position. And the specific process is shown in Figure 5.Figure 5
Schematic diagram of the gray wolf algorithm.The general steps of the GWO algorithm are as follows:Step 1: the algorithm initializes the wolf packStep 2: the algorithm calculates the fitness value of each wolfStep 3: the algorithm selects the top three wolves with the best fitness asα, β, and 8Step 4: the algorithm uses formulas (9) to (14) to update other wolves ωStep 5: the algorithm updates parameters, a, A, and CStep 6: if the end condition is not met, the algorithm goes to step 2Step 7: the algorithm outputs the position ofαIn this paper, sensor nodes represent individual wolves, and base station BS represents prey.HCGW adopts a round-robin mechanism similar to LEACH, and each round performs the following steps: ①According to the relationship between signal reception and transmission and distance, the simulated gray wolf algorithm divides the network into multiple layers. Each node determines which layer it is in based on the distance between its position and the base station. ②The fitness function includes the remaining energy of the node. ③After the cluster head is determined, all member nodes choose the cluster head to form a cluster. ④ The GWO communication route is established between the cluster heads to avoid long-distance transmission. ⑤Establishes a new route for route maintenance.


### 3.2.1. Network Layering

As shown in Figure6, this paper assumes that the network can be divided into L layers. According to energy model formulas (2)–(4), nodes with a distance less than d0 from the base station are classified as the first layer, and they are marked as layer α according to their priority. And the rest are β layer and 6 layer in order.Figure 6
Schematic diagram of network layering.The nodeSNi is in the lth layer:(16)l=2×did0.By layering the nodes, the communication distance between cluster heads is less than or equal tod0 during data transmission, which can effectively avoid the energy loss caused by long-distance communication.


### 3.2.2. Cluster Head Selection Method Based on Fitness Principle

After the sensor nodes are layered, in each layer, the fitness function and fitness rules are used to calculate the fitness of the node, and one or several nodes with high fitness are selected as the cluster head of this layer.(1) Node Remaining Energy. The node’s remaining energy ERE represents the maximum energy left by the node after a number of rounds in the network.(17)ERE=Einit−Er.(2) Node Density. The greater the node density, the more neighbor nodes of the node, and the less energy it consumes when exchanging data with surrounding nodes. The node density is represented by PSNi, and its calculation company is as follows:(18)PSNi=Nπ⋅d02.Here, N is the number of nodes in the communication range ofd0.(3) Node Centrality C. The centrality C represents the average distance between a certain node SN and its neighboring nodes. The smaller C is, the closer it is, the less energy is needed for communication, and vice versa.(19)Ci=xi−1n∑jnxj2+yi−1n∑jnyj2.Here,xi represents the abscissa of node SNi, and yi represents the ordinate of node SNi.(4) Fitness Function. The cluster head selection is determined by the fitness function. In the GWO algorithm, the fitness function plays a very important role in finding the prey mechanism. The input of this function is the characteristics of the node, including node residual energy ERE, node density, and node centrality. And, the output is the fitness value of whether the node can become the cluster head.(20)fCHi=q1PSNiCi+q2∑ERE.Here,q1 and q2 are random numbers in the range of [0, 1]. A certain threshold is set for the fitness, and the node with a fitness value greater than this threshold will be selected as the cluster head.(5) Fitness Rules. The HCGW algorithm uses adaptive criteria for comprehensive evaluation. The nodes with more residual energy, higher node density, and higher centrality have very high priority. HCGW contains a total of 3 3∗3∗=27 fitness criteria, as shown in Table 1.Table 1
Fitness rules.
Fitness rulesRemaining energyNode densityCentralityAdaptability1FewSecondarySecondaryVery secondary2FewSecondaryCommonlyVery secondary3FewSecondaryHighVery secondary4FewCommonlySecondaryVery secondary5FewCommonlyCommonlyVery secondary6FewCommonlyHighVery secondary7FewHighSecondaryVery secondary8FewHighCommonlyVery secondary9FewHighHighVery secondary10CommonlySecondarySecondarySlightly secondaryer11CommonlySecondaryCommonlySlightly secondaryer12CommonlySecondaryHighCommonly13CommonlyCommonlySecondarySlightly secondaryer14CommonlyCommonlyCommonlyCommonly15CommonlyCommonlyHighSlightly higher16CommonlyHighSecondarySlightly secondaryer17CommonlyHighCommonlyCommonly18CommonlyHighHighSlightly higher19ManySecondarySecondarySlightly secondaryer20ManySecondaryCommonlyCommonly21ManySecondaryHighSlightly higher22ManyCommonlySecondaryCommonly23ManyCommonlyCommonlySlightly higher24ManyCommonlyHighHigh25ManyHighSecondaryCommonly26ManyHighCommonlyHigh27ManyHighHighVery high


### 3.2.3. Formation of the Family

After receiving the Invite.Msg message, the member node calculates the approximate distanced from itself to each CH and selects the cluster head with the smallest distance to join to form a cluster structure.


### 3.2.4. Route Establishment and Maintenance

The cluster head performs preprocessing steps such as compression and optimization of the data. Then, the algorithm sends the data head node of the upper layer with higher priority according to the priority order of the hierarchy and then transmits it in turn until the first layer. At this time, a multihop routing similar to the gray wolf hierarchy is established.After a long enough timeT, the routing of the entire network will be updated. Compared with the LEACH protocol’s global mechanism, proposed by the HCGW algorithm, it can greatly save computational and broadcast costs and at the same time achieve local optimality.


## 3.2.1. Network Layering

As shown in Figure6, this paper assumes that the network can be divided into L layers. According to energy model formulas (2)–(4), nodes with a distance less than d0 from the base station are classified as the first layer, and they are marked as layer α according to their priority. And the rest are β layer and 6 layer in order.Figure 6
Schematic diagram of network layering.The nodeSNi is in the lth layer:(16)l=2×did0.By layering the nodes, the communication distance between cluster heads is less than or equal tod0 during data transmission, which can effectively avoid the energy loss caused by long-distance communication.


## 3.2.2. Cluster Head Selection Method Based on Fitness Principle

After the sensor nodes are layered, in each layer, the fitness function and fitness rules are used to calculate the fitness of the node, and one or several nodes with high fitness are selected as the cluster head of this layer.(1) Node Remaining Energy. The node’s remaining energy ERE represents the maximum energy left by the node after a number of rounds in the network.(17)ERE=Einit−Er.(2) Node Density. The greater the node density, the more neighbor nodes of the node, and the less energy it consumes when exchanging data with surrounding nodes. The node density is represented by PSNi, and its calculation company is as follows:(18)PSNi=Nπ⋅d02.Here, N is the number of nodes in the communication range ofd0.(3) Node Centrality C. The centrality C represents the average distance between a certain node SN and its neighboring nodes. The smaller C is, the closer it is, the less energy is needed for communication, and vice versa.(19)Ci=xi−1n∑jnxj2+yi−1n∑jnyj2.Here,xi represents the abscissa of node SNi, and yi represents the ordinate of node SNi.(4) Fitness Function. The cluster head selection is determined by the fitness function. In the GWO algorithm, the fitness function plays a very important role in finding the prey mechanism. The input of this function is the characteristics of the node, including node residual energy ERE, node density, and node centrality. And, the output is the fitness value of whether the node can become the cluster head.(20)fCHi=q1PSNiCi+q2∑ERE.Here,q1 and q2 are random numbers in the range of [0, 1]. A certain threshold is set for the fitness, and the node with a fitness value greater than this threshold will be selected as the cluster head.(5) Fitness Rules. The HCGW algorithm uses adaptive criteria for comprehensive evaluation. The nodes with more residual energy, higher node density, and higher centrality have very high priority. HCGW contains a total of 3 3∗3∗=27 fitness criteria, as shown in Table 1.Table 1
Fitness rules.
Fitness rulesRemaining energyNode densityCentralityAdaptability1FewSecondarySecondaryVery secondary2FewSecondaryCommonlyVery secondary3FewSecondaryHighVery secondary4FewCommonlySecondaryVery secondary5FewCommonlyCommonlyVery secondary6FewCommonlyHighVery secondary7FewHighSecondaryVery secondary8FewHighCommonlyVery secondary9FewHighHighVery secondary10CommonlySecondarySecondarySlightly secondaryer11CommonlySecondaryCommonlySlightly secondaryer12CommonlySecondaryHighCommonly13CommonlyCommonlySecondarySlightly secondaryer14CommonlyCommonlyCommonlyCommonly15CommonlyCommonlyHighSlightly higher16CommonlyHighSecondarySlightly secondaryer17CommonlyHighCommonlyCommonly18CommonlyHighHighSlightly higher19ManySecondarySecondarySlightly secondaryer20ManySecondaryCommonlyCommonly21ManySecondaryHighSlightly higher22ManyCommonlySecondaryCommonly23ManyCommonlyCommonlySlightly higher24ManyCommonlyHighHigh25ManyHighSecondaryCommonly26ManyHighCommonlyHigh27ManyHighHighVery high


## 3.2.3. Formation of the Family

After receiving the Invite.Msg message, the member node calculates the approximate distanced from itself to each CH and selects the cluster head with the smallest distance to join to form a cluster structure.


## 3.2.4. Route Establishment and Maintenance

The cluster head performs preprocessing steps such as compression and optimization of the data. Then, the algorithm sends the data head node of the upper layer with higher priority according to the priority order of the hierarchy and then transmits it in turn until the first layer. At this time, a multihop routing similar to the gray wolf hierarchy is established.After a long enough timeT, the routing of the entire network will be updated. Compared with the LEACH protocol’s global mechanism, proposed by the HCGW algorithm, it can greatly save computational and broadcast costs and at the same time achieve local optimality.


## 4. Smart Garden Planning and Design Based on the Agricultural Internet of Things

The process for the smart garden information management platform to access and call basic geographic data is as follows: (1) The smart garden information management platform sends a graphical call request to the basic geographic information sharing service platform. (2) After receiving the graphic data query request, the basic geographic information sharing service platform will execute the relevant graphic data query process, package the query results (map images or JSON format attribute data), and return them to the smart garden information management platform. (3) After receiving the query result, the intelligent garden information management platform displays it in the map window of the platform. The thematic geographic data of landscaping is directly accessed and invoked on the platform and can be displayed superimposed with the basic geographic information sharing service. The schematic diagram of the business data interface model (process) of the smart garden information management platform is shown in Figure7.Figure 7
Schematic diagram of the data interface model of the smart garden business.After constructing a smart garden planning system based on the agricultural Internet of Things, the effect of the data processing of the agricultural Internet of Things in this paper is evaluated, and a garden simulation system is constructed to analyze the performance of the system. The network nodes of the simulation system are shown in Figure8.Figure 8
Model of the agricultural smart garden system.Through the performance verification of the above model, the data processing effect of the agricultural smart garden is shown in Table2 and Figure 9.Table 2
Data processing effect of agricultural IoT smart garden.
No.Data processingNo.Data processingNo.Data processing195.291693.113193.52292.291796.083293.08393.111894.793396.04496.551992.663496.12593.312093.903593.71695.612195.893696.00793.672293.833793.68896.332393.083892.51994.562494.353994.511094.572593.434095.171194.102695.764193.121293.862795.914292.831394.012892.624394.631495.692994.794495.691592.563094.094595.47Figure 9
Data processing statistics.The above model verifies the data processing effect of the agricultural smart garden system.On this basis, the planning and design effects of agricultural smart gardens are carried out, and the results shown in Table3 and Figure 10 are obtained.Table 3
Planning and design effects of agricultural smart gardens.
No.Planning and designNo.Planning and designNo.Planning and design186.451682.773181.62274.261780.813289.68380.491888.723377.24489.061986.273488.22582.102080.383583.12684.062186.883674.41785.452274.033780.85889.512382.763891.39974.472474.253978.901086.672580.524079.561183.422680.944174.141278.272782.414290.941373.732885.224387.791488.742984.314481.331577.873082.944588.75Figure 10
Statistical diagram of planning and design effects of smart gardens.The above analysis verifies that the smart garden planning and design system has a good planning and design effect.


## 5. Conclusion

People can intuitively watch the objects in the real environment scene through the network platform and can select corresponding operations on the network client to perform corresponding operations on the real objects in the real environment. Virtual experience is dependent on computer and Internet of Things technology. Compared with real experience, virtual experience has some inherent characteristics, such as virtual experience, virtual experience with uncertainty, and virtual experience with globality. This paper combines the agricultural Internet of Things technology to carry out smart garden planning and design. With the theme of agricultural pastoral, it promotes industrial development and raises people’s awareness of ecological and environmental protection and brings people a good pastoral scenery experience.



---

*Source: 8522751-2022-01-07.xml*