Adaptive Routing Method for Agricultural Internet of Things Based on Fuzzy Logic
By adopting an adaptive routing method based on fuzzy logic in the agricultural Internet of Things, the low packet delivery rate and high delay problems caused by inter-node interference and poor link quality are solved, and the effect of improving packet delivery rate and extending network life is achieved.
Patent Information
- Application Number
- CN202210106012.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-01-28
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2042-01-28
AI Technical Summary
In the agricultural Internet of Things, there are problems such as low packet delivery rate, high-end to end delay, network jitter, frequent network topology changes and high energy consumption due to severe inter-node interference and poor link quality.
FLARP, an adaptive routing method for agricultural IoT based on fuzzy logic, uses a fuzzy inference control system to change the routing adaptive farmland network topology, combine link quality and internode interference, select the next hop node of the optimal path, and introduce node energy factor and heterogeneity measurement to extend network life and improve throughput.
It effectively improves packet delivery rate and throughput, extends network life, makes the network have good scalability and robustness, and reduces energy consumption.
Smart Images

Figure CN114501575B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of agricultural Internet of Things, and specifically relates to an adaptive routing method for agricultural Internet of Things based on fuzzy logic. Background Art
[0002] The agricultural Internet of Things is a special type of self-organizing network. Nodes for monitoring the pH value of the growth environment, temperature, soil humidity, air humidity, etc. are low-cost, miniature, and heterogeneous sensor nodes. These resource-constrained nodes are usually placed in the wild, and the cost of replacing the power supply module is relatively high. At the same time, under the complex environment of farmland, communication nodes will frequently interrupt the path establishment with the target node, and data packets will not be successfully transmitted even after multiple retransmissions, indirectly increasing the overall network energy consumption while reducing the packet delivery rate. The characteristics of the agricultural Internet of Things field are high sensor node density, strong heterogeneity, and dynamic topology, which result in different network systems formed between static crops and moving living bodies in the farm. Mobile nodes can move in random directions. Therefore, the agricultural Internet of Things has problems such as frequent topology changes, poor link quality, energy constraints, radio interference, and high latency.
[0003] In response to the above characteristics of the agricultural Internet of Things, Xue et al. proposed an improved LEACH (Low Energy Adaptive Clustering Hierarchy) protocol. Based on the analysis and research of the low-energy adaptive clustering hierarchical routing protocol, this protocol considered the influence of factors such as node energy and distance, and improved the low-energy adaptive clustering hierarchical routing protocol of the network, extending its service life. Although this protocol reduces energy consumption, it does not consider the data transmission quality, resulting in a low packet delivery rate due to link quality problems and interference between nodes, and high latency due to retransmissions, and there is no solution to deal with the frequent changes in network topology.
[0004] Kechiche et al. proposed an objective function based on fuzzy logic for the problems of low packet delivery rate and high latency. In addition to the routing metric related to energy consumption, this function also considers a new routing metric, that is, combining the link quality ETX (Expected Transmissions) and hop count HC (Hop Count) metrics through a fuzzy logic process. This objective function effectively reduces the packet delivery rate and achieves acceptable results in terms of delay without causing high traffic overhead when the network scale expands. However, it has not been improved in terms of throughput and frequent changes in network topology.
[0005] Adnan et al. proposed a multi-hop transmission clustering protocol based on fuzzy logic. The protocol forms unequal clusters through cluster heads selected by fuzzy logic based on the competition radius, achieving load balancing, minimizing energy consumption, and extending the network lifetime. However, this protocol cannot well adapt to mobile ad-hoc networks and is not applicable to the network system composed of static crops and living bodies in a moving state. Summary of the Invention
[0006] Aiming at the problems of serious interference between nodes, poor link quality, low packet delivery ratio, high end-to-end delay, network jitter, frequent changes in network topology, and high energy consumption in the above-mentioned agricultural Internet of Things, the present invention proposes a fuzzy logic-based adaptive routing method for agricultural Internet of Things FLARP (Fuzzy Logic Based Adaptive Routing Protocol). This method adopts a fuzzy inference control system, enabling the routing to spontaneously adapt to changes in the farmland network topology; combines link quality and interference between sensing nodes to select the next-hop node with the optimal path, effectively improving the packet delivery ratio, delay, and network jitter; introduces a node energy factor metric to extend the lifetime of the farmland network; introduces node heterogeneity to select the node with the optimal physical performance, effectively improving the throughput of the farmland system.
[0007] To achieve the above invention objectives, the present invention adopts the following technical solutions: A fuzzy logic-based adaptive routing method for agricultural Internet of Things, including the following steps:
[0008] 1) Construct parameters of the agricultural Internet of Things. The agricultural Internet of Things includes L sensor nodes and 1 sink node; the sensor nodes, whose positions can be moved, are used to monitor the growth conditions of crops and animals; the sensor nodes can communicate with each other; the sink node is the destination node, with a fixed position, and is used to receive the monitoring data sent by the sensor nodes; the sensor nodes regularly send information to the sink node.
[0009] 2) The source node that needs to send data determines whether the route to the destination node is available. If available, the source node directly forwards the data packet using the existing valid route and proceeds to step 14); otherwise, it proceeds to step 3).
[0010] 3) The source node generates a route request packet RREQ packet and sends it to all adjacent nodes; among them, all adjacent nodes are denoted as N i , i = {1, 2, 3,..., n}, where n is the number of adjacent nodes.
[0011] 4) All adjacent nodes that receive the RREQ packet determine whether they receive this RREQ packet for the first time. If not, they discard this RREQ packet, and the task of this round of the node is completed, proceeding to step 14); otherwise, it proceeds to step 5).
[0012] 5) Calculate the link quality ETX of the potential path from the source node to the destination node, where the potential path is the path serving as a candidate route between the source node and the destination node;
[0013] 6) Calculate the node energy factor EN of the potential path from the source node to the destination node;
[0014] 7) Calculate the interference I between nodes of the potential path from the source node to the destination node;
[0015] 8) Node N i Determine whether itself is the destination node. If not, go to step 9); otherwise, go to step 11);
[0016] 9) Node N i Determine whether there is a route to the destination node. If not, go to step 10); otherwise, go to step 11);
[0017] 10) Node N i Update the RREQ packet, cache and forward this packet, and go to step 4);
[0018] 11) Node N i Generate an RREP packet, add the hop count, link quality ETX, node energy factor EN, and interference I between nodes to the RREP packet and forward the RREP packet along the reverse route;
[0019] 12) The source node caches M RREP packets within the effective time T, and the value principle of M is as follows:
[0020]
[0021] where Z is the actual number of packets received within the effective time;
[0022] 13) The source node sends the M RREP packets to the fuzzy control system, and outputs the next-hop node with the optimal path through the fuzzy control system;
[0023] 14) The routing process ends.
[0024] Further, in the above step 3), the routing request packet RREQ includes a type field, a flag field, a hop count, an RREQ ID, a destination node IP address, a source node IP address, a source node heterogeneity, a source node coordinate, a node energy factor EN, an interference between nodes I, and a link quality ETX; where the value of the type field is 1, indicating that the message is an RREQ control packet; the flag bit size is 2 bits, corresponding to 2 flag bits G and D. G is a free route reply flag, indicating whether a free route reply message should be sent to the destination node. The initial value is 1, indicating that a free route reply message needs to be sent to the destination node; D is a destination node only reply flag, and the initial value is 0, indicating that both the destination node and intermediate nodes with a route to the destination node are allowed to reply; the hop count is the number of nodes passed from the source node to the node that receives this RREQ message, and the initial value is 0; the RREQ ID is a routing request message identifier, and the RREQ ID and the source node IP address serve as the unique identifier of the RREQ message; the source node coordinate records the source node location information; the node energy factor EN, the interference between nodes I, and the link quality ETX are initialized to 0 and updated by intermediate nodes that receive the RREQ packet; the source node heterogeneity records the source node heterogeneity information, and the specific value of the source node heterogeneity HD is calculated according to the node's own performance. The calculation formula is as follows:
[0025]
[0026] HD phy is the physical ability heterogeneity, and the calculation formula is as follows:
[0027]
[0028] where bandwidth represents the bandwidth, phy represents the CPU performance, and HD phy decreases as phy and bandwidth increase;
[0029] HD sen is the sensing ability heterogeneity, and the calculation formula is as follows:
[0030]
[0031] where r is the sensing radius of the node, and α is the sensing range of the node.
[0032] Further, in the above step 5), calculate the link quality ETX of the potential path from the source node to the destination node. The potential path is a path that serves as a candidate route between the source node and the destination node, and includes the following steps:
[0033] 5.1) Node N i Calculate the link quality ETX value with the previous node new The calculation formula is as follows:
[0034]
[0035] Among them, the probability P f and P r respectively represent the success rate of transmitting data packets and the success rate of receiving data packets. The probability P r is calculated as follows:
[0036]
[0037] Among them, count(t - w, t) is the number of LPPs received by the receiving node during w, the number of w / τ is the number of LPPs that should be received, and t is the time when the node calculates the probability P r .
[0038] 5.2) Calculate the link quality ETX of the potential path from the source node to the destination node. The calculation formula is as follows:
[0039] ETX = ETX new + ETX old
[0040] Among them, ETX old is the original ETX value in the RREQ packet.
[0041] Furthermore, in the above step 6), calculating the node energy factor EN of the potential path from the source node to the destination node includes the following steps:
[0042] 6.1) Node N i Calculate the energy E consumed for receiving the LPP packet from the previous node r , and the calculation formula is as follows:
[0043]
[0044] Among them, is the remaining energy before receiving the LPP packet, is the remaining energy after receiving the LPP packet;
[0045] 6.2) Node N i Calculate the energy E consumed for sending the data packet to the previous node s , and the calculation formula is as follows:
[0046]
[0047] Among them, is the remaining energy before sending the LPP packet, is the remaining energy after sending the LPP packet;
[0048] 6.3) Calculate node N iThe energy factor EN of the previous node new , and the calculation formula is as follows:
[0049]
[0050] Where E res is the remaining energy of node N i , E ini is the initial energy of node N i , is the remaining energy of the neighboring node, is the initial energy of the neighboring node, β 1 and β 2 are the coefficient factors related to energy of node N i and the neighboring node;
[0051] 6.4) Calculate the node energy factor EN of the potential path from the source node to the destination node, and the calculation formula is as follows:
[0052] EN = EN new + EN old
[0053] Where EN old is the original EN value in the RREQ packet.
[0054] Furthermore, in the above step 7), calculating the interference I between nodes of the potential path from the source node to the destination node includes the following steps:
[0055] 7.1) After node N i receives the RREQ packet, read the position information of the previous node and calculate the distance d between nodes. The formula is as follows:
[0056]
[0057] Where (X n , Y n ) are the coordinates of node N i , (X m , Y m ) are the coordinates of the neighboring node;
[0058] 7.2) Calculate the Received Signal Strength Indication (RSSI), and the calculation formula is as follows:
[0059] RSSI = -(10 × n × lgd + A)
[0060] Where n is the propagation exponent and A is the received signal strength at a distance of 1m from the sender;
[0061] 7.3) Calculate node N iInter - node interference I with the previous node new , the inter - node interference I new can be represented by a quantity inversely proportional to RSSI, and the calculation formula is as follows:
[0062] I new = RSSI -1
[0063] 7.4) Calculate the inter - node interference I of the potential path from the source node to the destination node, and the calculation formula is as follows:
[0064] I = I new + I old
[0065] where, I old is the original I value in the RREQ packet.
[0066] Furthermore, in the above - mentioned step 11), the RREP packet contains the following fields: type field, flag field, hop count, RREP ID, destination node IP address, source node IP address, lifetime, node heterogeneity, node energy factor, inter - node interference, and link quality; among them: the value of the type field is 2, indicating that the message is an RREP control packet; the size of the flag field is 2 bits, corresponding to two flag bits R and A. R is the repair flag, used for multicast, and the initial value is 0, indicating that this route does not need to be repaired; A is the need - for - confirmation flag, and the initial value is 1, indicating that the next adjacent node that receives this message needs to unicast an acknowledgment message to this node; the hop count is the number of nodes passed from the source node to the destination node; the RREP ID is the identifier of the route reply message; the lifetime is the survival time of the RREP packet; the node heterogeneity is the heterogeneity of the node sending the RREP packet, and the calculation method is the same as that in step 3); the node energy factor is the sum of the energy factors of the route between the source node and the node sending this RREP packet; the inter - node interference is the sum of the signal strengths of the route between the source node and the node sending this RREP packet; the link quality is the ETX from the node sending the RREP packet's cache to the source node.
[0067] Furthermore, in the above - mentioned step 13), the fuzzy control system includes an input module, a fuzzification engine, and an output module; the input module is used to receive the node quality information in the RREP packet; the fuzzification engine includes a fuzzification module, a fuzzy inference module, and a defuzzification module; the fuzzification module is used to convert the given input into a fuzzy set, the fuzzy inference module obtains the firing strength FS according to fuzzy rules and fuzzy logic operations, the defuzzification module calculates the output value through the FS value, that is, the node quality; the output module outputs the node quality to obtain the optimal next - hop node.
[0068] The present invention has the following beneficial effects when adopting the above - mentioned technical solutions:
[0069] This method effectively improves the packet delivery ratio and throughput of the agricultural Internet of Things, enables the network to have good scalability and robustness, and at the same time effectively extends the lifespan of the agricultural Internet of Things. Description of the Drawings
[0070] Figure 1 It is a flowchart of the routing method.
[0071] Figure 2 It is a structure diagram of RREQ.
[0072] Figure 3 It is a structure diagram of RREP.
[0073] Figure 4 It is a framework of the fuzzy control system. Detailed Implementation Manner
[0074] The present invention will be further described below in conjunction with the drawings and specific embodiments. It should be noted that only one optimal technical solution is used to elaborate on the technical solution and design principle of the present invention in detail below, but the protection scope of the present invention is not limited thereto.
[0075] As Figure 1 shown, an adaptive routing method for the agricultural Internet of Things based on fuzzy logic includes the following steps:
[0076] 1) Construct parameters of the agricultural Internet of Things. The agricultural Internet of Things includes L sensor nodes and 1 sink node. The sensor nodes can move in position and are used to monitor the growth status of crops and animals. The sensor nodes can communicate with each other. The sink node is the destination node with a fixed position and is used to receive the monitoring data sent by the sensor nodes. The sensor nodes send information to the sink node regularly.
[0077] 2) The source node that needs to send data determines whether the route to the destination node is available. If available, the source node directly forwards the data packet using the existing valid route and goes to step 14); otherwise, it goes to step 3).
[0078] 3) The source node generates a route request packet RREQ (Route Request) packet and sends it to all adjacent nodes. The structure of the route request packet RREQ is as Figure 2As shown, it includes a type field, a flag field, a hop count, an RREQ ID, a destination node IP address, a source node IP address, a source node heterogeneity degree, a source node coordinate, a node energy factor EN, an interference between nodes I, and a link quality ETX. Among them: The value of the type field is 1, indicating that the message is an RREQ control packet; the flag bit size is 2 bits, corresponding to two flag bits G and D. G is a free route reply flag, indicating whether a free route reply message should be sent to the destination node. The initial value is 1, indicating that a free route reply message needs to be sent to the destination node; D is a destination node only reply flag, and the initial value is 0, indicating that both the destination node and the intermediate node with a route to the destination node are allowed to reply; the hop count is the number of nodes passed from the source node to the node that receives this RREQ message, and the initial value is 0; the RREQ ID is the routing request message identifier, and the RREQ ID and the source node IP address are used as the unique identifier of the RREQ message; the source node coordinate records the source node location information; the node energy factor EN, the interference between nodes I, and the link quality ETX are initialized to 0 and updated by the intermediate node that receives the RREQ packet; the source node heterogeneity degree records the source node heterogeneity information, and the specific value of the source node heterogeneity HD is calculated according to the node's own performance. The calculation formula is as follows:
[0079]
[0080] HD phy is the physical ability heterogeneity degree, and the calculation formula is as follows:
[0081]
[0082] Among them, bandwidth represents the bandwidth, phy represents the CPU performance, and HD phy decreases as phy and bandwidth increase;
[0083] HD sen is the sensing ability heterogeneity degree, and the calculation formula is as follows:
[0084]
[0085] Among them, r is the sensing radius of the node, and α is the sensing range of the node;
[0086] 4) All adjacent nodes N i that receive the RREQ packet, i = {1, 2, 3,..., n}, determine whether this RREQ packet is received for the first time. If it is not received for the first time, discard this RREQ packet, the node's current round task is completed, and go to step 14), otherwise go to step 5);
[0087] 5) Calculate the link quality ETX of the potential path from the source node to the destination node, where the potential path is the path serving as the candidate route between the source node and the destination node; as a preferred embodiment of the present invention, it includes the following steps:
[0088] 5.1) Node N i Calculate the link quality ETX with the previous node new value, and the calculation formula is as follows:
[0089]
[0090] where the probability P f and P r respectively represent the success rate of transmitting data packets and the success rate of receiving data packets. The calculation formula for the probability P r is as follows:
[0091]
[0092] The probability value P r is measured using the link probe packet LPP (Link Probe Packet). Each node broadcasts a fixed-size LPP at an average period τ and remembers the number of LPPs received from other nodes within the last w seconds (10s is taken in the scheme). count(t - w, t) is the number of LPPs received by the receiving node during w, and the number of w / τ is the number of LPPs that should be received. P f is substantially equal to P when the sender becomes the receiver r . Calculate P f and P r , and obtain the link quality ETX between itself and the neighboring node new ;
[0093] 5.2) Calculate the link quality ETX of the potential path from the source node to the destination node, and the calculation formula is as follows:
[0094] ETX = ETX new + ETX old
[0095] where ETX old is the original ETX value in the RREQ packet;
[0096] 6) Calculate the node energy factor EN of the potential path from the source node to the destination node; as a preferred embodiment of the present invention, it includes the following steps:
[0097] 6.1) Node N i Calculate the energy E r consumed by receiving the LPP packet from the previous node, and the calculation formula is as follows:
[0098]
[0099] Among them, is the remaining energy before receiving the LPP packet, is the remaining energy after receiving the LPP packet.
[0100] 6.2) Node N i Calculate the energy E consumed by the data packet sent to the previous node s , and the calculation formula is as follows:
[0101]
[0102] Among them, is the remaining energy before sending the LPP packet, is the remaining energy after sending the LPP packet.
[0103] 6.3) Calculate node N i and the energy factor EN of the previous node new , and the calculation formula is as follows:
[0104]
[0105] Among them, E res is the remaining energy of node N i , E ini is the initial energy of node N i , is the remaining energy of the neighboring node, is the initial energy of the neighboring node, β 1 and β 2 are the coefficient factors related to energy of node N i and the neighboring node, and the range is between (0, 1). Because the nodes are equal during the transmission process, so β 1 and β 2 are both set to 0.5.
[0106] 6.4) Calculate the node energy factor EN of the potential path from the source node to the destination node, and the calculation formula is as follows:
[0107] EN = EN new + EN old
[0108] Among them, EN old is the original EN value in the RREQ packet;
[0109] 7) Calculate the interference I between nodes of the potential path from the source node to the destination node; As a preferred embodiment of the present invention, it includes the following steps:
[0110] 7.1) Node N iAfter receiving the RREQ packet, read the previous node location information and calculate the distance d between nodes. The formula is as follows:
[0111]
[0112] Among them, (X n , Y n ) is node N i Coordinates, (X m , Y m ) are the neighboring node coordinates.
[0113] 7.2) Calculate the received signal strength indication RSSI (Received Signal Strength Indication), the calculation formula is as follows:
[0114] RSSI = -(10×n×lgd+A)
[0115] Where n is the propagation index and A is the received signal strength at a distance of 1 m from the sender.
[0116] 7.3) Compute Node N i Inter-node interference with the previous node I new , the inter-node interference I new It can be expressed as a quantity inversely proportional to RSSI, and the calculation formula is as follows:
[0117] I new =RSSI -1
[0118] 7.4) Calculate the inter-node interference I of the potential path from the source node to the destination node. The calculation formula is as follows:
[0119] I=I new +I old
[0120] Among them, I old is the original I value in the RREQ packet;
[0121] 8) Node N i Determine whether it is the destination node. If not, go to step 9); otherwise, go to step 11);
[0122] 9) Node N i Determine whether there is a route to the destination node. If not, go to step 10); otherwise, go to step 11);
[0123] 10) Node N i Update the RREQ packet, cache and forward the packet, and go to step 4);
[0124] 11) Node N iGenerate an RREP packet, add the hop count, link quality ETX value, node energy factor, and interference between nodes to the RREP packet, and forward the RREP packet along the reverse route; where the RREP packet structure is as Figure 3 shown, including the following fields: type field, flag field, hop count, RREP ID, destination node IP address, source node IP address, lifetime, node heterogeneity, node energy factor, interference between nodes, and link quality. Among them: the value of the type field is 2, indicating that the message is an RREP control packet; the size of the flag field is 2 bits, corresponding to two flag bits R and A. R is the repair flag, used for multicast, with an initial value of 0, indicating that this route does not need to be repaired; A is the acknowledgment required flag, with an initial value of 1, indicating that the next neighboring node that receives this message needs to unicast an acknowledgment message to this node; the hop count is the number of nodes passed from the source node to the destination node; the RREP ID is the identifier of the route reply message; the lifetime is the survival time of the RREP packet; the node heterogeneity is the heterogeneity of the node sending the RREP packet, and the calculation method is the same as in step 3); the node energy factor is the sum of the energy factors of the route between the source node and the node sending this RREP packet; the interference between nodes is the sum of the signal strengths of the route between the source node and the node sending this RREP packet; the link quality is the ETX from the node sending the RREP packet to the source node cached by the node.
[0125] 12) The source node receives and caches M RREP packets within the effective time T. The value-taking principle of M is as follows:
[0126]
[0127] Among them, Z is the actual number of packets received within the effective time. In a specific embodiment of the present invention, T = 10s and M = 5;
[0128] 13) The source node sends the M RREP packets to the fuzzy control system, and outputs the next-hop node with the optimal path through the fuzzy control system. The fuzzy control system is as Figure 4 shown, including an input module, a fuzzification engine, and an output module. The input module takes the node quality information in the M packets as input. The fuzzification engine is the core of the fuzzy control system, including three parts: a fuzzification module, a fuzzy inference module, and a defuzzification module. Among them, the fuzzification module is used to convert the given input into a fuzzy set. The fuzzy inference module obtains the fire strength value FS (Fire Strength) according to fuzzy rules and fuzzy logic operations. The defuzzification module calculates the output value through the FS value, that is, the node quality. The output module outputs the quality of the next-hop node with the optimal path. Specifically, it includes the following steps:
[0129] 13.1) The input module reads the node quality information in the packet as input. The input language variables and fuzzy sets are as shown in the following table:
[0130] Table 1 Linguistic Variables and Fuzzy Sets
[0131]
[0132]
[0133] 13.2) The fuzzification module fuzzifies the node quality information through the membership function, and the input membership functions are as follows:
[0134]
[0135]
[0136]
[0137] 13.3) The fuzzy inference module performs fuzzy inference through fuzzy rules and fuzzy logic operations. Among them, the fuzzy rules are as follows:
[0138] Combine the hop count and the distance between nodes to obtain a new linguistic variable - Interval, as follows:
[0139] Table 2 Fuzzy Rules for Hop Count and Distance between Nodes
[0140]
[0141]
[0142] Combine the interference between nodes and the link quality to obtain a new linguistic variable - Communication Quality, as follows:
[0143] Table 3 Fuzzy Rules for Interference between Nodes and Link Quality
[0144]
[0145] At this time, the fuzzy rule base consists of the following linguistic variables: Interval, Communication Quality, Node Energy Factor, and Node Heterogeneity Degree.
[0146] Let the universe of discourse of Interval be U, and the fuzzy set A i be {near, medium, far}, where i = {1, 2, 3}; the universe of discourse of Communication Quality be X, and the fuzzy set B j be {poor, medium, good}, where j = {1, 2, 3}; the universe of discourse of Node Energy be Y, and the fuzzy set C m be {less, less, medium, more, much}, where m = {1, 2, 3, 4, 5}; the universe of discourse of Node Heterogeneity Degree be Z, and the fuzzy set D nis {low, relatively low, medium, relatively high, high}, where n = {1, 2, 3, 4, 5}; the system output is the neighbor quality, the universe of discourse is W, and the fuzzy set is E t is {very poor, poor, relatively poor, medium deviation, medium, medium preference, relatively good, good, very good}, where t = {1, 2, 3, 4, 5, 6, 7, 8, 9}, and the fuzzy rule base is expressed as follows:
[0147] IF U = A i AND X = B j AND Y = C m AND Z = D n THEN W = E t
[0148] The fuzzy logic operation adopts the minimum membership degree method.
[0149] 13.4) The defuzzification module defuzzifies the fuzzy inference result, and the defuzzification calculation formula is as follows:
[0150]
[0151] 13.5) The output module outputs the next-hop node with the optimal path, and the membership function of the system output is as follows:
[0152]
[0153] 14) The routing process ends.
[0154] The described embodiment is the preferred embodiment of the present invention, but the present invention is not limited to the above embodiment. Without departing from the essence of the present invention, any obvious improvement, replacement or modification that those skilled in the art can make belongs to the protection scope of the present invention.
[0155] The present invention uses NS3 as the experimental platform, mainly aiming at the agricultural Internet of Things, and designs and completes an implementation method of an adaptive routing for the agricultural Internet of Things based on fuzzy logic, which has the advantages of low latency, low energy consumption, high throughput and high adaptability. The above content is only used to illustrate the design idea and characteristics of the present invention, and its purpose is to enable those skilled in the art to understand the content of the present invention and implement it accordingly. The protection scope of the present invention is not limited to the above content. Therefore, all equivalent changes or modifications made according to the principles and design ideas disclosed by the present invention are within the protection scope of the present invention.
Claims
1. An adaptive routing method for agricultural Internet of Things based on fuzzy logic, characterized in that, it includes the following steps: 1) Construct parameters of the agricultural Internet of Things, where the agricultural Internet of Things includes L sensor nodes and 1 sink node; the sensor nodes, whose positions can be moved, are used to monitor the growth conditions of crops and animals; the sensor nodes can communicate with each other; the sink node is the destination node, with a fixed position, and is used to receive the monitoring data sent by the sensor nodes; The sensor nodes send information to the sink node regularly; 2) The source node that needs to send data determines whether the route to the destination node is available. If it is available, the source node directly forwards the data packet using the existing valid route, and goes to step 14); Otherwise, go to step 3); 3) The source node generates a routing request packet RREQ packet and sends it to all adjacent nodes; among them, all adjacent nodes are denoted as N i , where i = {1, 2, 3,..., n}, and n is the number of adjacent nodes; 4) All adjacent nodes that receive the RREQ packet determine whether they receive this RREQ packet for the first time. If it is not the first time, discard this RREQ packet, and the node's task for this round is completed, and go to step 14), otherwise go to step 5); 5) Calculate the link quality ETX of the potential path from the source node to the destination node, where the potential path is the path as the candidate route between the source node and the destination node; 6) Calculate the node energy factor EN of the potential path from the source node to the destination node; 7) Calculate the interference I between nodes of the potential path from the source node to the destination node; 8) Node N i Determine whether it is the destination node itself. If not, go to step 9); otherwise, go to step 11). 9) Node N i Determine whether there is a route to the destination node. If not, go to step 10); otherwise, go to step 11). 10) Node N i Update the RREQ packet, cache and forward this packet, go to step 4); 11) Node N i Generate an RREP packet, add the hop count, link quality ETX, node energy factor EN, and interference I between nodes to the RREP packet, and forward the RREP packet along the reverse route; 12) The source node caches M RREP packets within the effective time T, and the value-taking principle of M is as follows: where Z is the number of packets actually received within the effective time; 13) The source node sends the M RREP packets to the fuzzy control system, and outputs the next-hop node with the optimal path through the fuzzy control system; In step 13), the fuzzy control system includes an input module, a fuzzification engine, and an output module; the input module is used to receive the node quality information in the RREP packet; the fuzzification engine includes a fuzzification module, a fuzzy inference module, and a defuzzification module; the fuzzification module is used to convert the given input into a fuzzy set, the fuzzy inference module obtains the firing strength FS according to the fuzzy rules and fuzzy logic operations, the defuzzification module calculates the output value through the FS value, and the output value represents the node quality; the output module outputs the node quality to obtain the optimal next-hop node; 14) The routing process ends.
2. The adaptive routing method for agricultural Internet of Things based on fuzzy logic according to claim 1, characterized in that, In step 3), the routing request packet RREQ includes a type field, a flag field, a hop count, an RREQ ID, a destination node IP address, a source node IP address, a source node heterogeneity, source node coordinates, a node energy factor EN, an interference between nodes I, and a link quality ETX. Among them, the value of the type field is 1, indicating that the message is an RREQ control packet. The flag bit size is 2 bits, corresponding to two flag bits G and D. G is a free route reply flag, indicating whether a free route reply message should be sent to the destination node. The initial value is 1, indicating that a free route reply message needs to be sent to the destination node. D is a destination node only reply flag, and the initial value is 0, indicating that both the destination node and the intermediate node with a route to the destination node are allowed to reply to the message. The hop count is the number of nodes passed from the source node to the node that receives this RREQ message, and the initial value is 0. The RREQ ID is a routing request message identifier, and the RREQ ID and the source node IP address are used as the unique identifier of the RREQ message. The source node coordinates record the location information of the source node. The node energy factor EN, the interference between nodes I, and the link quality ETX are initialized to 0 and updated by the intermediate node that receives the RREQ packet. The source node heterogeneity records the source node heterogeneity information, and the specific value of the source node heterogeneity HD is calculated according to the node's own performance. The calculation formula is as follows: HD phy is the physical ability heterogeneity degree, and the calculation formula is as follows: where bandwidth represents the bandwidth, phy represents the CPU performance, HD phy decreases as phy and bandwidth increase; HD sen is the heterogeneity degree of perception ability, and the calculation formula is as follows: where r is the sensing radius of the node and α is the sensing range of the node.
3. The adaptive routing method for an agricultural Internet of Things based on fuzzy logic according to claim 1, characterized in that, in step 5), calculating the link quality ETX of the potential path from the source node to the destination node, where the potential path is the path that is a candidate route between the source node and the destination node, and includes the following steps: 5.1) Node N i Calculate the link quality ETX with the previous node new The value, and the calculation formula is as follows: Among them, the probability P f and P r represent the success rate of transmitting data packets and the success rate of receiving data packets respectively. The probability P r is calculated as follows: where count(t - w, t) is the number of LPPs received by the receiving node during w, the number of w / τ is the number of LPPs that should be received, and t is the time when the node calculates the probability P r ; 5.2) Calculating the link quality ETX of the potential path from the source node to the destination node, and the calculation formula is as follows: ETX = ETX new + ETX old Among them, ETX old is the original ETX value in the RREQ packet.
4. The adaptive routing method for an agricultural Internet of Things based on fuzzy logic according to claim 1, characterized in that, in step 6), calculating the node energy factor EN of the potential path from the source node to the destination node includes the following steps: 6.1) Node N i Calculate the energy E consumed for receiving the LPP packet from the previous node r , and the calculation formula is as follows: Among them, is the remaining energy before receiving the LPP packet, is the remaining energy after receiving the LPP packet; 6.2) Node N i Calculate the energy E consumed by the data packet sent to the previous node s , and the calculation formula is as follows: Among them, is the remaining energy before sending the LPP packet, is the remaining energy after sending the LPP packet; 6.3) Computing Node N i and the energy factor EN of the previous node new , and the calculation formula is as follows: Among them, E res is the remaining energy of node N i and E ini is the initial energy of node N i . is the remaining energy of neighboring nodes, is the initial energy of neighboring nodes, and β 1 and β 2 are coefficient factors related to the energy of node N i and neighboring nodes; 6.4) Calculating the node energy factor EN of the potential path from the source node to the destination node, and the calculation formula is as follows: EN = EN new + EN old Among them, EN old is the original EN value in the RREQ packet.
5. The adaptive routing method for an agricultural Internet of Things based on fuzzy logic according to claim 1, characterized in that, in step 7), calculating the interference between nodes I of the potential path from the source node to the destination node includes the following steps: 7.1) Node N i After receiving the RREQ packet, read the position information of the previous node and calculate the distance d between nodes. The formula is as follows: Among them, (X n , Y n ) is the coordinate of node N i , and (X m , Y m ) is the coordinate of the adjacent node; 7.2) Calculating the received signal strength indication RSSI (Received Signal Strength Indication), and the calculation formula is as follows: RSSI = -(10 × n × lgd + A) where n is the propagation exponent and A is the received signal strength at a distance of 1 m from the sender; 7.3) Computing Node N i The inter-node interference I with the previous node new The inter-node interference I new can be represented by a quantity inversely proportional to the RSSI, and the calculation formula is as follows: I new = RSSI -1 7.4) Calculating the interference between nodes I of the potential path from the source node to the destination node, and the calculation formula is as follows: I = I new +I old where I old is the original I value in the RREQ packet.
6. The adaptive routing method for an agricultural Internet of Things based on fuzzy logic according to claim 1, characterized in that, In the said step 11), the RREP packet contains the following fields: type field, flag field, hop count, RREP ID, destination node IP address, source node IP address, lifetime, node heterogeneity, node energy factor, interference between nodes, and link quality; where: the value of the type field is 2, indicating that the message is an RREP control packet; the size of the flag field is 2 bits, corresponding to two flag bits R and A. R is the repair flag, used for multicast, with an initial value of 0, indicating that this route does not need to be repaired; A is the acknowledgment required flag, with an initial value of 1, indicating that the next neighboring node receiving this message needs to unicast an acknowledgment message to this node; the hop count is the number of nodes passed from the source node to the destination node; the RREP ID is the identifier of the route reply message; the lifetime is the survival time of the RREP packet; the node heterogeneity is the heterogeneity of the node sending the RREP packet, and the calculation method is the same as that in step 3); the node energy factor is the total energy factor of the route between the source node and the node sending this RREP packet; the interference between nodes is the total signal strength of the route between the source node and the node sending this RREP packet; the link quality is the ETX from the node sending the RREP packet to the source node cached by the node.