INET Framework for OMNeT++/OMNEST
inet::physicallayer::IdealTransmitter Class Reference

Implements the IdealTransmitter model, see the NED file for details. More...

#include <IdealTransmitter.h>

Inheritance diagram for inet::physicallayer::IdealTransmitter:
inet::physicallayer::TransmitterBase inet::physicallayer::ITransmitter inet::physicallayer::IPrintableObject

Public Member Functions

 IdealTransmitter ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
virtual const ITransmissioncreateTransmission (const IRadio *radio, const cPacket *packet, const simtime_t startTime) const override
 Returns a transmission which describes the radio signal corresponding to the provided mac frame. More...
 
virtual m getMaxCommunicationRange () const override
 Returns the maximum transmission range. More...
 
virtual m getMaxInterferenceRange () const override
 Returns the maximum interference range. More...
 
- Public Member Functions inherited from inet::physicallayer::TransmitterBase
virtual W getMaxPower () const override
 Returns the maximum transmission power above which no transmission is ever transmitted. More...
 
- Public Member Functions inherited from inet::physicallayer::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string getInfoStringRepresentation () const
 
virtual std::string getDetailStringRepresentation () const
 
virtual std::string getDebugStringRepresentation () const
 
virtual std::string getTraceStringRepresentation () const
 
virtual std::string getCompleteStringRepresentation () const
 

Protected Member Functions

virtual void initialize (int stage) override
 
- Protected Member Functions inherited from inet::physicallayer::TransmitterBase
virtual int numInitStages () const override
 

Protected Attributes

simtime_t preambleDuration
 
int headerBitLength
 
bps bitrate
 
m communicationRange
 
m interferenceRange
 
m detectionRange
 

Additional Inherited Members

- Public Types inherited from inet::physicallayer::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 

Detailed Description

Implements the IdealTransmitter model, see the NED file for details.

Constructor & Destructor Documentation

inet::physicallayer::IdealTransmitter::IdealTransmitter ( )
28  :
29  headerBitLength(-1),
30  bitrate(NaN),
34 {
35 }
int headerBitLength
Definition: IdealTransmitter.h:34
m communicationRange
Definition: IdealTransmitter.h:36
bps bitrate
Definition: IdealTransmitter.h:35
m interferenceRange
Definition: IdealTransmitter.h:37
#define NaN
Definition: INETMath.h:103
m detectionRange
Definition: IdealTransmitter.h:38

Member Function Documentation

const ITransmission * inet::physicallayer::IdealTransmitter::createTransmission ( const IRadio transmitter,
const cPacket *  macFrame,
const simtime_t  startTime 
) const
overridevirtual

Returns a transmission which describes the radio signal corresponding to the provided mac frame.

This function never returns nullptr.

Implements inet::physicallayer::ITransmitter.

65 {
66  auto controlInfo = dynamic_cast<TransmissionRequest*>(macFrame->getControlInfo());
67  auto transmissionBitrate = controlInfo && !std::isnan(controlInfo->getBitrate().get()) ? controlInfo->getBitrate() : bitrate;
68  auto headerDuration = headerBitLength / transmissionBitrate.get();
69  auto dataDuration = macFrame->getBitLength() / transmissionBitrate.get();
70  auto duration = preambleDuration + headerDuration + dataDuration;
71  auto endTime = startTime + duration;
72  auto mobility = transmitter->getAntenna()->getMobility();
73  auto startPosition = mobility->getCurrentPosition();
74  auto endPosition = mobility->getCurrentPosition();
75  auto startOrientation = mobility->getCurrentAngularPosition();
76  auto endOrientation = mobility->getCurrentAngularPosition();
77  return new IdealTransmission(transmitter, macFrame, startTime, endTime, preambleDuration, headerDuration, dataDuration, startPosition, endPosition, startOrientation, endOrientation, communicationRange, interferenceRange, detectionRange);
78 }
int headerBitLength
Definition: IdealTransmitter.h:34
m communicationRange
Definition: IdealTransmitter.h:36
bps bitrate
Definition: IdealTransmitter.h:35
m interferenceRange
Definition: IdealTransmitter.h:37
m detectionRange
Definition: IdealTransmitter.h:38
simtime_t preambleDuration
Definition: IdealTransmitter.h:33
virtual m inet::physicallayer::IdealTransmitter::getMaxCommunicationRange ( ) const
inlineoverridevirtual

Returns the maximum transmission range.

Returns a value in the range [0, +infinity] or NaN if unspecified.

Reimplemented from inet::physicallayer::TransmitterBase.

48 { return communicationRange; }
m communicationRange
Definition: IdealTransmitter.h:36
virtual m inet::physicallayer::IdealTransmitter::getMaxInterferenceRange ( ) const
inlineoverridevirtual

Returns the maximum interference range.

Returns a value in the range [0, +infinity] or NaN if unspecified.

Reimplemented from inet::physicallayer::TransmitterBase.

49 { return interferenceRange; }
m interferenceRange
Definition: IdealTransmitter.h:37
void inet::physicallayer::IdealTransmitter::initialize ( int  stage)
overrideprotectedvirtual
38 {
39  if (stage == INITSTAGE_LOCAL) {
40  preambleDuration = par("preambleDuration");
41  headerBitLength = par("headerBitLength");
42  bitrate = bps(par("bitrate"));
43  communicationRange = m(par("communicationRange"));
44  interferenceRange = m(par("interferenceRange"));
45  detectionRange = m(par("detectionRange"));
46  }
47 }
int headerBitLength
Definition: IdealTransmitter.h:34
m communicationRange
Definition: IdealTransmitter.h:36
compose< b, pow< s,-1 > > bps
Definition: Units.h:985
bps bitrate
Definition: IdealTransmitter.h:35
m interferenceRange
Definition: IdealTransmitter.h:37
Local initializations.
Definition: InitStages.h:35
m detectionRange
Definition: IdealTransmitter.h:38
simtime_t preambleDuration
Definition: IdealTransmitter.h:33
value< double, units::m > m
Definition: Units.h:1047
std::ostream & inet::physicallayer::IdealTransmitter::printToStream ( std::ostream &  stream,
int  level 
) const
overridevirtual

Prints this object to the provided output stream.

Function calls to operator<< with pointers or references either const or not are all forwarded to this function.

Reimplemented from inet::physicallayer::IPrintableObject.

50 {
51  stream << "IdealTransmitter";
52  if (level <= PRINT_LEVEL_TRACE)
53  stream << ", preambleDuration = " << preambleDuration
54  << ", headerBitLength = " << headerBitLength
55  << ", bitrate = " << bitrate;
56  if (level <= PRINT_LEVEL_INFO)
57  stream << ", communicationRange = " << communicationRange;
58  if (level <= PRINT_LEVEL_TRACE)
59  stream << ", interferenceRange = " << interferenceRange
60  << ", detectionRange = " << detectionRange;
61  return stream;
62 }
int headerBitLength
Definition: IdealTransmitter.h:34
m communicationRange
Definition: IdealTransmitter.h:36
bps bitrate
Definition: IdealTransmitter.h:35
m interferenceRange
Definition: IdealTransmitter.h:37
m detectionRange
Definition: IdealTransmitter.h:38
simtime_t preambleDuration
Definition: IdealTransmitter.h:33

Member Data Documentation

bps inet::physicallayer::IdealTransmitter::bitrate
protected
m inet::physicallayer::IdealTransmitter::communicationRange
protected
m inet::physicallayer::IdealTransmitter::detectionRange
protected
int inet::physicallayer::IdealTransmitter::headerBitLength
protected
m inet::physicallayer::IdealTransmitter::interferenceRange
protected
simtime_t inet::physicallayer::IdealTransmitter::preambleDuration
protected

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