Algorithm 2. Forwarder_Node_Selection (S = Source, D = Destination) |
//when any node S wants to send a packet toward D and it has already constructed a forwarder list, it will follow this algorithm. |
Notations
FL(S): |
Forwarder List of source node S |
Ri: |
ith node in the forwarder list |
PRR: |
Packet Reception Ratio) |
RE: |
Residual Energy |
D: |
Distance |
P: |
Probability |
ArrProb[Ri]: |
Array to store probability of a given node |
Pmax: |
Maximum probability |
D: |
Destination/Target |
|
Input
|
R: R is set of nodes in the forwarder list (FL) i.e., R = {R1, R2, …, Rn} |
Process START
Let R1, R2, …, Rn are the nodes in the FL of source node S. Each node Ri∈ FL(S) where i = 1, 2, …, n
Declare three float variables X1, X2, and X3 to represent the properties of Ri, i.e., PRR (Packet Reception Ratio), RE (Residual Energy), and D (distance), respectively.
-
For each node Ri∈ FL(S) repeat
Compute P(Ri|S)//Probability of selection of Ri given S, i.e.,
Pk = P(Ri|S) for i = 1, 2 …, n and Assign k←i
Compute the probability of P(R i|S) by computing the probability of each parameter separately, given S.
where,
-
Make an unsorted array of probability values of n nodes, i.e., R1, R2, …, Rn from step 6.
For i = 1 to n and k = i, ArrProb[Ri]←Pk//To find the node with maximum probability.
Select the first node of the array ArrProb[0] as the node with maximum value Pmax i.e., Pmax←ArrProb[0]
-
Go through the rest of the elements of the array, i.e., from the 2nd element to the last (n − 1)
element, for i = 1 to n − 1.
-
For i = 1 to n − 1, if any value in the array ArrProb[i] is found to be greater than the current value Pmax. i.e.,
if ArrProb[i] > Pmax then, Pmax← ArrProb[i]
When the end of the array is reached, then the current value of the Pmax is the greatest value in the array, Pmax←ArrProb[i].
-
The node Ri with Pmax value is selected as a relay node from the forwarder list, as
the node with the highest probability. The node with the next highest probability acts as a relay node in case the first selected relay node fails to broadcast.
Broadcast transmission of the data packet as {Ri, coordinates, data}
-
Destination node D is reached, if Yes, go to step 15. Else, apply Algorithm 1 on Ri
S←Ri and go to step 2.
END
|
Output: A potential forwarder node is selected from the list of forwarder nodes. |