Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

ChannelControl Class Reference
[channelControl - channel and connection related classes]

Module to control the channel and handle all connection related stuff. More...

#include <ChannelControl.h>

Collaboration diagram for ChannelControl:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 Module_Class_Members (ChannelControl, cSimpleModule, 0)
 Constructor.
virtual void initialize ()
 Reads init parameters and calculates a maximal interfence distance.
bool registerNic (cModule *, const Coord *)
 Returns the x and y coordinates of the given nic. Registers a nic to have its connections managed by ChannelControl.
void updateNicPos (int, const Coord *oldPos, const Coord *newPos)
 Updates the position information of a registered nic.
const CoordgetPgs ()
 Returns the playgroundSize.
const NicEntry::GateList & getGateList (int, const Coord *)
const cGate * getOutGateTo (int, int, const Coord *)

Static Public Attributes

static const double speedOfLight = 300000000.0
 Speed of light.

Protected Types

typedef std::map< int, NicEntry * > NicEntries
typedef std::vector< NicEntries > RowVector
typedef std::vector< RowVector > NicMatrix

Protected Member Functions

void updateConnections (NicEntries &nmap, NicEntry *nic)
 Manages the connections of a registered nic.
virtual double calcInterfDist ()
 Calculate interference distance.
void checkGrid (unsigned oldX, unsigned oldY, unsigned newX, unsigned newY, int id)
bool increment (unsigned max, unsigned src, unsigned *target)
bool decrement (unsigned max, unsigned src, unsigned *target)
bool inRangeEuclid (const Coord &a, const Coord &b)
bool inRangeTorus (const Coord &a, const Coord &b)

Protected Attributes

bool coreDebug
 Set debugging for the basic module.
NicMatrix nics
 Registry of all Nics.
bool sendDirect
 Does the ChannelControl use sendDirect or not?
Coord playgroundSize
 x and y size of the area the nodes are in (in meters)
double maxInterferenceDistance
 the biggest interference distance in the network.
double maxDistSquared
 Square of maxInterferenceDistance cache a value that is often used.
double findDistance
unsigned maxX
unsigned maxY
bool useTorus

Detailed Description

Module to control the channel and handle all connection related stuff.

The central module that coordinates the connections between all nodes, and handles dynamic gate creation. ChannelControl therefore periodically communicates with the ChannelAccess modules

Author:
Steffen Sroka, Daniel Willkomm
See also:
ChannelAccess


Member Function Documentation

double ChannelControl::calcInterfDist  )  [protected, virtual]
 

Calculate interference distance.

Calculation of the interference distance based on the transmitter power, wavelength, pathloss coefficient and a threshold for the minimal receive Power

You may want to overwrite this function in order to do your own interference calculation

void ChannelControl::checkGrid unsigned  oldX,
unsigned  oldY,
unsigned  newX,
unsigned  newY,
int  id
[protected]
 

check connections of a nic in the grid

bool ChannelControl::decrement unsigned  max,
unsigned  src,
unsigned *  target
[inline, protected]
 

find the next smaller coordinate in grid, return true if the connections in this position should be updated.

const cGate * ChannelControl::getOutGateTo int  from,
int  to,
const Coord pos
 

Called by P2PPhyLayer. Needed to send a packet directly to a certain nic without other nodes 'hearing' it. This is only useful for physical layers that work with bit error probability like P2PPhyLayer.

Parameters:
from id of the nic from which the a packet is about to be sent
to id of the nic to which the packet is about to be sent

bool ChannelControl::increment unsigned  max,
unsigned  src,
unsigned *  target
[inline, protected]
 

find the next larger coordinate in grid, return true if the connections in this position should be updated.

void ChannelControl::initialize  )  [virtual]
 

Reads init parameters and calculates a maximal interfence distance.

Sets up the playgroundSize and calculates the maxInterferenceDistance

calcInterfDist

bool ChannelControl::inRangeEuclid const Coord a,
const Coord b
[inline, protected]
 

check whether nodes are connected in euclidean space

bool ChannelControl::inRangeTorus const Coord a,
const Coord b
[protected]
 

check whether nodes are connected on torus (connections wrap around corners)

bool ChannelControl::registerNic cModule *  ptr,
const Coord pos
 

Returns the x and y coordinates of the given nic. Registers a nic to have its connections managed by ChannelControl.

Called by ChannelAccess for the nic module upon initialization. The nics are written into a list.

Parameters:
ptr the module pointer of the registered nic
pos Position of the nic
Returns:
Returns whether ChannelControl uses sendDirect or not

void ChannelControl::updateConnections NicEntries &  nmap,
NicEntry nic
[protected]
 

Manages the connections of a registered nic.

Called by ChannelControl::updateNodePosition(...) when a nic has moved. Sets up a new connection between two nics, if they are within interference range. Accordingly tears down a connection, if the nics move out of range.

Parameters:
id Id of the nic that will have its' connections updated

void ChannelControl::updateNicPos int  id,
const Coord oldPos,
const Coord newPos
 

Updates the position information of a registered nic.

Called periodically by ChannelAccess to indicate that the nic with "id" moved.

Updates the nics' position and all its connections

Parameters:
id the module id of the registered nic
pos the coordinates of the registered nic


Member Data Documentation

double ChannelControl::findDistance [protected]
 

Distance that helps to find a node under a certain position. Can be larger then

See also:
maxInterferenceDistance to allow nodes to be placed into the same square if the playground is too small for the grid speedup to work.

unsigned ChannelControl::maxX [protected]
 

further cached values

NicMatrix ChannelControl::nics [protected]
 

Registry of all Nics.

This matrix keeps all Nics according to their position. It allows to restrict the position update to a subset of all nics.

bool ChannelControl::useTorus [protected]
 

If set, node connections wrap arounnd the borders of the playground. This eliminiates certain border effects.


The documentation for this class was generated from the following files:
Generated on Fri Jan 12 08:29:50 2007 for Mobility Framework by  doxygen 1.4.4