Exercises - Routing: Politecnico Di Milano
Exercises - Routing: Politecnico Di Milano
Exercises - Routing: Politecnico Di Milano
Exercises – Routing
Question 1
What is the difference between a proactive routing protocol and
a reactive routing protocol?
Consider the following WSN scenarios and explain why you
would choose either a proactive or a reactive routing solution:
1. A WSN is used to monitor air pollution in a city where every
sensor reports its sensor data once every minute to a single
remote base station. Most sensors are mounted on lamp posts,
but some are also mounted on citybuses.
2. A WSN is used to measure humidity in a field, where low-power
sensors report measurements only when certain thresholds are
exceeded.
3. A WSN is used to detect the presence of vehicles, where each
sensor locally records the times of vehicle detection. These
records are delivered to the base station only when the sensor is
explicitly queried.
Answer
Scenario 1: A WSN is used to monitor air
pollution in a city where every sensor
reports its sensor data once every minute to
a single remote base station. Most sensors
are mounted on lamp posts, but some are
also mounted on city buses
Most of the sensors are static, application
requires periodical traffic. I would choose a
proactive approach.
Answer
Scanario 2: A WSN is used to measure humidity in
a field, where low-power sensors report
measurements only when certain thresholds are
exceeded.
It’s a event-driven communication paradigm, the
application does not seem to have real-time
requirements. I would choose a reactive approach.
Answer
Scenario 3: A WSN is used to detect the presence
of vehicles, where each sensor locally records the
times of vehicle detection. These records are
delivered to the base station only when the sensor
is explicitly queried.
Communication is completely asynchronous. I
would choose a reactive approach.
Exercise 2
For the given network topology find the optimal routes from A
to M under the following criteria. The numbers X/Y aside each
link represent the latency and the energy budget to transmit a
single packet. The other number Z below each node is the
residual energy capacity.
Minimum Number of hops
Minimum Energy consumed per packet
Shortest Latency
Maximum Minimum Energy Capacity
Solution
Minimum Number of Hops
It is easy to see that the path with minimum
number of hops is:
A-E-G-J-M
The path has the following features:
Total latency: 1+3+1+5=10
Total Energy Consumption: 2+3+3+5=13
Solution
Minimum Energy Consumed per packet
We have to find the shortest path on a graph
whose edges are weighted with the consumed
energy
5 1
1 2 2 2
2 3 3 5
1 1 1 1 2 1 2 1
Short Digression on Shortest Paths
Given G(N,A) and two nodes i
and j, find the path with
minimum length
The problem has polynomial
complexity in the number of nodes
Property:
If node k is traversed by the shortest
path from i to j, also the path from i to
k is the shortest
Most Common Algorithms
Bellman-Ford (basic)
Assumptions: positive/negative weights
Complexity: O(N3)
Dijkstra (basic)
Assumptions: only positive weights
Complexity: O(N2)
Dijkstra Algorithms
Assumptions:
Positive weighted edges
Target:
Find out the shortest paths from a source (1) and
all the other nodes
Initialization:
P 1,
D1 0, D (j 0 ) d1 j j 1
dij= if the edge i-j does not exist
Dijkstra Algorithm
1. find i (N-P) :
Di min D j
j( N P )
and set
P: P
i . If P N , then STOP.
2. for each j (N-P) neighbor of any node in P set :
D j min D j , min Dk d kj
kP
3. Go To 1.
Dijkstra in practice
Each node is assigned a label (n, L) where n is
the next hop on the path and L is the current
minimum path length
At each algorithm step, each node neighboring
with any node in P updates its label looking at
its P-neighbors’ labels
At each algorithm step, the node with the
lowest minimum path length is added to set P
When all the nodes are in P shortest path tree
can be built
Solution
(A, 10) (G, 7) (K, 3) (M, 2)
(D, 12) (G, 7) (K, 3) (M, 2)
(-, ) 5
(-, ) (-, ) (-, )
1
C (F, 7) D H K
(H, 5) (L, 3)
1 (F, 7) 2 2 (L, 3) 2
(G, 8) (H, 5)
(E, 9) (M, 5)
(-, ) (-, )
(E, 9) 2 3 3 (-, ) 5
(-, ) A E G J M (M, 0)
1 1 1 1 2 1
1 2
B F I L
(-, ) (-, ) (-, ) (-, )
(E, 8) (G, 6) (J, 4) (M, 1)
(J, 4)
The min-energy route is: A-E-F-G-H-K-M
Solution
Shortest Latency: the solution is similar to
the previous case. The weights to be
considered in the shortest path calculation
change.
3 4 6 5
7 4 1
8 8 2 4
Solution
Alternative approach:
Node G “must” be in the route
Eliminate all the nodes which have lower
energy budget than G
If a path between A and M exists, that’s the
one with maximum minimum energy capacity
Exercise 3
A WSN has a 5x5 grid topology. Nodes can
communicate only with neighboring nodes.
A packet transmission or forwarding costs 1
unit of energy (null consumption due to
processing and reception). Find the energy
optimal routes for both topologies.
Solution
Being the energy cost equal to 1, finding the
minimum energy tree is equivalent to
finding the min-hop shortest path tree
Exercise 4
Consider the following network topologies. What is the average and total load
in the network when the per-node load is calculated as the number of routes
each node has to service (including its own)
What is the network lifetime of both topologies if:
A node transmits in 1 second time frame its packet and all the packets it has received
from its neighbors in the previous second
Each node has a energy budget of 100
Each transmission costs 1
Null reception and processing energy
Solution
The average per-node load can be obtained
by counting the traffic instances each node
manages.
Time Time
Tx 1pkt 4pkt 8pkt 12pkt 12pkt ……. Tx 1pkt 2pkt 3pkt 5pkt 8pkt 12pkt 15pkt 17pkt…
The two bottleneck nodes will die out during the 11-th second
Exercise 5
Consider the WSN reported in the figure.
Suppose the WSN is operated by the RPL A
2 3
protocol. Links among nodes represent 1.2
reachability and numbers aside each link B C
represent the corresponding ETX 1 1 4
Find a DODAG routed in A which is built D 3 E 1.5 F
with following objective function: “To
minimize the ETX along the established
paths”
Find a tree routed in A built according to
the following routing objective function:
“To minimize the ETX along the
established paths under the constraints
that the minimum per-link ETX is lower
than 2”
Solution
Find a DODAG routed in A which is built with
following objective function: “To minimize the
cumulative ETX along the established paths”
A A
2 3 2 3
1.2 1.2
B C B C
1 1 4 1 1 4
D E F D 3 E 1.5 F
3 1.5
Solution
Find a tree routed in A built according to the
following routing objective function: “To minimize
the ETX along the established paths under the
constraints that the minimum per-link ETX is lower
than 2”
All the links with ETX higher than 2 don’t have to be
considered for routing
The resulting graph is
A A already a tree
2 3 2
1.2 1.2
B C B C
1 1 4 1 1
D 3 E 1.5 F D E 1.5 F
Exercise 6
A routing protocol for WSNs leverages the
expected transmission count (ETX) as a routing
metric. To this end, two nodes, A and B, at the
vertices of a link probe the quality of the link
by sending out 100 [byte] probing packets
which are acknowledged (if correctly received)
through explicit ACKs of 10 [byte].
Assuming that the Bit Error Rate (BER) is
p=0.005 in both directions, find out the ETX
measure for the link (assume independent
errors bit by bit)
Solution
A B
(k 1) P (1 P )
* * k
k 0
RTT