PDTR: Probabilistic and Deterministic Tree-based Routing for Wireless Sensor Networks

This paper proposed a “Probabilistic and Deterministic Tree-based Routing for WSNs (PDTR)”. The PDTR builds a tree from the leaves to the head (sink), according to the best elements in the initial probabilistic routing table, measured by the product of hops-count distribution, and transmission distance distribution, to select the best tree-paths. Each sender node forwards the received data to the next hop via the deterministic built tree. After that, when any node loses of its energy, PDTR updates the tree at that node. This update links probabilistically one of that node’s children to a new parent, according to the updated probabilistic routing table, measured by the product of the updated: Hops-count distribution, transmission distance distribution, and residual energy distribution at the loss of ℓe energy. By implementing the control parameters in each distribution, PDTR shows the impact of each distribution in the routing path. These control parameters are oriented by the user for different performances. The simulation results prove that selecting the initial best paths to root the packets via unicast, then improving the tree at the node with loss of energy by rooting the packets via anycast, leads to better performance in terms of energy consumption and network lifetime.


Introduction
A wireless sensor network (WSN) is a network of low-power and low-cost devices that communicate among themselves within the communication range using radio signals. Many protocols have been proposed to maximize both energy efficiency and energy balancing. WSNs have generated an increasing interest because of their significant role in our daily lives: i.e., surveillance, health care, acoustic and seismic detection, environmental monitoring. Most of these protocols are location-based schemes, characterized by three facts: first, each node in the network must be aware of its location information. Second, each node must be aware of its direct neighbor node's location. Third, the source node must be aware of the destination node's location [1]. The localization of WSNs is a very crucial issue; many methods have been proposed to get the node's location, and most of these proposed methods supposed that only a small proportion of sensor nodes, called anchor (beacon) nodes, are location-aware through a global positioning system (GPS), because of the high cost and energy consumption of GPS. However, the other nodes could obtain their position by estimating distance, using the anchor nodes is already fixed, and the routing paths are predefined. This may cause quick energy depletion, which can result in the loss of some nodes and a loss of part of the network.
In [28], the authors proposed a probabilistic scheme based on the node degree and link loss to increase the reliability of selective forwarding. The authors in [29] presented a Probabilistic Geographic Routing (PGR) that uses only local information, link reliability, and residual energy to probabilistically forward data after selecting a candidate's nodes and assigning these probabilities to these candidates.
Distributed Heuristic Algorithm (DHA) was presented in [30]. DHA is a probabilistic scheme based on three distances parameters to select the forwarder nodes, the distance between the sender node and the sink, the distance between the forwarder node and the sink, and the maximum distance between the sender node and the sink.

Assumptions and Notations
This proposed protocol, PDTR, was designed under the following conditions; the non-mobility of the sink and the sensors, and the homogeneity of all the network sensors (the same initial energy and the same communication range), except for the sink, which is charged with high energy, (see Figure 1).   Table 1 shows the notations that used in this study.

Notation
Description ℕ The set of sensor nodes in the network; ℕ = , , , … ; ℕ The neighboring nodes of the node ; = |ℕ |.  Figure 1 shows the PDTR working network. The sink (node 0) is static and located at the center, near to the base station. The sensors are homogeneous and static. The sensors near the sink (within the communication range) communicate directly with the sink. The sensors out of the sink communication range should maintain a multi-hop path for the communication with the sink. The main objective of PDTR is to prolong the network lifetime under the conditions depicted and explained in Figure 1. Table 1 shows the notations that used in this study. The neighboring nodes of the node n i ; m i = |N i |. n h Node needing help, is defined by the node that loses e of its initial energy.
n np Node needing new-parent, is defined as the removed child node from n h children, when updating the tree. d i,j The Euclidian distance between: n i , n j . h(n i ) The hop-count of the node n i , is the minimum number of hops to reach the sink.

E i
The residual energy of the node n i . δ The communication radius. α The control parameter of the impact of hop-count distribution on the routing protocol. β The control parameter of the impact of transmission distance distribution on the routing protocol. γ The control parameter of the impact of the residual energy distribution on the routing protocol. ϕ i, j * The initial probability of the link n i , n j , is defined by Equation (14).
The probability of the link n i , n j , is defined by Equation (12).
The path transmitting a packet of size k, from the source node n s to the sink node n b , is defined by Equation (15). Sbt n q N The nodes of the Sub-tree (n q ), sub-tree rooted at the node n q , is defined by Equation (16).

CP np
The set of candidate parents of the node need new-parent n np ; CP np = C np , is defined by Equation (17).

F P
The expected data forwarding probability F P for the node n i , it is defined by Equation (19).
The variance of the Expected data forwarding, it is given by Equation (20) for the source node n i .
The expected energy cost of the path p k n s , transmitting a packet of size k, from the source node n s to the sink node n b , is defined by Equation (21). e The loss of energy.

S n i
The area of the sensor n i , is defined by Equation (22).

S N
The total area of the sensors in the network N, is defined by Equation (24).

M
The average of all neighboring nodes in N, is defined by Equation (23). D The network density, is defined by Equation (25) 3.

Radio Model Used for PDTR
The proposed PDTR uses First Order Radio Model with asymmetric channel to run the radio as depicted in Figure 2, such that it uses the same energy, to transmit the data from x to y, and to transmit the same data from y to x, this energy is denoted by E elec , and has the value of E elec = 50 nJ bit . E elec depends on filtering, modulation, digital coding and signal spreading [26]. In this model, two channel models are used. The Free space channel model of transmitter amplifier is denoted by ε fs , and has the value of ε fs = 10 pJ/bit/m 2 . The Multi-path channel model of transmitter amplifier is denoted by ε mp and has the value ε mp = 0.0013 pJ/bit/m 4 [26]. Let d (n i ,n j ) be the distance between the transmitter n i and the receiver n j . Let t 0 be the distance threshold, and it has the value of t 0 = ε f s ε mp (meters).
Sensors 2020, 20, x FOR PEER REVIEW 5 of 22 ℎ( ) The hop-count of the node , is the minimum number of hops to reach the sink. The residual energy of the node . δ The communication radius. The control parameter of the impact of hop-count distribution on the routing protocol. The control parameter of the impact of transmission distance distribution on the routing protocol. The control parameter of the impact of the residual energy distribution on the routing protocol. φ , * The initial probability of the link 〈 , 〉, is defined by Equation (14).
The probability of the link 〈 , 〉, is defined by Equation (12). The path transmitting a packet of size k, from the source node to the sink node , is defined by Equation (15). The nodes of the Sub-tree ( ), sub-tree rooted at the node , is defined by Equation (16). The set of candidate parents of the node need new-parent ; = , is defined by Equation (17).

ℱ
The expected data forwarding probability ℱ for the node , it is defined by Equation (19). σ The variance of the Expected data forwarding, it is given by Equation (20) for the source node .

E
The expected energy cost of the path , transmitting a packet of size k, from the source node to the sink node , is defined by Equation (21). ℓ The loss of energy. The area of the sensor , is defined by Equation (22). The total area of the sensors in the network , is defined by Equation (24).
The average of all neighboring nodes in , is defined by Equation (23). The network density, is defined by Equation (25)

Radio Model Used for PDTR
The proposed PDTR uses First Order Radio Model with asymmetric channel to run the radio as depicted in Figure 2, such that it uses the same energy, to transmit the data from x to y, and to transmit the same data from y to x, this energy is denoted by , and has the value of = 50 .
depends on filtering, modulation, digital coding and signal spreading [26]. In this model, two channel models are used. The Free space channel model of transmitter amplifier is denoted by ε , and has the value of , = 10 / / . The Multi-path channel model of transmitter amplifier is denoted by and has the value = 0.0013 / / [26]. Let ( , ) be the distance between the transmitter and the receiver . Let be the distance threshold, and it has the value of = (meters).  When d (n i ,n j ) is greater than t 0 = ε f s ε mp (meters), a multi-path (mp) channel model is used to run the radio. Otherwise, the free space (fs) channel model is used to run it, as given in Equations (1) and (2). Each sensor needs an energy of E Tx n i , n j , k to transmit k bits size message over distance d (n i ,n j ) , and needs an energy of E Rx (k) to receive the transmitted message of k bits.

Proposed Method PDTR
This work is categorized among the location-based deterministic and probabilistic protocols. It proposes a probabilistic and deterministic tree-based routing approach called PDTR, which aims to attend an efficient and balanced energy consumption. It is built from the leaves to the root, the sensing nodes (leaves) transmit the sensed data to the sink (root) node, through a deterministic tree structure. Each node selects a parent with a higher probability in the initial probabilistic routing table, to relay the sensed data toward the sink. After time, when any node n i loses e of its energy, the sub-tree routed at the node n i cuts one of its sub-sub-trees, and the root node of the cut sub-subtree selects probabilistically a new parent, according to the updated probabilistic routing table. Then, the sub-subtree routed at a cut node will be rooted probabilistically at the new parent node. This process is repeated for the node n i , each time it loses e of its energy, starting from the first energy loss, until the value of its remaining energy is less than e . The used probabilistic protocol in the removed child is classified among the adaptive probabilistic schemes. Each node n i is aware of its location (x i , y i ), and has a hop-count h(n i ) that indicates the minimum number of hops required to reach the sink node, as defined in Table 1. All sensors in the network are fully charged with the same initial energy E * , except for the sink node, which has a different initial energy, E n 0 * , as given in Table 2. Every source node collects data and has to choose the appropriate forwarder to send the collected data to, according to the probabilistic routing table.

The Probabilistic Routing Table Set-Up Phase
This phase is achieved according to three selection distribution: the hop-count distribution, the sender node chooses the neighbor with lower hop-count to relay the sensed data. In the transmission distance distribution, the sender node selects the nearest neighbor to be the next hop (forwarder). Finally, in the residual energy distribution, the node with the greater residual energy has more chance to be chosen as the next-hop, if its energy has not fallen below threshold energy.

Hop-count Distribution
The source node selects the neighbor node with a lower hop-count as its forwarder to relay the sensed data. This distribution has the aim to give priority to nodes close to the sink; the closer the forwarder node is to the sink, the less energy is needed for data transmission, and the priority is higher for the forwarders that are closer to the sink. We define h(n i ) by the hop-count of the node n i as the minimum number of hops to reach the sink. In N sensor nodes network, the maximum hop-count can be N-1, because at the worst case, each node has only two neighbor nodes, a back-warder node and forwarder node, except for the sink node, which does not have a forwarder (parent), and source nodes do not have a back-warder. Here, the hop-count of the node n i neighboring nodes is defined as a random variable: h(n l ) = h(n 1 ), . . . , h n m i , m i neighbors.
Let N i be the neighboring nodes set of n i such that|N i | = m i , as defined in Table 1.
The hop-count function is normalized by the following Equation (3).
The forwarding probability function of the hop-count distribution from the sender n i to its neighboring nodes is calculated by Equation (3) and given by the following Equation (4).
From Equation (4), we can see that further nodes have bigger probabilities, but we want to give a higher probability to the closer nodes. Let h n j be the mass probability of the hop-count distribution, such that the higher probability is given to the nodes with lower hop-count, as expressed in Equation (5).
To determine the impact of the hop-count distribution on the other two distributions defined in the proposed PDTR, we defined in Table 1, a hop-count control parameter denoted by α such that: α ≥ 0, as shown in Equation (5).

Transmission Distance Distribution
The closer the forwarder node is to the sender; the less energy is needed for data transmission. Higher priority is given to forwarders closer to the sender node. From each node to its neighboring nodes, the transmission distance can be calculated by the Euclidian distance, and it is normalized by Equation (6). The furthest node can have a maximum distance of communication radius δ value from the sender node.
Let N i be the neighboring nodes of the node n i , such that |N i | = m i ; d i,l = d i,1 , d i,2 , . . . , d i,m i , m i neighboring node. The transmission distance distribution function is normalized by Equation (6).
The probability function of the transmission distance distribution by using Equation (6) is given by Equation (7).ď From Equation (7), we can see that the further nodes have higher probabilities, but we want to give a higher probability to the closer nodes.
Let d i,j be the mass probability function of the distance distribution (see Equation (8)), such that the higher probability will be given to the closer nodes to the sender node, the smaller distance will have a greater probability. To determine the impact of the transmission distribution on the other two distributions defined in the proposed PDTR, we defined in Table 1, a transmission distance control parameter denoted by β such that: β ≥ 0, as shown in Equation (8).

Residual Energy Distribution
The sender node selects the next-hop with higher remaining residual energy to relay collected data, in order to balance the energy and ensure more lifetime for the network. This distribution has the aim of giving priority to nodes with higher residual energy. However, on the other side, this distribution depends on the location of the nodes, and the nodes with low battery may be used as a relay node. Let E j be the residual energy of the node n j such that; n j is the forwarder of . , E i,m i , and n i has m i neighboring nodes denoted by the set N i . Let E j be the normalized function of these nodes, given by Equation (9).
Let E i, j be the mass probability of the residual energy distribution of forwarding data from the sender node to its neighboring nodes, such that the greater probability is given to the nodes with greater residual energy, as expressed in Equation (10).
To determine the impact of the residual energy distribution on the other two distributions defined in the proposed PDTR, we defined in Table 1, a residual energy control parameter denoted by γ such that: γ ≥ 0, as shown in Equation (10).

Initialization of the Probabilistic Routing Table
The probabilistic routing table is a set of elements: ϕ i,j , for each possible link n i , n j , ∀n i ∈ N, ∀n j ∈ N i , such that ϕ i,j is calculated by usingφ i,j , as explained in Equations (11) and (12).
For initialization, since the initial energy is the same for all nodes in the network (except for the sink node), we can initialize the probabilistic routing table by assuming at the beginning that: We note that the hop-count will be defined as depth in a tree structure (since all nodes have the same residual energy distribution). From Equation (13) the initial probabilistic routing table is the set of elements ϕ i,j * , for each possible link n i , n j , ∀n i ∈ N, ∀n j ∈ N i . These elements are calculated by Equation (14).

Routing Tree Phase
PDTR builds the tree from the leaves (source node) to the root (sink node). Let p ns be the path starting from the source node n s (located at the head of the path) toward the sink node n r . Each source node which has sensed data has to send the collected data to one parent that will be selected according to the initial probabilistic routing table; the parent with the highest probability has the priority to be chosen.

Remark 2.
The hops-count notion in the tree is defined as the depth (level). After building the tree, if the initial hops-count for any node is different from its depth (level) in the built tree, the hop-count for that node will be updated to its depth (level) value. Hence, the hops-count distribution has to be updated.

Updating the Probabilistic Routing Phase
After some time, the residual energy of each node starts to decrease, depending on the quantity of the transmitted packet by each sensor node. Hence, the necessity of updating the tree-routing in order to balance energy consumption and prolong the network lifetime is shown. PDTR proposes a strategy to reach this goal. Each time any node n i loses e of its energy, and if it is not a leaf, then it will be defined as a node that needs help, and selects the child with the lowest residual energy to be removed from its children. Then, the selected child node has to probabilistically select a new-parent (forwarder) from its candidate parents, according to the updated probabilistic routing table. This process will be repeated for the node n i each time it loses e of its energy, until the value of its remaining energy is less than e .

Definitions
Definition 1. Path Links and Path Nodes: Let p k n s be the path transmitting a packet of size k from the source node n s to the sink node n r , such that the path links p k n s L = { n s , n v , n v , n w , . . . , n l , n r } are defined as the sequence of all links between each node and its parent, starting from the link n s , n v between the source node n s and its selected forwarder n v , to the last link n l , n r relaying the last node n l to the sink node n r . The associated path nodes are defined as p k n s N, such that: p k n s N = n s , n v , n w , . . . , n q , n f , . . . , n l , n r = n s , n v , n w , . . . , n q n f , . . . , n r , such that the node n f is the forwarder node of the node n q and p k n s N is expressed in Equation (15). p k n s N = n s − n q n f − n r = p k n s n s − n q p k n s n f − n r (15) Definition 2. Sub-tree (n q ) Nodes: Let Sbt n q N be the Sub-tree (n q ) Nodes, defined as the nodes of the Sub-tree (n q ). Sbt n q N consists of all paths starting from the source node n s , and passing by the node n q toward the sink node n r , such that n s ∈ S and S is the set of all source nodes sending data, through paths passing by the node n q toward the root (sink) node n r .|S| = v, as explained in Equation (16), by using Equation (15).
Definition 3. Node Need New-Parent Selection: It is clear that the residual energy distribution changes by sending data, which requests an update. Let the node n h be the node that loses e of its energy, it broadcasts the current energy state to the sink node and to all its children as well. It is declared that n h is the node that needs a help, the neighboring nodes (children nodes) as well, send a feedback to n h about the current residual energy, then n h selects the child with the lowest residual energy to be removed; the cost of this process is very low and can be negligible. The selected child node is defined as the node needing new-parent, defined as n np .

Definition 4.
Candidate Parents: The selected child node n np broadcasts its current energy state to its neighboring nodes. Then, the neighboring nodes update their residual energy. The residual energy is already updated, once receiving a packet by the node n np , then n np selects probabilistically a new-parent node n p among the set of its candidate parents CP np based on its updated probabilistic routing table. The CP np is defined as the set of n np neighboring nodes that do not belong to the Sub-tree (n h ) nodes ( Sbt n h N ), and have a higher residual energy than the residual energy of the node n h .
The candidate parents for n np CP np are a set of neighboring nodes of n np , such that they satisfy the conditions (1,2), such that: ∀ n i ∈ N np , ∃n p ∈ CP np 1.
n p Sbt n h N (The candidate parent should not be a node in the Sub-tree ( n h ) nodes, such that nodes in Sbt n h N are defined by Equation (16) 2.
E n p > E n h (The residual energy of the candidate parent of the node need new-parent n p should be greater than the residual energy of its current parent (n h )).
The candidate parents set for n np is denoted by CP np , and defined by Equation (17).

Remark 3
If CP np = ∅, n h will select another child node n np among its children nodes to be removed, such that:n np n np and CP np ∅.

New-Parent Probabilistic Selection
The node needing new-parent n np has to probabilistically select a new parent among the candidate parents set CP np ; this selection is achieved according to the updated probabilistic routing table, defined by the update of the initial probabilistic routing table. For the nodes in CP np at the time when n h (parent node of n np ) loses e of its energy, the update is calculated by Equation (12) as following:

Remark 4.
Hops-count distribution and the residual energy distribution must be updated, because they may change after the packets transmission process, while the transmission distance distribution has to be updated not due to the fact that it changes by time (the nodes are statics), but due to the fact that the neighboring nodes set of the node needing new-parent n np changes, which requests a transmission distance distribution update.

Updating the Hops-Count for the Sub-Tree (n np ) Nodes
In each time any node n np changes its parent, and the hop-count of its new-parent is different from the hop-count of its old-parent, the hop-count of the all nodes belonging to the Sub-tree (n np ) has to be updated according to Equation (18), thus the update of the hops-count distribution and the update of the probabilistic routing table by Equation (12) are completed.
After linking the node needing new-parent n np to its new-parent n p , if h n p h(n h ), then for each child node and its parent node in Sub-tree (n np ), the hop-count should be updated by the following Equation (18).

Expected Data Forwarding Probability
Each node n i has to forward its sensed and collected data according to an expected By replacing in Equations (11) and (12), we get: Hence, the expected data forwarding probability for the node n i is given by Equation (19).

Variance
Since the residual energy varies after each energy consumption when sending a packet, and since the hop-count distribution varies after the update of the tree, the expected data forwarding probability given by Equation (19) varies by the variance σ 2 i , given by Equation (20) for the source node n i . (20)

Path Expected Energy Cost
Let E p k ns be the expected energy cost of the path p k n s transmitting a packet of size k from the source node n s to the sink node n b via a tree structure, such that p k n s = {n s , n v , n v , n w , . . . , n l , n b }. E p k ns is given Equation (21) and defined as the sum of the energy cost of all path nodes. From Equations (1) and (2), we get:

Simulation Results
To prove the performance of the proposed PDTR protocol, a designed toolkit using C# and WPF was developed. The simulation had the following aims and results.

On the Energy Consumption
Ensuring longer network lifetime when minimizing the energy consumption at the same time is the goal of the best WSN routing protocol. In this paper, we proposed a new tree-based strategy that has an update phase each time any node loses e of its energy.
For this, we considered three scenarios; in each scenario, each source node sends one packet every 0.1 s, for the parameters defined in Table 1 and their values given by Table 2. The communication range R = 80 m, while e = {2%, 4%, 6%, 8%, 10%, 12%, 14%, 16%, 18%, 20%, 22%, 24%, 26%}. In the first scenario, the number of nodes is fixed, such that N = 100. Figure 3, first scenario shows the simulation results of sending, in each t = 0.1 s, one packet from one random node towards the sink for a period of 300 s. The results show that to minimize the network energy consumption, the value of e parameter should belong to e = [20%, 26%]. (see Figure 3, first scenario).
In the second scenario, the number of nodes is fixed such that N = 120. Figure 3, second scenario shows the simulation results of sending, in each t = 0.1s, one packet from one random node towards the sink for a period of 300 s. The results show that to minimize the network energy consumption, the value of e parameter should belong to [16%, 26%] (see Figure 3, second scenario).
Sensors 2020, 20, x FOR PEER REVIEW 12 of 22 show that to minimize the network energy consumption, the value of ℓ parameter should belong to ℓ = 20%, 26% . (see Figure 3, first scenario).
In the second scenario, the number of nodes is fixed such that N = 120. Figure 3, second scenario shows the simulation results of sending, in each t = 0.1s, one packet from one random node towards the sink for a period of 300 s. The results show that to minimize the network energy consumption, the value of ℓ parameter should belong to 16%, 26% (see Figure 3, second scenario).
In the third scenario, the number of nodes is fixed such that N = 140. Figure 3, third scenario shows the simulation results of sending, in each t=0.1s, one packet from one random node towards the sink for a period of 300s. The results show that to minimize the network energy consumption, the value of ℓ parameter should belong to 14%, 26% (see Figure 3, third scenario). From the above three scenarios, we can conclude that minimize the total energy consumption, the selection of ℓ value depends on the number of nodes. For the network size N = 100, The value of ℓ parameter should belong to ℓ = 20%, 26% for the network size N = 120, The value of ℓ parameter should belong to ℓ = 16%, 26% for the network size N = 140, The value of ℓ parameter should belong to ℓ = 14%, 26% for the parameter values given by

First scenario
Second scenario Third scenario Figure 3. Impact of e parameter on the total energy consumption varying number of nodes for the first scenario, the second scenario and the third scenario.
In the third scenario, the number of nodes is fixed such that N = 140. Figure 3, third scenario shows the simulation results of sending, in each t = 0.1 s, one packet from one random node towards the sink for a period of 300 s. The results show that to minimize the network energy consumption, the value of e parameter should belong to [14%, 26%] (see Figure 3, third scenario).
From the above three scenarios, we can conclude that minimize the total energy consumption, the selection of e value depends on the number of nodes. For the network size N = 100, The value of e parameter should belong to e = [20%, 26%] for the network size N = 120, The value of e parameter should belong to e = [16%, 26%] for the network size N = 140, The value of e parameter should belong to e = [14%, 26%] for the parameter values given by Table 2, and the communication range R = 80 m.

On the Network Lifetime
Prolonging the network lifetime can be reached by saving the nodes' residual energy. To maximize the network lifetime, we should study the impact of the loss of the energy parameter.
For this, we consider three scenarios; in each scenario, each source node sends one packet every 0.1 s for the parameter values given by Table 2. The communication rangeR = 80 m, while e = {2%, 4%, 6%, 8%, 10%, 12%, 14%, 16%, 18%, 20%, 22%, 24%, 26%}. In the first scenario, the number of nodes is fixed such that N = 100. In Figure 4, the first scenario shows the simulation results after the round when the first node is declared dead. The results show that, to increase the network lifetime, the value of e parameter should be set such that e = 20%.
In the second scenario, the number of nodes is fixed such that N = 120. In Figure 4, the second scenario shows the simulation results after the round when the first node is declared dead. The results show that, to increase the network lifetime, the value of e parameter should be set such that e = 18%.
In the third scenario, the number of nodes is fixed such that N = 140. Figure 4, third scenario shows the simulation results after the round when the first node is declared dead. The results show that, to increase the network lifetime, the value of e parameter should be set such that e = 14%.  From the above three scenarios, we can conclude that there is a decreasing relationship between the network size (N) and the optimal value of the loss energy parameter ℓ that maximizes the network lifetime. It is concluded that the maximum lifetime is reached when ℓ = 20% for the network size N = 100 , the maximum lifetime is reached when ℓ = 18% for the network size N = 120, and the maximum lifetime is reached when ℓ = 14% for the network size N = 140 for the parameters defined in Table 1 and their values given by Table 2. The communication range = 80 m.

Control Parameters Upper Bound
The user has to decide the values of the control parameters, depending on the requirement of the applications. The role of each parameter is to determine the impact of the corresponding distribution on the other distributions. The values of the control parameters should be selected in order to keep the influence of the three distributions. After intensive experimental work, it was concluded that to maintain this objective, the upper bound of control-parameters denoted by , has  From the above three scenarios, we can conclude that there is a decreasing relationship between the network size (N) and the optimal value of the loss energy parameter e that maximizes the network lifetime. It is concluded that the maximum lifetime is reached when e = 20% for the network size N = 100 , the maximum lifetime is reached when e = 18% for the network size N = 120, and the maximum lifetime is reached when e = 14% for the network size N = 140 for the parameters defined in Table 1 and their values given by Table 2. The communication rangeR = 80 m.

Control Parameters Upper Bound
The user has to decide the values of the control parameters, depending on the requirement of the applications. The role of each parameter is to determine the impact of the corresponding distribution on the other distributions. The values of the control parameters should be selected in order to keep the influence of the three distributions. After intensive experimental work, it was concluded that to maintain this objective, the upper bound of control-parameters denoted by U b , has a strong relation with the network density deployment; this relation is defined by Equation (26). In the homogeneous network, sensors are deployed at the interest network area Ω, and they have the same communication radius, denoted by δ. To calculate the density of the deployment of these N sensors on the given network, we consider two parts. First, the area of each sensor in the network is denoted by S n i (it is the same for all sensors, since sensors are homogenous), and is defined by Equation (22). Second, the average of sensors' neighboring nodes in the network, denoted by M and defined by Equation (23). The density of sensor node deployment in the network is denoted by D, and is defined by Equation (25), and the sum of the area of all sensors is denoted by S N , and is defined by Equation (24), par the interest network area Ω.
6.3. Importance of Implementing the Control-Parameters Sets on PDTR

On the Delay
Achieving the low delay when sending and receiving data can be reached by minimizing the number of hops in the routing protocol. Hence, the control parameter of the hop-count distribution α should have greater value than the two other control parameters.
From the above two scenarios, we can conclude that; first, the minimum number of hops in the proposed PDTR protocol is reached when γ = β = 0 . Second, the greater hop-count control parameter, the lower the number of hops needed in the PDTR routing protocol.
This conclusion is maintained under the condition: α + γ + β ≤ U b (Experimental view).
In the second scenario, 14 parameters set are selected such that the value of α = 3, while = β = 0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2,2.2,2.4,2.6 . Each source node 1 < s < 100, sends 1packet every 0.1 second, and the simulation time is 300s, for the parameter values defined and given by Tables 1 and 2, such that the communication range is R = 50. The results show that the minimum number of hops in the routing protocol is reached when = β = 0, (see Figure 5b). From the above two scenarios, we can conclude that; first, the minimum number of hops in the proposed PDTR protocol is reached when = β = 0 . Second, the greater hop-count control parameter, the lower the number of hops needed in the PDTR routing protocol.

On the Energy Consumption
Minimizing both the transmission distance and the number of hops leads to minimizing energy consumption. To achieve this goal, the control parameters of both the transmission distance and the hop-count have to be greater than the control parameter of the residual energy distribution. For this, we consider three scenarios.
(a) Impact of control parameters sets on the average hops/path and the average delay/path for the first scenario.

(b) Impact of control parameters sets on
The average hops/path and the average delay/path for the second scenario.

Control Parameters Set ID
Average Hops/Path Average Delay/Path" Figure 5. Impact of control parameters sets on the average hops/path and the average delay/path.

On the Energy Consumption
Minimizing both the transmission distance and the number of hops leads to minimizing energy consumption. To achieve this goal, the control parameters of both the transmission distance and the hop-count have to be greater than the control parameter of the residual energy distribution. For this, we consider three scenarios.
The first scenario selected 14 parameters set such that the value of α = 3, β = 1, while γ = {0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2, 2.4, 2.6}. Each source node sends one packet every 0.1 s, and the simulation time is 100 s, for the parameter values defined in Table 1 and given by Table 2, and the communication radius R = 25 m. The results show that to achieve the minimum energy consumption, the control parameter of the residual energy should be γ = 0, (see Figure 6, first scenario).
The third scenario selected 14 parameters set such that the value of α = 3, β = 3, while γ = {0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2, 2.4, 2.6}. Each source node sends one packet every 0.1 s, and the simulation time is 100 s, for the parameter values given by Table 2, and the communication range R = 50 m. The results show that to achieve the minimum energy consumption, the control parameter of the residual energy should be γ = 0, (see Figure 6, third scenario).
From the above three scenarios, we can conclude that; first, the minimum energy consumption in the proposed PDTR protocol is reached when γ = 0. Second, for better results in term of energy consumption, the control parameter of the transmission distance should be set such that: β > α 2 . Third, for better results in term of energy consumption, the control parameter of the transmission distance should be less than the control parameter of the hops-count β < α.To minimize the energy consumption in the PDTR routing protocol, the values of the control parameters should be set such that γ = 0, α > β > α 2 .This conclusion is maintained under the condition: α + γ + β ≤ U b (Experimental view).
The third scenario selected 14 parameters set such that the value of α = 3, β = 3, while = 0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2,2.2,2.4,2.6 . Each source node sends one packet every 0.1 second, and the simulation time is 100 s, for the parameter values given by Table 2, and the communication range R=50m. The results show that to achieve the minimum energy consumption, the control parameter of the residual energy should be γ = 0, (see Figure 6, third scenario). Figure 6. Impact of control parameters sets on total energy consumption for first scenario, second scenario and third scenario.
From the above three scenarios, we can conclude that; first, the minimum energy consumption in the proposed PDTR protocol is reached when = 0. Second, for better results in term of energy consumption, the control parameter of the transmission distance should be set such that: β > . Third, for better results in term of energy consumption, the control parameter of the transmission distance should be less than the control parameter of the hops-count β < α.
To minimize the energy consumption in the PDTR routing protocol, the values of the control parameters should be set such that = 0, α > β > .
This conclusion is maintained under the condition: α + + β ≤ (Experimental view). Control parameters set ID First Scenario Second Scenario Third scenario Figure 6. Impact of control parameters sets on total energy consumption for first scenario, second scenario and third scenario.

On the Network Lifetime
Prolonging the network lifetime can be achieved by selecting the nodes with higher residual energy. To maximize the network lifetime, we should maximize the value of the residual energy control parameter γ.
For this, we consider two scenarios. The first scenario selected 11 parameters set such that the value of α = 3, β = 2, while γ = {0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2}. Each source node sends one packet every 0.1 s for the parameter values given by Table 2, the communication range is fixed R = 50 m, and the number of nodes is fixed N = 100. Figure 7, first scenario shows the simulation results after the round when the first node is declared dead. It shows that the maximum lifetime is reached when γ = 1.2.
The second scenario selected 11 parameters set such that the value of α = 3, β = 2.6, while γ = {0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2}. Each source node sends one packet every 0.1 s for the parameter values given by Table 2, the communication range is fixed R = 50 m, and the number of nodes is fixed N = 100. Figure 7, second scenario shows the simulation results after the round when the first node is declared dead. It shows that the maximum lifetime is reached when γ = 1.4. Prolonging the network lifetime can be achieved by selecting the nodes with higher residual energy. To maximize the network lifetime, we should maximize the value of the residual energy control parameter γ.
For this, we consider two scenarios. The first scenario selected 11 parameters set such that the value of α = 3, β = 2, while = 0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2 . Each source node sends one packet every 0.1 second for the parameter values given by Table 2, the communication range is fixed = 50 , and the number of nodes is fixed N = 100. Figure 7, first scenario shows the simulation results after the round when the first node is declared dead. It shows that the maximum lifetime is reached when γ = 1.2. The second scenario selected 11 parameters set such that the value of α = 3, β = 2.6, while = 0,0.2,0.4,0.6,0.8,1,1.2,1.4,1.6,1.8,2 . Each source node sends one packet every 0.1 second for the parameter values given by Table 2, the communication range is fixed = 50 , and the number of nodes is fixed N = 100. Figure 7, second scenario shows the simulation results after the round when the first node is declared dead. It shows that the maximum lifetime is reached when γ = 1.4. From the above two scenarios, we can conclude that the maximum network lifetime in the proposed PDTR protocol is reached when: > > ; for α + + β ≤ , and > β > .

Performance Comparison of the Proposed PDTR to the State-of-the-Art Routing Protocols
To prove the performance of our proposed approach PDTR, we compare it to the following protocols. From the above two scenarios, we can conclude that the maximum network lifetime in the proposed PDTR protocol is reached when: 3β 4 > γ > β 2 ; for α + γ + β ≤ U b , and 3α 4 > β > α 2 .

Performance Comparison of the Proposed PDTR to the State-of-the-Art Routing Protocols
To prove the performance of our proposed approach PDTR, we compare it to the following protocols. In Deterministic Routing Protocols (DRP), such as Tree Routing (TR) and Enhanced Tree Routing (ETR) the paths are predefined, and each node has a fixed forwarder node. Thus, the protocol does not need more energy to be updated, unlike the case of probabilistic protocols; consequently, the DRP consumes less energy and provides better performance in terms of energy consumption in comparison to the probabilistic protocols, as we can see in Figures 8 and 9.
Moreover, DPR, with its unicast routing, is the worst in terms of energy balancing and lifetime, since some nodes will be more loaded than others (see Figures 10 and 11).
However, the fact that each node has only one fixed forwarder means that each time the sender node sends data to its parent if its parent is in sleep mode, the sender node has to wait, which means an increase in the waiting time delay, thus an increase in the sending time delay, and a decrease in the number of generated packets in comparison to probabilistic protocols, (see Figures 12 and 13). Our proposed approach with the parent probabilistic selection decreases the delay in both the waiting time and sending time. The PDTR at the update phase offers for the node needing a parent a set of candidate parents with different probabilities, and the node has to choose the suitable awake parent through a tree structure. PDTR also improves on DRP in terms of energy efficiency since it builds the tree based on three probability distributions (hops count, transmission distance and residual energy). Since the node's initial energy is the same in our case, we do not consider this criterion. Based on these criteria, PDTR starts generating packets through best-selected paths, and over time the network loading will be high for some nodes (node loses e =20% of its energy for this scenario (Network size = 100)), and the PDTR starts the probabilistic update; thus it achieves better performance than DRPs in term of energy balancing and energy efficiency.
In Probabilistic Routing Protocols (PRP), such as Distributed Adaptive Probabilistic Routing (DAPR) and Distributed Heuristic Algorithm (DHA)), unlike the DRP, the sender in PRP has a set of candidate parent nodes, thus transmitting packets via different paths and distributing the network load and the energy consumption among nodes; consequently, PRPs improved on DRPs in terms of network balancing and lifetime, (see Figures 10 and 11). Moreover, the fact that the nodes have more candidate nodes when sending the packets means that the problem of the forwarder being in sleep mode does not affect the transmission, because the node has to choose another appropriate awake forwarder, thus decreasing both the waiting time and sending time in comparison to the DRPs, and increasing the number of generated packets (see Figures 12 and 13). However, in term of energy consumption, PRPs need more energy than DRPs, first because the packets may travel via longer paths, and second due to the updating, these protocols are built with the probabilities that need to be adjusted according to the transmission process; for these reasons, PRPs need more energy consumption than DRPs (see Figures 8 and 9). PDTR improved on PRPs in term of energy consumption by the fact that it processes via a tree structure based on 3PD probability distributions (Hops distribution, transmission distance distribution, and residual energy distribution), and packets traveling via the tree structure built from optimal paths need less energy consumption than traveling via anycast structure. Moreover, PDTR has to be updated each time the node meets the high network loading, in order to save the energy and prolong the lifetime; thus, the PDTR increases the lifetime of DRP and PRP cited above (see . On the other hand, the updating of PDTR does not need much energy, unlike in PRPs, due to the fact that the update of PDTR happens only when any node loses 20% of its energy. Hence, better performance in terms of energy consumption (see Figures 8 and 9). Figure 8 shows the simulation results of sending, in each t = 0.1 s, one packet from one random node towards the sink for a period of 480 s; the number of nodes is assumed fixed N = 100, while the communication range R varies, such that: R = {50, 60, 70, 80, 90, and 100 m}. DRP and PRP cited above (see Figures 10,11,12 ,13). On the other hand, the updating of PDTR does not need much energy, unlike in PRPs, due to the fact that the update of PDTR happens only when any node loses 20% of its energy. Hence, better performance in terms of energy consumption (see Figure 8,9). Figure 8 shows the simulation results of sending, in each t = 0.1s, one packet from one random node towards the sink for a period of 480 s; the number of nodes is assumed fixed = 100, while the communication range R varies, such that: R= 50,60,70,80,90, and 100 .     Figure 10 shows the simulation results after the round when the first node is declared dead of sending, in each t = 0.1 s, one packet from one random node towards the sink; the number of nodes is assumed to be fixed = 100 ,while the communication range varies, = 50,60,70,80,90, and 100 .  Figure 11 shows the simulation results after the round when the first node is declared dead of sending, in each t = 0.1s, one packet from one random source node towards the sink, the communication range is assumed to be fixed = 80 , while the number of nodes N varies, = 100,120,140,160,180,200 .  Figure 10 shows the simulation results after the round when the first node is declared dead of sending, in each t = 0.1 s, one packet from one random node towards the sink; the number of nodes N is assumed to be fixed N = 100, while the communication range R varies, R = {50, 60, 70, 80, 90, and 100 m}.  Figure 10 shows the simulation results after the round when the first node is declared dead of sending, in each t = 0.1 s, one packet from one random node towards the sink; the number of nodes is assumed to be fixed = 100 ,while the communication range varies, = 50,60,70,80,90, and 100 .  Figure 11 shows the simulation results after the round when the first node is declared dead of sending, in each t = 0.1s, one packet from one random source node towards the sink, the communication range is assumed to be fixed = 80 , while the number of nodes N varies, = 100,120,140,160,180,200 .  Figure 11 shows the simulation results after the round when the first node is declared dead of sending, in each t = 0.1 s, one packet from one random source node towards the sink, the communication range is assumed to be fixed R = 80 m, while the number of nodes N varies, N = {100, 120, 140, 160, 180, 200}.  Figure 11 shows the simulation results after the round when the first node is declared dead of sending, in each t = 0.1s, one packet from one random source node towards the sink, the communication range is assumed to be fixed = 80 , while the number of nodes N varies, = 100,120,140,160,180,200 .   Figure 11. Impact of varying the number of nodes on the network lifetime. Figure 12 shows the simulation results after the round when the first node is declared dead of sending in each round 50 packets (1packet/1 s) from each source node among the randomly selected source nodes SN, such that: SN = {5, 10, 20, 50, 100}.
Sensors 2020, 20, x FOR PEER REVIEW 19 of 22 Figure 12 shows the simulation results after the round when the first node is declared dead of sending in each round 50 packets (1packet/1 second) from each source node among the randomly selected source nodes , such that: = 5,10,20,50,100 .  Figure 13 shows the simulation results after the round when the first node is declared dead of sending in each round (second) an NP packet (1packet/1second) from each source node among five randomly selected source nodes, such that NP varies from 50 to 250. The simulation results prove that our proposed algorithm PDTR provides better performance than DRP, DAPR, and DHA in terms of energy consumption and lifetime.
From Figure 8, we can conclude that the relation between the communication range and the energy consumption is a decreasing relation-larger communication range leads to less energy consumption. This can be explained by the fact that extending the communication range will reduce the number of hops needed to transmit packets towards the sink. From Figure 9, we can conclude that the relation between the number of nodes and the energy consumption is an increasing relation.  Figure 13 shows the simulation results after the round when the first node is declared dead of sending in each round (second) an NP packet (1packet/1 s) from each source node among five randomly selected source nodes, such that NP varies from 50 to 250.
Sensors 2020, 20, x FOR PEER REVIEW 19 of 22 Figure 12 shows the simulation results after the round when the first node is declared dead of sending in each round 50 packets (1packet/1 second) from each source node among the randomly selected source nodes , such that: = 5,10,20,50,100 .  Figure 13 shows the simulation results after the round when the first node is declared dead of sending in each round (second) an NP packet (1packet/1second) from each source node among five randomly selected source nodes, such that NP varies from 50 to 250. The simulation results prove that our proposed algorithm PDTR provides better performance than DRP, DAPR, and DHA in terms of energy consumption and lifetime.
From Figure 8, we can conclude that the relation between the communication range and the energy consumption is a decreasing relation-larger communication range leads to less energy consumption. This can be explained by the fact that extending the communication range will reduce the number of hops needed to transmit packets towards the sink. From Figure 9, we can conclude The simulation results prove that our proposed algorithm PDTR provides better performance than DRP, DAPR, and DHA in terms of energy consumption and lifetime.
From Figure 8, we can conclude that the relation between the communication range and the energy consumption is a decreasing relation-larger communication range leads to less energy consumption. This can be explained by the fact that extending the communication range will reduce the number of hops needed to transmit packets towards the sink. From Figure 9, we can conclude that the relation between the number of nodes and the energy consumption is an increasing relation. This can be explained by the fact that a larger network size means a longer paths length, thus higher path expected energy cost. From Figure 10, we can conclude that there is an increasing relation between the lifetime and the communication range; this can be concluded from the conclusion obtained from Figure 8. Larger communication range leads to lower energy consumption, and hence longer lifetime. From Figure 11, we can conclude that there is an increasing relationship between the lifetime and the network size. Despite the conclusion obtained from Figure 8, the larger network size leads to higher energy consumption. PDTR prolongs the lifetime when increasing the size of the network size, due to the fact that more nodes mean more possible forwarder candidates in a probabilistic strategy, thus providing a longer lifetime. From Figure 12, we can conclude that there is a decreasing relationship between the lifetime and the number of source nodes. This can be explained by the fact that more source nodes means more generated packets, and more generated packets need more energy consumption, hence leading to a shorter lifetime. From Figure 13, we can conclude that there is a decreasing relationship between the lifetime and the number of generated packets; as explained above, more generated packets need more energy consumption, thus leading to shorter lifetime.

Conclusions
This paper presents a Probabilistic and Deterministic Tree Routing Protocol called PDTR. It aims to root the packet toward the sink via optimal tree paths and save the nodes' energy for as long as possible. PDTR simulation results show a longer network lifetime, and less energy consumption, in comparison to the previously proposed protocols. That is to say that PDTR is a suggested routing protocol to prolong the network lifetime under the condition of sensor homogeneity.
PDTR improves the deterministic tree strategy due to the fact that it builds the tree according to three probability distributions (hops-count, transmission distance, and residual energy). Hence the selection of optimal paths and the saving of energy. Moreover, PDTR improves the probabilistic tree strategy. First, this is due to the fact that it forwards data based on the product of three probability distributions controlled by parameters, two of them need to be updated by time (residual energy and hops-count); this update performs the use of paths when transmitting data, in comparison to the protocols based on predefined probability distribution. Second, it does not need much energy to be updated, in comparison to the other probabilistic protocols, because the update of PDTR happens only when any node loses e of its energy, hence a better performance in terms of energy consumption is obtained.
Our work is based on hop-count distribution and residual energy, which sometimes need to be updated in the tree due to the change in sub-trees position and nodes' residual energies. This update needs some energy. Hence, our future work involves examining this fairness issue in order to enhance the PDTR and save the used energy to prolong the WSN lifetime.