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::IPrintableObject

Classes

class  TotalObstacleLossComputation
 

Parameters

IRadioMediummedium = nullptr
 The radio medium where the radio signal propagation takes place. More...
 
ModuleRefByPar< physicalenvironment::IPhysicalEnvironmentphysicalEnvironment
 The physical environment that provides to obstacles. More...
 
virtual void initialize (int stage) override
 
virtual bool isObstacle (const physicalenvironment::IPhysicalObject *object, const Coord &transmissionPosition, const Coord &receptionPosition) const
 
 IdealObstacleLoss ()
 
virtual std::ostream & printToStream (std::ostream &stream, int level, int evFlags=0) 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...
 

Additional Inherited Members

- Public Types inherited from inet::IPrintableObject
enum  PrintLevel {
  PRINT_LEVEL_TRACE, PRINT_LEVEL_DEBUG, PRINT_LEVEL_DETAIL, PRINT_LEVEL_INFO,
  PRINT_LEVEL_COMPLETE = INT_MIN
}
 
enum  PrintFlag { PRINT_FLAG_FORMATTED = (1 << 0), PRINT_FLAG_MULTILINE = (1 << 1) }
 
- Public Member Functions inherited from inet::IPrintableObject
virtual ~IPrintableObject ()
 
virtual std::string printToString () const
 
virtual std::string printToString (int level, int evFlags=0) const
 
virtual std::string getInfoStringRepresentation (int evFlags=0) const
 
virtual std::string getDetailStringRepresentation (int evFlags=0) const
 
virtual std::string getDebugStringRepresentation (int evFlags=0) const
 
virtual std::string getTraceStringRepresentation (int evFlags=0) const
 
virtual std::string getCompleteStringRepresentation (int evFlags=0) const
 
- Static Public Attributes inherited from inet::physicallayer::ITracingObstacleLoss
static simsignal_t obstaclePenetratedSignal = cComponent::registerSignal("obstaclePenetrated")
 

Constructor & Destructor Documentation

◆ IdealObstacleLoss()

inet::physicallayer::IdealObstacleLoss::IdealObstacleLoss ( )
24 {
25 }

Member Function Documentation

◆ computeObstacleLoss()

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.

58 {
59  TotalObstacleLossComputation obstacleLossVisitor(this, transmissionPosition, receptionPosition);
60  physicalEnvironment->visitObjects(&obstacleLossVisitor, LineSegment(transmissionPosition, receptionPosition));
61  return obstacleLossVisitor.isObstacleFound() ? 0 : 1;
62 }

◆ initialize()

void inet::physicallayer::IdealObstacleLoss::initialize ( int  stage)
overrideprotectedvirtual
28 {
29  if (stage == INITSTAGE_LOCAL) {
30  medium = check_and_cast<IRadioMedium *>(getParentModule());
31  physicalEnvironment.reference(this, "physicalEnvironmentModule", true);
32  }
33 }

◆ isObstacle()

bool inet::physicallayer::IdealObstacleLoss::isObstacle ( const physicalenvironment::IPhysicalObject object,
const Coord transmissionPosition,
const Coord receptionPosition 
) const
protectedvirtual
41 {
42  const ShapeBase *shape = object->getShape();
43  const Coord& position = object->getPosition();
44  const Quaternion& orientation = object->getOrientation();
45  RotationMatrix rotation(orientation.toEulerAngles());
46  const LineSegment lineSegment(rotation.rotateVectorInverse(transmissionPosition - position), rotation.rotateVectorInverse(receptionPosition - position));
47  Coord intersection1, intersection2, normal1, normal2;
48  bool hasIntersections = shape->computeIntersection(lineSegment, intersection1, intersection2, normal1, normal2);
49  bool isObstacle = hasIntersections && intersection1 != intersection2;
50  if (isObstacle) {
51  ObstaclePenetratedEvent event(object, intersection1, intersection2, normal1, normal2, isObstacle ? 1 : 0);
52  const_cast<IdealObstacleLoss *>(this)->emit(obstaclePenetratedSignal, &event);
53  }
54  return isObstacle;
55 }

◆ printToStream()

std::ostream & inet::physicallayer::IdealObstacleLoss::printToStream ( std::ostream &  stream,
int  level,
int  evFlags = 0 
) const
overridevirtual

Prints this object to the provided output stream.

Reimplemented from inet::IPrintableObject.

36 {
37  return stream << "IdealObstacleLoss";
38 }

Member Data Documentation

◆ medium

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

The radio medium where the radio signal propagation takes place.

◆ physicalEnvironment

ModuleRefByPar<physicalenvironment::IPhysicalEnvironment> inet::physicallayer::IdealObstacleLoss::physicalEnvironment
protected

The physical environment that provides to obstacles.


The documentation for this class was generated from the following files:
inet::physicallayer::IdealObstacleLoss::medium
IRadioMedium * medium
The radio medium where the radio signal propagation takes place.
Definition: IdealObstacleLoss.h:43
inet::physicallayer::ITracingObstacleLoss::obstaclePenetratedSignal
static simsignal_t obstaclePenetratedSignal
Definition: ITracingObstacleLoss.h:35
inet::physicallayer::IdealObstacleLoss::isObstacle
virtual bool isObstacle(const physicalenvironment::IPhysicalObject *object, const Coord &transmissionPosition, const Coord &receptionPosition) const
Definition: IdealObstacleLoss.cc:40
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::physicallayer::IdealObstacleLoss::IdealObstacleLoss
IdealObstacleLoss()
Definition: IdealObstacleLoss.cc:23
inet::physicallayer::IdealObstacleLoss::physicalEnvironment
ModuleRefByPar< physicalenvironment::IPhysicalEnvironment > physicalEnvironment
The physical environment that provides to obstacles.
Definition: IdealObstacleLoss.h:47