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

#include <IdealObstacleLoss.h>

Inheritance diagram for inet::physicallayer::IdealObstacleLoss:
inet::physicallayer::TracingObstacleLossBase inet::physicallayer::ITracingObstacleLoss inet::physicallayer::IObstacleLoss inet::physicallayer::IPrintableObject

Classes

class  TotalObstacleLossComputation
 

Public Member Functions

 IdealObstacleLoss ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level) const override
 Prints this object to the provided output stream. More...
 
virtual double computeObstacleLoss (Hz frequency, const Coord &transmissionPosition, const Coord &receptionPosition) const override
 Returns the obstacle loss factor caused by physical objects present in the environment as a function of frequency, transmission position, and reception position. 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 bool isObstacle (const IPhysicalObject *object, const Coord &transmissionPosition, const Coord &receptionPosition) const
 

Protected Attributes

Parameters
IRadioMediummedium = nullptr
 The radio medium where the radio signal propagation takes place. More...
 
IPhysicalEnvironmentphysicalEnvironment = nullptr
 The physical environment that provides to obstacles. More...
 

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
}
 
- Static Public Attributes inherited from inet::physicallayer::ITracingObstacleLoss
static simsignal_t obstaclePenetratedSignal = cComponent::registerSignal("obstaclePenetrated")
 

Constructor & Destructor Documentation

inet::physicallayer::IdealObstacleLoss::IdealObstacleLoss ( )
31 {
32 }

Member Function Documentation

double inet::physicallayer::IdealObstacleLoss::computeObstacleLoss ( Hz  frequency,
const Coord transmissionPosition,
const Coord receptionPosition 
) const
overridevirtual

Returns the obstacle loss factor caused by physical objects present in the environment as a function of frequency, transmission position, and reception position.

The value is in the range [0, 1] where 1 means no loss at all and 0 means all power is lost.

Implements inet::physicallayer::IObstacleLoss.

65 {
66  TotalObstacleLossComputation obstacleLossVisitor(this, transmissionPosition, receptionPosition);
67  physicalEnvironment->visitObjects(&obstacleLossVisitor, LineSegment(transmissionPosition, receptionPosition));
68  return obstacleLossVisitor.isObstacleFound() ? 0 : 1;
69 }
virtual void visitObjects(const IVisitor *visitor, const LineSegment &lineSegment) const =0
IPhysicalEnvironment * physicalEnvironment
The physical environment that provides to obstacles.
Definition: IdealObstacleLoss.h:57
void inet::physicallayer::IdealObstacleLoss::initialize ( int  stage)
overrideprotectedvirtual
35 {
36  if (stage == INITSTAGE_LOCAL) {
37  medium = check_and_cast<IRadioMedium *>(getParentModule());
38  physicalEnvironment = getModuleFromPar<IPhysicalEnvironment>(par("physicalEnvironmentModule"), this);
39  }
40 }
IPhysicalEnvironment * physicalEnvironment
The physical environment that provides to obstacles.
Definition: IdealObstacleLoss.h:57
Local initializations.
Definition: InitStages.h:35
IRadioMedium * medium
The radio medium where the radio signal propagation takes place.
Definition: IdealObstacleLoss.h:53
bool inet::physicallayer::IdealObstacleLoss::isObstacle ( const IPhysicalObject object,
const Coord transmissionPosition,
const Coord receptionPosition 
) const
protectedvirtual

Referenced by inet::physicallayer::IdealObstacleLoss::TotalObstacleLossComputation::visit().

48 {
49  const ShapeBase *shape = object->getShape();
50  const Coord& position = object->getPosition();
51  const EulerAngles& orientation = object->getOrientation();
52  Rotation rotation(orientation);
53  const LineSegment lineSegment(rotation.rotateVectorCounterClockwise(transmissionPosition - position), rotation.rotateVectorCounterClockwise(receptionPosition - position));
54  Coord intersection1, intersection2, normal1, normal2;
55  bool hasIntersections = shape->computeIntersection(lineSegment, intersection1, intersection2, normal1, normal2);
56  bool isObstacle = hasIntersections && intersection1 != intersection2;
57  if (isObstacle) {
58  ObstaclePenetratedEvent event(object, intersection1, intersection2, normal1, normal2, isObstacle ? 1 : 0);
59  const_cast<IdealObstacleLoss *>(this)->emit(obstaclePenetratedSignal, &event);
60  }
61  return isObstacle;
62 }
static simsignal_t obstaclePenetratedSignal
Definition: ITracingObstacleLoss.h:48
IdealObstacleLoss()
Definition: IdealObstacleLoss.cc:30
virtual bool isObstacle(const IPhysicalObject *object, const Coord &transmissionPosition, const Coord &receptionPosition) const
Definition: IdealObstacleLoss.cc:47
std::ostream & inet::physicallayer::IdealObstacleLoss::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.

43 {
44  return stream << "IdealObstacleLoss";
45 }

Member Data Documentation

IRadioMedium* inet::physicallayer::IdealObstacleLoss::medium = nullptr
protected

The radio medium where the radio signal propagation takes place.

Referenced by initialize().

IPhysicalEnvironment* inet::physicallayer::IdealObstacleLoss::physicalEnvironment = nullptr
protected

The physical environment that provides to obstacles.

Referenced by computeObstacleLoss(), and initialize().


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