Steady-state random waypoint mobility model. More...
#include "steady-state-random-waypoint-mobility-model.h"
Public Member Functions | |
SteadyStateRandomWaypointMobilityModel () | |
~SteadyStateRandomWaypointMobilityModel () override | |
Public Member Functions inherited from ns3::MobilityModel | |
MobilityModel () | |
~MobilityModel () override=0 | |
int64_t | AssignStreams (int64_t stream) |
Assign a fixed random variable stream number to the random variables used by this model. | |
double | GetDistanceFrom (Ptr< const MobilityModel > position) const |
Vector | GetPosition () const |
Vector | GetPositionWithReference (const Vector &referencePosition) const |
This method may be used if the position returned may depend on some reference position provided. | |
double | GetRelativeSpeed (Ptr< const MobilityModel > other) const |
Vector | GetVelocity () const |
void | SetPosition (const Vector &position) |
Public Member Functions inherited from ns3::Object | |
Object () | |
Constructor. | |
~Object () override | |
Destructor. | |
void | AggregateObject (Ptr< Object > other) |
Aggregate two Objects together. | |
void | Dispose () |
Dispose of this Object. | |
AggregateIterator | GetAggregateIterator () const |
Get an iterator to the Objects aggregated to this one. | |
TypeId | GetInstanceTypeId () const override |
Get the most derived TypeId for this Object. | |
template<typename T > | |
Ptr< T > | GetObject () const |
Get a pointer to the requested aggregated Object. | |
template<> | |
Ptr< Object > | GetObject () const |
Specialization of () for objects of type ns3::Object. | |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
Get a pointer to the requested aggregated Object by TypeId. | |
template<> | |
Ptr< Object > | GetObject (TypeId tid) const |
Specialization of (TypeId tid) for objects of type ns3::Object. | |
void | Initialize () |
Invoke DoInitialize on all Objects aggregated to this one. | |
bool | IsInitialized () const |
Check if the object has been initialized. | |
void | UnidirectionalAggregateObject (Ptr< Object > other) |
Aggregate an Object to another Object. | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Default constructor. | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. | |
uint32_t | GetReferenceCount () const |
Get the reference count of the object. | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment operator. | |
void | Ref () const |
Increment the reference count. | |
void | Unref () const |
Decrement the reference count. | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. | |
void | GetAttribute (std::string name, AttributeValue &value, bool permissive=false) const |
Get the value of an attribute, raising fatal errors if unsuccessful. | |
bool | GetAttributeFailSafe (std::string name, AttributeValue &value) const |
Get the value of an attribute without raising errors. | |
void | SetAttribute (std::string name, const AttributeValue &value) |
Set a single attribute, raising fatal errors if unsuccessful. | |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
Set a single attribute without raising errors. | |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
Connect a TraceSource to a Callback with a context. | |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
Connect a TraceSource to a Callback without a context. | |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected with a context. | |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Disconnect from a TraceSource a Callback previously connected without a context. | |
Static Public Member Functions | |
static TypeId | GetTypeId () |
Register this type with the TypeId system. | |
Static Public Member Functions inherited from ns3::MobilityModel | |
static TypeId | GetTypeId () |
Register this type with the TypeId system. | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId () |
Register this type. | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId () |
Get the type ID. | |
Protected Member Functions | |
void | DoInitialize () override |
Initialize() implementation. | |
Protected Member Functions inherited from ns3::MobilityModel | |
void | NotifyCourseChange () const |
Must be invoked by subclasses when the course of the position changes to notify course change listeners. | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
Copy an Object. | |
virtual void | DoDispose () |
Destructor implementation. | |
virtual void | NotifyNewAggregate () |
Notify all Objects aggregated to this one of a new Object being aggregated. | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
Complete construction of ObjectBase; invoked by derived classes. | |
virtual void | NotifyConstructionCompleted () |
Notifier called once the ObjectBase is fully constructed. | |
Private Member Functions | |
void | BeginWalk () |
Start a motion period and schedule the ending of the motion. | |
int64_t | DoAssignStreams (int64_t) override |
The default implementation does nothing but return the passed-in parameter. | |
Vector | DoGetPosition () const override |
Vector | DoGetVelocity () const override |
void | DoInitializePrivate () |
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. | |
void | DoSetPosition (const Vector &position) override |
void | Start () |
Start a pause period and schedule the ending of the pause. | |
void | SteadyStateBeginWalk (const Vector &destination) |
Use provided destination to calculate travel delay, and schedule a Start() event at that time. | |
Private Attributes | |
bool | alreadyStarted |
flag for starting state | |
EventId | m_event |
current event ID | |
ConstantVelocityHelper | m_helper |
helper for velocity computations | |
double | m_maxPause |
maximum pause value (s) | |
double | m_maxSpeed |
maximum speed value (m/s) | |
double | m_maxX |
maximum x value of traveling region (m) | |
double | m_maxY |
maximum y value of traveling region (m) | |
double | m_minPause |
minimum pause value (s) | |
double | m_minSpeed |
minimum speed value (m/s) | |
double | m_minX |
minimum x value of traveling region (m) | |
double | m_minY |
minimum y value of traveling region (m) | |
Ptr< UniformRandomVariable > | m_pause |
random variable for pause values | |
Ptr< RandomBoxPositionAllocator > | m_position |
position allocator | |
Ptr< UniformRandomVariable > | m_speed |
random variable for speed values | |
Ptr< UniformRandomVariable > | m_u_r |
rv used in step 5 of algorithm | |
Ptr< UniformRandomVariable > | m_x |
rv used for position allocator | |
Ptr< UniformRandomVariable > | m_x1_r |
rv used in rejection sampling phase | |
Ptr< UniformRandomVariable > | m_x2_r |
rv used in rejection sampling phase | |
Ptr< UniformRandomVariable > | m_y |
rv used for position allocator | |
Ptr< UniformRandomVariable > | m_y1_r |
rv used in rejection sampling phase | |
Ptr< UniformRandomVariable > | m_y2_r |
rv used in rejection sampling phase | |
double | m_z |
z value of traveling region | |
Additional Inherited Members | |
Public Types inherited from ns3::MobilityModel | |
typedef void(* | TracedCallback) (Ptr< const MobilityModel > model) |
TracedCallback signature. | |
Related Symbols inherited from ns3::ObjectBase | |
static TypeId | GetObjectIid () |
Ensure the TypeId for ObjectBase gets fully configured to anchor the inheritance tree properly. | |
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 movement occurs on the plane, where 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.
Definition at line 45 of file steady-state-random-waypoint-mobility-model.h.
ns3::SteadyStateRandomWaypointMobilityModel::SteadyStateRandomWaypointMobilityModel | ( | ) |
Definition at line 78 of file steady-state-random-waypoint-mobility-model.cc.
References ns3::CreateObject(), m_pause, m_position, m_speed, m_u_r, m_x, m_x1_r, m_x2_r, m_y, m_y1_r, and m_y2_r.
|
override |
Definition at line 93 of file steady-state-random-waypoint-mobility-model.cc.
References ns3::EventId::Cancel(), and m_event.
|
private |
Start a motion period and schedule the ending of the motion.
Definition at line 240 of file steady-state-random-waypoint-mobility-model.cc.
References ns3::CalculateDistance(), ns3::ConstantVelocityHelper::GetCurrentPosition(), m_event, m_helper, m_maxX, m_maxY, m_minX, m_minY, m_position, m_speed, ns3::MobilityModel::NotifyCourseChange(), NS_ASSERT, ns3::Simulator::Schedule(), ns3::Seconds(), ns3::ConstantVelocityHelper::SetVelocity(), Start(), ns3::ConstantVelocityHelper::Unpause(), and ns3::ConstantVelocityHelper::Update().
Referenced by DoInitializePrivate(), and Start().
|
overrideprivatevirtual |
The default implementation does nothing but return the passed-in parameter.
Subclasses using random variables are expected to override this.
start | starting stream index |
Reimplemented from ns3::MobilityModel.
Definition at line 296 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, and m_y2_r.
|
overrideprivatevirtual |
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 ns3::ConstantVelocityHelper::GetCurrentPosition(), m_helper, and ns3::ConstantVelocityHelper::Update().
|
overrideprivatevirtual |
Concrete subclasses of this base class must implement this method.
Implements ns3::MobilityModel.
Definition at line 290 of file steady-state-random-waypoint-mobility-model.cc.
References ns3::ConstantVelocityHelper::GetVelocity(), and m_helper.
|
overrideprotectedvirtual |
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 99 of file steady-state-random-waypoint-mobility-model.cc.
References ns3::Object::DoInitialize(), and DoInitializePrivate().
|
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 106 of file steady-state-random-waypoint-mobility-model.cc.
References alreadyStarted, BeginWalk(), ns3::CreateObject(), ns3::EventId::IsPending(), 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::ConstantVelocityHelper::SetPosition(), SteadyStateBeginWalk(), and ns3::ConstantVelocityHelper::Update().
Referenced by DoInitialize().
|
overrideprivatevirtual |
position | the position to set. |
Concrete subclasses of this base class must implement this method.
Implements ns3::MobilityModel.
Definition at line 279 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().
|
static |
Register this type with the TypeId system.
Definition at line 22 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(), ns3::MakeDoubleChecker(), and ns3::TypeId::SetParent().
|
private |
Start a pause period and schedule the ending of the pause.
Definition at line 262 of file steady-state-random-waypoint-mobility-model.cc.
References BeginWalk(), 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().
|
private |
Use provided destination to calculate travel delay, and schedule a Start() event at that time.
destination | the destination to move to |
Definition at line 216 of file steady-state-random-waypoint-mobility-model.cc.
References ns3::CalculateDistance(), ns3::ConstantVelocityHelper::GetCurrentPosition(), 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().
|
private |
flag for starting state
Definition at line 99 of file steady-state-random-waypoint-mobility-model.h.
Referenced by DoInitializePrivate(), and DoSetPosition().
|
private |
current event ID
Definition at line 98 of file steady-state-random-waypoint-mobility-model.h.
Referenced by ~SteadyStateRandomWaypointMobilityModel(), BeginWalk(), DoInitializePrivate(), DoSetPosition(), Start(), and SteadyStateBeginWalk().
|
private |
helper for velocity computations
Definition at line 85 of file steady-state-random-waypoint-mobility-model.h.
Referenced by BeginWalk(), DoGetPosition(), DoGetVelocity(), DoInitializePrivate(), DoSetPosition(), Start(), and SteadyStateBeginWalk().
|
private |
maximum pause value (s)
Definition at line 96 of file steady-state-random-waypoint-mobility-model.h.
Referenced by DoInitializePrivate(), and GetTypeId().
|
private |
maximum speed value (m/s)
Definition at line 86 of file steady-state-random-waypoint-mobility-model.h.
Referenced by DoInitializePrivate(), GetTypeId(), and SteadyStateBeginWalk().
|
private |
maximum x value of traveling region (m)
Definition at line 90 of file steady-state-random-waypoint-mobility-model.h.
Referenced by BeginWalk(), DoInitializePrivate(), GetTypeId(), and SteadyStateBeginWalk().
|
private |
maximum y value of traveling region (m)
Definition at line 92 of file steady-state-random-waypoint-mobility-model.h.
Referenced by BeginWalk(), DoInitializePrivate(), GetTypeId(), and SteadyStateBeginWalk().
|
private |
minimum pause value (s)
Definition at line 95 of file steady-state-random-waypoint-mobility-model.h.
Referenced by DoInitializePrivate(), and GetTypeId().
|
private |
minimum speed value (m/s)
Definition at line 87 of file steady-state-random-waypoint-mobility-model.h.
Referenced by DoInitializePrivate(), GetTypeId(), and SteadyStateBeginWalk().
|
private |
minimum x value of traveling region (m)
Definition at line 89 of file steady-state-random-waypoint-mobility-model.h.
Referenced by BeginWalk(), DoInitializePrivate(), GetTypeId(), and SteadyStateBeginWalk().
|
private |
minimum y value of traveling region (m)
Definition at line 91 of file steady-state-random-waypoint-mobility-model.h.
Referenced by BeginWalk(), DoInitializePrivate(), GetTypeId(), and SteadyStateBeginWalk().
|
private |
random variable for pause values
Definition at line 97 of file steady-state-random-waypoint-mobility-model.h.
Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), DoInitializePrivate(), and Start().
|
private |
position allocator
Definition at line 94 of file steady-state-random-waypoint-mobility-model.h.
Referenced by SteadyStateRandomWaypointMobilityModel(), BeginWalk(), DoAssignStreams(), and DoInitializePrivate().
|
private |
random variable for speed values
Definition at line 88 of file steady-state-random-waypoint-mobility-model.h.
Referenced by SteadyStateRandomWaypointMobilityModel(), BeginWalk(), DoAssignStreams(), and DoInitializePrivate().
|
private |
rv used in step 5 of algorithm
Definition at line 104 of file steady-state-random-waypoint-mobility-model.h.
Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), DoInitializePrivate(), and SteadyStateBeginWalk().
|
private |
rv used for position allocator
Definition at line 105 of file steady-state-random-waypoint-mobility-model.h.
Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), and DoInitializePrivate().
|
private |
rv used in rejection sampling phase
Definition at line 100 of file steady-state-random-waypoint-mobility-model.h.
Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), and DoInitializePrivate().
|
private |
rv used in rejection sampling phase
Definition at line 102 of file steady-state-random-waypoint-mobility-model.h.
Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), and DoInitializePrivate().
|
private |
rv used for position allocator
Definition at line 106 of file steady-state-random-waypoint-mobility-model.h.
Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), and DoInitializePrivate().
|
private |
rv used in rejection sampling phase
Definition at line 101 of file steady-state-random-waypoint-mobility-model.h.
Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), and DoInitializePrivate().
|
private |
rv used in rejection sampling phase
Definition at line 103 of file steady-state-random-waypoint-mobility-model.h.
Referenced by SteadyStateRandomWaypointMobilityModel(), DoAssignStreams(), and DoInitializePrivate().
|
private |
z value of traveling region
Definition at line 93 of file steady-state-random-waypoint-mobility-model.h.
Referenced by DoInitializePrivate(), and GetTypeId().