OverSim
SVivaldi Class Reference

#include <SVivaldi.h>

Inheritance diagram for SVivaldi:
Vivaldi AbstractNcs

Public Member Functions

virtual void init (NeighborCache *neighborCache)
double getLoss () const
void stopAdaptation ()
- Public Member Functions inherited from Vivaldi
virtual ~Vivaldi ()
void processCoordinates (const simtime_t &rtt, const AbstractNcsNodeInfo &nodeInfo)
Prox getCoordinateBasedProx (const AbstractNcsNodeInfo &info) const
virtual AbstractNcsNodeInfogetUnvalidNcsInfo () const
virtual AbstractNcsNodeInfocreateNcsInfo (const std::vector< double > &coords) const
const VivaldiCoordsInfogetOwnNcsInfo () const
const std::vector< double > & getOwnCoordinates () const
double getOwnError () const
double getOwnHeightVector () const
- Public Member Functions inherited from AbstractNcs
virtual ~AbstractNcs ()
virtual bool isReady ()
virtual void handleTimerEvent (cMessage *msg)
virtual bool handleRpcCall (BaseCallMessage *msg)

Protected Member Functions

virtual double calcError (const simtime_t &rtt, double dist, double weight)
virtual double calcDelta (const simtime_t &rtt, double dist, double weight)
- Protected Member Functions inherited from Vivaldi
virtual void finishVivaldi ()
virtual void updateDisplay ()

Private Attributes

double lossC
double effectiveSample
double loss
double lossResetLimit

Additional Inherited Members

- Protected Attributes inherited from Vivaldi
VivaldiCoordsInfoownCoords
double errorC
double coordC
bool showPosition
GlobalStatisticsglobalStatistics
NeighborCacheneighborCache

Detailed Description

Definition at line 34 of file SVivaldi.h.

Member Function Documentation

double SVivaldi::calcDelta ( const simtime_t &  rtt,
double  dist,
double  weight 
)
protectedvirtual

Reimplemented from Vivaldi.

Definition at line 53 of file SVivaldi.cc.

{
// calculate loss factor
loss = lossC + (1 - lossC) * loss;
if(fabs(dist - SIMTIME_DBL(rtt)) > lossResetLimit) loss = 0.0;
return coordC * weight * (1 - loss);
}
double SVivaldi::calcError ( const simtime_t &  rtt,
double  dist,
double  weight 
)
protectedvirtual

Reimplemented from Vivaldi.

Definition at line 43 of file SVivaldi.cc.

{
// get avg absolute prediction error
// update weighted moving average of local error
return (sum * errorC) + ownCoords->getError() * (1 - errorC);
}
double SVivaldi::getLoss ( ) const
inline

Definition at line 48 of file SVivaldi.h.

Referenced by DiscoveryMode::sendNewRequest(), and DiscoveryMode::stop().

{ return loss; };
void SVivaldi::init ( NeighborCache neighborCache)
virtual

Reimplemented from Vivaldi.

Definition at line 31 of file SVivaldi.cc.

{
Vivaldi::init(neighborCache);
lossC = neighborCache->par("svivaldiLossConst");
lossResetLimit = neighborCache->par("svivaldiLossResetLimit");
loss = 0;
WATCH(loss);
}
void SVivaldi::stopAdaptation ( )
inline

Definition at line 49 of file SVivaldi.h.

{ loss = 1; };

Member Data Documentation

double SVivaldi::effectiveSample
private

Definition at line 38 of file SVivaldi.h.

double SVivaldi::loss
private

Definition at line 39 of file SVivaldi.h.

Referenced by calcDelta(), getLoss(), init(), and stopAdaptation().

double SVivaldi::lossC
private

Definition at line 37 of file SVivaldi.h.

Referenced by calcDelta(), and init().

double SVivaldi::lossResetLimit
private

Definition at line 40 of file SVivaldi.h.

Referenced by calcDelta(), and init().


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