Channel that models delay, bit error rate and data rate. More...
#include <cdataratechannel.h>
Public Member Functions | |
Redefined cObject member functions. | |
virtual std::string | info () const |
Setting and getting channel parameters. | |
virtual bool | isTransmissionChannel () const |
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 |
virtual simtime_t | calculateDuration (cMessage *msg) const |
virtual simtime_t | getTransmissionFinishTime () const |
virtual bool | isBusy () const |
virtual void | forceTransmissionFinishTime (simtime_t t) |
Implementation methods | |
virtual void | initialize () |
virtual void | processMessage (cMessage *msg, simtime_t t, result_t &result) |
Protected Member Functions | |
virtual void | handleParameterChange (const char *parname) |
Constructors, destructor | |
| |
cDatarateChannel (const char *name=NULL) | |
virtual | ~cDatarateChannel () |
static cDatarateChannel * | create (const char *name) |
Channel that models delay, bit error rate and data rate.
cDatarateChannel::cDatarateChannel | ( | const char * | name = NULL |
) | [explicit] |
Constructor.
This is only for internal purposes, and should not be used when creating channels dynamically; use the create() factory method instead.
virtual simtime_t cDatarateChannel::calculateDuration | ( | cMessage * | msg | ) | const [virtual] |
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.
static cDatarateChannel* cDatarateChannel::create | ( | const char * | name | ) | [static] |
Utility function for dynamic channel creation.
Equivalent to cChannelType::getDatarateChannelType()->create(name)
.
virtual void cDatarateChannel::forceTransmissionFinishTime | ( | simtime_t | t | ) | [virtual] |
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.
virtual double cDatarateChannel::getBitErrorRate | ( | ) | const [inline, virtual] |
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.
virtual double cDatarateChannel::getDatarate | ( | ) | const [inline, virtual] |
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.
virtual simtime_t cDatarateChannel::getDelay | ( | ) | const [inline, virtual] |
Returns the propagation delay of the channel, in seconds.
This method is equivalent to reading the "delay" parameter, via par("delay").
virtual double cDatarateChannel::getPacketErrorRate | ( | ) | const [inline, virtual] |
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.
virtual simtime_t cDatarateChannel::getTransmissionFinishTime | ( | ) | const [inline, virtual] |
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.
virtual void cDatarateChannel::handleParameterChange | ( | const char * | parname | ) | [protected, virtual] |
virtual std::string cDatarateChannel::info | ( | ) | const [virtual] |
virtual bool cDatarateChannel::isBusy | ( | ) | const [inline, virtual] |
Returns whether the sender gate is currently transmitting, ie.
whether transmissionFinishTime() is greater than the current simulation time.
Reimplemented from cChannel.
virtual bool cDatarateChannel::isDisabled | ( | ) | const [inline, virtual] |
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.
virtual void cDatarateChannel::setBitErrorRate | ( | double | d | ) | [virtual] |
Sets the bit error rate (BER) of the channel.
virtual void cDatarateChannel::setDatarate | ( | double | d | ) | [virtual] |
Sets the data rate of the channel, in bit/second.
virtual void cDatarateChannel::setPacketErrorRate | ( | double | d | ) | [virtual] |
Sets the packet error rate (PER) of the channel.