Plant factory mesh network communication optimization method, system and device
By improving the LEACH cluster head election algorithm and optimizing cluster head node election and task allocation based on task weights, the problems of energy imbalance and task matching in plant factory mesh networks are solved, extending network lifetime and improving communication efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA AGRI UNIV
- Filing Date
- 2023-08-09
- Publication Date
- 2026-07-21
Smart Images

Figure CN117062181B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of wireless sensor networks, and in particular to a method, system, and device for optimizing communication in a plant factory mesh network. Background Technology
[0002] China is a major agricultural country, and traditional, low-yield, and inefficient agricultural methods are no longer suitable for the current development trend of a gradually decreasing agricultural population and a continuously increasing total population. Smart agriculture, which leverages modern information technology to promote high-yield, high-quality, and high-efficiency agriculture, has become the mainstream. The plant factory model represents an advanced stage of modern facility agriculture development. A plant factory is a highly efficient agricultural production system that achieves continuous production by precisely controlling environmental parameters of agricultural crops in a closed environment. Plant factories mainly consist of sensors for environmental information such as temperature, humidity, light, and CO2, along with corresponding environmental control equipment. These Internet of Things (IoT) devices are connected to a network and controlled by a host computer system to achieve intelligent collection of plant information and environmental regulation in a closed environment, achieving continuous and efficient plant production. Simultaneously, it facilitates scientific research by researchers to explore the impact of environmental parameters on plants.
[0003] Edge computing provides computing services closer to the object or data source, aiming to solve the latency problem of current networks and respond to computing needs more quickly. The application of edge computing in highly flexible and low-cost Wireless Sensor Networks (WSNs) is currently a research hotspot. Deploying sensors in greenhouses to build remote control systems faces major challenges such as low latency, high cost, and complex deployment, especially when crop environmental factors cause destructive conditions requiring real-time control. Therefore, building edge computing based on WSN networks to achieve intelligent data acquisition in plant factories is of great significance. Wireless mesh networking is an important part of WSNs. In a mesh network, each node is peer-to-peer, building the network in a self-organizing manner. When a few nodes consistently serve as sink nodes, node wear accelerates, leading to frequent sink node maintenance. Therefore, an algorithm for alternately electing sink cluster heads is needed to average the energy consumption of each node in the network and enhance network robustness.
[0004] The LEACH (Low Energy Adaptive Clustering Hierarchy) algorithm is a classic clustering routing algorithm in WSN. It mainly reduces the complex communication overhead between nodes by having each node take turns serving as the cluster head node. At the same time, it can make the network's energy consumption evenly distributed among each node, extending the network's lifetime. In addition, the clustering method can make the network have good scalability, and when a member in one cluster cannot work properly, it does not affect the normal operation of other clusters.
[0005] However, while the traditional LEACH algorithm provides an idea for evenly distributing network energy consumption, it still has some shortcomings in practical applications in plant factories. First, because each node is randomly selected as a cluster head, nodes farther from the central router may become cluster heads, resulting in higher energy consumption in that round. Second, due to its probabilistic randomness, the number of cluster heads in each round is uncertain. Furthermore, the lack of consideration for the remaining energy of nodes during election allows even nodes with insufficient energy to become cluster heads, leading to negative energy generation and invalid work rounds. Finally, because each node has the same working time, more distant nodes consume more energy. However, much of the data collected by sensors is repetitive and highly correlated; therefore, the workload of nodes at different locations should be considered to reduce network energy consumption. Summary of the Invention
[0006] The purpose of this invention is to provide a method, system, and device for optimizing communication in a plant factory mesh network, which can reduce network energy consumption and improve network communication efficiency.
[0007] To achieve the above objectives, the present invention provides the following solution:
[0008] A method for optimizing communication in a plant factory mesh network includes:
[0009] Determine the location of each node in the Mesh network and the location of the central router;
[0010] Perform node initialization operations and assign corresponding energy to each node;
[0011] Add all nodes to the waiting array;
[0012] Determine if all nodes are dead;
[0013] If so, then the process ends;
[0014] If not, the improved LEACH cluster head election algorithm based on task weights is used to elect cluster head nodes and determine the tasks of member nodes within each cluster head node.
[0015] Once the mesh network reaches a stable state, member nodes within each cluster head node transmit data according to their corresponding tasks. The cluster head node receives, merges, and transmits the data, and then returns to the step of adding all nodes to the waiting array.
[0016] Optionally, determining whether all nodes are dead specifically includes:
[0017] Determine whether the energy of each node in the waiting array is less than or equal to 0;
[0018] If so, remove the node from the waiting array and then check the next node;
[0019] If not, then determine whether all nodes have ever been cluster heads;
[0020] If so, reset the information of all nodes that have been elected as cluster heads, and return to the step of determining whether the energy of each node in the waiting array is less than or equal to 0;
[0021] If not, determine whether the current node has been elected as the cluster head node; if so, remove it from the waiting array and determine whether the next node has been elected as the cluster head node.
[0022] Optionally, if not, the improved LEACH cluster head election algorithm based on task weights is used to elect cluster head nodes and determine the tasks of member nodes within each cluster head node, specifically including:
[0023] Determine the location of the mesh network and determine the weights based on the degree to which distance in the mesh network affects the efficiency of node information transmission;
[0024] Based on the weights and the distance of the node from the central router, the threshold function of the LEACH cluster head election algorithm is transformed into a threshold function improved based on position weights.
[0025] Based on the threshold of each node in the r-th round using a threshold function improved by position weight, the initial cluster head node is determined from the waiting array;
[0026] The cluster head nodes for secondary screening are determined based on the energy threshold of the initially selected cluster head nodes and the number of cluster heads.
[0027] Count the number of member nodes of each cluster head node in the secondary screening;
[0028] The workload of each cluster head node, the workload of forwarding nodes within the cluster, and the workload of each cluster head node's member nodes are determined based on the number of member nodes in each secondary-selected cluster head node and the distance between the secondary-selected cluster head node and the central router.
[0029] Optionally, determining the workload of the cluster head node itself, the workload of forwarding nodes within the cluster, and the workload of member nodes within each cluster head node based on the number of member nodes in each secondary-selected cluster head node and the distance of the secondary-selected cluster head node from the central router specifically includes:
[0030] When the number of member nodes in each of the secondary-selected cluster head nodes is the same, and the distances of the secondary-selected cluster head nodes from the central router are all different, the formula is used. Determine the task quantity k of the cluster head node for secondary screening. i ; and according to mk i Determine the workload of nodes within the forwarding cluster;
[0031] Where m is the number of member nodes of each cluster head node in the secondary selection, k0 represents the amount of data that each node needs to send, d0 is the distance threshold, f(d) is a function of the distance d between the cluster head node in the secondary selection and the central router, i is the i-th cluster head node, and n represents the number of cluster heads in the current round.
[0032] Optionally, the step of determining the workload of the cluster head node itself, the workload of forwarding nodes within the cluster, and the workload of member nodes within each cluster head node based on the number of member nodes of each secondary-selected cluster head node and the distance of the secondary-selected cluster head node from the central router further includes:
[0033] When the number of member nodes in each cluster head node after secondary screening is different, the formula is used. Determine the task quantity k of the cluster head node for secondary screening. i-in ; and according to m i k i-in Determine the workload of nodes within the forwarding cluster;
[0034] Where n represents the number of cluster heads in the current round, k0 represents the amount of data each node needs to send, g(d) is a function of the distance d between the cluster head nodes selected in the secondary round and the central router, and m i This represents the number of member nodes within the cluster head node in the i-th category, based on the distance of the cluster head node from the central router according to the secondary filtering.
[0035] A plant factory mesh network communication optimization system includes:
[0036] The parameter determination module is used to determine the location of each node in the Mesh network and the location of the central router;
[0037] The initialization module is used to perform node initialization operations and assign corresponding energy to each node.
[0038] The wait array determination module is used to add all nodes to the wait array;
[0039] The judgment module is used to determine whether all nodes are dead;
[0040] End module, used to terminate if the condition is met;
[0041] The task allocation module is used to elect cluster head nodes and determine the tasks of member nodes within each cluster head node, if not, based on the improved LEACH cluster head election algorithm with task weights.
[0042] The transmission and update module is used when the Mesh network enters a stable state, and the member nodes within each cluster head node transmit data according to their corresponding tasks. The cluster head node receives, merges, and transmits the data, and then returns to the step of adding all nodes to the waiting array.
[0043] A plant factory mesh network communication optimization device includes: at least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement a plant factory mesh network communication optimization method as described in any one of claims 1-6.
[0044] Optionally, the memory is a computer-readable storage medium.
[0045] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0046] The present invention provides a method, system, and device for optimizing communication in a plant factory mesh network. Based on an improved LEACH cluster head election algorithm with task weights, the algorithm elects cluster head nodes and determines the tasks of member nodes within each cluster head node. The algorithm provided by the present invention effectively solves the problems of randomness in cluster head node position, remaining energy of cluster head nodes, number of network cluster heads, and task matching of nodes, thus addressing the shortcomings of the original LEACH algorithm in mesh networks. It has high application value and broad application prospects. Attached Figure Description
[0047] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0048] Figure 1 This is a schematic diagram of a method for optimizing communication in a plant factory mesh network provided by the present invention;
[0049] Figure 2This is a complete flowchart based on LEACH-L in an embodiment of the present invention.
[0050] Figure 3 This is a complete flowchart based on LEACH-L-EN, representing an embodiment of the present invention.
[0051] Figure 4 This is a complete flowchart of an embodiment of the present invention based on LEACH-L-EN-T. Detailed Implementation
[0052] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0053] The purpose of this invention is to provide a method, system, and device for optimizing communication in a plant factory mesh network, which can reduce network energy consumption and improve network communication efficiency.
[0054] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0055] like Figure 1 As shown, the present invention provides a method for optimizing communication in a plant factory mesh network, comprising:
[0056] S101, determine the location of each node in the Mesh network and the location of the central router.
[0057] S102, perform node initialization operations; and assign corresponding energy to each node.
[0058] S103, add all nodes to the waiting array.
[0059] S104, determine whether all nodes are dead.
[0060] S104 specifically includes:
[0061] Determine whether the energy of each node in the waiting array is less than or equal to 0.
[0062] If so, remove the node from the waiting array and then check the next node.
[0063] If not, then determine whether all nodes have ever been cluster heads.
[0064] If so, reset the information of all nodes that have been elected as cluster heads, and return to the step of determining whether the energy of each node in the waiting array is less than or equal to 0.
[0065] If not, check if the current node has been elected as a cluster head node; if so, remove it from the waiting array and check if the next node has been elected as a cluster head node. In the LEACH algorithm, a node that has been elected as a cluster head node will not serve as a cluster head node in the next round of cluster head election.
[0066] S105, if yes, then end.
[0067] S107, if not, then the improved LEACH cluster head election algorithm based on task weight is used to elect cluster head nodes and determine the tasks of member nodes within each cluster head node.
[0068] S107 specifically includes:
[0069] S701, determine the location of the Mesh network, and determine the weight based on the degree of influence of distance on the information transmission efficiency of nodes in the Mesh network.
[0070] S702 transforms the threshold function of the LEACH cluster head election algorithm into an improved threshold function based on location weights, according to the weights and the distance of the node from the central router.
[0071] S703, determine the initial cluster head node from the waiting array based on the threshold of each node in the r-th round of the improved threshold function based on position weight.
[0072] S704. The cluster head nodes for secondary screening are determined based on the energy threshold of the initially selected cluster head nodes and the number of cluster heads.
[0073] S705, count the number of member nodes of each cluster head node in the secondary screening.
[0074] S706 determines the workload of the cluster head node itself, the workload of forwarding nodes within the cluster, and the workload of member nodes within each cluster head node based on the number of member nodes of each secondary-selected cluster head node and the distance of the secondary-selected cluster head node from the central router.
[0075] Among them, S701-S703 are the improved LEACH algorithm based on position weights (LEACH-L algorithm), and as follows Figure 2 As shown; S704 is an improved LEACH-L algorithm (LEACH-L-EN algorithm) based on energy threshold and number of cluster heads, and as... Figure 3 As shown; S705-S706 are the improved LEACH-L-EN algorithm (LEACH-L-EN-T algorithm) based on task weights, and as... Figure 4 As shown.
[0076] The improved LEACH algorithm based on position weights (LEACH-L algorithm) includes:
[0077] S31. Determine the location of the Mesh network. Based on the degree of influence of distance on the information transmission efficiency of nodes in the Mesh network, set the weight k to 1 or 2 (if the distance has a greater impact on the signal propagation of nodes in the Mesh, then k is 2, which means that nodes closer to the central router have a greater probability of being selected as cluster heads).
[0078] S32. Calculate the distance d between the node and the target node (central router), and transform the threshold function (formula (1)) of the initial LEACH cluster head election algorithm into a threshold function based on position weight improvement, as shown in formula (2).
[0079]
[0080]
[0081] Where p is the percentage of nodes in the network that are expected to become cluster heads, r is the current round number, n is the node index, and G is the set of nodes that have not become cluster heads in the most recent 1 / p rounds. The threshold T(n) can be derived from the idea of the LEACH algorithm. Assuming the total number of nodes in the network is N, since the cluster head selection probability is p, theoretically, each round must guarantee that Np nodes are selected as cluster heads. Therefore, in the r-th round (r is not a multiple of 1 / p) (rounds are counted from 0 for ease of calculation), there must also be Np nodes as cluster heads. Since the total number of nodes selected as cluster heads in the first r rounds is Npr, there are a total of N-Npr nodes that are not selected as cluster heads. Therefore, Np nodes must be selected from these nodes, so the proportion is Np / (N-Npr) = p / (1-pr). When r reaches 1 / p, the numerator is zero, so the competition for cluster heads restarts every 1 / p rounds. Therefore, r must be replaced with rmod(1 / p), that is, the modulus of r and 1 / p. So the proportion of cluster heads in the r-th round is p / (1-prmod(1 / p)). Formula (2) adds a position-based improvement factor, where k is the weight of the current node in different cultivation positions and d is the distance between the current node and the target node. Since the target node may be itself in the Mesh network, 1 is added to the denominator to prevent the denominator from being 0.
[0082] S33. Each node calculates the threshold of each node in the rth round according to formula (2), randomly generates a number from 0 to 100 and divides it by 100. If the value obtained is less than the threshold, the node is the cluster head node and broadcasts the information that it is the cluster head, waiting for ordinary nodes to join. If the value obtained is not less than the threshold, the node is an ordinary node and selects the nearest cluster head node to join.
[0083] To address the issues of remaining energy in cluster head nodes and the number of cluster heads in the network, an improved LEACH-L algorithm (LEACH-L-EN algorithm) based on energy thresholds and the number of cluster heads is proposed. The process is as follows:
[0084] S41. Calculate the energy threshold of each node in the waiting array. The energy threshold is calculated as shown in formula (3), where m is calculated as shown in formula (4). If the energy is less than the energy threshold, the node is removed from the waiting array (the node in the waiting array is qualified to serve as the cluster head).
[0085]
[0086] m=(1-p) / p (4)
[0087]
[0088] The node energy threshold mainly consists of three parts: energy consumption for receiving data from cluster members, energy consumption for merging data from cluster members, and energy consumption for sending data; among which, the energy consumption for sending data includes the energy consumption for forwarding data from cluster members and sending its own data to the router node. In formula (3), k0 represents the amount of data that each node needs to send, E e E is the energy consumed by the transmitting or receiving circuit to transmit 1 bit of data packet. D Let d represent the energy consumed in fusing 1 bit of data, d represent the distance between the node and the router node, m represent the average number of cluster members in each cluster, and the calculation formula is given by formula (4). d0 is the distance threshold, and its calculation formula is given by formula (5). In formula (4), p represents the percentage of nodes in the network that are expected to become cluster heads. Assuming that the total number of nodes in the network is N, the number of cluster heads in the current round of the network is Np, and the number of non-cluster head nodes is N-Np. Therefore, the average number of cluster members in each cluster head node is (N-Np) / Np, which simplifies to formula (4).
[0089] S42. It is stipulated that the number of cluster head nodes is within the range of [Np-1, Np+1] as the optimal number. It is determined whether the length of the waiting array is less than Np. If so, all of them are set as cluster head nodes. Otherwise, cluster heads are selected for the nodes in the waiting array according to the LEACH-L algorithm. If the number of cluster heads is less than Np-1, the LEACH-L algorithm election is continuously performed until the number of cluster heads is not less than Np-1.
[0090] S43. If the number of cluster heads obtained is less than or equal to Np+1, the cluster head election is complete. Otherwise, the number of cluster heads needs to be reduced to Np+1 according to the distance of the cluster head node from the center of the router. Cluster heads that are far away are disqualified from becoming cluster heads.
[0091] S44. Ordinary nodes select the nearest cluster head to join the cluster.
[0092] An improved LEACH-L-EN algorithm (LEACH-L-EN-T algorithm) based on task weights is proposed to address the task matching problem of nodes. This includes:
[0093] S51. After the LEACH-L-EN cluster head election, count the number of members in each cluster and determine whether the number of members m in each cluster is the same, and calculate the distance d between each cluster head and the central router.
[0094] S52. If the number of cluster members m is the same, and the distance d from each cluster head to the central router is different, calculate the workload of each cluster head node and the workload of forwarding nodes within the cluster according to formulas (6)-(10): The cluster head energy consumption formula (6) of the original algorithm can be transformed into: E cx (k0,d)=k0*f(d), where f(d) is a function of d, as shown in formula (7). Then, the amount of data sent by each node in the improved algorithm is k. d The formula is: k d =E cx / f(d); For cluster head nodes ((n1,d1),(n2,d2),...,(n n ,d n Total task quantity k all-d The calculation formula is shown in formula (8).
[0095]
[0096]
[0097]
[0098] When the total number of tasks per node remains constant, the average energy consumption E of the improved algorithm based on task weights is... λ The solution formula is shown in formula (9).
[0099]
[0100] When the total number of tasks is the same, the average task quantity k of each cluster head node in the improved algorithm based on task weights is... i The calculation formula for (i∈(1,...,n)) is shown in formula (10).
[0101]
[0102] The number of intra-cluster tasks that each cluster head node needs to forward is mk. i The amount of data it sends is k i .
[0103] S53. If the number of members in each cluster is different and the distance from the central router may be the same, calculate the task load of each cluster head node and the task load of forwarding nodes within the cluster according to formulas (11)-(16): For cases where the distance d is the same, it is equivalent to an unknown number of members in the cluster head node at the distance d, so they can be classified into one category; for cases where m is different, the task load k forwarded by the cluster head needs to be calculated. i-in The amount of data k sent by the cluster head itself i-self Calculate separately. Since the calculations in S52 are performed when m is the same, the nodes within each cluster can be classified according to the distance between the cluster head and the router. Each category can then be sorted in ascending order of the number of cluster members within that category. First, extract the smallest number of cluster members (m1) from each category and use it as the first set of cluster members for calculation. Then, subtract m1 from the number of cluster members in all categories and re-sort them. Repeat this process until only one category remains, ensuring that m is the same each time the improved calculation is performed. i The same; however, at this time, the energy E generated by the cluster head node in the original algorithm for forwarding data to nodes within the cluster is the same. cx-in As shown in formula (11), where g(d) is a function of d, as shown in formula (12).
[0104] E cx-in (k0,d)=m i k0g(d) (11)
[0105]
[0106] The improved algorithm then considers the amount of data k in each cluster head and intra-cluster node. i-in The calculation formula can be transformed into k i-in =E λ-i / (m*g(d)); For the cluster head node in the network ((m i ,d1),(m i ,d2),...,(m i ,d n Total number of tasks within the cluster k i-in-all The calculation formula can be transformed into formula (13).
[0107]
[0108] The average energy consumption E of the improved algorithm based on task weights for this splitting is then... λ-i The solution is shown in formula (14):
[0109]
[0110] When the total number of tasks is the same, the average forwarding task k of each cluster head node in the improved algorithm is [not specified]. iThe simplified formula for (i∈(1,...,n)) is shown in formula (15). Finally, the number of intra-cluster tasks that each cluster head node needs to forward is m. i k i-in .
[0111]
[0112] The improved forwarding task in the above example satisfies formula (16), where N represents the total number of nodes alive in the current round of the network and n represents the number of cluster heads in the current round.
[0113] Σk i-in =(Nn)k0 (16)
[0114] The amount of data k sent by the cluster head itself i-self The calculation is performed according to formula (6)-formula (10). However, since the cluster head itself has improved data, it can be regarded as the first case where the number of members in the cluster m = 0.
[0115] S54. After calculating the task volume of each cluster head and the total amount of forwarded data, calculate the task volume of each member in each cluster according to the calculation method of Method 1 in S52, with m=0.
[0116] S108, the Mesh network enters a stable state. Member nodes within each cluster head node transmit data according to their corresponding tasks. The cluster head node receives, merges, and transmits the data, and then returns to the step of adding all nodes to the waiting array.
[0117] The following description, in conjunction with specific embodiments, outlines the specific steps:
[0118] S1. Initialize the Mesh network and its nodes; randomly distribute 100 nodes within a 100x100m area, with each node's x and y coordinates ranging from 0 to 100m. Until the entire network ceases to function (i.e., all nodes die), the x and y coordinates of the nodes remain unchanged. The central router is located at (100, 100). Then, perform node initialization, assigning each node 0.1J of energy.
[0119] S2. The process of determining dead nodes and cluster head nodes in the LEACH algorithm is divided into the following two steps:
[0120] S21. Add all 100 nodes to the waiting array (the cluster head node will be selected from the waiting array). First, check whether each node has energy. If the energy of the node is less than or equal to 0J, the node is removed from the waiting array and the next node is checked. The process ends when all nodes have died.
[0121] S22. If a node's energy is greater than 0J, first check if all nodes have ever been cluster heads. This is because in the LEACH algorithm, a node that has been elected as a cluster head will not be a cluster head node in the next round of cluster head election. If all nodes have been elected as cluster heads, reset the information of all nodes that have been elected as cluster heads, and restart the energy determination process. Otherwise, check if the current node has been elected as a cluster head node. If it has, remove the node from the waiting array and proceed to the next node. After the determination is completed, enter the LEACH algorithm cluster head election process.
[0122] S3. Selecting the cluster head from the waiting array: The proposed improved LEACH algorithm (LEACH-L algorithm) based on position weights addresses the randomness of cluster head node positions and consists of the following three steps:
[0123] S31. Determine the current node position and set the weight k to 1;
[0124] S32. Calculate the distance between the node and the target node (central router), and calculate the threshold for each node using the improved threshold formula;
[0125] S33. Randomly generate a number between 0 and 100 and divide it by 100. If the resulting value is less than the threshold, the node is the cluster head node and broadcasts the information that it is the cluster head, waiting for ordinary nodes to join. If the resulting value is not less than the threshold, the node is an ordinary node and selects the nearest cluster head node to join.
[0126] S4. Select cluster heads from the waiting array. An improved LEACH-L algorithm (LEACH-L-EN algorithm) based on energy thresholds and the number of cluster heads is proposed to address the issues of remaining energy of cluster head nodes and the number of cluster heads in the network. This includes the following steps:
[0127] S41. After the S2 judgment process is completed, calculate the energy threshold of each node. If the energy is less than the energy threshold, remove it from the waiting array.
[0128] S42. Set the probability p to 5%, and determine whether the length of the ordinary node array is less than 5. If it is, set all of them as cluster head nodes. Otherwise, select cluster heads for the nodes in the ordinary node array according to the LEACH-L algorithm. If the number of cluster heads is less than 4, continue to perform the LEACH-L algorithm election until the number of cluster heads is not less than 4.
[0129] S43. If the number of cluster heads obtained is less than 6, the cluster head election is complete. Otherwise, the number of cluster heads needs to be reduced to 6 according to the distance of the cluster head node from the center of the router. Cluster heads that are far away are disqualified.
[0130] S44. Ordinary nodes select the nearest cluster head to join the cluster.
[0131] S5. Select cluster heads from the waiting array, and based on the actual amount of tasks assigned to nodes, propose an improved LEACH-L-EN algorithm (LEACH-L-EN-T algorithm) based on task weights to address the task matching problem of nodes. This includes the following steps:
[0132] S51. First, perform LEACH-L-EN cluster head election on the waiting array after the S2 process is completed. Ordinary nodes select the cluster head that is closest to them to join the cluster. Then, count the number of members in each cluster and determine whether the number of members m in each cluster is the same, and whether the distance of each cluster head node from the central router is the same.
[0133] S52. If the number of members m in each cluster is the same, and the distance of each cluster head node from the central router is different, calculate the workload of each cluster head node and the workload of forwarding nodes within the cluster according to Method 1.
[0134] S53. If the number of members in each cluster is different, or the distance between the cluster head node and the central router is the same, then calculate the workload of each cluster head node and the workload of forwarding nodes within the cluster according to Method 2.
[0135] S54. After calculating the task volume of each cluster head and the total amount of forwarded data, calculate the task volume of each member in each cluster according to the calculation method in S52 with m=0.
[0136] S6. The network enters a stable working state. Each ordinary node transmits data according to its own task, and the cluster head node realizes the fusion and transmission of its own information and the information of the nodes within the cluster.
[0137] S7. The stable working state ends, and the process returns to step S2 for the next round of judgment.
[0138] Corresponding to the above method, the present invention also provides a plant factory mesh network communication optimization system, comprising:
[0139] The parameter determination module is used to determine the location of each node in the Mesh network and the location of the central router;
[0140] The initialization module is used to perform node initialization operations and assign corresponding energy to each node.
[0141] The wait array determination module is used to add all nodes to the wait array;
[0142] The judgment module is used to determine whether all nodes are dead;
[0143] End module, used to terminate if the condition is met;
[0144] The task allocation module is used to elect cluster head nodes and determine the tasks of member nodes within each cluster head node, if not, based on the improved LEACH cluster head election algorithm with task weights.
[0145] The transmission and update module is used when the Mesh network enters a stable state, and the member nodes within each cluster head node transmit data according to their corresponding tasks. The cluster head node receives, merges, and transmits the data, and then returns to the step of adding all nodes to the waiting array.
[0146] In order to execute the methods corresponding to the above embodiments and achieve the corresponding functions and technical effects, the present invention also provides a plant factory Mesh network communication optimization device, including: at least one processor, at least one memory, and computer program instructions stored in the memory, wherein when the computer program instructions are executed by the processor, the plant factory Mesh network communication optimization method is implemented.
[0147] The memory is a computer-readable storage medium.
[0148] Based on the above description, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention. The aforementioned computer storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.
[0149] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the systems disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple; relevant parts can be referred to the method section.
[0150] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for optimizing communication in a plant factory mesh network, characterized in that, include: Determine the location of each node in the Mesh network and the location of the central router; Perform node initialization operations; And assign corresponding energy to each node; Add all nodes to the waiting array; Determine if all nodes are dead; If so, then the process ends; If not, the improved LEACH cluster head election algorithm based on task weights is used to elect cluster head nodes and determine the tasks of member nodes within each cluster head node. Once the Mesh network reaches a stable state, member nodes within each cluster head node transmit data according to their corresponding tasks. The cluster head node receives, merges, and transmits the data, and then returns to the step of adding all nodes to the waiting array. If not, then the improved LEACH cluster head election algorithm based on task weights is used to elect cluster head nodes and determine the tasks of member nodes within each cluster head node, specifically including: Determine the location of the mesh network and determine the weights based on the degree to which distance in the mesh network affects the efficiency of node information transmission; Based on the weights and the distance of the node from the central router, the threshold function of the LEACH cluster head election algorithm is transformed into a threshold function improved based on position weights. Based on the threshold of each node in the r-th round using a threshold function improved by position weight, the initial cluster head node is determined from the waiting array; The cluster head nodes for secondary screening are determined based on the energy threshold of the initially selected cluster head nodes and the number of cluster heads. Count the number of member nodes of each cluster head node in the secondary screening; The workload of each cluster head node, the workload of forwarding nodes within the cluster, and the workload of each cluster head node are determined based on the number of member nodes in each secondary-selected cluster head node and the distance of the secondary-selected cluster head node from the central router. The process of determining the workload of each cluster head node, the workload of forwarding nodes within the cluster, and the workload of each member node within the cluster head node based on the number of member nodes in each secondary-selected cluster head node and the distance of the secondary-selected cluster head node from the central router specifically includes: Based on the calculation of the task load of each cluster head and the total amount of forwarded data, according to m =0 calculates the task load of members within each cluster; When the number of member nodes in each of the secondary-selected cluster head nodes is the same, and the distances of the secondary-selected cluster head nodes from the central router are all different, the formula is used. Determine the workload of the cluster head node itself during the secondary screening. k i ; and according to mk i Determine the workload of nodes within the forwarding cluster; in, m This represents the number of member nodes in each cluster head node after secondary selection. k 0 indicates the amount of data that each node needs to send. d 0 represents the distance threshold. , f ( d This refers to the distance between the cluster head node and the central router during the secondary filtering process. d The function, d This represents the distance between the node and the router node. , i For the first i Cluster head node, n This indicates the number of cluster heads in the current round. E e The energy consumed by a transmitting or receiving circuit to transmit a 1-bit data packet. E D The energy consumed to fuse 1 bit of data.
2. The method for optimizing communication in a plant factory mesh network according to claim 1, characterized in that, The determination of whether all nodes are dead specifically includes: Determine whether the energy of each node in the waiting array is less than or equal to 0; If so, remove the node from the waiting array and then check the next node; If not, then determine whether all nodes have ever been cluster heads; If so, reset the information of all nodes that have been elected as cluster heads, and return to the step of determining whether the energy of each node in the waiting array is less than or equal to 0; If not, determine whether the current node has been elected as the cluster head node; if so, remove it from the waiting array and determine whether the next node has been elected as the cluster head node.
3. The method for optimizing communication in a plant factory mesh network according to claim 1, characterized in that, The process of determining the workload of each cluster head node, the workload of forwarding nodes within the cluster, and the workload of each cluster head node's member nodes based on the number of member nodes in each secondary-selected cluster head node and the distance of the secondary-selected cluster head node from the central router, specifically includes: When the number of member nodes in each cluster head node after secondary screening is different, the formula is used. Determine the workload of the cluster head node itself during the secondary screening. k i-in ; and according to m i k i-in Determine the workload of nodes within the forwarding cluster; in, n This indicates the number of cluster heads in the current round. k 0 indicates the amount of data that each node needs to send. g ( d This refers to the distance between the cluster head node and the central router during the secondary filtering process. d The function, , m i This represents the number of member nodes within the cluster head node in the i-th category, based on the distance of the cluster head node from the central router according to the secondary filtering.
4. A plant factory mesh network communication optimization system, used to implement the plant factory mesh network communication optimization method according to any one of claims 1-3, characterized in that, include: The parameter determination module is used to determine the location of each node in the Mesh network and the location of the central router; The initialization module is used to perform node initialization operations; And assign corresponding energy to each node; The wait array determination module is used to add all nodes to the wait array; The judgment module is used to determine whether all nodes are dead; End module, used to terminate if the condition is met; The task allocation module is used to elect cluster head nodes and determine the tasks of member nodes within each cluster head node, if not, based on the improved LEACH cluster head election algorithm with task weights. The transmission and update module is used when the Mesh network enters a stable state, and the member nodes within each cluster head node transmit data according to their corresponding tasks. The cluster head node receives, merges, and transmits the data, and then returns to the step of adding all nodes to the waiting array.
5. A plant factory mesh network communication optimization device, characterized in that, include: The system comprises at least one processor, at least one memory, and computer program instructions stored in the memory, which, when executed by the processor, implement a plant factory Mesh network communication optimization method as described in any one of claims 1-3.
6. The plant factory mesh network communication optimization device according to claim 5, characterized in that, The memory is a computer-readable storage medium.