Data Distribution Optimization Strategy in Wireless Sensor Networks With Edge Computing

Resource-constrained wireless sensor networks (WSNs) impose a substantial challenge to the transmission and processing of non-redundant perceptual data. Moreover, breakthroughs in this area have opened up a new dimension that integrates edge computing technology in wireless sensor networks. However, achieving reliable data distribution in wireless sensor networks with edge computing (EWSN) and balancing the link bandwidth and node energy resources have become challenging problems. In this article, we propose a joint bandwidth allocation and energy consumption (JBAEC) algorithm for distributing different perceptual data to different sensor nodes of the EWSN by considering the available transmission links between the source sensor and destination nodes under the condition of early perceived energy. Therefore, we first establish the model of different data packet types and energy detection costs. Second, we describe the problem of effective bandwidth allocation and prove its NP-hard feature. In addition, we formulate the bandwidth allocation problem as an optimization problem that is divided into the two states of sufficient energy and lack of energy. Afterwards, we present an available node selection (ANS) algorithm for sorting the available relay nodes under the condition of different energy-sufficient nodes. The effective transmission network construction (ETNC) algorithm selects the available transmission links based on the set of available nodes. Finally, we implement the JBAEC algorithm by using the NS-2 simulator and present extensive simulation results to verify the data distribution efficiency of the JBAEC algorithm in the EWSN.


I. INTRODUCTION
Perceptual data are the data sensed, measured and transmitted by wireless sensors in WSNs. These types of data mainly include the movement data of the human body and vehicles and the natural environment data such as meteorology, hydrology, temperature, and humidity. Different types of wireless sensors will perceive different types of data. In similar wireless sensor network environments, a large quantity of sensed redundant data are transmitted to the cloud data centre, thereby resulting in an excessive network load and rapid resource consumption [1]. The emerging edge computing technology can concentrate the perceptual data on the edge sensing end and effectively improve the transmission The associate editor coordinating the review of this manuscript and approving it for publication was Zihuai Lin . and processing efficiency of perceptual data [2]. In addition, the perception of redundant data stored in different sensor nodes can reduce the transmission load of wireless sensor networks [3]. Therefore, the integration of edge computing technology in wireless sensor networks is a new way to save the available link bandwidth of data transmission [4], [5]. This type of network is called the edge wireless sensor network (EWSN). Consequently, we use edge computing technology to disperse the perceptual data on different sensor nodes. The perceptual data stored in each sensor are different, and the data transmitted to the cloud data centre are reduced as much as possible.
In the energy-constrained edge wireless sensor network, all the sensors are energized by typical batteries that can either be replaced or recharged [6], [7]. Once the battery is depleted, the sensor dies. Therefore, we need to design a good scheduling strategy to balance energy consumption. In addition, the main difficulty of data transmission is the tradeoff allocation of the bandwidth and energy consumption in the EWSN; i.e., each reliable data transmission must select a link with sufficient effective bandwidth and energy and choose as few perceptual data as possible [8], [9]. Therefore, the effective bandwidth allocation with constrained energy resources has emerged as a critical issue.
A. BACKGROUND AND MOTIVATION 1) BACKGROUND Various strategies have been proposed in the literature for reliable data distribution in which the sense node dynamically detects and utilizes the effective bandwidth and energy [10]- [12], thereby improving the resource utilization of WSNs. This article considers the energy-efficient depthbased probabilistic routing (EEPDB) algorithm in [13] for WSNs that uses the node's vertical depth, residual energy and forwarding number within a 2-hop neighbourhood to determine the forwarding probability of qualified candidates and thus avoid the local optimization problem and packet delivery failure in some scenarios. In addition, the proposed flow splitting optimization (FSO) algorithm [14] can transmit the perceptual data with the least redundancy from the source node to the destination node, and proves that the FSO algorithm can minimize the transmission load of the wireless sensor network.
These mechanisms of perceived data distribution in [13], [14] are based on the traditional structure of a wireless sensor network. In the process of data analysis and scheduling, each source node first needs to detect the resource state of other sensor nodes, and the source node obtains the idle bandwidth of the transmission link and the residual energy of relay nodes before the transmission of perceptual data [15]. These mechanisms cannot sense the data and node states of the entire network, thereby transmitting a large quantity of redundant perceived data to the cloud data centre, which increases the transmission load of perceived data and energy consumption. However, not all of these data are needed by cloud data centres.

2) MOTIVATION
The EEPDB algorithm in [13] mainly considers the effective energy allocation in the process of data analysis and transmission, but the processing efficiency of effective data is very low. Although the energy allocation of the network reaches a relatively better value, the effective bandwidth cannot be utilized efficiently. Moreover, the FSO algorithm in [14] does not consider the energy consumption of the network. The wireless sensor networks have this feature with energy constraints. The energy imbalance seriously reduces the life cycle of the network such that the data collection and processing of WSN fail [16]. These reasons have motivated us to develop an efficient data distribution strategy for achieving the tradeoff of effective data processing and energy efficiency in EWSN.
The distribution strategy of perceptual data in EWSN will lead to the following challenges: • Buffer allocation: Buffers are precious hardware resources in EWSN. Unreasonable buffer allocation will cause data packet loss in the data allocation process, thereby reducing network performance due to data retransmission. Therefore, formulating a reasonable buffer allocation mechanism is an important factor for reliable data distribution.
• Effective bandwidth: The transmission of perceptual data from the source sensor node to the destination nodes requires an effective bandwidth to ensure the stability of EWSN, and an effective bandwidth needs to be allocated reasonably to avoid the congestion of transmission links.
• Storage space: The uneven storage of perceptual data will cause the storage hole problem to occur prematurely, thereby reducing the life cycle of EWSN. In addition, we want to minimize the quantity of perceptual data transmitted over EWSN so that the storage space will be an important criterion for selecting the destination nodes.
• Energy consumption: EWSN are composed of wireless sensors with different computing capabilities. All the nodes need to use limited energy resources to handle the computing tasks and data distributions. Therefore, a less efficient energy allocation strategy will cause the detection node to fail prematurely, and therefore, the effective distribution of perceptual data cannot be effectively performed.

B. CONTRIBUTIONS
In this article, we study the problem of bandwidth allocation efficiency based on minimal energy consumption in EWSN. Our goal is to improve the efficiency of data processing and transmission and save energy consumption by uploading data calculation and processing tasks to the edge computing server, thereby extending the survival time of EWSN. For achieving the effective distribution of perceived data, we first establish the model of ECWSN and prove that the split distribution problem of perceived data is an NP-hard problem. Afterwards, we also analyse the optimization problem of the data distribution in both sufficient energy and lack of energy conditions. Then, we use the available node selection (ANS) algorithm to solve the selection problem of relay nodes based on the network state of sufficient energy, and the allocation of available transmission links is solved by using the effective transmission network construction (ETNC) algorithm. Next, the proposed JBAEC algorithm effectively allocates the effective bandwidth with efficient energy consumption for the distribution of perceived data in EWSN. The simulation results ultimately prove that the JBAEC algorithm achieves a better distribution efficiency of perceived data. The ANS, ETNC, and JBAEC algorithms are executed by the edge computing servers in EWSN, and the data distribution path selected by the JBAEC algorithm passes through the relay nodes with the lower data redundancy. Therefore, the data distribution strategy of the JBAEC algorithm has lower energy consumption through the effective node selection of the ANS algorithm and effective link scheduling of the ETNC algorithm. The contributions of the article can be summarized as follows.
• We present a system model to describe the distribution capability of split perceived data in edge wireless sensor networks.
• We formulate the optimization objective for maximizing the effective bandwidth allocation in the transmission processing of perceived data, and at the same time, the sensor node states of both sufficient bandwidth and energy consumption are considered.
• We propose the JBAEC algorithm to efficiently allocate the effective bandwidth for distributing the perceived data. Our JBAEC algorithm not only improves the utilization efficiency of the effective bandwidth but also minimizes the energy consumption of EWSN. The remainder of this article is organized as follows: Section II provides the models and formalizes the data distribution optimization function. The available node selection (ANS) algorithm is presented in III. In Section IV, we propose the effective transmission network construction (ETNC) algorithm. The joint bandwidth allocation and energy consumption (JBAEC) algorithm is shown in V. Section VI evaluates the performance of the JBAEC algorithm. Finally, the conclusion of this article is summarized in Section VII.

II. SYSTEM MODEL AND PROBLEM FORMULATION
In this section, we will establish the network model of EWSN and system model of the splitting data. Furthermore, by targeting the distribution issue of splitting data, we prove that the problem of the perceived data distribution is NP-hard.

A. NETWORK AND SYSTEM MODELS
The considered edge wireless sensor network (EWSN) consists of stationary wireless sensor nodes and edge computing servers, and these wireless sensor nodes are in both sufficient energy and energy-constrained states. We denote the EWSN as EWSN (m, n, h), with h as the maximum hops of the data distribution in the current edge computing system and m edge computing servers, each of which connects n wireless sensors, at the edge end. The wireless sensor nodes include source sensor nodes and relay nodes. m i is the i-th wireless node in the m-th edge computing system. The link in a edge computing system is expressed as m i→j , the transmission link of different edge computing systems is m i → m j . The buffer queue of this type of equipment is generally smaller, and we assume that the edge computing server have relatively larger capacity of buffer and sustainable power supply function (for example, installing solar panels). The source node sends the data distribution request to the edge computing server for backup. If the relay node fails to forward the data and causes packet loss due to buffer overflow, the edge computing server will resend it in real time. When the data distribution time exceeds the average transmission time 3*(1/µ) [17], the backup data distribution request will be discarded, and the data distribution will be considered successful. In this article, these source nodes perceive real-time data in different environments and send a splitting data request ω to the edge computing server through the control links to the destination nodes. The destination node includes the storage nodes of the perception data and sink node. The relay nodes forward the perceptual data of the source sensor under the unified scheduling of the edge computing server in EWSN, as shown in Fig. 1. Available transmission links between the source sensor and destination nodes have idle bandwidths, energies, and buffers for ensuring the reliable data transmission, thereby improving the operating efficiency by implementing effective bandwidth allocation in the transmission links of EWSN.
Assume that the sensor as source node m i senses the data ω m i from the real-time environment. The maximum and minimum packet types of perceptual data ω m i are C m i and c m i , respectively. The packet type number of perceptual data in EWSN is l, l = C c . We divide the packet types of perceptual data into l parts on average. We assume that the data packet type l belongs to a set of packet types L, and the sum of data packets isL, whereL = L 1 ,L ≤ C, l ∈ L. We call L the edge block. The storage space of each sensor is the edge block as the storage unit. In the process of perceptual data division, some destination nodes have a small amount of residual storage space, and we call the residual storage space the waste space. The waste space is generally small and cannot be used in the storage of perception data. The data distribution request in any source sensor is composed of the perceptual data packets of l types, as shown in Fig. 2.
To reliably transmit the perceptual data packets to the destination nodes, the edge computing server must judge the available transmission link for forwarding perceptual data in EWSN, i.e., whether the transmission link has residual effective bandwidth and energy or not. The setting of the edge computing server in EWSN has a reliable application example in practical applications. For example, factory production machines use Wi-Fi networks in the field of industrial Internet, although good coverage can be achieved, but the connection will still be dropped from time to time, or there will be no signal in a certain corner. The 5G edge computing network can maintain real-time online, with higher reliability, so that the production of factory machines will not be offline. Moreover, we assume that the energy detection is used for the effective bandwidth sensing [18]. We use H 0 to denote that the transmission link m i→j is effective, and H 1 represents that the transmission link m i→j is invalid.
In the processing of energy detection, the signal strength of the sensor node is accumulated from | J | channel samples. Therefore, we denote T (y) as the test statistics for the energy detection, and it can be written as where y(m j ) is the received signal sample. The edge computing server based on the test statistics T (y) determines whether the transmission link in the current domain is vacant or not; i.e., the transmission link is assumed to be invalid when T (y) ≥ ε and vice versa. ε is the energy detection threshold of the wireless sensor in EWSN.
We define P d as the link congestion probability, and P f denotes the detection probability of the effective link. They are the important performance metrics for evaluating the link state of effective bandwidth sensing. Let γ be the received signal-to-noise ratio (SNR) of the wireless sensor detected from the edge computing server [19]. Then, P d can be written as 2 dt. In addition, the detection probability of effective link P f can be obtained Therefore, the values of P f and P d will decrease along with an increase in the value ε. In this article, we assume that the target value P f is predefined, and ε is adjusted in order to satisfy this target value. LetP m j be the energy detection cost of the m j -th wireless sensor. Equation (6) holds If the valueP m j ≥ 0, the source sensor node with sufficient energy can allocate effective bandwidth for satisfying the distribution request of perceptual data ω in the EWSN and vice versa.
Some notations used in this article are summarized in Table 1.

B. PROBLEM FORMULATION
We assume that one distribution process of perceptual data ω m i needs m j relay nodes for forwarding the packets to the destination nodes, a set of candidate relay nodes {L m j } can be selected in EWSN, andP m j reflects the ability of the m j -th wireless link for transmitting perceptual data packets, j ∈ J . l m j represents the l type of data packet passing through the m j -th transmission link, l m j ≤ ω m i . We consider the effective bandwidth allocation that originated from source sensor nodes with the objective to maximize the probability sum of the bandwidth allocation under the constraints of energy consumption. Therefore, the objective of the effective bandwidth allocation is to maximize where ρ m j indicates whether the m j -th transmission link satisfies the data distribution request ω m i . Obviously, the bandwidth allocation problem of a single sensor node is a 0-1 knapsack (KP) problem. Furthermore, the 0-1 knapsack problem is one of the classical NP-hard problems in combinatorial optimization. Several exact algorithms based on the dynamic programming approach are available to solve the 0-1 KP in addition to the branch and bound approach or hybridizations of both approaches [20]. VOLUME 8, 2020 However, multiple sensor nodes are required to simultaneously allocate the effective bandwidth in the actual edge wireless sensor networks [21]. Therefore, this article mainly studies the distribution requests of perception data that come from multiple source sensor nodes that are satisfied under the scheduling of edge computing servers. We will prove in Theorem 1 that this distribution process is NP-hard.
Theorem 1: Assuming that the edge wireless sensor networks have a set of data distribution requests that come from the different source sensor nodes, the construction process of the edge block is NP-hard.
Proof 1: To prove that the edge block construction problem is NP-hard, we need to show the NP-completeness of its decision form; i.e., we attempt to find the optimization solution of edge block construction in EWSN. Therefore, the data forwarding requests of all relay nodes are satisfied, and the total bandwidth requests in the EWSN are not greater than the available link capacity between source sensor nodes and destination nodesC [16]. It is easy to see that such a problem is in the NP class, and the objective associated with a given solution can be evaluated in polynomial time.
We will prove the above problem through reducing the two-partition problem; i.e., given a set of numbers M = {m 1 , m 2 , · · · , m n }, we attempt to divide them into two sets such that where J 1 and J 2 are index sets without overlapping. We now describe the reduction from the two-partition issue to the construction problem of the edge block in EWSN. The created data distribution requests of two source sensor nodes should be not less than C, where C represents the distribution request of both source sensor nodes. Therefore, the set of available relay nodes should satisfy the requests of two source sensor nodes. For each number m j ∈ C, we create two distribution requests l and l for both source sensor nodes that share an effective bandwidth and energy capacity of transmission links between two relay nodes. Moreover, all relay nodes can be satisfied except these nodes without the available residual energy and effective bandwidth, each of which can accommodate at most one perceptual data type. In addition, we letC = 2C.
Subsequently, we only need to show that the two-partition issue has a solution if and only if the resulting instance of the edge block construction problem satisfies the constraints of the available bandwidth and the energy consumption. First, we suppose a solution of the two-partition issue such that the numbers can be divided into two sets of an identical sum. The corresponding solution is that the available link allocates effective bandwidth m j to one data distribution request in EWSN, where j ∈ J 2 .
Finally, we suppose that the bandwidth and energy constraint problem of available links has a solution with a total bandwidth capacityC and the energy consumptions of both source sensor nodes C. Since only one bandwidth and energy allocation can be accommodated at the sensors on the resource bottleneck of each source sensor node, the two source sensor nodes associated with a common bottleneck cannot be used by two relay nodes simultaneously. To achieve the bandwidth and energy request of both relay nodes C, the effective bandwidths and residual energies are assigned to two satisfied relay nodes, which forms a solution of the two-partition problem.
It can be seen from Theorem 1 that it is difficult to allocate the effective bandwidth and the residual energy to the optimal value during the edge block construction in EWSN. Therefore, we need to separately consider the effect of the conditions of the effective bandwidth and the residual energy on the process of the perception data distribution.

III. AVAILABLE NODE SELECTION
In this section, we first formulate rules for selecting effective nodes in the EWSN, and the effective nodes are all relay nodes that satisfy the data distribution request ω. Then, we propose the ANS algorithm to perform the scheduling of effective nodes.

A. AVAILABLE NODE JUDGEMENT STANDARD
In this section, we will select the available relay nodes such that the effective bandwidth can satisfy the distribution requests of perceptual data in EWSN. The set of candidate relay nodes m j is defined as T m j , m j ∈ J , and |J | is the number of relay nodes in the current edge computing system. The scale of judging the available relay node is that this relay has sufficient bandwidth and energy to satisfy the current distribution requests of perception data in EWSN. For the purpose of solving the allocation problem of effective bandwidth, a binary variable ω l m i is defined as 1, if the source sensor node m i has the distribution request of type l 0, others.
To describe the effective bandwidth of the relay node, a binary variable ρ l m j is held 1, if the relay node m j has the effective bandwidth of type l, 0, others.
EWSN must have sufficient effective bandwidth for ensuring the data transmission and processing, thereby avoiding the data distribution failure. Therefore, the bandwidth request of the data distribution should be less than the minimum effective bandwidth of the relay nodes in the current edge computing system. Equation (8) holds Since the data distribution request of each source sensor node is different, the effective bandwidth allocated by the edge computing server according to the relay node state to the request node is also different. We obtain the binary variable σ l If the effective bandwidth of type l is allocated to the request node m i , the allocated minimum bandwidth σ is equal to the data distribution request ω. To ensure reliable transmission of data distribution request ω, the sum of allocated bandwidth σ must be greater than or equal to the sum of data distribution request ω in the EWNS. Therefore, this constraint is expressed as In addition, the relay nodes must have sufficient bandwidth for ensuring the data distribution, and the conditions of ω l m i ≥ 1 and σ l m j ≥ 1 are always satisfied. Equation (10) can be replaced as We set the maximum value of node failure probability at the next time slot as P d max , and | J | is the number of relay nodes. To ensure that the residual bandwidth can satisfy the transmission requests of perception data in the current edge computing system, the sum of node failure probabilities should be greater than | J | times the maximum node failure probability; the inequality (12) holds j∈J l∈L The residual energy of the m j -th relay node is not less than the energy consumption of the data distribution request on the m j -th relay node. Otherwise, the relay node cannot guarantee the reliable transmission of perception data in EWSN. We can obtain Equation (13) where E m j and E m j are the energy test statistics and the energy request for satisfying the required data transmission of relay node m j , respectively. The detected energy sum of all wireless sensors shall be greater than | J | E max in EWSN, i.e., where E max is the maximum energy request in EWSN. Therefore, the multiplexing data transmission problem with the objective of maximizing the total available node probability is considered as where n is the number of relay nodes in EWSN.
The maximization problem (16) describes the problem of effective bandwidth allocation in the process of perception data distribution with sufficient energy of the nodes in EWSN. The computing and storage load of the edge computing server is relatively lighter when the EWSN is initially established and the data distribution request is smaller, and the queues in the buffers of each relay node will not overflow. Therefore, the network operation is relatively stable under this condition. When the data distribution load is larger, the packet loss will inevitably occur. Therefore, we formulate a data distribution request retransmission mechanism caused by packet loss in Algorithm 3 on the premise of selecting an effective relay node according to the formula (16). The edge computing server formulates an effective bandwidth allocation mechanism according to the maximization problem (16), thereby minimizing the resource consumption of EWSN.

B. AVAILABLE NODE SELECTION ALGORITHM
The pseudocode of the ANS algorithm is shown in Algorithm 1. All relay nodes are sorted in a decreasing order according to the values ofx l m j and are maintained in the set W . Then, we find feasible solutions that satisfy constraints (10), (11) and (14). The effective bandwidth type of each available link linked to the relay node m j is checked sequentially, and the relay nodes are included in the set T if they satisfy the following conditions: 1) The available link originating from this available node m j guarantees sufficient residual bandwidth, 2) the relay node can ensure that the perception data are forwarded to the next node, and 3) the nodes must have sufficient energy for ensuring the analysis and processing of perception data.

IV. EFFECTIVE TRANSMISSION NETWORK CONSTRUCTION
In this section, we first describe the criteria for judging effective links. Then, we use the ETNC algorithm to link the VOLUME 8, 2020

A. AVAILABLE LINK JUDGEMENT STANDARD
In this section, we first select a destination node based on the Jaccard similarity, i.e., J (N reflects the same degree of data stored in different sensor nodes. Then, we build a transmission network that satisfies the data distribution request based on the selected relay nodes and destination node in EWSN.
To reduce the transmission load and the transmission delay of perceptual data in EWSN, we store the data at the edge end of EWSN according to the established edge block. Therefore, the choice of the destination node will determine the distribution performance of the perceptual data. The selected destination node must ensure that the perception data can be transmitted and has the same degree as the perceptual data type of the source sensor node. It is assumed that the source sensor node cannot store the current perception data due to limited resources.
To indicate that the different types of effective bandwidth are allocated by the selected available link between the relay nodes, we define a binary variableρ l m i→j as , if the link m i→j has the residual bandwidth of type l, 0, others.
For the same reason, we define a binary variableω l m i as the transmission request of type l that originated from the source sensor node.  The process of effective bandwidth allocation is represented by the following constraints (19)- (21).
To explain these constraints more clearly, we present a simple example shown in Fig.3, where red solid arrows indicate that the available transmission link m i→j allocates the effective bandwidth of type l to the bandwidth request ω l . The black dotted arrows are the available transmission links. In the edge computing wireless sensor networks, the difference between the remaining bandwidth space of the selected relay transmission link and the bandwidth request ω m i of the source sensor node m i must be greater than or equal to 1. Otherwise, the effective bandwidth allocation will fail; this condition is expressed in the constraint (19). The constraint (20) imposes that the available link probability P f of the selected relay transmission link based on the request of the source sensor node m i is greater than the link congestion probability P d . To ensure that the bandwidth request ω l of type l is satisfied by the links between the source sensor node and destination node, the sum of the available link probabilities should be greater than the sum of the congestion link probabilities, which is represented by constraint (21).
For making reasonable usage of effective bandwidth on the transmission links, we define ψ l t as the effective bandwidth request of type l at time-slot t, and theψ l t is the residual bandwidth of the available transmission link between the relay node and destination node. At the current time slot t, the total effective residual bandwidth of type l that originated from the source sensor nodes shall not be less than the total bandwidth request of type l in EWSN. Therefore, we hold Equation ( The effective bandwidth of type l on the transmission link m i→j without sufficient energy is ξ l m j . The effective bandwidth number of all types is equal to the sum of the effective bandwidths with sufficient energy and lack of energy on the available transmission links, and we obtain the following constraint (23) If an effective bandwidth is allocated to the selected available link that originated from the relay node m j , the energy consumption efficiency of the relay node m j is constrained by τ m j , 0 < τ m j ≤ 1, the e m j is the energy level of the relay node m j , and Equation (24) holds The constraint (25) indicates that the energy consumption efficiency of the relay node m j is determined by the bottleneck energy. The energy consumption sum of all relay nodes is caused by the data distribution request ω and is why the effective bandwidth allocation is not larger than the total energy consumption in a transmission process of perception data.
Otherwise, the definitions ofρ The corresponding problem with sufficient energy can be reformulated as follows. The optimization problem (27) reflects the problem of effective bandwidth allocation in an environment with a long running time and a heavy data distribution load of EWSN. This maximization problem can become an important reference for the selection of the transmission paths of perception data, and the selected paths take into consideration the effective bandwidth and the optimal energy consumption in the data distribution process of EWSN.

B. EFFECTIVE TRANSMISSION NETWORK CONSTRUCTION (ETNC) ALGORITHM
In this subsection, the effective transmission network construction (ETNC) algorithm is invoked to find feasible solutions of available links, as shown in Algorithm 2. Algorithm 2 first finds the destination node where the perception data need to be stored. Then, we construct a distribution network based on the effective relay nodes selected by Algorithm 1.

Algorithm 2 Effective Transmission Network Construction Algorithm
Require: Incoming data distribution request ω m i , the states' information of each relay node. Ensure: Data distribution network.
Step 1: determine the destination node 2: if ω l m i > B then for j = 1 to |W | do 4: Calculate the value of J (N Select the m j -th sensor as the destination node; else 8: j = j + 1; end if 10: end for else 12: Store the perception data ω m i in the m i -th source node. end if 14: Step 2: Construct transmission network Edge computing server calculates the distance d from the source sensor to the destination node; 16: for i = 1 to d r do for j = 1 to |W |r d do 18: if N j and N j+1 are satisfied by Equation (16)

end for end for
In the first step of this algorithm, we decide whether the perception data ω l m i need to be transmitted and select the destination node for satisfying the storage conditions of the data distribution request ω l m i . B is the minimum effective storage space of the source sensor node. The current storage space of the sensor not only satisfies the current data storage request ω l m i but also ensures that the node works normally. Therefore, the remaining storage space is larger than the data distribution request ω l m i , B =B −B, andB andB are the existing and reserved remaining storage space, respectively. In addition, we select the node with the highest perception data similarity J between the source sensor node m i and others nodes as the destination node, thereby reducing the quantity of perception data that need to be transmitted in EWSN.
The second step of the ETNC algorithm is to establish a reliable distribution network that transmits data requests ω l m i in EWSN. The transmission radius of each node is r, and d is the distance between the source sensor node m i and the destination node. Our goal is to select an effective relay node based on the linear distance between the source sensor node and the destination node to avoid an excessively long transmission distance of perception data ω l m i .

V. JOINT BANDWIDTH ALLOCATION AND ENERGY CONSUMPTION ALGORITHM
In this section, we propose the joint bandwidth allocation and energy consumption (JBAEC) algorithm. The purpose of the JBAEC algorithm is to select the optimal perception data transmission paths based on considering the appropriate bandwidth allocation and energy consumption, thereby optimizing the data distribution strategy of EWSN. In this algorithm, the edge computing server first determines the type of perception data that need to be forwarded and then selects the appropriate relay nodes based on the stored data state of the all relay nodes in EWSN.ω is the same type of the perception data stored by the destination node as the data distribution request ω m i that needs to be transmitted. L l m i represents the type of perception data that the edge computing server needs to transmit, and we hope that the smaller the value is, the better the transmission is so that the resource consumption of EWSN can be reduced. |W |r d indicates all the effective relay nodes in the transmission network constructed by Algorithm 2. Therefore, we will select the transmission links consisting of the relay nodes with the minimum energy and bandwidth consumption among these effective relay nodes according to Equation (27).
The processes of the joint bandwidth allocation and energy consumption (JBAEC) algorithm are summarized in Algorithm 3. The JBAEC algorithm fully considers the realtime link bandwidth, energy consumption, and queue of buffer in EWSN. In addition, all computing tasks are performed by the edge computing servers in each edge computing system, thereby avoiding the scheduling strategy of perception data falling into a local optimum and saving the resource consumption of EWSN.

A. ALGORITHM FLOWCHART
We use the algorithm flowchart in Fig. 4 to further show the distribution process of perception data through the ANS algorithm, ETNC algorithm, and JBAEC algorithm. The operations of these algorithms are executed in the edge computing servers, and the sensor node is only responsible for distributing the request upload and performing data distribution tasks according to the instructions of the edge computing server. Therefore, wireless sensors can save their own energy consumption.

Algorithm 3 Joint Bandwidth Allocation and Energy Consumption (JBAEC) Algorithm
Require: Incoming data distribution request ω l , SNR γ , energy threshold ε Ensure: The appropriate transmission path Send data distribution request ω m i to the current edge computing server; The distance between node m j−1 and node m j is not greater than r then 6: Select the m j -th relay node with the maximum value of Equation (27); Delete the transmission link; end if 12: end if l = l + 1; if The queue is idle in the buffer of node N m j+1 then 15: Send data N m j−1 N m j to the relay sensor node N m j+1 ; else Resend data N m j−1 N m j in time slot t + 1; 18: end if j = j + 1; end for 21: end for Edge computing server delivers configure signals to the corresponding devices. The edge computing server first screens the type of distributed data ω sent by the sensing node and determines whether the sensing data need to be sent to the cloud centre via the Internet. This article mainly studies the data distribution problem in EWSN. The edge computing server comprehensively considers storage space, transmission bandwidth, and effective buffering factors to select the destination node. In addition, the edge computing server temporarily stores the data distribution request ω to avoid data retransmission caused by packet loss. This method reduces the buffer burden of the relay nodes and saves valuable buffer resources.
Algorithm 1, that is, the ANS algorithm, selects effective relay nodes from the source wireless sensor to the destination node. These nodes have the energy, bandwidth and buffer required to satisfy the forwarding data distribution request ω. Moreover, these nodes store the same type of data distribution request ω. We can let the source node send the least redundant data, which can minimize the consumption of network resources. Algorithm 2, that is, the ETNC algorithm, constructs an effective transmission network based on the ANS algorithm. Algorithm 3, that is, the JBAEC algorithm, selects the most appropriate data transmission links based on the network constructed by the ETNC algorithm. Through the implementation of the above algorithms, we can ensure that the data distribution request ω is reliably transmitted to the destination node.

B. TIME COMPLEXITY ANALYSIS
To prove the efficiency of the joint bandwidth allocation and energy consumption (JBAEC) algorithm, we will analyse its time complexity in this subsection.
The completion of the JBAEC algorithm is based on the ANS and ETNC algorithms. In the first process of available node selection in Algorithm 1, it needs to sort the different types of available nodes and spend the maximum time O(m|J | 2 ), and it takes O(|W | log |W |) time to select a valid node. In the second process of effective transmission network construction, the maximum time O(|W | log |W |+ d r |W |r d ) is used to establish a transmission network to satisfy the data distribution request ω l . Ultimately, the joint bandwidth allocation and energy consumption (JBAEC) algorithm takes O( |W |r d log |L| log(m|J |)) time to allocate the appropriate effective bandwidth of available links. Thus, the worst time complexity of the JBAEC algorithm is given by ≤ O(n|J | + |J |(2 log |J | + log |L| log n + 1)) ≤ O(n(n + 2 log n + log |L| log n + 1)) where |W | ≤ |J | ≤ n,m × |J | ≤ n.
The worst-case time complexity means that each data distribution is transmitted from the two longest-distance edge computing systems of EWSN. In this case, the entire network is operating under overload conditions. Our proposed JBAEC algorithm hopes to select the destination node with the same perception data and storage resources as the source distribution node based on the perception data that do not need to be transmitted to the sink node. Therefore, assuming that each data distribution is completed in the same edge computing server, i.e., m = 1, the time complexity of the JBAEC algorithm is Because there are not many heterogeneous data types perceived by EWSN, the number of perception data types L is approximately a constant. It can be seen from Equation (29) that the running time of the JBAEC algorithm is mainly reflected in the selection of effective relay nodes and transmission links in each edge computing system, and the overall time complexity is very low. With the expansion of the network scale and the increase of sensing nodes, the time complexity of the JBAEC algorithm will not increase significantly under the premise that the number of edge computing servers and the energy, storage space and buffer of each server are sufficient in EWSN.

VI. SIMULATION RESULTS
In this section, we present simulation results by using the network simulator 2 (NS-2) to examine the effective bandwidth allocation efficiency (EBAE) and packet delivery proportion of the JBAEC algorithm [22]. We first state the simulation setup details and then elaborate on the details of the results.

A. SIMULATION SETTINGS
In these simulations, the measurement samples are generated by using a Poisson process, and the arrival rate of each source sensor node is λ. λ represents the size of data distribution requests sent by the source node to the edge computing server per unit time. The maximum number of hopsh in each edge computing system is not more than the half number of relay nodes. Therefore, the maximum number of hops from the source node to the sink node is mh. Each data distribution type l stays in EWSN for a period of time according to an exponential distribution with a mean of (1/µ) [17]. µ indicates the average transmission rate of data distribution requests in the EWSN. In addition, we set the surveillance field as 1000 m by 1000 m with wireless sensor nodes varying from 100 to 500, and the sensor node range of each edge computing system varies between 10 and 50, while the communication radius r of the sensor node is 100 m. The packet size is 4000 bits. The communication energy of the edge computing server is greater than the energy of other sensor nodes. Assume that the EWSNs have a total of 30 authorized frequency bands. Afterwards, the energy detection threshold ε = 5 mW , and the signal-to-noise ratio (SNR) γ = 10 dB. The unit data processing energy consumption of the node signal receiving circuit and the transmitting circuit is 50 nJ /bit. For each set of parameters, the simulation is run for 10 rounds. The related network parameters are set as shown in Table 2.

B. COMPARISON OF THE EFFECTIVE BANDWIDTH ALLOCATION EFFICIENCY
In this subsection, we first define the effective bandwidth allocation efficiency (EBAE) and then compare the EBAE between our JBAEC algorithm and other baseline algorithms for the different distribution proportions of relay nodes.

Definition 1 (Effective Bandwidth Allocation Efficiency):
The effective bandwidth allocation efficiency (EBAE) is defined as the ratio between the successfully allocated effective bandwidths and the sum of effective bandwidths in EWSN, i.e., where ω (l) m i is the data distribution request of type l that originated from the m i -th source sensor node, andω (l) m j indicates the effective bandwidth number of type l in the m j -th relay node.
We take the EBAE as the metric for evaluating the data distribution performance in EWSN. The higher the EBAE is, the higher the allocation efficiency of the effective bandwidth is, and the data transmission efficiency of EWSN will be higher and vice versa. Fig. 5(a) indicates the evolution of the EBAEs of EWSN as the number of data distribution requests gradually increases. We consider two kinds of deployment of wireless sensor nodes, i.e., uniform distribution and random distribution. The random distribution means that all wireless sensor nodes are randomly placed in the simulation field, and the uniform distribution indicates that there are nearly equal wireless sensor nodes in each edge computing system. We can observe from Fig. 5(a) that the EBAE of the uniform distribution achieves a higher value than that of the random distribution, but the difference between the two EBAEs is not very large. The reason is that the deployment of the uniform distribution makes it easier to allocate the effective bandwidth based on stable energy support. In addition, the source sensor nodes in an edge computing system have similar data distribution requests along with the JBAEC algorithm runs, which implies that the distribution of wireless sensors is not the main factor that determines the efficiency of the JBAEC algorithm. Therefore, the deployment of the random distribution reflects a lower performance of the JBAEC algorithm.
We define Algorithm 3 that does not adopt Algorithm 1 and Algorithm 2 as the random algorithm. We can observe from Fig. 5(b) that the EBAE of the JBAEC algorithm is higher than that of the random algorithm in most of the simulation times and exceeds that of the random algorithm at the crossover point. This is because the random algorithm cannot compute the optimization of the effective bandwidth allocation and energy consumption; i.e., the types of data distributions and the energy states of relay nodes cannot be accurately classified in EWSN. Therefore, the random algorithm cannot allocate the most appropriate effective bandwidths to available links. In addition, the JBAEC algorithm is more complicated than the random algorithm, and thus, the EBAE of the JBAEC algorithm is lower than that of the random algorithm before the crossover point. This simulation result further demonstrates the effectiveness of the JBAEC algorithm.
We define the reciprocal of the average number of source sensor nodes in each edge computing system as the distribution ratio of wireless sensors R, R = |I | |J | , where | I | and | J | are the number of source and relay nodes, respectively. When the distribution ratio of source sensor nodes R is taken as 1 10 , the effective bandwidth allocation efficiency (EBAE) is the highest. This is the reason why the number of effective bandwidths can basically satisfy the data distribution request of EWSN when the distribution ratio of source sensor nodes R is equal to 1 10 . Accordingly, the bandwidth allocation efficiency of the available link is relatively higher. Therefore, the effective bandwidth allocation efficiency (EBAE) and the distribution ratio of source sensor nodes R are a proportional relationship. Furthermore, the EBAE of the JBAEC algorithm is in an oscillating state in the adjustment phase of the JBAEC algorithm because the effective bandwidth of the available link is in an inhomogeneous state. The simulation result reveals that the distribution ratio of source sensor nodes R affects the data distribution performance of the JBAEC algorithm to a certain extent.

C. COMPARISON OF PACKET DELIVERY PROPORTION
In this subsection, we compare the packet delivery proportion (PDP) for the different distribution ratios R and the different distribution states of wireless sensor nodes. Furthermore, we compare the packet delivery proportion of the JBAEC algorithm, EEPDB algorithm [13] and FSO algorithm [14]. We first give the definition of the packet delivery proportion.
Definition 2 (Packet Delivery Proportion): Packet delivery proportion (PDP) is defined as the proportion between those successfully allocated to the effective bandwidth and sent packets and the sum of the first successfully delivered packets and retransmitted packets in EWSN. The higher the packet delivery proportion is, the higher the forwarding efficiency of the data distribution request is and vice versa.
The higher proportion of relay nodes that lack energy represents that the distribution efficiency of perceptual data will be very poor in EWSN. Fig. 6(a) shows the comparison of the packet delivery proportion for different distribution ratios of wireless sensors R. We can find that there is a gradual packet delivery proportion degradation phenomenon as the proportion of nodes lacking energy increases gradually. The fewer relay nodes there are that lack energy, the lower the probability is of the acquired effective bandwidth in each source sensor node. Therefore, each relay node forwards relatively fewer packets as the number of relay nodes that lack energy increases. Moreover, the packet delivery proportion is lowest when the distribution ratio of wireless sensor nodes R is the lowest. In addition, the packet delivery proportions are very close when R = 1 10 and R = 1 20 , but the packet delivery proportion decreases quickly when R = 1 50 . The reason why the proportion of faulty source sensors is higher than that of other wireless sensors is due to the lack of energy. Therefore, the JBAEC algorithm has a lower distribution efficiency of perception data in EWSN.
Furthermore, we set the distributions of wireless sensor nodes as a random distribution and a uniform distribution. We can observe from Fig. 6(b) that the uniform distribution has higher packet delivery proportions as the proportion of VOLUME 8, 2020 the sensor nodes that lack energy increases gradually. This is because the mode of the random distribution results in an uneven distribution of wireless sensor nodes within the scope of the effective bandwidth range of each available link in EWSN. Therefore, the wireless sensor nodes implemented with a random distribution are difficult for obtaining the effective bandwidth and energy of available links. In addition, we can find that the packet delivery proportion of the random distribution decreased quickly, which shows that the transmission efficiency of perception data with the random distribution implementation is increasingly harder to achieve in EWSN.
Finally, Fig. 6(c) shows the comparison of packet delivery proportions among the JBAEC algorithm, EEPDB algorithm and FSO algorithm. The JBAEC algorithm has a higher packet delivery proportion than the EEPDB algorithm and FSO algorithm. This is because the design of the EEPDB algorithm mainly considers the energy allocation of source sensor nodes, thereby reducing the allocation efficiency of the effective bandwidth in EWSN. Moreover, the FSO algorithm only studies the allocation method of the effective bandwidth and does not consider the failure of the effective bandwidth allocation caused by the lack of energy of relay nodes. Neither the EEPDB algorithm nor the FSO algorithm accounts for the issue of energy and effective bandwidth allocation in EWSN. In addition, compared to that of JBAEC and EEPDB algorithms, the packet delivery proportion of the FSO algorithm decreases the fastest, which indicates that the strategy is not adaptable to the surroundings that lack energy. Therefore, the FSO algorithm is the most unstable.

VII. CONCLUSION
The main challenge of resource consumption balance in edge wireless sensor networks (EWSN) lies in the optimal tradeoff selection in the effective bandwidth allocation and energy consumption of relay nodes. To handle this challenge, in this article, we first classify the perception data types in EWSN and establish the system model of the energy detection cost. Afterwards, we formulate the data distribution problem as an optimization function that is constrained by the allocation of the effective bandwidth and energy consumption on the available transmission links. Furthermore, we employ the ANS and ETNC algorithms to solve the problem of effective bandwidth selection under the different energy states of relay nodes. Then, we propose the joint bandwidth allocation and energy consumption (JBAEC) algorithm in EWSN, which aims to find progressively optimal transmission links from the set of different relay nodes and ensures that the data transmission is not constrained by restricted energy. Ultimately, the simulation results verify the performance of the JBAEC algorithm in terms of the effective bandwidth allocation efficiency (EBAE) and packet delivery proportion (PDP).