A Discrete-Event Network Simulator
API
ns3::SteadyStateRandomWaypointMobilityModel Class Reference

Steady-state random waypoint mobility model. More...

#include "steady-state-random-waypoint-mobility-model.h"

+ Inheritance diagram for ns3::SteadyStateRandomWaypointMobilityModel:
+ Collaboration diagram for ns3::SteadyStateRandomWaypointMobilityModel:

Public Member Functions

 SteadyStateRandomWaypointMobilityModel ()
 
- Public Member Functions inherited from ns3::MobilityModel
 MobilityModel ()
 
virtual ~MobilityModel ()=0
 
int64_t AssignStreams (int64_t stream)
 Assign a fixed random variable stream number to the random variables used by this model. More...
 
double GetDistanceFrom (Ptr< const MobilityModel > position) const
 
Vector GetPosition (void) const
 
Vector GetPositionWithReference (const Vector &referencePosition) const
 This method may be used if the position returned may depend on some reference position provided. More...
 
double GetRelativeSpeed (Ptr< const MobilityModel > other) const
 
Vector GetVelocity (void) const
 
void SetPosition (const Vector &position)
 
- Public Member Functions inherited from ns3::Object
 Object ()
 Constructor. More...
 
virtual ~Object ()
 Destructor. More...
 
void AggregateObject (Ptr< Object > other)
 Aggregate two Objects together. More...
 
void Dispose (void)
 Dispose of this Object. More...
 
AggregateIterator GetAggregateIterator (void) const
 Get an iterator to the Objects aggregated to this one. More...
 
virtual TypeId GetInstanceTypeId (void) const
 Get the most derived TypeId for this Object. More...
 
template<>
Ptr< ObjectGetObject () const
 Specialization of () for objects of type ns3::Object. More...
 
template<typename T >
Ptr< T > GetObject (TypeId tid) const
 Get a pointer to the requested aggregated Object by TypeId. More...
 
template<>
Ptr< ObjectGetObject (TypeId tid) const
 Specialization of (TypeId tid) for objects of type ns3::Object. More...
 
template<typename T >
Ptr< T > GetObject (void) const
 Get a pointer to the requested aggregated Object. More...
 
void Initialize (void)
 Invoke DoInitialize on all Objects aggregated to this one. More...
 
bool IsInitialized (void) const
 Check if the object has been initialized. More...
 
- Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter >
 SimpleRefCount ()
 Default constructor. More...
 
 SimpleRefCount (const SimpleRefCount &o)
 Copy constructor. More...
 
uint32_t GetReferenceCount (void) const
 Get the reference count of the object. More...
 
SimpleRefCountoperator= (const SimpleRefCount &o)
 Assignment operator. More...
 
void Ref (void) const
 Increment the reference count. More...
 
void Unref (void) const
 Decrement the reference count. More...
 
- Public Member Functions inherited from ns3::ObjectBase
virtual ~ObjectBase ()
 Virtual destructor. More...
 
void GetAttribute (std::string name, AttributeValue &value) const
 Get the value of an attribute, raising fatal errors if unsuccessful. More...
 
bool GetAttributeFailSafe (std::string name, AttributeValue &value) const
 Get the value of an attribute without raising erros. More...
 
virtual TypeId GetInstanceTypeId (void) const =0
 Get the most derived TypeId for this Object. More...
 
void SetAttribute (std::string name, const AttributeValue &value)
 Set a single attribute, raising fatal errors if unsuccessful. More...
 
bool SetAttributeFailSafe (std::string name, const AttributeValue &value)
 Set a single attribute without raising errors. More...
 
bool TraceConnect (std::string name, std::string context, const CallbackBase &cb)
 Connect a TraceSource to a Callback with a context. More...
 
bool TraceConnectWithoutContext (std::string name, const CallbackBase &cb)
 Connect a TraceSource to a Callback without a context. More...
 
bool TraceDisconnect (std::string name, std::string context, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected with a context. More...
 
bool TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb)
 Disconnect from a TraceSource a Callback previously connected without a context. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 Register this type with the TypeId system. More...
 
- Static Public Member Functions inherited from ns3::MobilityModel
static TypeId GetTypeId (void)
 Register this type with the TypeId system. More...
 
- Static Public Member Functions inherited from ns3::Object
static TypeId GetTypeId (void)
 Register this type. More...
 
- Static Public Member Functions inherited from ns3::ObjectBase
static TypeId GetTypeId (void)
 Get the type ID. More...
 

Protected Member Functions

virtual void DoInitialize (void)
 Initialize() implementation. More...
 
- Protected Member Functions inherited from ns3::MobilityModel
void NotifyCourseChange (void) const
 Must be invoked by subclasses when the course of the position changes to notify course change listeners. More...
 
- Protected Member Functions inherited from ns3::Object
 Object (const Object &o)
 Copy an Object. More...
 
virtual void DoDispose (void)
 Destructor implementation. More...
 
virtual void DoInitialize (void)
 Initialize() implementation. More...
 
virtual void NotifyNewAggregate (void)
 Notify all Objects aggregated to this one of a new Object being aggregated. More...
 
- Protected Member Functions inherited from ns3::ObjectBase
void ConstructSelf (const AttributeConstructionList &attributes)
 Complete construction of ObjectBase; invoked by derived classes. More...
 
virtual void NotifyConstructionCompleted (void)
 Notifier called once the ObjectBase is fully constructed. More...
 

Private Member Functions

void BeginWalk (void)
 Start a motion period and schedule the ending of the motion. More...
 
virtual int64_t DoAssignStreams (int64_t)
 The default implementation does nothing but return the passed-in parameter. More...
 
virtual Vector DoGetPosition (void) const
 
virtual Vector DoGetVelocity (void) const
 
void DoInitializePrivate (void)
 Configure random variables based on attributes; calculate the steady state probability that node is initially paused; schedule either end of pause time or initial motion of the node. More...
 
virtual void DoSetPosition (const Vector &position)
 
void Start (void)
 Start a pause period and schedule the ending of the pause. More...
 
void SteadyStateBeginWalk (const Vector &destination)
 Use provided destination to calculate travel delay, and schedule a Start() event at that time. More...
 

Private Attributes

bool alreadyStarted
 flag for starting state More...
 
EventId m_event
 current event ID More...
 
ConstantVelocityHelper m_helper
 helper for velocity computations More...
 
double m_maxPause
 maximum pause value (s) More...
 
double m_maxSpeed
 maximum speed value (m/s) More...
 
double m_maxX
 maximum x value of traveling region (m) More...
 
double m_maxY
 maximum y value of traveling region (m) More...
 
double m_minPause
 minimum pause value (s) More...
 
double m_minSpeed
 minimum speed value (m/s) More...
 
double m_minX
 minimum x value of traveling region (m) More...
 
double m_minY
 minimum y value of traveling region (m) More...
 
Ptr< UniformRandomVariablem_pause
 random variable for pause values More...
 
Ptr< RandomBoxPositionAllocatorm_position
 position allocator More...
 
Ptr< UniformRandomVariablem_speed
 random variable for speed values More...
 
Ptr< UniformRandomVariablem_u_r
 rv used in step 5 of algorithm More...
 
Ptr< UniformRandomVariablem_x
 rv used for position allocator More...
 
Ptr< UniformRandomVariablem_x1_r
 rv used in rejection sampling phase More...
 
Ptr< UniformRandomVariablem_x2_r
 rv used in rejection sampling phase More...
 
Ptr< UniformRandomVariablem_y
 rv used for position allocator More...
 
Ptr< UniformRandomVariablem_y1_r
 rv used in rejection sampling phase More...
 
Ptr< UniformRandomVariablem_y2_r
 rv used in rejection sampling phase More...
 
double m_z
 z value of traveling region More...
 

Additional Inherited Members

- Public Types inherited from ns3::MobilityModel
typedef void(* TracedCallback) (Ptr< const MobilityModel > model)
 TracedCallback signature. More...
 

Detailed Description

Steady-state random waypoint mobility model.

This model based on random waypoint mobility (RWM) model for case when speed, pause and position are uniformly distributed random variables. The difference is that the initial values of this parameters are not from uniform distribution but from stationary distribution of RWM model. The implementation of this model is 2D-specific and with nonzero nodes speeds. In the 3D ns-3 coordinate system, the momement occurs on the $ z=\overline{Z} $ plane, where $ \overline{Z} $ is a constant which can be configured using the Z attribute.

Based on NS-2 implementation by Toilers Research Group – Colorado School of Mines (http://toilers.mines.edu). The papers related to this code are: W. Navidi and T. Camp, Stationary Distributions for the Random Waypoint Mobility Model, IEEE Transactions on Mobile Computing, vol. 3, no. 1, pp. 99-108, January-March 2004. W. Navidi, T. Camp, and N. Bauer, Improving the Accuracy of Random Waypoint Simulations Through Steady-State Initialization, Proceedings of the 15th International Conference on Modeling and Simulation (MS '04), pp. 319-326, March 2004.

Config Paths

ns3::SteadyStateRandomWaypointMobilityModel is accessible through the following paths with Config::Set and Config::Connect:

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

Attributes

  • MinSpeed: Minimum speed value, [m/s]
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0.3
    • Flags: construct write read
  • MaxSpeed: Maximum speed value, [m/s]
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0.7
    • Flags: construct write read
  • MinPause: Minimum pause value, [s]
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0
    • Flags: construct write read
  • MaxPause: Maximum pause value, [s]
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0
    • Flags: construct write read
  • MinX: Minimum X value of traveling region, [m]
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 1
    • Flags: construct write read
  • MaxX: Maximum X value of traveling region, [m]
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 1
    • Flags: construct write read
  • MinY: Minimum Y value of traveling region, [m]
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 1
    • Flags: construct write read
  • MaxY: Maximum Y value of traveling region, [m]
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 1
    • Flags: construct write read
  • Z: Z value of traveling region (fixed), [m]
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 0
    • Flags: construct write read

Attributes defined in parent class ns3::MobilityModel

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

No TraceSources are defined for this type.

TraceSources defined in parent class ns3::MobilityModel

Size of this type is 296 bytes (on a 64-bit architecture).

Definition at line 55 of file steady-state-random-waypoint-mobility-model.h.

Constructor & Destructor Documentation

◆ SteadyStateRandomWaypointMobilityModel()

ns3::SteadyStateRandomWaypointMobilityModel::SteadyStateRandomWaypointMobilityModel ( )

Member Function Documentation

◆ BeginWalk()

void ns3::SteadyStateRandomWaypointMobilityModel::BeginWalk ( void  )
private

◆ DoAssignStreams()

int64_t ns3::SteadyStateRandomWaypointMobilityModel::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.

Parameters
startstarting stream index
Returns
the number of streams used

Reimplemented from ns3::MobilityModel.

Definition at line 287 of file steady-state-random-waypoint-mobility-model.cc.

References m_pause, m_position, m_speed, m_u_r, m_x, m_x1_r, m_x2_r, m_y, m_y1_r, m_y2_r, and ns3::RandomVariableStream::SetStream().

+ Here is the call graph for this function:

◆ DoGetPosition()

Vector ns3::SteadyStateRandomWaypointMobilityModel::DoGetPosition ( void  ) const
privatevirtual
Returns
the current position.

Concrete subclasses of this base class must implement this method.

Implements ns3::MobilityModel.

Definition at line 266 of file steady-state-random-waypoint-mobility-model.cc.

References ns3::ConstantVelocityHelper::GetCurrentPosition(), m_helper, and ns3::ConstantVelocityHelper::Update().

+ Here is the call graph for this function:

◆ DoGetVelocity()

Vector ns3::SteadyStateRandomWaypointMobilityModel::DoGetVelocity ( void  ) const
privatevirtual
Returns
the current velocity.

Concrete subclasses of this base class must implement this method.

Implements ns3::MobilityModel.

Definition at line 282 of file steady-state-random-waypoint-mobility-model.cc.

References ns3::ConstantVelocityHelper::GetVelocity(), and m_helper.

+ Here is the call graph for this function:

◆ DoInitialize()

void ns3::SteadyStateRandomWaypointMobilityModel::DoInitialize ( void  )
protectedvirtual

Initialize() implementation.

This method is called only once by Initialize(). If the user calls Initialize() multiple times, DoInitialize() is called only the first time.

Subclasses are expected to override this method and chain up to their parent's implementation once they are done. It is safe to call GetObject() and AggregateObject() from within this method.

Reimplemented from ns3::Object.

Definition at line 102 of file steady-state-random-waypoint-mobility-model.cc.

References ns3::Object::DoInitialize(), and DoInitializePrivate().

+ Here is the call graph for this function:

◆ DoInitializePrivate()

void ns3::SteadyStateRandomWaypointMobilityModel::DoInitializePrivate ( void  )
private

Configure random variables based on attributes; calculate the steady state probability that node is initially paused; schedule either end of pause time or initial motion of the node.

Definition at line 109 of file steady-state-random-waypoint-mobility-model.cc.

References alreadyStarted, BeginWalk(), ns3::UniformRandomVariable::GetValue(), ns3::EventId::IsRunning(), m_event, m_helper, m_maxPause, m_maxSpeed, m_maxX, m_maxY, m_minPause, m_minSpeed, m_minX, m_minY, m_pause, m_position, m_speed, m_u_r, m_x, m_x1_r, m_x2_r, m_y, m_y1_r, m_y2_r, m_z, ns3::MobilityModel::NotifyCourseChange(), NS_ASSERT, ns3::ConstantVelocityHelper::Pause(), ns3::Simulator::Schedule(), ns3::Simulator::ScheduleNow(), ns3::Seconds(), ns3::ObjectBase::SetAttribute(), ns3::ConstantVelocityHelper::SetPosition(), SteadyStateBeginWalk(), and ns3::ConstantVelocityHelper::Update().

Referenced by DoInitialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ DoSetPosition()

void ns3::SteadyStateRandomWaypointMobilityModel::DoSetPosition ( const Vector &  position)
privatevirtual
Parameters
positionthe position to set.

Concrete subclasses of this base class must implement this method.

Implements ns3::MobilityModel.

Definition at line 272 of file steady-state-random-waypoint-mobility-model.cc.

References alreadyStarted, ns3::EventId::Cancel(), m_event, m_helper, ns3::Simulator::ScheduleNow(), ns3::ConstantVelocityHelper::SetPosition(), and Start().

+ Here is the call graph for this function:

◆ GetTypeId()

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

Register this type with the TypeId system.

Returns
the object TypeId

Definition at line 31 of file steady-state-random-waypoint-mobility-model.cc.

References m_maxPause, m_maxSpeed, m_maxX, m_maxY, m_minPause, m_minSpeed, m_minX, m_minY, m_z, ns3::MakeDoubleAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

◆ Start()

void ns3::SteadyStateRandomWaypointMobilityModel::Start ( void  )
private

Start a pause period and schedule the ending of the pause.

Definition at line 256 of file steady-state-random-waypoint-mobility-model.cc.

References BeginWalk(), ns3::UniformRandomVariable::GetValue(), m_event, m_helper, m_pause, ns3::MobilityModel::NotifyCourseChange(), ns3::ConstantVelocityHelper::Pause(), ns3::Simulator::Schedule(), ns3::Seconds(), and ns3::ConstantVelocityHelper::Update().

Referenced by BeginWalk(), DoSetPosition(), and SteadyStateBeginWalk().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SteadyStateBeginWalk()

void ns3::SteadyStateRandomWaypointMobilityModel::SteadyStateBeginWalk ( const Vector &  destination)
private

Use provided destination to calculate travel delay, and schedule a Start() event at that time.

Parameters
destinationthe destination to move to

Definition at line 210 of file steady-state-random-waypoint-mobility-model.cc.

References ns3::CalculateDistance(), ns3::ConstantVelocityHelper::GetCurrentPosition(), ns3::UniformRandomVariable::GetValue(), bianchi11ax::k, m_event, m_helper, m_maxSpeed, m_maxX, m_maxY, m_minSpeed, m_minX, m_minY, m_u_r, ns3::MobilityModel::NotifyCourseChange(), NS_ASSERT, ns3::Simulator::Schedule(), ns3::Seconds(), ns3::ConstantVelocityHelper::SetVelocity(), Start(), ns3::ConstantVelocityHelper::Unpause(), and ns3::ConstantVelocityHelper::Update().

Referenced by DoInitializePrivate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ alreadyStarted

bool ns3::SteadyStateRandomWaypointMobilityModel::alreadyStarted
private

flag for starting state

Definition at line 106 of file steady-state-random-waypoint-mobility-model.h.

Referenced by DoInitializePrivate(), and DoSetPosition().

◆ m_event

EventId ns3::SteadyStateRandomWaypointMobilityModel::m_event
private

◆ m_helper

ConstantVelocityHelper ns3::SteadyStateRandomWaypointMobilityModel::m_helper
private

◆ m_maxPause

double ns3::SteadyStateRandomWaypointMobilityModel::m_maxPause
private

maximum pause value (s)

Definition at line 103 of file steady-state-random-waypoint-mobility-model.h.

Referenced by DoInitializePrivate(), and GetTypeId().

◆ m_maxSpeed

double ns3::SteadyStateRandomWaypointMobilityModel::m_maxSpeed
private

maximum speed value (m/s)

Definition at line 93 of file steady-state-random-waypoint-mobility-model.h.

Referenced by DoInitializePrivate(), GetTypeId(), and SteadyStateBeginWalk().

◆ m_maxX

double ns3::SteadyStateRandomWaypointMobilityModel::m_maxX
private

maximum x value of traveling region (m)

Definition at line 97 of file steady-state-random-waypoint-mobility-model.h.

Referenced by BeginWalk(), DoInitializePrivate(), GetTypeId(), and SteadyStateBeginWalk().

◆ m_maxY

double ns3::SteadyStateRandomWaypointMobilityModel::m_maxY
private

maximum y value of traveling region (m)

Definition at line 99 of file steady-state-random-waypoint-mobility-model.h.

Referenced by BeginWalk(), DoInitializePrivate(), GetTypeId(), and SteadyStateBeginWalk().

◆ m_minPause

double ns3::SteadyStateRandomWaypointMobilityModel::m_minPause
private

minimum pause value (s)

Definition at line 102 of file steady-state-random-waypoint-mobility-model.h.

Referenced by DoInitializePrivate(), and GetTypeId().

◆ m_minSpeed

double ns3::SteadyStateRandomWaypointMobilityModel::m_minSpeed
private

minimum speed value (m/s)

Definition at line 94 of file steady-state-random-waypoint-mobility-model.h.

Referenced by DoInitializePrivate(), GetTypeId(), and SteadyStateBeginWalk().

◆ m_minX

double ns3::SteadyStateRandomWaypointMobilityModel::m_minX
private

minimum x value of traveling region (m)

Definition at line 96 of file steady-state-random-waypoint-mobility-model.h.

Referenced by BeginWalk(), DoInitializePrivate(), GetTypeId(), and SteadyStateBeginWalk().

◆ m_minY

double ns3::SteadyStateRandomWaypointMobilityModel::m_minY
private

minimum y value of traveling region (m)

Definition at line 98 of file steady-state-random-waypoint-mobility-model.h.

Referenced by BeginWalk(), DoInitializePrivate(), GetTypeId(), and SteadyStateBeginWalk().

◆ m_pause

Ptr<UniformRandomVariable> ns3::SteadyStateRandomWaypointMobilityModel::m_pause
private

random variable for pause values

Definition at line 104 of file steady-state-random-waypoint-mobility-model.h.

Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), DoInitializePrivate(), and Start().

◆ m_position

Ptr<RandomBoxPositionAllocator> ns3::SteadyStateRandomWaypointMobilityModel::m_position
private

◆ m_speed

Ptr<UniformRandomVariable> ns3::SteadyStateRandomWaypointMobilityModel::m_speed
private

◆ m_u_r

Ptr<UniformRandomVariable> ns3::SteadyStateRandomWaypointMobilityModel::m_u_r
private

◆ m_x

Ptr<UniformRandomVariable> ns3::SteadyStateRandomWaypointMobilityModel::m_x
private

rv used for position allocator

Definition at line 112 of file steady-state-random-waypoint-mobility-model.h.

Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), and DoInitializePrivate().

◆ m_x1_r

Ptr<UniformRandomVariable> ns3::SteadyStateRandomWaypointMobilityModel::m_x1_r
private

rv used in rejection sampling phase

Definition at line 107 of file steady-state-random-waypoint-mobility-model.h.

Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), and DoInitializePrivate().

◆ m_x2_r

Ptr<UniformRandomVariable> ns3::SteadyStateRandomWaypointMobilityModel::m_x2_r
private

rv used in rejection sampling phase

Definition at line 109 of file steady-state-random-waypoint-mobility-model.h.

Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), and DoInitializePrivate().

◆ m_y

Ptr<UniformRandomVariable> ns3::SteadyStateRandomWaypointMobilityModel::m_y
private

rv used for position allocator

Definition at line 113 of file steady-state-random-waypoint-mobility-model.h.

Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), and DoInitializePrivate().

◆ m_y1_r

Ptr<UniformRandomVariable> ns3::SteadyStateRandomWaypointMobilityModel::m_y1_r
private

rv used in rejection sampling phase

Definition at line 108 of file steady-state-random-waypoint-mobility-model.h.

Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), and DoInitializePrivate().

◆ m_y2_r

Ptr<UniformRandomVariable> ns3::SteadyStateRandomWaypointMobilityModel::m_y2_r
private

rv used in rejection sampling phase

Definition at line 110 of file steady-state-random-waypoint-mobility-model.h.

Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), and DoInitializePrivate().

◆ m_z

double ns3::SteadyStateRandomWaypointMobilityModel::m_z
private

z value of traveling region

Definition at line 100 of file steady-state-random-waypoint-mobility-model.h.

Referenced by DoInitializePrivate(), and GetTypeId().


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