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

#include <ConstantSpeedPropagation.h>

Inheritance diagram for inet::physicallayer::ConstantSpeedPropagation:
inet::physicallayer::PropagationBase inet::physicallayer::IPropagation inet::physicallayer::IPrintableObject

Public Member Functions

 ConstantSpeedPropagation ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
virtual const IArrivalcomputeArrival (const ITransmission *transmission, IMobility *mobility) const override
 Returns the time and space coordinates when the transmission arrives at the object that moves with the provided mobility. More...
 
- Public Member Functions inherited from inet::physicallayer::PropagationBase
 PropagationBase ()
 
virtual mps getPropagationSpeed () const override
 Returns the theoretical propagation speed of radio signals in the range (0, +infinity). 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
 
virtual const Coord computeArrivalPosition (const simtime_t startTime, const Coord startPosition, IMobility *mobility) const
 
- Protected Member Functions inherited from inet::physicallayer::PropagationBase
virtual void finish () override
 

Protected Attributes

bool ignoreMovementDuringTransmission
 
bool ignoreMovementDuringPropagation
 
bool ignoreMovementDuringReception
 
- Protected Attributes inherited from inet::physicallayer::PropagationBase
mps propagationSpeed
 
long arrivalComputationCount
 

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
}
 

Constructor & Destructor Documentation

inet::physicallayer::ConstantSpeedPropagation::ConstantSpeedPropagation ( )
27  :
32 {
33 }
bool ignoreMovementDuringReception
Definition: ConstantSpeedPropagation.h:32
bool ignoreMovementDuringPropagation
Definition: ConstantSpeedPropagation.h:31
bool ignoreMovementDuringTransmission
Definition: ConstantSpeedPropagation.h:30
PropagationBase()
Definition: PropagationBase.cc:24

Member Function Documentation

const IArrival * inet::physicallayer::ConstantSpeedPropagation::computeArrival ( const ITransmission transmission,
IMobility mobility 
) const
overridevirtual

Returns the time and space coordinates when the transmission arrives at the object that moves with the provided mobility.

The result might be an approximation only, because there's a tradeoff between precision and performance. This function never returns nullptr.

Implements inet::physicallayer::IPropagation.

65 {
67  const simtime_t startTime = transmission->getStartTime();
68  const simtime_t endTime = transmission->getEndTime();
69  const Coord startPosition = transmission->getStartPosition();
70  const Coord endPosition = transmission->getEndPosition();
71  const Coord startArrivalPosition = ignoreMovementDuringPropagation ? mobility->getCurrentPosition() : computeArrivalPosition(startTime, startPosition, mobility);
72  const simtime_t startPropagationTime = startPosition.distance(startArrivalPosition) / propagationSpeed.get();
73  const simtime_t startArrivalTime = startTime + startPropagationTime;
74  const EulerAngles startArrivalOrientation = mobility->getCurrentAngularPosition();
76  const Coord endArrivalPosition = startArrivalPosition;
77  const simtime_t endPropagationTime = startPropagationTime;
78  const simtime_t endArrivalTime = endTime + startPropagationTime;
79  const simtime_t preambleDuration = transmission->getPreambleDuration();
80  const simtime_t headerDuration = transmission->getHeaderDuration();
81  const simtime_t dataDuration = transmission->getDataDuration();
82  const EulerAngles endArrivalOrientation = mobility->getCurrentAngularPosition();
83  return new Arrival(startPropagationTime, endPropagationTime, startArrivalTime, endArrivalTime, preambleDuration, headerDuration, dataDuration, startArrivalPosition, endArrivalPosition, startArrivalOrientation, endArrivalOrientation);
84  }
85  else {
86  const Coord endArrivalPosition = computeArrivalPosition(endTime, endPosition, mobility);
87  const simtime_t endPropagationTime = endPosition.distance(endArrivalPosition) / propagationSpeed.get();
88  const simtime_t endArrivalTime = endTime + endPropagationTime;
89  const simtime_t preambleDuration = transmission->getPreambleDuration();
90  const simtime_t headerDuration = transmission->getHeaderDuration();
91  const simtime_t dataDuration = transmission->getDataDuration();
92  const EulerAngles endArrivalOrientation = mobility->getCurrentAngularPosition();
93  return new Arrival(startPropagationTime, endPropagationTime, startArrivalTime, endArrivalTime, preambleDuration, headerDuration, dataDuration, startArrivalPosition, endArrivalPosition, startArrivalOrientation, endArrivalOrientation);
94  }
95 }
bool ignoreMovementDuringReception
Definition: ConstantSpeedPropagation.h:32
bool ignoreMovementDuringPropagation
Definition: ConstantSpeedPropagation.h:31
const value_type & get() const
Definition: Units.h:89
mps propagationSpeed
Definition: PropagationBase.h:30
virtual const Coord computeArrivalPosition(const simtime_t startTime, const Coord startPosition, IMobility *mobility) const
Definition: ConstantSpeedPropagation.cc:48
long arrivalComputationCount
Definition: PropagationBase.h:31
const Coord inet::physicallayer::ConstantSpeedPropagation::computeArrivalPosition ( const simtime_t  startTime,
const Coord  startPosition,
IMobility mobility 
) const
protectedvirtual

Referenced by computeArrival().

49 {
50  // TODO: return mobility->getPosition(time);
51  throw cRuntimeError("Movement approximation is not implemented");
52 }
void inet::physicallayer::ConstantSpeedPropagation::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::physicallayer::PropagationBase.

36 {
38  if (stage == INITSTAGE_LOCAL) {
39  ignoreMovementDuringTransmission = par("ignoreMovementDuringTransmission");
40  ignoreMovementDuringPropagation = par("ignoreMovementDuringPropagation");
41  ignoreMovementDuringReception = par("ignoreMovementDuringReception");
42  // TODO:
44  throw cRuntimeError("ignoreMovementDuringTransmission is yet not implemented");
45  }
46 }
bool ignoreMovementDuringReception
Definition: ConstantSpeedPropagation.h:32
bool ignoreMovementDuringPropagation
Definition: ConstantSpeedPropagation.h:31
virtual void initialize(int stage) override
Definition: PropagationBase.cc:30
bool ignoreMovementDuringTransmission
Definition: ConstantSpeedPropagation.h:30
Local initializations.
Definition: InitStages.h:35
std::ostream & inet::physicallayer::ConstantSpeedPropagation::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::PropagationBase.

55 {
56  stream << "ConstantSpeedPropagation";
57  if (level <= PRINT_LEVEL_TRACE)
58  stream << ", ignoreMovementDuringTransmission = " << ignoreMovementDuringTransmission
59  << ", ignoreMovementDuringPropagation = " << ignoreMovementDuringPropagation
60  << ", ignoreMovementDuringReception = " << ignoreMovementDuringReception;
61  return PropagationBase::printToStream(stream, level);
62 }
virtual std::ostream & printToStream(std::ostream &stream, int level) const override
Prints this object to the provided output stream.
Definition: PropagationBase.cc:36
bool ignoreMovementDuringReception
Definition: ConstantSpeedPropagation.h:32
bool ignoreMovementDuringPropagation
Definition: ConstantSpeedPropagation.h:31
bool ignoreMovementDuringTransmission
Definition: ConstantSpeedPropagation.h:30

Member Data Documentation

bool inet::physicallayer::ConstantSpeedPropagation::ignoreMovementDuringPropagation
protected
bool inet::physicallayer::ConstantSpeedPropagation::ignoreMovementDuringReception
protected
bool inet::physicallayer::ConstantSpeedPropagation::ignoreMovementDuringTransmission
protected

Referenced by initialize(), and printToStream().


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