A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::MobilityModel Class Reference

Keep track of the current position and velocity of an object. More...

#include <mobility-model.h>

+ Inheritance diagram for ns3::MobilityModel:
+ Collaboration diagram for ns3::MobilityModel:

Public Member Functions

 MobilityModel ()
virtual ~MobilityModel ()=0
int64_t AssignStreams (int64_t stream)
double GetDistanceFrom (Ptr< const MobilityModel > position) const
Vector GetPosition (void) const
double GetRelativeSpeed (Ptr< const MobilityModel > other) const
Vector GetVelocity (void) const
void SetPosition (const Vector &position)
- Public Member Functions inherited from ns3::Object
 Object ()
virtual ~Object ()
void AggregateObject (Ptr< Object > other)
void Dispose (void)
AggregateIterator GetAggregateIterator (void) const
virtual TypeId GetInstanceTypeId (void) const
template<typename T >
Ptr< T > GetObject (void) const
template<typename T >
Ptr< T > GetObject (TypeId tid) const
void Start (void)
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 SimpleRefCount (const SimpleRefCount &o)
uint32_t GetReferenceCount (void) const
SimpleRefCountoperator= (const SimpleRefCount &o)
void Ref (void) const
void Unref (void) const
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
void GetAttribute (std::string name, AttributeValue &value) const
bool GetAttributeFailSafe (std::string name, AttributeValue &attribute) const
void SetAttribute (std::string name, const AttributeValue &value)
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::MobilityModel.

Protected Member Functions

void NotifyCourseChange (void) const
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
virtual void DoDispose (void)
virtual void DoStart (void)
virtual void NotifyNewAggregate (void)

Private Member Functions

virtual int64_t DoAssignStreams (int64_t start)
virtual Vector DoGetPosition (void) const =0
virtual Vector DoGetVelocity (void) const =0
virtual void DoSetPosition (const Vector &position)=0

Private Attributes

TracedCallback< Ptr< const
MobilityModel > > 
m_courseChangeTrace

Detailed Description

Keep track of the current position and velocity of an object.

All space coordinates in this class and its subclasses are understood to be meters or meters/s. i.e., they are all metric international units.

This is a base class for all specific mobility models.

Definition at line 39 of file mobility-model.h.

Constructor & Destructor Documentation

ns3::MobilityModel::MobilityModel ( )

Definition at line 53 of file mobility-model.cc.

ns3::MobilityModel::~MobilityModel ( )
pure virtual

Definition at line 57 of file mobility-model.cc.

Member Function Documentation

int64_t ns3::MobilityModel::AssignStreams ( int64_t  stream)

Assign a fixed random variable stream number to the random variables used by this model. Return the number of streams (possibly zero) that have been assigned.

Parameters
streamfirst stream index to use
Returns
the number of stream indices assigned by this model

Definition at line 102 of file mobility-model.cc.

References DoAssignStreams().

Referenced by ns3::MobilityHelper::AssignStreams().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int64_t ns3::MobilityModel::DoAssignStreams ( int64_t  start)
privatevirtual

The default implementation does nothing but return the passed-in parameter. Subclasses using random variables are expected to override this.

Definition at line 109 of file mobility-model.cc.

Referenced by AssignStreams().

+ Here is the caller graph for this function:

virtual Vector ns3::MobilityModel::DoGetPosition ( void  ) const
privatepure virtual
Returns
the current position.

Concrete subclasses of this base class must implement this method.

Referenced by GetDistanceFrom(), and GetPosition().

+ Here is the caller graph for this function:

virtual Vector ns3::MobilityModel::DoGetVelocity ( void  ) const
privatepure virtual
Returns
the current velocity.

Concrete subclasses of this base class must implement this method.

Referenced by GetVelocity().

+ Here is the caller graph for this function:

virtual void ns3::MobilityModel::DoSetPosition ( const Vector position)
privatepure virtual
Parameters
positionthe position to set.

Concrete subclasses of this base class must implement this method.

Referenced by SetPosition().

+ Here is the caller graph for this function:

Vector ns3::MobilityModel::GetPosition ( void  ) const
Returns
the current position

Definition at line 62 of file mobility-model.cc.

References DoGetPosition().

Referenced by ns3::Ns2MobilityHelperTest::CheckInitialPositions(), CourseChange(), ns3::Ns2MobilityHelperTest::CourseChange(), ns3::MobilityHelper::CourseChanged(), ns3::SteadyStateRandomWaypointTest::DistribCompare(), ns3::TwoRayGroundPropagationLossModel::DoCalcRxPower(), ns3::HierarchicalMobilityModel::DoGetPosition(), ns3::RandomRoomPositionAllocatorTestCase::DoRun(), ns3::HierarchicalMobilityModel::DoSetPosition(), ns3::ItuR1238PropagationLossModel::GetLoss(), ns3::OkumuraHataPropagationLossModel::GetLoss(), ns3::ItuR1411LosPropagationLossModel::GetLoss(), ns3::ItuR1411NlosOverRooftopPropagationLossModel::GetLoss(), ns3::HybridBuildingsPropagationLossModel::GetLoss(), GetPosition(), GetTypeId(), main(), ns3::BuildingsHelper::MakeConsistent(), ns3::AnimationInterface::MobilityCourseChangeTrace(), ns3::AnimationInterface::RecalcTopoBounds(), ns3::HierarchicalMobilityModel::SetChild(), ns3::SetInitialPosition(), ns3::HierarchicalMobilityModel::SetParent(), ns3::SetSchedPosition(), ns3::SingleModelSpectrumChannel::StartTx(), ns3::MultiModelSpectrumChannel::StartTx(), WaypointLazyNotifyFalse::TestXPosition(), WaypointLazyNotifyTrue::TestXPosition(), WaypointInitialPositionIsWaypoint::TestXPosition(), WaypointMobilityModelViaHelper::TestXPosition(), and ns3::AnimationInterface::UpdatePosition().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double ns3::MobilityModel::GetRelativeSpeed ( Ptr< const MobilityModel other) const
Parameters
otherreference to another object's mobility model
Returns
the relative speed between the two objects. Unit is meters/s.

Definition at line 87 of file mobility-model.cc.

References GetVelocity(), sample-rng-plot::x, ns3::Vector3D::x, ns3::Vector3D::y, and ns3::Vector3D::z.

+ Here is the call graph for this function:

TypeId ns3::MobilityModel::GetTypeId ( void  )
static

This method returns the TypeId associated to ns3::MobilityModel.

This object is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/$ns3::MobilityModel

Attributes defined for this type:

  • Position: The current position of the mobility model.
  • Velocity: The current velocity of the mobility model.

TraceSources defined for this type:

  • CourseChange: The value of the position and/or velocity vector changed

Reimplemented from ns3::Object.

Reimplemented in ns3::WaypointMobilityModel, ns3::GaussMarkovMobilityModel, ns3::HierarchicalMobilityModel, ns3::RandomWaypointMobilityModel, ns3::SteadyStateRandomWaypointMobilityModel, ns3::BuildingsMobilityModel, ns3::RandomWalk2dMobilityModel, ns3::RandomDirection2dMobilityModel, ns3::ConstantVelocityMobilityModel, ns3::ConstantPositionMobilityModel, and ns3::ConstantAccelerationMobilityModel.

Definition at line 31 of file mobility-model.cc.

References ns3::TypeId::ATTR_GET, ns3::TypeId::ATTR_SET, GetPosition(), GetVelocity(), m_courseChangeTrace, ns3::MakeTraceSourceAccessor(), ns3::MakeVectorChecker(), ns3::TypeId::SetParent(), and SetPosition().

+ Here is the call graph for this function:

Vector ns3::MobilityModel::GetVelocity ( void  ) const
void ns3::MobilityModel::SetPosition ( const Vector position)
Parameters
positionthe position to set.

Definition at line 73 of file mobility-model.cc.

References DoSetPosition().

Referenced by ns3::BuildingsPathlossTestCase::CreateMobilityModel(), ns3::BuildingsShadowingTestCase::CreateMobilityModel(), ns3::aodv::LoopbackTestCase::DoRun(), ns3::LenaMimoTestCase::DoRun(), ns3::ItuR1411LosPropagationLossModelTestCase::DoRun(), ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::DoRun(), ns3::Kun2600MhzPropagationLossModelTestCase::DoRun(), ns3::OkumuraHataPropagationLossModelTestCase::DoRun(), FriisPropagationLossModelTestCase::DoRun(), ns3::LenaPhyErrorModelTestCase::DoRun(), ns3::LtePathlossModelSystemTestCase::DoRun(), ns3::BuildingsHelperOneTestCase::DoRun(), TwoRayGroundPropagationLossModelTestCase::DoRun(), WaypointInitialPositionIsWaypoint::DoRun(), ns3::aodv::ChainRegressionTest::DoRun(), LogDistancePropagationLossModelTestCase::DoRun(), RangePropagationLossModelTestCase::DoRun(), ns3::HierarchicalMobilityModel::DoSetPosition(), GetTypeId(), ns3::MobilityHelper::Install(), JakesPropagationExample::JakesPropagationExample(), ns3::LteFadingTestSuite::LteFadingTestSuite(), main(), HwmpSimplestRegressionTest::ResetPosition(), HwmpReactiveRegressionTest::ResetPosition(), PsrExperiment::Run(), CollisionExperiment::Run(), ns3::HierarchicalMobilityModel::SetChild(), ns3::SetInitialPosition(), ns3::HierarchicalMobilityModel::SetParent(), SetPosition(), ns3::LteHexGridEnbTopologyHelper::SetPositionAndInstallEnbDevice(), ns3::SetSchedPosition(), TestDeterministic(), TestDeterministicByTime(), TestProbabilistic(), NetAnimExperiment::UpdatePositions(), and Experiment::UpdatePositions().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

TracedCallback<Ptr<const MobilityModel> > ns3::MobilityModel::m_courseChangeTrace
private

Used to alert subscribers that a change in direction, velocity, or position has occurred.

Definition at line 117 of file mobility-model.h.

Referenced by GetTypeId(), and NotifyCourseChange().


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