Classes | Public Member Functions | Protected Types | Protected Attributes

WiseRoute Class Reference
[netwLayer - network layer modules]

Wiseroute is a simple loop-free routing algorithm that builds a routing tree from a central network point. It is especially useful for wireless sensor networks and convergecast traffic, hence its name (Wireless Sensors Routing). The sink (the device at the center of the network) broadcasts a route building message. Each network node that receives it selects the sink as parent in the routing tree, and rebroadcasts the route building message. This procedure maximizes the probability that all network nodes can join the network, and avoids loops. More...

#include <WiseRoute.h>

Inherits BaseNetwLayer.

Collaboration diagram for WiseRoute:
Collaboration graph
[legend]

List of all members.

Classes

struct  tRouteTableEntry

Public Member Functions

virtual void initialize (int)
 Initialization of the module and some variables.
virtual void finish ()
 Called when the simulation has finished.

Protected Types

enum  messagesTypes { UNKNOWN = 0, DATA, ROUTE_FLOOD, SEND_ROUTE_FLOOD_TIMER }
enum  floodTypes { NOTAFLOOD, FORWARD, FORME, DUPLICATE }
typedef enum WiseRoute::floodTypes floodTypes
typedef struct
WiseRoute::tRouteTableEntry 
tRouteTableEntry
typedef map< int,
tRouteTableEntry
tRouteTable
typedef multimap< int,
unsigned long > 
tFloodTable

Protected Member Functions

Handle Messages

Functions to redefine by the programmer

These are the functions provided to add own functionality to your modules. These functions are called whenever a self message or a data message from the upper or lower layer arrives respectively.

virtual void handleUpperMsg (cMessage *msg)
 Handle messages from upper layer.
virtual void handleLowerMsg (cMessage *msg)
 Handle messages from lower layer.
virtual void handleSelfMsg (cMessage *msg)
 Handle self messages.
virtual void handleLowerControl (cMessage *msg)
 Handle control messages from lower layer.
virtual void updateRouteTable (int origin, int lastHop, double rssi, double ber)
 Update routing table.
cMessage * decapsMsg (WiseRoutePkt *msg)
 Decapsulate a message.
floodTypes updateFloodTable (bool isFlood, int srcAddr, int destAddr, unsigned long seqNum)
 update flood table. returns detected flood type (general or unicast flood to forward, duplicate flood to delete, unicast flood to me
int getRoute (int destAddr, bool iAmOrigin=false)
 find a route to destination address.

Protected Attributes

tRouteTable routeTable
tFloodTable floodTable
int headerLength
 Length of the NetwPkt header Read from omnetpp.ini.
int macaddress
 cached variable of my network address
int sinkAddress
bool useSimTracer
double rssiThreshold
 Minimal received RSSI necessary for adding source to routing table.
double routeFloodsInterval
 Interval [seconds] between two route floods. A route flood is a simple flood from which other nodes can extract routing (next hop) information.
unsigned long floodSeqNumber
 Flood sequence number.
SimTracertracer
cMessage * routeFloodTimer
long nbDataPacketsForwarded
long nbDataPacketsReceived
long nbDataPacketsSent
long nbDuplicatedFloodsReceived
long nbFloodsSent
long nbPureUnicastSent
long nbRouteFloodsSent
long nbRouteFloodsReceived
long nbUnicastFloodForwarded
long nbPureUnicastForwarded
long nbGetRouteFailures
long nbRoutesRecorded
long nbHops
cOutVector receivedRSSI
cOutVector routeRSSI
cOutVector allReceivedRSSI
cOutVector allReceivedBER
cOutVector routeBER
cOutVector receivedBER
cOutVector nextHopSelectionForSink
bool trace
bool stats
bool debug
 Debug switch for all other modules.

Detailed Description

Wiseroute is a simple loop-free routing algorithm that builds a routing tree from a central network point. It is especially useful for wireless sensor networks and convergecast traffic, hence its name (Wireless Sensors Routing). The sink (the device at the center of the network) broadcasts a route building message. Each network node that receives it selects the sink as parent in the routing tree, and rebroadcasts the route building message. This procedure maximizes the probability that all network nodes can join the network, and avoids loops.

Author:
Jerome Rousselot

Definition at line 62 of file WiseRoute.h.


Member Function Documentation

void WiseRoute::updateRouteTable ( int  origin,
int  lastHop,
double  rssi,
double  ber 
) [protected, virtual]

Update routing table.

The tuple provided in argument gives the next hop address to the origin. The table is updated only if the RSSI value is above the threshold.

Definition at line 302 of file WiseRoute.cc.

References SimTracer::logLink(), BaseNetwLayer::myNetwAddr, and rssiThreshold.

Referenced by handleLowerMsg().

{
  tRouteTable::iterator pos;

  pos = routeTable.find(origin);
  if(trace) {
    receivedRSSI.record(rssi);
    receivedBER.record(ber);
  }
  if (pos == routeTable.end()) {
    // A route towards origin does not exist yet. Insert the currently discovered one
    // only if the received RSSI is above the threshold.
    if (rssi > rssiThreshold) {
      tRouteTableEntry newEntry;

      // last hop from origin means next hop towards origin.
      newEntry.nextHop = lastHop;
      newEntry.rssi = rssi;
      if(trace) {
        routeRSSI.record(rssi);
        routeBER.record(ber);
      }
      routeTable.insert(make_pair(origin, newEntry));
      if(useSimTracer) {
        tracer->logLink(myNetwAddr, lastHop);
      }
      nbRoutesRecorded++;
      if (origin == 0 && trace) {
        nextHopSelectionForSink.record(lastHop);
      }
    }
  }
  else {
    // A route towards the node which originated the received packet already exists.
    // Replace its entry only if the route proposal that we just received has a stronger
    // RSSI.
//    tRouteTableEntry entry = pos->second;
//    if (entry.rssi > rssiThreshold) {
//      entry.nextHop = lastHop;
//      entry.rssi = rssi;
//      if (origin == 0)
//        nextHopSelectionForSink.record(lastHop);
//    }
  }
}


The documentation for this class was generated from the following files: