Evaluation of an Algorithm used in Routing and Service Discovery Protocols of Wireless Sensor Networks The Trickle Algorithm Markus Becker mab@comnets.uni-bremen.de ComNets, TZI, University Bremen, Germany 19th of October 2012 Becker: FFV, TUHH, October 2012 1 / 29
Outline IETF Protocol Stack for Wireless Sensor Networks Routing Protocol for Low power and Lossy Networks Trickle Algorithm Simulation Analytical Model Evaluation Conclusions & Outlook Becker: FFV, TUHH, October 2012 2 / 29
The Internet Engineering Task Force protocol stack for Wireless Sensor Networks Becker: FFV, TUHH, October 2012 3 / 29
The Internet Engineering Task Force protocol stack for Wireless Sensor Networks 802.3 USB 802.15.4 WSN node Border Router Node Border Router Host Internet Host 6LoWPAN: IPv6 over Low power Wireless Personal Area Network AM: Active Messaging CoAP: Constrained Application Protocol IP: Internet Protocol MAC: Medium Access Control PHY: Physical Layer PPP: Point-to-Point Protocol RPL: Routing Protocol for Low power and Lossy Networks TCP: Transmission Control Protocol UDP: User Datagram Protocol WSN: Wireless Sensor Network Becker: FFV, TUHH, October 2012 3 / 29
The Internet Engineering Task Force protocol stack for Wireless Sensor Networks PPP Interface 802.3 USB 802.15.4 WSN node Border Router Node Border Router Host Internet Host 6LoWPAN: IPv6 over Low power Wireless Personal Area Network AM: Active Messaging CoAP: Constrained Application Protocol IP: Internet Protocol MAC: Medium Access Control PHY: Physical Layer PPP: Point-to-Point Protocol RPL: Routing Protocol for Low power and Lossy Networks TCP: Transmission Control Protocol UDP: User Datagram Protocol WSN: Wireless Sensor Network Becker: FFV, TUHH, October 2012 3 / 29
The Internet Engineering Task Force protocol stack for Wireless Sensor Networks PPP Interface 802.3 USB 802.15.4 WSN node Border Router Node Proxy Internet Host 6LoWPAN: IPv6 over Low power Wireless Personal Area Network AM: Active Messaging CoAP: Constrained Application Protocol IP: Internet Protocol MAC: Medium Access Control PHY: Physical Layer PPP: Point-to-Point Protocol RPL: Routing Protocol for Low power and Lossy Networks TCP: Transmission Control Protocol UDP: User Datagram Protocol WSN: Wireless Sensor Network Becker: FFV, TUHH, October 2012 3 / 29
Routing Protocol for Low power and Lossy Networks IETF RFC 6206 and 6550...6554 RFC 6206: The Trickle Algorithm RFC 6550: Routing Protocol RPL RFC 6551: Routing Metrics RFC 6552: Objective Function RFC 6553: IPv6 Option for RPL RFC 6554: IPv6 Routing Header for RPL Low power and Lossy Networks (LLN) consist Border Router (BR), Router (R) and Host (H) nodes H choose only the default router RPL operates only within an LLN and terminates at BR Proactive distance-vector approach, uses graph structure Becker: FFV, TUHH, October 2012 4 / 29
RPL: Upward Routes DIO: Destination-Oriented Directed Acyclic Graph Information Object DIO announces upward routes (Routes to the BR) DIOs are sent using the Trickle algorithm (RFC 6206) Becker: FFV, TUHH, October 2012 5 / 29
Trickle Algorithm: Variables and Constants Variables τ Communication interval length T Timer value in range [τ/2, τ] C Communication counter Constants K Redundancy constant τ L Lowest τ τ H Highest τ Note: Notation according to the original Trickle paper: P. Levis, N. Patel, D. Culler, S. Shenker: Trickle: A Self-Regulating Algorithm for Code Propagation and Maintenance in Wireless Sensor Networks in NSDI 04 Proceedings. Becker: FFV, TUHH, October 2012 6 / 29
Trickle Algorithm: Rules τ expires Double τ, up to τ H, pick a new T from range [τ/2, τ] T expires If C < K, transmit Received consistent data Increment C Received inconsistent data Set τ to τ L. Reset C to 0, pick a new T from [τ/2, τ] Becker: FFV, TUHH, October 2012 7 / 29
Simulation Scenarios Line scenario with Closest Pattern Matching Propagation Model ( Line-CPM ) Grid scenario ( Grid ) Varying number of nodes Varying inter-node distances / scenario size Becker: FFV, TUHH, October 2012 8 / 29
Simulation Execution TinyOS application with 6LoWPAN implementation blip Simulation tool TOSSIM blip extended for simulations Monte-Carlo iterations for each scenario instance Becker: FFV, TUHH, October 2012 9 / 29
Analytical Models Number of Messages Consistency Time Becker: FFV, TUHH, October 2012 10 / 29
Analytical Models Number of Messages Consistency Time Becker: FFV, TUHH, October 2012 10 / 29
Trickle Algorithm Trickle algorithm in Line-Direct scenario: 0. Hop 1. Hop 2. Hop 3. Hop 0 τ L Becker: FFV, TUHH, October 2012 11 / 29
Analytical Model: Consistency Time Modelling consistency time for the Line scenario (1) 0. Hop: No Delay 1. Hop: Uniformly distributed delay 2. Hop: Addition of 2 uniformly distributed delays -> Triangle 3. Hop: Addition of 1 uniformly distributed delay and triangle 1 1 1 τl 2τL 3τL τl 2τL 3τL τl 2τL 3τL τl 2τL 3τL Central limit theorem: mean of summation of i.i.d. random variables, each with finite mean and variance, will be approximately normally distributed Becker: FFV, TUHH, October 2012 12 / 29
Analytical Model: Consistency Time Modelling consistency time for the Line scenario (1) 0. Hop: No Delay 1. Hop: Uniformly distributed delay 2. Hop: Addition of 2 uniformly distributed delays -> Triangle 3. Hop: Addition of 1 uniformly distributed delay and triangle 1 1 1 τl 2τL 3τL τl 2τL 3τL τl 2τL 3τL τl 2τL 3τL Central limit theorem: mean of summation of i.i.d. random variables, each with finite mean and variance, will be approximately normally distributed (1/4) 1/4 1/4 1/4 τl 2τL 3τL 1 τl 2τL 3τL Becker: FFV, TUHH, October 2012 12 / 29
Analytical Model: Consistency Time The probability density function (pdf) of the time to consistency scenario can be modeled in detail by p(t) = 1 N 1 C 1 N 1 N f h,c,a (t) p h,c,a (t), where h=0 c=0 a=1 h: hops c: Trickle cycle a: number of 1-hop ancestors closer to source N: total number of nodes C: maximum number of Trickle cycles to take into account Becker: FFV, TUHH, October 2012 13 / 29
Analytical Model: Consistency Time p(t) = 1 N N 1 C 1 N 1 h=0 c=0 a=1 f h,c,a (t) p h,c,a (t), where δ(t), h = 0, L 1 {L{Θ(t τ L 2 ) Θ(t τ L )} h }, h 1, c = 0 Θ(t τ L (2 c+1 1) τ L f h,c,a=1 (t) = 2 2 c ) Θ(t τ L (2 c+1 1)), h = 1, c 0 L 1 {L{Θ(t τ L 2 ) Θ(t τ L )} h c L{Θ(t 2τ L ) Θ(t 3τ L )} c }, h > 1, 0 < c < h. Θ( ) denotes the Heaviside step function. L denotes the Laplace transform and L 1 denotes the inverse Laplace transform. Becker: FFV, TUHH, October 2012 14 / 29
Analytical Model: Consistency Time f h,c,a (t) p(t) 1.0 0.9 0.8 0.7 0.6 0.5 Distributions p h,c,a (t) h=1, a=0 c= 0 1 2 3 4 p(t) 1.0 0.9 0.8 0.7 0.6 0.5 Distributions p h,c,a (t) c=0, a=0 h= 0 1 2 3 4 5 6 7 8 0.4 0.4 0.3 0.3 0.2 0.2 0.1 0.1 0.0 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 t [s] 0.0 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Time t [s] Becker: FFV, TUHH, October 2012 15 / 29
Analytical Model: Consistency Time f h,c,a (t) Distributions p h,c,a (t) c=0 p(t) 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 h=0, a=0 h=0, a=1 h=0, a=2 h=1, a=0 h=1, a=1 h=1, a=2 h=2, a=0 h=2, a=1 h=2, a=2 h=3, a=0 h=3, a=1 h=3, a=2 h=4, a=0 h=4, a=1 h=4, a=2 h=5, a=0 h=5, a=1 h=5, a=2 h=6, a=0 h=6, a=1 h=6, a=2 h=7, a=0 h=7, a=1 h=7, a=2 h=8, a=0 h=8, a=1 h=8, a=2 The distribution for a 1 can be calculated from the cdf given by 1 (1 P(X x)) a of the cdf for a = 1. 0.1 0.0 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Time t [s] Becker: FFV, TUHH, October 2012 16 / 29
Analytical Model: Consistency Time f h,c,a (t) 1.0 0.9 0.8 0.7 Distributions p h,c,a (t) h=2, a=0 c= 0 1 2 3 4 5 1.0 0.9 0.8 0.7 Distributions p h,c,a (t) h=3, a=0 c= 0 1 2 3 4 5 p(t) 0.6 0.5 p(t) 0.6 0.5 0.4 0.4 0.3 0.3 0.2 0.2 0.1 0.1 0.0 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Time t [s] 0.0 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Time t [s] Figure: Probability Density Function for h = 2, a = 0, c varied Figure: Probability Density Function for h = 3, a = 0, c varied Becker: FFV, TUHH, October 2012 17 / 29
Analytical Model: Consistency Time p h,c,a (t) 1.00 0.95 0.90 Packet Receive Ratio 0.80 PRR1 PRR1 PRR1 0.70 0.60 PRR2 PRR3 PRR2 PRR 0.50 0.40 0.30 0.20 0.10 0.05 0.00 0 20 40 60 80 100 120 140 160 180 Distance [m] Becker: FFV, TUHH, October 2012 18 / 29
Algorithm for Analytical Model calc_base_dists() calc_prr() calc_neigh(prr) calc_tx_outcomes(neighbors, prr) calc_hopcounts(prr, inject_node, trickle_k, neighbors, scenario) calc_hopcounts_next_cycles(hopcounts) calc_neighbors_hop_closer(hopcounts, prr, trickle_k) calc_prob_mix_from_hopcount(hopcounts) calc_timeseries(prob_mix, distributions) plot_graphs(timeseries) Becker: FFV, TUHH, October 2012 19 / 29
Simulation & Analytical Model: Parameters The Trickle settings for the following results are: τ L = 2 s τ H = 32 s K = 1, 3, or 9 Becker: FFV, TUHH, October 2012 20 / 29
Simulation & Analytical Model: Line 9, K = 1 Nodes consistent P(T t) 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 Model Time to Consistency (cdf) (#Nodes: 9, K: 1) 0.0 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Model Time t [s] Distance [m] 10 20 30 40 50 60 70 80 90 100 110 115 120 125 130 135 140 145 analytical simulated Becker: FFV, TUHH, October 2012 21 / 29
Simulation & Analytical Model: Line 9, K = 3 Nodes consistent P(T t) 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 Model Time to Consistency (cdf) (#Nodes: 9, K: 3) 0.0 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Model Time t [s] Distance [m] 10 20 30 40 50 60 70 80 90 100 110 115 120 125 130 135 140 145 analytical simulated Becker: FFV, TUHH, October 2012 22 / 29
Nodes consistent P(T t) Simulation & Analytical Model: Line 9, K = 9 Model Time to Consistency (cdf) (#Nodes: 9, K: 9) 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0.00 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Model Time t [s] Distance [m] 10 20 30 40 50 60 70 80 90 100 110 115 120 125 130 135 140 145 analytical simulated Becker: FFV, TUHH, October 2012 23 / 29
Simulation & Analytical Model: Line 16, K = 3 Nodes consistent P(T t) 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 Model Time to Consistency (cdf) (#Nodes: 16, K: 3) 0.0 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Model Time t [s] Distance [m] 10 20 30 40 50 60 70 80 90 100 110 115 120 125 130 135 140 145 analytical simulated Becker: FFV, TUHH, October 2012 24 / 29
Simulation & Analytical Model: Line 25, K = 3 Nodes consistent P(T t) 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 Model Time to Consistency (cdf) (#Nodes: 25, K: 3) 0.0 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Model Time t [s] Distance [m] 10 20 30 40 50 60 70 80 90 100 110 115 120 125 130 135 140 145 analytical simulated Becker: FFV, TUHH, October 2012 25 / 29
Simulation & Analytical Model: Grid 9, K = 3 Nodes consistent P(T t) 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 Model Time to Consistency (cdf) (#Nodes: 9, K: 3) 0.0 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Model Time t [s] Distance [m] 10 20 30 40 50 60 70 80 90 100 110 115 120 125 130 135 140 145 analytical simulated Becker: FFV, TUHH, October 2012 26 / 29
Simulation results and 95% confidence intervals Nodes consistent P(T t) 1.0 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 Model Time to Consistency (cdf) (#Nodes: 9, K: 3) 95 % Confidence Interval Distance [m] 10 100 20 110 30 115 40 120 50 125 60 130 70 135 80 140 90 145 0.0 0 2 4 6 8 10 12 14 16 18 20 22 24 26 28 Model Time t [s] Becker: FFV, TUHH, October 2012 27 / 29
Trickle/Push Comparison Trickle Push t push = 3 s t push = 5 s t push = 39 s t 95% 29.4 s 27.9 s 36.4 s 169.1 s t max 34.9 s 33.0 s 47.0 s 240.5 s Packets until consistent 176 714 196 415 Packets in steady state 2.6 1 s 33.3 1 s 20 1 s 2.6 1 s Trickle Settings: τ L = 2s, τ H = 32s, K =3 Scenario: Grid with 100 nodes Becker: FFV, TUHH, October 2012 28 / 29
Conclusions & Outlook Conclusions Implemented and studied the Trickle algorithm Important algorithm for RPL and distribution of other information Distributes faster and more-efficient than fixed-interval pushing First analytical model of Trickle algorithm Model for delay distribution was shown here Model for number of sent packets exists as well Analytical delay model fits simulation results Outlook Execute measurements and compare against simulation and analytical model Becker: FFV, TUHH, October 2012 29 / 29