A Clustering Method for Wireless Sensor Networks Based on Whale Algorithm and Fuzzy Logic Algorithm

By adopting a clustering method based on whale algorithm and fuzzy logic algorithm in wireless sensor networks, the problems of energy efficiency and network survival time of WSNs in harsh environments are solved, and more efficient energy utilization and network life extension are achieved.

CN116321342BActive Publication Date: 2025-06-20KUNMING UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310121099.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-15
Publication Date
2025-06-20
Estimated Expiration
2043-02-15

AI Technical Summary

Technical Problem

Existing wireless sensor networks (WSNs) have difficulty achieving long-term energy efficiency and network survival time in harsh environments, especially when node energy is limited and cannot be replaced regularly.

Method used

The wireless sensor network clustering method based on whale algorithm and fuzzy logic algorithm is adopted. The candidate cluster head is selected by updating the threshold formula, the final cluster head is selected using the fuzzy logic algorithm optimized by whale algorithm, and the node clustering strategy is optimized to improve the quality of the selected cluster heads for dynamic clustering.

Benefits of technology

It improves node energy utilization efficiency, balances node load, extends network life, and improves the overall performance of the network by optimizing cluster first-choice and node clustering strategies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116321342B_ABST
    Figure CN116321342B_ABST
Patent Text Reader

Abstract

The present invention relates to a clustering method for wireless sensor networks based on the whale optimization algorithm and the fuzzy logic algorithm, belonging to the technical field of clustering routing for wireless sensor networks. First, the present invention uses the WOA to optimize the fuzzy rules of the fuzzy logic algorithm; secondly, the remaining energy factor and the distance factor are introduced, and an influence factor for optimizing the traditional cluster head election threshold is designed accordingly. Then, based on the updated threshold formula, candidate cluster heads are selected; then, on the basis of the selected candidate cluster heads, the factors affecting the energy consumption of the final cluster head are analyzed, and three independent input variables are designed for the fuzzy logic algorithm. The fuzzy rules optimized by the WOA are used for reasoning to obtain the output of the fuzzy logic, which is used as the basis for selecting the final cluster head, making the energy and position of the elected final cluster head more reasonable; finally, the node clustering strategy is optimized. The present invention can improve the energy utilization efficiency of nodes, balance the node load, and thus extend the network lifetime.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to a wireless sensor network clustering method based on a whale algorithm and a fuzzy logic algorithm, and belongs to the technical field of wireless sensor network clustering routing. Background Art

[0002] As a distributed self-organizing sensing network that uses sensor nodes to monitor the target area, WSNs are widely used in military and civilian fields. In these fields, many applications, such as volcano monitoring and early warning systems in harsh outdoor environments, or military operations that require monitoring of enemy actions, require WSNs to provide long-term services, so the network needs to survive for a long time. However, due to cost and volume factors, the energy of sensor nodes is generally limited, and due to environmental reasons, it is impossible to regularly replace the node batteries deployed in these environments, so higher requirements are placed on the survival time of WSNs. In order to solve the energy constraint problem of the entire network, routing algorithms based on clustering strategies have always been the research focus of WSNs. In this algorithm, the system is generally divided into clusters, and any cluster consists of a cluster head and nodes within the cluster. It is generally used for WSNs with a larger range and has good scalability. A suitable clustering routing algorithm can not only find the best communication line in the end-to-end nodes through the information between nodes, but also minimize the energy consumption of this line to achieve the purpose of improving the network life.

[0003] The technology of this invention comes from the Yunnan Basic Research Program Key Project (202101AS070016); Yunnan Province "Xingdian Talent Support Program" Industrial Innovation Talent Project (Yunnan Development and Reform Personnel

[2019] No. 1096); Yunnan Province Technology Innovation Talent Project (2019HB113); Yunnan Provincial Key Laboratory of Computer Technology Application Open Fund; Yunnan Provincial Science and Technology Plan Project Major Science and Technology Special Program Funding. Summary of the invention

[0004] The technical problem to be solved by the present invention is to provide a wireless sensor network clustering method based on the whale algorithm and the fuzzy logic algorithm. The candidate cluster heads are selected by updating the threshold formula, the final cluster head is selected by using the fuzzy logic algorithm optimized by the whale algorithm, and the node clustering strategy is optimized, thereby improving the quality of the cluster heads selected by dynamic clustering, thereby improving the node energy utilization efficiency, balancing the node load, and increasing the network life.

[0005] The technical solution of the present invention is: a wireless sensor network clustering method based on whale algorithm and fuzzy logic algorithm, the specific steps are:

[0006] Step1: Initialize network parameters. Randomly deploy N WSNs sensor nodes in a two-dimensional monitoring area of size M×M. The base station collects the node location information, then calculates the maximum and minimum distances between the nodes and the base station, and broadcasts the node locations and the maximum and minimum distances between the nodes and the base station to the nodes. The nodes broadcast their own location information within the communication radius so that all nodes can calculate the distances to their neighbor nodes, the number of neighbor nodes, and the competition radius.

[0007] Step2: The base station uses WOA to optimize the fuzzy rules of the fuzzy logic algorithm.

[0008] The specific content of Step2 is as follows:

[0009] Step2.1: Encoding;

[0010] Each whale is represented by a probability matrix of r×c:

[0011]

[0012] where r = 7, c = 27, and r and c represent the number of output levels and the number of input combinations of the fuzzy logic respectively. pm ij ∈[0,1] represents the probability that this rule becomes a fuzzy rule in the fuzzy rule base.

[0013] Step2.2: Initialize the whale population;

[0014] Divide the whale population into multiple subgroups according to the number of whales. Randomly initialize the whale individuals in some subgroups, and set each position of the probability matrix of the whale individuals to a random value in the interval [0,1] to ensure the diversity of the population. Initialize the whale individuals in the remaining subgroups according to human experience. Set the values corresponding to the output variables in the corresponding positions of the initial fuzzy rules according to human experience to 1, and the values of the remaining positions to 0, so that the obtained fuzzy rule base is not too different from the optimal rules.

[0015] Step2.3: Take the first node death round FND as the fitness value, that is, fitness = FND.

[0016] Step2.4: Update the positions of the whale population;

[0017] Temporarily generate a random value pa for each position of the probability matrix corresponding to each whale. When pa < 0.5, update the position according to the shrinking encircling mechanism in Equation (2). When pa ≥ 0.5, update the position according to the bubble net attack in Equation (4). When choosing to shrink and encircle, judge the relationship between the parameter |A| and 1. When |A| < 1, choose to approach the optimal whale and encircle the prey according to Equation (2). When |A| ≥ 1, approach a random whale and randomly search for prey globally according to Equation (6).

[0018] x(t + 1) = x * (t) - A × D (2)

[0019] D = |C × x * (t) - x(t)| (3)

[0020] t ∈ [1, Max_iteration] indicates which iteration the WOA population is in. Max_iteration represents the number of WOA iterations. x(t) represents the whale individual currently being traversed. x * (t) represents the position of the best whale. D represents the distance between the whale individual currently being traversed and the best whale. A and C are coefficients, A = 2a × z - a, C = 2 × z, where z is a random number uniformly distributed in the range [0, 1]. The value range of the coefficient A is [-a, a], where a = 2 - t × (2 / Max_iteration).

[0021] x(t + 1) = D′ × e bl × cos(2πl) + x * (t) (4)

[0022] D′ = |x * (t) - x(t)| (5)

[0023] D′ represents the distance between the whale individual currently being traversed and the best whale. b represents the shape change control constant. l is a random number uniformly distributed in the range [-1, 1].

[0024] x(t + 1) = x rand (t) - A × D″ (6)

[0025] D″ = |C × x rand (t) - x(t)| (7)

[0026] D″ represents the distance between the current search individual and the random individual. x rand (t) represents the position of the current random individual.

[0027] Step2.5: Normalization;

[0028] Since the value at any position in the probability matrix should be in the interval [0, 1], however, after Step2.4, the positions of the whale population change, and it cannot be guaranteed that the probability values in the matrix will not exceed the bounds. Therefore, the probability matrix needs to be normalized according to Equation (8) for the probability value of the i-th row corresponding to the j-th fuzzy rule of the num-th whale in the iter-th iteration:

[0029]

[0030] Wherein, is the probability value before normalization, is the maximum probability value of the j-th column of whale num, is the minimum probability value of the j-th column of whale num.

[0031] Step2.6: Decode to obtain the fuzzy rule base;

[0032] Record the row number corresponding to the maximum value of each column in the matrix in the row vector where iter and num represent the number of iterations and the whale number respectively. The obtained row vector is a fuzzy rule base with all input cases.

[0033] Step3: Calculate the remaining energy influence factor and the distance influence factor to the base station through the node, obtain the influence factor for optimizing the traditional cluster head election threshold according to the remaining energy influence factor and the distance influence factor to the base station, update the threshold formula, and then compare the random number generated by the node with the threshold. If it is less than the threshold, the node is elected as the candidate cluster head.

[0034] The specific content of Step3 is as follows:

[0035] Step3.1: Calculate the remaining energy influence factor f e and the distance influence factor f c to the base station through the node, specifically as follows:

[0036] Calculate the remaining energy influence factor:

[0037]

[0038] Wherein, E s represents the remaining energy of the node, and E0 represents the initial energy of the node.

[0039] Calculate the distance influence factor to the base station:

[0040]

[0041] Wherein, d tB represents the distance from the node to the base station, and d maxtB represents the maximum value of the distances from all nodes to the base station.

[0042] Step3.2: Optimize the influence factor of the traditional cluster head election threshold, and the calculation formula is:

[0043] I CT = αf e + βf c

[0044] Where α is the weight of the remaining energy factor and β is the weight of the distance - to - base - station influence factor.

[0045] Step3.3: Update the threshold formula as:

[0046]

[0047] Where p is the candidate cluster - head ratio, rd is the round number of the current cluster establishment, n is the current node, and N is the set of nodes in the area.

[0048] Step3.4: Nodes generate random numbers and compare them with the threshold. If it is less than the threshold, the node is elected as a candidate cluster - head; otherwise, it becomes an ordinary node and waits to join a cluster.

[0049] Step4: Based on the already selected candidate cluster - heads, analyze the factors affecting the energy consumption of the final cluster - head. Input three independent variables into the fuzzy - logic algorithm, and use the fuzzy - rule reasoning optimized by WOA to obtain the output of the fuzzy logic, that is, the clustering probability of the node, as the basis for selecting the final cluster - head.

[0050] Step4.1: The remaining energy of the node, the distance between the node and the base - station, and the number of neighbor nodes of the node are respectively classified as: Low, Middle, High. Close, Medium, Far. Few, Medium, Many. The classification of the three input variables respectively uses the trapezoidal membership - function (Trapmf), triangular membership - function (Trimf), and trapezoidal membership - function (Trapmf).

[0051] Set the output variable of the fuzzy - logic algorithm as: the clustering probability of the node. Set its fuzzy set as: {Very Low, Low, Little Low, Middle, Little High, High, Very High}, and use Trimf.

[0052] Set the output variable of the fuzzy - logic algorithm as: the clustering probability of the node, and divide its fuzzy set into 7 levels.

[0053] Step4.2: Use the fuzzy rules optimized by WOA to infer the fuzzified output from the fuzzified input, that is, the fuzzified clustering probability of the node.

[0054] Step4.3: Use the area - centroid method to defuzzify the fuzzified clustering probability of the node to obtain the exact clustering probability of the node.

[0055] Step5: Introduce a competition - radius mechanism. Nodes with a large clustering probability and no already selected final cluster - head within the competition radius are given priority to become the final cluster - head.

[0056] Step 5 is specifically as follows:

[0057] The calculation formula for the competition radius is:

[0058]

[0059] d mintB represents the minimum value of the distances from all nodes to the base station, represents the default communication radius, and Area is the area of the monitoring region.

[0060] Candidate cluster heads broadcast information such as the clustering probability within the competition radius. After receiving the messages of all other candidate cluster heads within the competition radius, first let the nodes with a higher clustering probability than themselves make decisions.

[0061] That is, the candidate cluster heads with a large clustering probability and no cluster head selected within the competition radius are selected first, and the remaining candidate cluster heads within their competition radius end the competition.

[0062] Step 6: After the cluster head is selected, the cluster head node broadcasts the message that it has become the cluster head. Ordinary nodes calculate the distance between themselves and the cluster head according to the received cluster head information, and then judge whether to join the nearest cluster or communicate directly with the base station based on this.

[0063] Step 6 is specifically as follows:

[0064] After the cluster head is selected, the cluster head node broadcasts the message of becoming the cluster head within a distance of half of the longest diameter of the area. Ordinary nodes calculate the distance between themselves and the cluster head according to the coordinate parameters in the received cluster head node message. If the distance from the node to the base station is closer than the distances to all cluster heads, it communicates directly with the base station; otherwise, it sends a cluster joining message to the nearest cluster head and then waits to receive the intra-cluster scheduling message established by the cluster head.

[0065] The beneficial effects of the present invention are as follows: The quality of candidate cluster heads is improved by selecting candidate cluster heads through the threshold formula updated based on the remaining energy factor and distance factor; the fuzzy logic algorithm optimized by the whale algorithm is used to select the final cluster head, making the selected final cluster head more reasonable in terms of energy and position; non-uniform clustering using the competition radius balances the energy consumption of cluster heads; optimizing the node clustering strategy improves the energy utilization efficiency of the nodes around the base station. Brief Description of the Drawings

[0066] Figure 1 is the implementation flowchart of the present invention;

[0067] Figure 2 is the experimental parameter diagram of the present invention;

[0068] Figure 3 is the clustering schematic diagram of the present invention;

[0069] Figure 4 It is a relationship diagram of the number of dead nodes and communication rounds in an embodiment of the present invention;

[0070] Figure 5 It is a relationship diagram of the total remaining energy of the network and communication rounds in an embodiment of the present invention. Detailed implementation manners

[0071] The present invention will be further described below in conjunction with the accompanying drawings and specific implementation manners.

[0072] Embodiment 1: As Figure 1 shown, a clustering method for wireless sensor networks based on whale algorithm and fuzzy logic algorithm, the specific steps are as follows:

[0073] Step1: Initialize network parameters. Randomly deploy N WSNs sensor nodes in a two-dimensional monitoring area with an area of M×M. The base station collects the node position information, then calculates the maximum and minimum values of the distances between the nodes and the base station, and broadcasts the node positions and the maximum and minimum values of the distances between the nodes and the base station to the nodes. The nodes broadcast their own position information within the communication radius, so that all nodes can calculate the distances to neighbor nodes, the number of neighbor nodes, and the competition radius.

[0074] Step2: The base station uses WOA to optimize the fuzzy rules of the fuzzy logic algorithm.

[0075] Step3: Calculate the remaining energy influence factor and the distance influence factor to the base station by the nodes. Obtain the influence factor for optimizing the traditional cluster head election threshold according to the remaining energy influence factor and the distance influence factor to the base station, and update the threshold formula. Then compare the random number generated by the nodes with the threshold. If it is less than the threshold, the node is elected as a candidate cluster head.

[0076] Step4: On the basis of the already selected candidate cluster heads, analyze the factors affecting the final cluster head energy consumption. Input three independent variables into the fuzzy logic algorithm. Use the fuzzy rules optimized by WOA to infer the output of the fuzzy logic, that is, the clustering probability of the nodes, as the basis for selecting the final cluster head.

[0077] Step5: Introduce a competition radius mechanism. Among the nodes within the competition radius where no final cluster head has been selected and with a large clustering probability, the nodes are given priority to become the final cluster head.

[0078] Step6: After selecting the cluster head, the cluster head node broadcasts the message that it has become the cluster head. The ordinary nodes calculate the distances between themselves and the cluster head according to the received cluster head information, and judge whether to join the nearest cluster or communicate directly with the base station based on this.

[0079] The present invention will be described in detail below through specific examples.

[0080] Step1: Set up the simulation environment and experimental parameters;

[0081] In this invention, the MATLAB R2017 platform is used for simulation experiments. 100 WSNs sensor nodes are randomly deployed in a two-dimensional monitoring area with an area of 100m × 100m, and the base station is located at the center (50, 50) of the sensing area. This invention generates a clustering schematic diagram in the sensing area according to Figure 2 the experimental parameters shown as Figure 3 shown. By analyzing the relationship between the number of dead nodes and the total remaining energy of the network and the number of communication rounds, the performance advantage of this invention compared with the classical clustering routing algorithm LEACH is verified.

[0082] Step2: Overall implementation process;

[0083] As Figure 1 shown, the specific implementation process of this invention is as follows:

[0084] First, initialize the network, and calculate information such as the communication distance and competition radius between nodes. In the first round of network operation, after the base station collects information of all nodes in the monitoring area, it uses the WOA-optimized fuzzy logic algorithm to optimize the fuzzy rules. And after obtaining the optimal fuzzy rules, the nodes use these rules in each round of operation, that is, the optimal fuzzy rules only need to be calculated once by the base station.

[0085] Secondly, the nodes calculate the influence factor of the remaining energy and the influence factor of the distance to the base station, and accordingly design an influence factor to optimize the traditional cluster head election threshold, and update the threshold formula. Then, compare the random number generated by the node with the threshold. If it is less than the threshold, the node is elected as a candidate cluster head.

[0086] Then, based on the selected candidate cluster heads, analyze the factors affecting the final energy consumption of the cluster heads, design three independent input variables for the fuzzy logic algorithm, and use the fuzzy rule reasoning optimized by WOA to obtain the output of the fuzzy logic, that is, the clustering probability of the nodes, as the basis for selecting the final cluster heads. At the same time, introduce a competition radius mechanism, and the nodes with a large clustering probability and no selected final cluster heads within the competition radius are given priority to become the final cluster heads.

[0087] Finally, after the cluster heads are selected, the cluster head nodes broadcast the message that they have become cluster heads. The ordinary nodes calculate the distance between themselves and the cluster heads according to the received cluster head information, and accordingly decide whether to join the nearest cluster or communicate directly with the base station.

[0088] Step3: Initialize the network parameters. Randomly deploy 100 WSNs sensor nodes in a two-dimensional monitoring area with an area of 100m × 100m. The base station is located at the center (50, 50) of the sensing area, and calculate information such as the communication distance and competition radius between nodes;

[0089] Step4: After the base station collects all node information, it uses WOA to optimize the fuzzy rules of the fuzzy logic algorithm;

[0090] Step4.1: Encoding;

[0091] Each whale is represented by an r×c probability matrix:

[0092]

[0093] where r = 7 represents the number of output levels of the fuzzy logic, and c = 27 represents the number of combinations of 3 inputs of the fuzzy logic. pm ij ∈[0,1] represents the probability that this rule becomes a fuzzy rule in the fuzzy rule base. The 7×27 positions in the matrix correspond to 7×27 fuzzy rules.

[0094] Step4.2: Initialization of the whale population;

[0095] The whale population is equally divided into 3 subgroups according to the number of whales. Among them, the whale individuals in the third subgroup are randomly initialized, and each position of the probability matrix of the whale individuals is set to a random value in the interval [0,1] to ensure the diversity of the population; according to human experience, the whale individuals in the first and second subgroups are initialized, and the values corresponding to the output variables in the corresponding positions of the initial fuzzy rules according to human experience in the probability matrix of the whale individuals are set to 1, and the values of the remaining positions are set to 0, so that the obtained fuzzy rule base will not deviate too much from the optimal rules.

[0096] The initial probability matrices in the first and second subgroups are respectively:

[0097]

[0098] The positions of all whales are initialized to a 7×27 probability matrix according to the above method.

[0099] Step4.3: Determine the fitness value;

[0100] Take the first node death round (FND) as the fitness value, that is, fitness = FND. After optimization, the optimal fitness value of the whale individuals can reach 886 rounds.

[0101] Step4.4: Update the positions of the whale population;

[0102] For each whale, a random value pa is temporarily generated for each position of the probability matrix. When pa < 0.5, the position is updated according to the shrinking encircling mechanism in Equation (3). When pa ≥ 0.5, the position is updated according to the bubble-net attack in Equation (5). When choosing to shrink the encirclement, the relationship between the parameter |A| and 1 is judged. When |A| < 1, it is chosen to approach the optimal whale and encircle the prey according to Equation (3). When |A| ≥ 1, it approaches a random whale and searches for the prey randomly globally according to Equation (7).

[0103] x(t + 1) = x * (t) - A × D (3)

[0104] D = |C × x * (t) - x(t)| (4)

[0105] t ∈ [1, Max_iteration] indicates the number of iterations of the WOA population; Max_iteration represents the number of WOA iterations, which is 200 in this embodiment; x(t) represents the currently traversed whale individual; x * (t) represents the position of the best whale; D represents the distance between the currently traversed whale individual and the best whale; A and C are coefficients, A = 2a × z - a, C = 2 × z, z is a random number uniformly distributed in the range [0, 1], and the change range of the coefficient A value is [-a, a], where a = 2 - t × (2 / Max_iteration).

[0106] x(t + 1) = D′ × e bl × cos(2πl) + x * (t) (5)

[0107] D′ = |x * (t) - x(t)| (6)

[0108] D′ represents the distance between the currently traversed whale individual and the best whale; b represents the shape change control constant, which is 1 in this embodiment; l is a random number uniformly distributed in the range [-1, 1].

[0109] x(t + 1) = x rand (t) - A × D″ (7)

[0110] D″ = |C × x rand (t) - x(t)| (8)

[0111] D″ represents the distance between the current search individual and the random individual. x rand (t) represents the position of the current random individual.

[0112] Step4.5: Normalization;

[0113] Since the value at any position in the probability matrix should be in the interval [0, 1], however, after Step 4.4, the positions of the whale population change, and it cannot be guaranteed that the probability values in the matrix will not exceed the bounds. Therefore, the probability matrix needs to be normalized according to Equation (9) for the probability value of the i-th row corresponding to the j-th fuzzy rule of the num-th whale in the iter-th iteration:

[0114]

[0115] In the formula, is the probability value before normalization, is the maximum probability value of the num-th whale in the j-th column, is the minimum probability value of the num-th whale in the j-th column.

[0116] Step 4.6: Decode to obtain the fuzzy rule base.

[0117] Record the row number corresponding to the maximum value in each column of the matrix in the row vector where iter and num represent the number of iterations and the whale number respectively. The obtained 27-column row vector is a fuzzy rule base with all 27 input cases.

[0118] Step 5: The node calculates the influence factor of the remaining energy and the influence factor of the distance to the base station, designs an influence factor for optimizing the traditional cluster head election threshold based on this, and updates the threshold formula. Then, the node compares the generated random number with the threshold. If it is less than the threshold, the node is elected as a candidate cluster head;

[0119] Step 5.1: The node calculates the influence factor of the remaining energy and the influence factor of the distance to the base station;

[0120] Calculate the influence factor of the remaining energy according to Equation (10):

[0121]

[0122] In the formula, E s represents the remaining energy of the node; E0 represents the initial energy of the node, which is 0.5 J in this embodiment.

[0123] Calculate the influence factor of the distance to the base station according to Equation (11):

[0124]

[0125] In the formula, d tB represents the distance from the node to the base station, and d maxtB represents the maximum value of the distances from all nodes to the base station.

[0126] Step5.2: Design and optimize the influencing factor of the traditional cluster head election threshold, and the calculation formula is:

[0127] I CT = αf e + βf c (12)

[0128] In the formula, α + β = 1. α is the weight of the remaining energy factor, which linearly increases from 0.39 to 0.61 as the energy decreases in this embodiment; β is the weight of the distance influence factor to the base station, which linearly decreases from 0.61 to 0.39 in this embodiment.

[0129] Step5.3: Update the threshold formula as:

[0130]

[0131] In the formula, p is the candidate cluster head ratio, rd is the round number of the current cluster establishment, n is the current node, and N is the set of nodes in the area.

[0132] Step5.4: Select candidate cluster heads.

[0133] The node generates a random number and compares it with the threshold. If it is less than the threshold, the node is elected as a candidate cluster head; otherwise, it becomes an ordinary node and waits to join the cluster.

[0134] Step6: On the basis of the already selected candidate cluster heads, analyze the factors affecting the energy consumption of the final cluster head. Three independent input variables are designed for the fuzzy logic algorithm, and the output of the fuzzy logic, that is, the clustering probability of the node, is obtained through fuzzy rule reasoning optimized by WOA, as the basis for selecting the final cluster head;

[0135] Step6.1: Set the input and output of the fuzzy logic algorithm;

[0136] Set the three input variables of the fuzzy logic algorithm as: the remaining energy of the node, the distance between the node and the base station, and the number of neighbor nodes of the node, and classify them as: Low, Middle, High; Close, Medium, Far; Few, Medium, Many. The classifications of the three input variables respectively adopt the trapezoidal membership function (Trapmf), triangular membership function (Trimf), and trapezoidal membership function (Trapmf).

[0137] Set the output variable of the fuzzy logic algorithm as: the clustering probability of the node. Set its fuzzy set as: {Very Low, Low, Little Low, Middle, Little High, High, Very High}, and adopt Trimf.

[0138] Step6.2: Fuzzy inference;

[0139] The fuzzified input is inferred to obtain a fuzzified output, i.e., the fuzzified node clustering probability, using the fuzzy rules optimized by WOA.

[0140] Step6.3: Defuzzification;

[0141] The area centroid method is used to defuzzify the fuzzified node clustering probability to obtain an accurate node clustering probability.

[0142] Step7: Introduce a competition radius mechanism. Nodes with a large clustering probability and no previously selected final cluster heads within the competition radius are given priority to become the final cluster heads;

[0143] The calculation formula for the competition radius is:

[0144]

[0145] d mintB represents the minimum value of the distances from all nodes to the base station, represents the default communication radius, and Area is the area of the monitoring region.

[0146] Candidate cluster heads broadcast information such as the clustering probability within the competition radius. After receiving the messages of all other candidate cluster heads within the competition radius, nodes with a higher clustering probability than themselves are allowed to make decisions first. That is, candidate cluster heads with a large clustering probability and no selected cluster heads within the competition radius are selected first, and the remaining candidate cluster heads within their competition radius end the competition.

[0147] Step8: After the cluster head is selected, the cluster head node broadcasts the message that it has become the cluster head. Ordinary nodes calculate the distance between themselves and the cluster head based on the received cluster head information and decide whether to join the nearest cluster or communicate directly with the base station.

[0148] After the cluster head is selected, the cluster head node broadcasts the message of becoming the cluster head within a distance of half of the longest diameter of the region. Ordinary nodes calculate the distance between themselves and the cluster head based on the coordinate parameters in the received cluster head node message. If the distance from the node to the base station is closer than the distances to all cluster heads, it communicates directly with the base station; otherwise, it sends a cluster joining message to the nearest cluster head and then waits to receive the intra-cluster scheduling message established by the cluster head.

[0149] Such as Figure 4As shown, observe the number of dead nodes in the embodiments of the present invention and the comparative algorithm LEACH changing with the number of communication rounds. It can be seen that throughout the process, the number of dead nodes in the embodiments of the present invention is always less than that of LEACH, indicating that the lifespan of the network in the embodiments of the present invention is longer than that of LEACH. The first node of LEACH died at about 488 rounds, while in the embodiments of the present invention, nodes began to die at about 860 rounds. By calculation, the round when the first node of the embodiments of the present invention died was increased by about 76.23% compared with LEACH. It can be seen that the embodiments of the present invention have greatly extended the round when the first node dies.

[0150] As Figure 5 shown, observe the total remaining energy of the network in the embodiments of the present invention and the comparative algorithm LEACH changing with the number of communication rounds. It can be seen that both curves decline as the number of communication rounds increases. However, at the same communication round, the total remaining energy of the network in the embodiments of the present invention is always greater than that of LEACH, and the gap is getting larger and larger. From this, it can be seen that the energy consumption per round in the embodiments of the present invention is lower, that is, the embodiments of the present invention improve the energy utilization efficiency of sensor nodes.

[0151] The specific embodiments of the present invention have been described in detail above in conjunction with the accompanying drawings. However, the present invention is not limited to the above embodiments. Within the scope of knowledge possessed by those of ordinary skill in the art, various changes can be made without departing from the gist of the present invention.

Claims

1. A clustering method for wireless sensor networks based on the whale algorithm and the fuzzy logic algorithm, characterized in that: Step1: Initialize network parameters. Randomly deploy N WSNs sensor nodes in a two-dimensional monitoring area of M×M. The base station collects the node location information, then calculates the maximum and minimum values of the distances between the nodes and the base station, and broadcasts the node locations and the maximum and minimum values of the distances between the nodes and the base station to the nodes. The nodes broadcast their own location information within the communication radius, so that all nodes can calculate the distances to their neighbor nodes, the number of neighbor nodes, and the competition radius; Step2: The base station uses WOA to optimize the fuzzy rules of the fuzzy logic algorithm; Step3: The nodes calculate the remaining energy impact factor and the distance impact factor to the base station. Based on the remaining energy impact factor and the distance impact factor to the base station, obtain the impact factor for optimizing the traditional cluster head election threshold, and update the threshold formula. Then compare the random number generated by the node with the threshold. If it is less than the threshold, this node is elected as a candidate cluster head; Step4: On the basis of the candidate cluster heads that have been selected, analyze the factors affecting the final energy consumption of the cluster heads. Input three independent variables into the fuzzy logic algorithm. The three input variables are the remaining energy of the node, the distance between the node and the base station, and the number of neighbor nodes of the node. Use the fuzzy rules optimized by WOA to infer the output of the fuzzy logic, that is, the clustering probability of the node, as the basis for selecting the final cluster head; Step5: Introduce a competition radius mechanism. Nodes with a large clustering probability and no selected final cluster heads within the competition radius are given priority to become the final cluster heads; Step6: After the cluster heads are selected, the cluster head nodes broadcast the message that they have become cluster heads. Ordinary nodes calculate the distances between themselves and the cluster heads based on the received cluster head information, and accordingly determine whether to join the nearest cluster or communicate directly with the base station; The specific content of Step2 is as follows: Step2.1: Each whale is represented by an r×c probability matrix, where r and c represent the number of output levels and the number of input combinations of the fuzzy logic respectively; Step2.2: Divide the whale population into multiple subgroups equally according to the number of whales. Randomly initialize the whale individuals in some subgroups, and initialize the whale individuals in the remaining subgroups; Step2.3: Take the first node death round FND as the fitness value, that is, fitness = FND; Step2.4: Temporarily generate a random value pa at each position of the probability matrix corresponding to each whale, and accordingly select whether to update the position according to the shrinking encircling mechanism or update the position according to the bubble net attack; Step2.5: Normalize the probability value of the i-th row corresponding to the j-th fuzzy rule of the num-th whale in the iter-th iteration: Wherein, is the probability value before normalization, is the maximum probability value of the j-th column of whale num, is the minimum probability value of the j-th column of whale num; Step2.6: Decode to obtain the fuzzy rule base.

2. The clustering method for wireless sensor networks based on the whale algorithm and the fuzzy logic algorithm according to claim 1, characterized in that, The specific content of Step3 is as follows: Step 3.1: Calculate the remaining energy influence factor f through the node e and the distance influence factor f to the base station c ; Step3.2: Optimize the impact factor of the traditional cluster head election threshold. The calculation formula is: I CT = αf e + βf c In the formula, α is the weight of the remaining energy factor, and β is the weight of the distance impact factor to the base station; Step3.3: Update the threshold formula as: In the formula, p is the candidate cluster head ratio, rd is the number of rounds for this cluster establishment, n is the current node, and N is the set of nodes in the area; Step 3.4: The node generates a random number and compares it with the threshold. If it is less than the threshold, the node is elected as a candidate cluster head; otherwise, it becomes an ordinary node and waits to join a cluster.

3. The clustering method for wireless sensor networks based on the whale algorithm and the fuzzy logic algorithm according to claim 1, characterized in that, The specific content of Step 4 is as follows: Step 4.1: Set the three input variables of the fuzzy logic algorithm as: the remaining energy of the node, the distance between the node and the base station, and the number of neighbor nodes of the node, and divide each input variable into 3 levels with different membership functions respectively; Set the output variable of the fuzzy logic algorithm as: the clustering probability of the node, and divide its fuzzy set into 7 levels; Step 4.2: Use the fuzzy rules optimized by WOA to infer the fuzzified output from the fuzzified input, that is, the fuzzified clustering probability of the node; Step 4.3: Use the area centroid method to defuzzify the fuzzified clustering probability of the node to obtain the accurate clustering probability of the node.

4. The clustering method for wireless sensor networks based on the whale algorithm and the fuzzy logic algorithm according to claim 1, characterized in that, The specific content of Step 5 is as follows: The candidate cluster head broadcasts information such as the clustering probability within the competition radius. After receiving the messages of all other candidate cluster heads within the competition radius, first let the nodes with a higher clustering probability than itself make decisions; That is, the candidate cluster head with a larger clustering probability and no cluster head has been selected within the competition radius is selected first, and the remaining candidate cluster heads within its competition radius end the competition.

5. The wireless sensor network clustering method based on the whale algorithm and the fuzzy logic algorithm according to claim 1, characterized in that The specific content of Step 6 is as follows: The cluster head broadcasts the message of becoming a cluster head, and the ordinary node calculates the distance between itself and the cluster head according to the received cluster head node information; If the distance from the node to the base station is closer than the distance to all cluster heads, it communicates directly with the base station; otherwise, it sends a cluster joining message to the nearest cluster head and then waits to receive the intra-cluster scheduling message established by the cluster head.

Citation Information

Patent Citations

  • Efficient inhomogeneous clustering routing method of wireless sensor network

    CN102158927A

  • Network selection method based on neural network in ultra-dense heterogeneous wireless network

    CN113242584A