490 likes | 508 Vues
Lecture 4: Routing. Anish Arora CIS788.11J Introduction to Wireless Sensor Networks Material uses slides from Wattenhofer, Gouda, Estrin. Routing Overview. Patterns: Convergecast one shot subscription or persistent subscription subscriber in-network or from base station
E N D
Lecture 4: Routing Anish Arora CIS788.11J Introduction to Wireless Sensor Networks Material uses slides from Wattenhofer, Gouda, Estrin
Routing Overview • Patterns: • Convergecast • one shot subscription or persistent subscription • subscriber in-network or from base station • if in-network and one-shot subscriber, then subscriber could be moving • Broadcast • potentially directed/local • potentially with feedback (PIF) • potentially scoped (e.g. data centric routing)
Routing Overview • Model assumptions: • Availability of locations • Density/planarity • Node/link heterogeneity • Requirements: • Latency • Reliability • Energy • Scalability • Convergence
Convergecast Protocol Classification • Distance vector protocols • Key issues: • Link selection • Route metric: • Expected number of transmissions on path • Expected transmission time • Distance advanced towards destination • Greedy protocols: issue of dealing with holes • Geometric protocols • Randomized protocols • Gradient-descent protocols • Multi-path protocols, even flooding • Hierarchical protocols (potentially exploiting clusters)
Location-based/Geometric/Geographic Convergecast • Sensor nodes addressed according to their locations • No routing tables stored in nodes!
Correct Geometric Routing: Face Routing • [Kranakis, Singh, Urrutia CCCG 1999]
Face Routing • Remark: Planar graph can easily (and locally!) be computed with the Gabriel Graph, for example
Face Routing s t
Face Routing s t
Face Routing s t
Face Routing s t
Face Routing s t
Face Routing s t
Face Routing s t
“Right Hand Rule” Face Routing Properties • All necessary information is stored in the message • Source and destination positions • Point of transition to next face • Completely local: • Knowledge about direct neighbors’ positions sufficient • Faces are implicit • Planarity of graph is computed locally (not an assumption) • Computation for instance with Gabriel Graph
Efficiency in Face Routing • Theorem: Face Routing reaches destination in O(n) steps • But: Can perform poorly compared to the optimal route • Need to bound search area adaptively
Grid Routing Key ideas: • Embeds tree in logical grid • Well suited for bursty convergecast traffic • Avoids fast link reliability estimation • Preselects innerband links • Focuses only on up/down link detection • Attempts to spread load uniformly • Parent chosen randomly and rotated periodically • Deals with holes randomly • Cycles avoided by limiting number of diversions • Base station snoops
The Logical Grid • The motes are named as if they form an M*N logical grid • Each mote is named by a pair (i, j) where i = 0 .. M-1 and j = 0 .. N-1 • The base station is mote (0,0) • Physical connectivity between motes is a superset of their connectivity in the logical grid: (0,1) (0,1) (1,1) (2,1) (2,1) (1,1) (2,0) (0,0) (1,0) (2,0) (0,0) (1,0)
Potential Parents • A mote (i, j) dominates another mote (x, y) iff i≥x and j≥y • If (i, j) dominates (x, y), then distance from (i, j) to (x, y) is (i-x)+(j-y) • Let H be a “small” positive integer, called the hop size A potential parent of a mote (i, j) is a mote (x, y) such that • (i, j) dominates (x, y) and • distance from (i, j) to (x, y) = H (except in special cases where (i,j) is close to some edge of the grid)
Communication Pattern • Each mote (i, j) can send msgs whose ultimate destination is mote (0, 0) • The motes need to maintain an incoming spanning tree whose root is (0, 0): each mote maintains a pointer to its parent • When a mote (i, j) has a msg, it forwards the msg to its parent. This continues until the msg reaches mote (0, 0) (H = 2)
Protocol Message • When a mote (i, j) has a parent, then every random period, whose average is 20 seconds, mote (i, j) sends the msg: connected(i, j) Otherwise, mote (i, j) does nothing • Every random period, whose average is 20 seconds, mote (0, 0) sends the msg: connected(0, 0)
Maintaining a Parent • Initially, no mote has a parent • When a mote (i, j) receives a connected(x, y) msg, where (x, y) is a potential parent of (i, j), (i, j) makes (x, y) its (new) parent • Thus, the parent of a mote is changed, in a round robin fashion, among the active potential parents of that mote – load balancing and fast fault recovery
Losing the Parent • If a mote (i, j) does not receive any connected(x, y) msg from any of its potential parents for 120 seconds, then (i, j) loses its parent • If a mote (i, j) has no parent and receives a connected(x, y) msg, where (x, y) is not a potential parent of (i, j), then (i, j) makes (x, y) its “foster parent” but (i, j) will not send connected(i, j) msgs as long as (i, j) has no parent
Using the Routing Protocol • When a mote (i, j) has a data msg to forward, it checks whether (i, j) has a parent or a foster parent • if (i, j) has a parent or a foster parent (x, y), (i, j) sends a data(x, y) msg, intended for (x, y) • otherwise, (i, j) discards the data msg • A mote (i, j) has a data msg to forward iff either the mote itself has generated the msg or it has received the data(i, j) msg
Using the Routing Protocol by the Root • When mote (0, 0), the base station, receives any data(x, y), it forwards the msg text to its resident application (the base station snooping)
Grid Routing in Exscal • Each mote is assigned three potential parents for a base station, based on a location of a mote in a logical grid • A mote reads potential parent information from internal flash. • “Potential Parents” session will cover how to compute potential parents for each mote in the demo topology • Provide primary and secondary base stations for each mote - overcome a base station failure • A sensor can be connected to the secondary base station, only when its primary base station fails • Connected message format connected(myID, currentBaseStationID)
Data-centric routing • Sensor networks can be considered as a virtual database • Implement query-processing operators in the sensor network • Queries are flooded through the network (or sent to a representative set of nodes) • In response, nodes generate tuples and send matching tuples towards the origin of the query • Intermediate nodes may merge responses or aggregate
Directed Diffusion • Protocol initiated by destination (through query) • Data has attributes ; sink broadcasts interests • Nodes diffuse the interest towards producers via a sequence of local interactions • Nodes receiving the broadcast set up a gradient (leading towards the sink) • Intermediate nodes opportunistically fuse interests, aggregate, correlate or cache data • Reinforcement and negative reinforcement used to converge to efficient distribution
Sending data Source Sink Reinforcing stable path Source Source Sink Sink Recovering from node failure Illustrating Directed Diffusion Setting up gradients Source Sink
Data Naming • Expressing an Interest • Using attribute-value pairs • E.g., Type = Wheeled vehicle // detect vehicle location Interval = 20 ms // send events every 20ms Duration = 10 s // Send for next 10 s Field = [x1, y1, x2, y2] // from sensors in this area
Gradient Set Up • Inquirer (sink) broadcasts exploratory interest, i1 • Intended to discover routes between source and sink • Neighbors update interest-cache and forwards i1 • Gradient for i1set up to upstream neighbor • No source routes • Gradient – a weighted reverse link • Low gradient Few packets per unit time needed
Low Low Low Exploratory Gradient Exploratory Request Gradient Event Bidirectional gradients established on all links through flooding
Event-data propagation • Event e1 occurs, matches i1 in sensor cache • e1 identified based on waveform pattern matching • Interest reply diffused down gradient (unicast) • Diffusion initially exploratory (low packet-rate) • Cache filters suppress previously seen data • Problem of bidirectional gradient avoided
Reinforced gradient Reinforced gradient Reinforcement Event • From exploratory gradients, reinforce optimal path for high-rate data download Unicast • Byrequesting higher-rate-i1 on the optimal path • Exploratory gradients still exist – useful for faults A sensor field Sink
Path Failure / Recovery • Link failure detected by reduced rate, data loss • Choose next best link (i.e., compare links based on infrequent exploratory downloads) • Negatively reinforce lossy link • Either send i1 with base (exploratory) data rate • Or, allow neighbor’s cache to expire over time Link A-M lossy A reinforces B B reinforces C … D need not A (–) reinforces M M (–) reinforces D Event D M Src A C B Sink
Loop Elimination P Q • M gets same data from both D and P, but P always delivers late due to looping • M negatively-reinforces (nr) P, P nr Q, Q nr M • Loop {M Q P} eliminated • Conservative nr useful for fault resilience D M A
1. For propagating interests In our example, flood More sophisticated behaviors possible: e.g. based on cached information, GPS 2. For setting up gradients Highest gradient towards neighbor from whom we first heard interest Others possible: towards neighbor with highest energy 3. For data transmission Different local rules can result in single path delivery, striped multi-path delivery, single source to multiple sinks … 4. For reinforcement reinforce one path, or part thereof, based on observed losses, delay variances etc. other variants: inhibit certain paths because resource levels are low Local Behavior Choices
Compare diffusion to a) flooding, and b) centrally computed tree (“ideal”) Key metrics: total energy consumed per packet delivered (indication of network life time) average pkt delay Simulation studies FLOODING DIFFUSION CENTRALIZED DIFFUSION CENTRALIZED FLOODING
Rumor Routing • Designed for query/event ratios between query and event flooding • Motivation • Sometimes a non-optimal route is satisfactory • Advantages • Tunable best effort delivery • Tunable for a range of query/event ratios • Disadvantages • Optimal parameters depend heavily on topology (but can be adaptively tuned) • Does not guarantee delivery
Basis for Algorithm • Observation: Two lines in a bounded rectangle have a 69% chance of intersecting • Create a set of straight line gradients from event, then send query along a random straight line from source • Thought: Can this bound be proved for a random walk . What is this bound if the line is not really straight? Event Source
Creating Paths • Nodes that observe an event send out agents which leave routing info to the event as state in nodes • Agents attempt to travel in a straight line • If an agent crosses a path to another event, it begins to build the path to both • Agent also optimizes paths if they find shorter ones
Algorithm Basics • All nodes maintain a neighbor list • Nodes also maintain a event table • When it observes an event, the event is added with distance 0 • Agents • Packets that carry local event info across the network • Aggregate events as they go
Agent Path • Agent tries to travel in a “somewhat” straight path • Maintains a list of recently seen nodes • When it arrives at a node adds the node’s neighbors to the list • For the next tries to find a node not in the recently seen list • Avoids loops • -important to find a path regardless of “quality”
Following Paths • A query originates from source, and is forwarded along until it reaches it’s TTL • Forwarding Rules: • If a node has seen the query before, it is sent to a random neighbor • If a node has a route to the event, forward to neighbor along the route • Otherwise, forward to random neighbor using straightening algorithm
Fault Tolerance • After agents propagated paths to events, some nodes were disabled • Delivery probability degraded linearly up to 20% node failure, then dropped sharply • Both random and clustered failure were simulated with similar results
Reliable Data Transport • Transport layer design is difficult because of application-specific nature of sensor networks • Networking layers tend to become fused (particularly transport and application) • Goal: design customizable transport layer • Provide the primitives for reliable transport