OMNeT++ Simulation Library  5.6.1
cDatarateChannel Class Reference

#include <cdataratechannel.h>

Description

Channel that models delay, bit error rate and data rate.

Inheritance diagram for cDatarateChannel:
cChannel cComponent cDefaultList cNoncopyableOwnedObject cOwnedObject noncopyable cNamedObject cObject

Public Member Functions

Redefined cObject member functions.
virtual std::string str () const override
 
Setting and getting channel parameters.
virtual bool isTransmissionChannel () const override
 
virtual void setDelay (double d)
 
virtual void setDatarate (double d)
 
virtual void setBitErrorRate (double d)
 
virtual void setPacketErrorRate (double d)
 
virtual void setDisabled (bool d)
 
virtual simtime_t getDelay () const
 
virtual double getDatarate () const
 
virtual double getBitErrorRate () const
 
virtual double getPacketErrorRate () const
 
virtual bool isDisabled () const
 
Transmission state.
virtual double getNominalDatarate () const override
 
virtual simtime_t calculateDuration (cMessage *msg) const override
 
virtual simtime_t getTransmissionFinishTime () const override
 
virtual bool isBusy () const override
 
virtual void forceTransmissionFinishTime (simtime_t t) override
 
Implementation methods
virtual void initialize () override
 
virtual void processMessage (cMessage *msg, simtime_t t, result_t &result) override
 
- Public Member Functions inherited from cChannel
virtual void finalizeParameters () override
 
 cChannel (const char *name=nullptr)
 
virtual ~cChannel ()
 
virtual void parsimPack (cCommBuffer *buffer) const override
 
virtual void parsimUnpack (cCommBuffer *buffer) override
 
virtual void callInitialize () override
 
virtual bool callInitialize (int stage) override
 
virtual void callFinish () override
 
virtual ComponentKind getComponentKind () const override
 
virtual cModulegetParentModule () const override
 
cChannelTypegetChannelType () const
 
virtual cPropertiesgetProperties () const override
 
virtual cGategetSourceGate () const
 
- Public Member Functions inherited from cComponent
 cComponent (const char *name=nullptr)
 
virtual ~cComponent ()
 
virtual void forEachChild (cVisitor *v) override
 
const cComponentgetThisPtr () const
 
virtual cComponentTypegetComponentType () const
 
cSimulationgetSimulation () const
 
int getId () const
 
virtual const char * getNedTypeName () const
 
bool isModule () const
 
bool isChannel () const
 
virtual cModulegetSystemModule () const
 
virtual int getNumParams () const
 
virtual cParpar (int k)
 
const cParpar (int k) const
 
virtual cParpar (const char *parname)
 
const cParpar (const char *parname) const
 
virtual int findPar (const char *parname) const
 
bool hasPar (const char *s) const
 
virtual cRNGgetRNG (int k) const
 
virtual unsigned long intrand (long r, int rng=0) const
 
virtual double dblrand (int rng=0) const
 
virtual double uniform (double a, double b, int rng=0) const
 
virtual SimTime uniform (SimTime a, SimTime b, int rng=0) const
 
virtual double exponential (double mean, int rng=0) const
 
virtual SimTime exponential (SimTime mean, int rng=0) const
 
virtual double normal (double mean, double stddev, int rng=0) const
 
virtual SimTime normal (SimTime mean, SimTime stddev, int rng=0) const
 
virtual double truncnormal (double mean, double stddev, int rng=0) const
 
virtual SimTime truncnormal (SimTime mean, SimTime stddev, int rng=0) const
 
virtual double gamma_d (double alpha, double theta, int rng=0) const
 
virtual double beta (double alpha1, double alpha2, int rng=0) const
 
virtual double erlang_k (unsigned int k, double mean, int rng=0) const
 
virtual double chi_square (unsigned int k, int rng=0) const
 
virtual double student_t (unsigned int i, int rng=0) const
 
virtual double cauchy (double a, double b, int rng=0) const
 
virtual double triang (double a, double b, double c, int rng=0) const
 
virtual double lognormal (double m, double w, int rng=0) const
 
virtual double weibull (double a, double b, int rng=0) const
 
virtual double pareto_shifted (double a, double b, double c, int rng=0) const
 
virtual int intuniform (int a, int b, int rng=0) const
 
virtual int intuniformexcl (int a, int b, int rng=0) const
 
virtual int bernoulli (double p, int rng=0) const
 
virtual int binomial (int n, double p, int rng=0) const
 
virtual int geometric (double p, int rng=0) const
 
virtual int negbinomial (int n, double p, int rng=0) const
 
virtual int poisson (double lambda, int rng=0) const
 
virtual void subscribe (simsignal_t signalID, cIListener *listener)
 
virtual void subscribe (const char *signalName, cIListener *listener)
 
virtual void unsubscribe (simsignal_t signalID, cIListener *listener)
 
virtual void unsubscribe (const char *signalName, cIListener *listener)
 
virtual bool isSubscribed (simsignal_t signalID, cIListener *listener) const
 
virtual bool isSubscribed (const char *signalName, cIListener *listener) const
 
virtual std::vector< simsignal_tgetLocalListenedSignals () const
 
virtual std::vector< cIListener * > getLocalSignalListeners (simsignal_t signalID) const
 
virtual bool hasGUI () const
 
virtual cDisplayStringgetDisplayString () const
 
virtual void setDisplayString (const char *dispstr)
 
virtual void bubble (const char *text) const
 
virtual std::string resolveResourcePath (const char *fileName) const
 
virtual void recordScalar (const char *name, double value, const char *unit=nullptr)
 
virtual void recordScalar (const char *name, SimTime value, const char *unit=nullptr)
 
virtual void recordStatistic (cStatistic *stats, const char *unit=nullptr)
 
virtual void recordStatistic (const char *name, cStatistic *stats, const char *unit=nullptr)
 
virtual void emit (simsignal_t signalID, bool b, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, long l, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, unsigned long l, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, double d, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, const SimTime &t, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, const char *s, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, cObject *obj, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, const cObject *obj, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, char c, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, unsigned char c, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, short i, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, unsigned short i, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, int i, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, unsigned int i, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, float f, cObject *details=nullptr)
 
virtual void emit (simsignal_t signalID, long double d, cObject *details=nullptr)
 
bool mayHaveListeners (simsignal_t signalID) const
 
bool hasListeners (simsignal_t signalID) const
 
- Public Member Functions inherited from cDefaultList
 cDefaultList (const char *name=nullptr)
 
virtual ~cDefaultList ()
 
virtual bool isSoftOwner () const override
 
bool getPerformFinalGC () const
 
virtual void setPerformFinalGC (bool b)
 
int defaultListSize () const
 
cOwnedObjectdefaultListGet (int k)
 
bool defaultListContains (cOwnedObject *obj) const
 
- Public Member Functions inherited from cNoncopyableOwnedObject
 cNoncopyableOwnedObject (const char *name=nullptr, bool namepooling=true)
 
virtual cNoncopyableOwnedObjectdup () const override
 
- Public Member Functions inherited from cOwnedObject
 cOwnedObject ()
 
 cOwnedObject (const char *name, bool namepooling=true)
 
 cOwnedObject (const cOwnedObject &obj)
 
virtual ~cOwnedObject ()
 
cOwnedObjectoperator= (const cOwnedObject &o)
 
virtual cObjectgetOwner () const override
 
virtual bool isOwnedObject () const override
 
- Public Member Functions inherited from cNamedObject
 cNamedObject ()
 
 cNamedObject (const char *name, bool namepooling=true)
 
 cNamedObject (const cNamedObject &obj)
 
virtual ~cNamedObject ()
 
cNamedObjectoperator= (const cNamedObject &o)
 
virtual void setName (const char *s)
 
virtual const char * getName () const override
 
virtual void setNamePooling (bool b)
 
virtual bool getNamePooling ()
 
- Public Member Functions inherited from cObject
 cObject ()
 
 cObject (const cObject &other)
 
virtual ~cObject ()
 
virtual const char * getClassName () const
 
bool isName (const char *s) const
 
virtual const char * getFullName () const
 
virtual std::string getFullPath () const
 
const cObjectgetThisPtr () const
 
virtual _OPPDEPRECATED std::string info () const
 
virtual _OPPDEPRECATED std::string detailedInfo () const
 
cObjectfindObject (const char *name, bool deep=true)
 
void copyNotSupported () const
 

Protected Member Functions

virtual void handleParameterChange (const char *parname) override
 
virtual void finish () override
 
- Protected Member Functions inherited from cComponent
virtual void initialize (int stage)
 
virtual int numInitStages () const
 
virtual void refreshDisplay () const
 
- Protected Member Functions inherited from cDefaultList
virtual void take (cOwnedObject *obj) override
 
virtual void drop (cOwnedObject *obj) override
 
- Protected Member Functions inherited from cObject
void dropAndDelete (cOwnedObject *obj)
 

Constructors, destructor

 cDatarateChannel (const char *name=nullptr)
 
virtual ~cDatarateChannel ()
 
static cDatarateChannelcreate (const char *name)
 

Additional Inherited Members

- Static Public Member Functions inherited from cComponent
static simsignal_t registerSignal (const char *name)
 
static const char * getSignalName (simsignal_t signalID)
 
- Static Public Member Functions inherited from cOwnedObject
static long getTotalObjectCount ()
 
static long getLiveObjectCount ()
 
static void resetObjectCounters ()
 
static cDefaultListgetDefaultOwner ()
 

Constructor & Destructor Documentation

◆ cDatarateChannel()

cDatarateChannel ( const char *  name = nullptr)
explicit

Constructor. This is only for internal purposes, and should not be used when creating channels dynamically; use the create() factory method instead.

◆ ~cDatarateChannel()

virtual ~cDatarateChannel ( )
virtual

Destructor.

Member Function Documentation

◆ handleParameterChange()

virtual void handleParameterChange ( const char *  parname)
overrideprotectedvirtual

This method is called by the simulation kernel to notify the module or channel that the value of an existing parameter has changed. Redefining this method allows simple modules and channels to be react on parameter changes, for example by re-reading the value. This default implementation does nothing.

The parameter name is nullptr if more than one parameter has changed.

To make it easier to write predictable components, the function is NOT called on uninitialized components (i.e. when initialized() returns false). For each component, the function is called (with nullptr as a parname) after the last stage of the initialization, so that the module gets a chance to update its cached parameters.

Also, one must be extremely careful when changing parameters from inside handleParameterChange(), to avoid creating an infinite notification loop.

Reimplemented from cComponent.

◆ finish()

virtual void finish ( )
overrideprotectedvirtual

Finish hook. finish() is called after end of simulation if it terminated without error. This default implementation does nothing.

Reimplemented from cComponent.

◆ create()

static cDatarateChannel* create ( const char *  name)
static

Utility function for dynamic channel creation. Equivalent to cChannelType::getDatarateChannelType()->create(name).

◆ str()

virtual std::string str ( ) const
overridevirtual

Produces a one-line description of the object's contents. See cObject for more details.

Reimplemented from cChannel.

◆ isTransmissionChannel()

virtual bool isTransmissionChannel ( ) const
inlineoverridevirtual

Returns true.

Implements cChannel.

◆ setDelay()

virtual void setDelay ( double  d)
virtual

Sets the propagation delay of the channel, in seconds.

◆ setDatarate()

virtual void setDatarate ( double  d)
virtual

Sets the data rate of the channel, in bit/second.

See also
isBusy(), getTransmissionFinishTime()

◆ setBitErrorRate()

virtual void setBitErrorRate ( double  d)
virtual

Sets the bit error rate (BER) of the channel.

See also
cPacket::hasBitError()

◆ setPacketErrorRate()

virtual void setPacketErrorRate ( double  d)
virtual

Sets the packet error rate (PER) of the channel.

See also
cPacket::hasBitError()

◆ setDisabled()

virtual void setDisabled ( bool  d)
virtual

Disables or enables the channel.

◆ getDelay()

virtual simtime_t getDelay ( ) const
inlinevirtual

Returns the propagation delay of the channel, in seconds. This method is equivalent to reading the "delay" parameter, via par("delay").

◆ getDatarate()

virtual double getDatarate ( ) const
inlinevirtual

Returns the data rate of the channel, in bit/second. This method is equivalent to reading the "datarate" parameter, via par("datarate"). This value affects the transmission time of messages sent through the channel.

◆ getBitErrorRate()

virtual double getBitErrorRate ( ) const
inlinevirtual

Returns the bit error rate (BER) of the channel. This method is equivalent to reading the "ber" parameter, via par("ber"). When a message sent through the channel suffers at least one bit error, its bit error flag will be set.

◆ getPacketErrorRate()

virtual double getPacketErrorRate ( ) const
inlinevirtual

Returns the packet error rate (PER) of the channel. This method is equivalent to reading the "per" parameter, via par("per"). When a message is sent through the channel, its bit error flag will be set with this probability.

◆ isDisabled()

virtual bool isDisabled ( ) const
inlinevirtual

Returns whether the channel is disabled. This method is equivalent to reading the "disabled" parameter, via par("disabled"). A disabled channel discards all messages sent on it.

◆ getNominalDatarate()

virtual double getNominalDatarate ( ) const
inlineoverridevirtual

Same as getDatarate().

Implements cChannel.

◆ calculateDuration()

virtual simtime_t calculateDuration ( cMessage msg) const
overridevirtual

Returns the message length in bits divided by the datarate.

Note that processMessage() does NOT call this method, so in order to change the duration computation algorithm via subclassing you need to redefine both this and processMessage().

Implements cChannel.

◆ getTransmissionFinishTime()

virtual simtime_t getTransmissionFinishTime ( ) const
inlineoverridevirtual

Returns the simulation time the sender gate will finish transmitting. If the gate is not currently transmitting, the result is undefined but less or equal the current simulation time.

The transmission duration of a message depends on the message length and the data rate assigned to the channel.

Implements cChannel.

◆ isBusy()

virtual bool isBusy ( ) const
inlineoverridevirtual

Returns whether the sender gate is currently transmitting, ie. whether transmissionFinishTime() is greater than the current simulation time.

Reimplemented from cChannel.

References omnetpp::simTime().

◆ forceTransmissionFinishTime()

virtual void forceTransmissionFinishTime ( simtime_t  t)
overridevirtual

Forcibly overwrites the finish time of the current transmission in the channel (see getTransmissionFinishTime()). This method can be used for implementing transmission abortion; see declaration in base class (cChannel::forceTransmissionFinishTime()) for more information.

Implements cChannel.

◆ initialize()

virtual void initialize ( )
overridevirtual

Initialization.

Reimplemented from cComponent.

◆ processMessage()

virtual void processMessage ( cMessage msg,
simtime_t  t,
result_t result 
)
overridevirtual

Performs bit error rate, delay and transmission time modelling.

Implements cChannel.


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