Wireless Sensor Networks Routing M. Schölzel
Network in computer science Network is a graph G = (V,E) V set of all nodes E set of all edges: (v 1,v 2 ) E V 2 V = { A, B, C,... } E = { (A,B), (B,C), (C,F),... } Routing Find a (the best) path from source to destination WSN graph idealized model connectivity is function of time nodes mobility varying environmental conditions asymmetric links (directed graph) D A B I H C G F M L K E Q P U R O J W T N V S 2
Routing in wireless networks Motivation Radio range limited, direct communication source-sink impossible... J I H E...multi hop communication required A B C D F G Routing necessary Find (optimal) route to destination on source.....and on intermediates nodes (forwarding) 3
Routing in wireless networks Motivation Direct communication sometimes possible J H Multi hop communication (often) more energy efficient than a direct one TX energy ~ distance α (α >= 2) A B I C E F G D 4
Example Recall Friis Equation: PP rrxx = PP tttt GG tt GG rr λλ² (4ππ)² ddd LL Suppose P tx = 20 mw and d = 200 m PP rrxx = PP tttt CC ddd, where C = GG tt GG rr λλλ (4ππ)² LL 0,0025 P tx = 20 mw 200 m P rx = 0,00000125 mw For d = 50 m, P tx = 1,25 sufficient: P tx = 5 mw P tx = 1,25 mw P tx = 1,25 mw P tx = 1,25 mw P tx = 1,25 mw 50 m 50 m 50 m 50 m P rx = 0,00000125 mw
Forwarding Schemes Forwarding = Passing on packets Simple Forwarding schemes do not take into account the network topology Flooding, Gossipping, Controlled Flooding Routing schemes make use of the knowledge of the network topology In routing schemes for wired networks the topology changes rarely In WSNs ad hoc routing required, that is: able to cope with frequent changes self-configuring distributed and have low overhead ad hoc routing are classified into table driven protocols (proactive) Maintaining accurate information in the routing tables (task of the routing algorithm with the help of the routing protocol) on-demand do not attempt to maintain the routing tables construct a path if required
Simple Forwarding Flooding Forward an incoming packet to all neighbors use the implicit broadcasting property of a wireless channel Avoid packet circulation forward only packets not seen before, requires unique source identifier sequence numbers expiration date (time to life, maximal number of hops, helpful if the destination node is not reachable) Gossiping Forward the packet randomly to an arbitrary single neighbor hoping that it will sometime reach the destination Controlled flooding: forwarding to some neighbors Flooding with Randomized forwarding, e.g. forward only with a certain probability (< 65 75%)
Routing maintenance Routing: additional information required (e.g. neighbours, network topology,...) Routing information exchanged with other nodes What information? With which nodes exchanged? D A B I H G C M L K F E Q P U R O J W T N V S How to determine route? Usually routing tables 8
Distance Vector Routing Called Bellman-Ford (1957), Routing Information Protocol (RIP) in Internet each node maintains routing table (no topology graph) Routing table for a node dest next distance C B 2 G B 2 B B 1 L J 3 nodes known distances (hops, delay...) to their neighbours periodically distance vectors sent to all neighbours Routing table determined from received distance vectors 9
Count To Infinity Problem DVR is sensitive to loop formation A B C D E 10
Count-to-infinity solution Mitigation by split horizon (do not advertise a route back to a neighbor from which it was received) avoids direct loops, but no longer loops General Count-to-infinity solution sequence numbers sequence numbers origin from destination contained in update packets and routing tables update a route only, if the sequence number is newer destination source A B C D E B does not update its route 11
Collection Tree Protocol Application: Collect information in a WSN at a single/multiple sink node(s) the sink becomes the root of a tree nodes forward messages towards the sink multiple sinks are allowed B C D S E Each node selects among its neighbors that one that has lowest cost to the sink Proactive distance vector routing protocol Any-cast protocol when using multiple sinks, no specific root node can be selected data packet may any/multiple sink(s) A G F
Routing Beacons Each node A informs its neighbors periodically about its cost to reach a sink: P C Parent ETX CTP Routing Frame Parent: address of the current parent of A if A does not have a valid parent node it sets Parent to invalid (e.g., 0xFFFF) ETX: estimated and accumulated costs from A to the sink P: pull bit is set, if a node A does not have a parent anymore Neighbors of A should send immediately beacons, such that A gets a new parent soon Nodes that receive a Routing Frame update their routing table
Beacon Interval Beacon rate t is dynamically adapted Initialized with t := t min in TinyOS: t min = 64 ms if t min is too small, then too many collisions occur next time r to send a beacon is selected randomly from interval [t,2 t] Then t is updated: t := min{2 t, t max } TinyOS: t max = 256 s t max guarentees for low traffic if the links become stable In order to increases reactivity of the network to changes, t := t min, if particular events occur: packet with pull-bit is received inconsistency in the network topology is detected (loops)
Link Estimation ETX (a,b) denotes the estimated link quality of a single hop from a to b 1, iiiiqqqqqq (aa,bb) QQQQQQQQ aa,bb = 0 EEEEEE (aa,bb) = 1 QQQQQQ (aa,bb) QQQQQQQQ, ooooooooooooooooo aa,bb where Qin (a,b) is the packet loss rate from b to a Qout (a,b) is the packet loss rate from a to b Example: Qin (a,b) Qout (b,a) ETX (a,b) 0 0 1 0,97 0,97 1,063 0,8 0,8 1,56 0,5 0,5 4 0,44 0,44 5,2
Link Estimation Estimating Qin (A,B) at node A is simple node B adds to each packet the number of previously sent packets (sequence_number) destined to A Node A records number of received packets from B QQQQQQ (AA,BB) = nnnnnnnnnnnn_oooo_rrrrrrrr_pppppppppppppp ssssssssssssssss_nnnnnnnnnnnn A sequence_number How can A estimate Qout (A,B)? A must know how many packets will be received successfully from B Option 1: Count the received ACK-packets. Option 2: Use the Link Estimation Exchange Protocol (LEEP) B
LEEP Link Estimation Exchange Protocol (LEEP) Frame: LEEP Header CTP Beacon Payload LI entry 1 LI entry n n resvd sequence_no node_id link quality Qout (A,B) of A is determined by B as Qin(B,A) and send back to A in the corresponding LI entry QQQQQQ (AA,BB) = nnnnnnnnnnnn_oooo_rrrrrrrr_pppppppppppppp ssssssssssssssss_nnnnnnnnnnnn QQoooooo (AA,BB) LI entry contains Qin (B,A) from B A finds its Qout (A,B) in an LI entry of a beacon A B QQQQQQ (BB,AA) = nnnnnnnnnnnn_oooo_rrrrrrrr_pppppppppppppp ssssssssssssssss_nnnnnnnnnnnn
Estimating the packet loss rate Each node Z maintains a Link Estimation Table (LE-table) for its neighbors A, B, C, mature is initialized as invalid (node cannot be selected as parent) Neighbor X Qin (Z,X) Qout (Z,X) mature ETX 1hop A B A B Z C Qin is updated after receiving K packets from neighbor X If Qin holds already a valid value then Qin new := a Qin old + (1-a) Qin (Z,X) mature is set to valid Qout is updated from LI-entry in received packets ETX 1hop is updated based on the received beacons ETX b = ETX (Z,X) data frames ETX d = (data_frames_acknowledged / data_frames_sent) ETX 1hop := a ETX 1hop + (1-a) ETX x, where x Î {b,e} updated after sending a single data frame or K beacons
Routing Table Each node maintains a routing table and its current costs to reach the sink ETX Upon receiving a beacon the routing table is updated R Next hop Parent ETX C B C 2 D R 6 LEEP Frame B D E current ETX of a node: ETX from routing table + ETX from LE table P C Parent ETX Beacon Periodically each node selects a new parent e.g. every 8 seconds if a beacon is send if the current parent node is no longer reachable (no ACK if data frame is send) A current ETX from B G F
Election of the new Parent Node A wants to select a new parent Among all nodes in A s routing table with valid parent node Select node X from the routing table for which ETX x + ETX 1hop is minimal and ETX 1hop < 5 corresponding entry in the LE table must be mature parent node of X must be distinct from A (avoid loops of length 2) If there is such a node X, then A selects X only as new parent, if this reduces the current ETX value at least by factor 1.5 this avoids too many topology changes
Data Transmission Frame Format P, C, ETX have the same meaning as in Beacons THL: Time has lived, incremented on each hop origin: Address of the source node sequno: sequence number of the data packet collect_id: may be used by higher protocol layers for assigning a type to the packet 0 8 15 P C reserved THL seqno ETX Origin data collect_id
Data Transmission Each node has a transmit buffer for data packets 12 entries in TinyOS for forwarding 1 entry for each local client of the node if the buffer is full, new data packets will be discarded Transmission works synchronously an ACK is expected before the next packet will be transmitted if no ACK is received within time t ack, then retransmission is retried up to 30 times After successful transmission the next packet is not transmitted before time t nack this should give node C enough time for forwarding, without interfering with the next transmission from A at B A B C D
Duplicate Detection Duplicates can occur, if an ACK is not received in theory this may creates an exponential grow of the number of packets two packets are considered as duplicates, if they match in the fields THL, origin, seqno, collect_id are equal these fields will be set by the original node and not changed on the path 0 8 15 P C reserved THL ETX Origin seqno collect_id data
Duplicate Handling Before a packet is put into the transmit buffer it will be checked if it is a duplicate compare with packets in the transmit buffer compare with packets in the transmit cache Transmit cache is used to keep track of packets that were already successfully transmitted only the parameters THL, origin, seqno, collect_id for duplication detection are stored
Loop Control As Distance Vector Routing CTP is sensitive to loop formation Example Next hop Parent ETX ETX 1hop Next hop Next hop R - 0 1 Parent ETX ETX 1hop C R 1 1 G A 4 1 D R 3 3 Parent ETX ETX 1hop B C 2 1 Next hop A B C G Parent ETX ETX 1hop R D E F B cannot reach C B selects a new parent node A B C G R D E F A B 3 1
Loop Detection in CTP Data packets contain the ETX value of the current transmitter This value should become smaller on each hop A receiver of a packet can detect a loop, if the received ETX value is smaller than its own ETX value It reduces its beacon interval to t min and sends its new costs to all neighbors This propagates the new costs of B to A Next hop Parent ETX ETX 1hop R - 0 1 R Next hop Next hop Parent ETX ETX 1hop G A 4 1 D R 3 3 Parent ETX ETX 1hop B C 2 1 Next hop A B C ETX=5 ETX=3 ETX=4 G Parent ETX ETX 1hop E D F B cannot reach C A B 3 1
Loop Detection in CTP Up on loop detection, the receiver reduces its beacon interval to t min and sends its new costs to all neighbors Next hop Parent ETX ETX 1hop R - 0 1 R Next hop Parent ETX ETX 1hop C G A 4 1 E D R 3 3 B D New costs of B are propagated to A Next hop Parent ETX ETX 1hop B C 5 1 A G F New costs of A are propagated to G Next hop Parent ETX ETX 1hop A B 6 1 D R 3 2
Loop Detection in CTP Costs in the loop are continuously increased until one node selects another parent node outside the loop Next hop Parent ETX ETX 1hop R - 0 1 R Next hop Parent ETX ETX 1hop C G A 4 1 D R 3 3 B D E Next hop Parent ETX ETX 1hop B C 5 1 A G F G selects a new parent node Next hop Parent ETX ETX 1hop A B 6 1 D R 3 2
Routing in ZigBee Topology determines the routing algorithm: Mesh: AODV Tree routing 29
ZigBee TreeRouting 1 PAN coordinator Each node must join the network (PAN or router) End-device gets address Router gets address + range of addresses for children Routing based on addresses: Forward to children if there s a child with the address Otherwise, forward to parent 30
Source sends route request (RREQ) Intermediate nodes record (memory) where RREQ came from required for reverse path Destination sends back directed route reply (RREP) reverse path used Intermediate nodes activate route routing table Ad Hoc On-Demand Distance Vector Routing (AODV) 31
Proactive vs. Reactive Protocols Proactive Reactive Maintain routing structures (routing tables, network graph) continually periodically on event (topology change) Route updates sent even when no data traffic overhead Do nothing when no data traffic Find path shortly before data transmission 1. Discover path (routing packets) 2. Transmit data Referred to as table-driven Referred to as on-demand 33
Summary Advantages: Proactive No delays before data transmission Advantages: Reactive Overhead proportional to data transmission mostly much smaller than proactive Drawbacks: Large protocol overhead Drawbacks: Delay before data transmission 34