a 2D random walk position model More...
#include <random-walk-2d-mobility-model.h>
Public Types | |
enum | Mode { MODE_DISTANCE, MODE_TIME } |
Public Member Functions | |
RandomWalk2dMobilityModel () | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::RandomWalk2dMobilityModel. | |
Private Member Functions | |
void | Start (void) |
void | Rebound (Time timeLeft) |
void | DoWalk (Time timeLeft) |
virtual void | DoDispose (void) |
virtual Vector | DoGetPosition (void) const |
virtual void | DoSetPosition (const Vector &position) |
virtual Vector | DoGetVelocity (void) const |
Private Attributes | |
StaticSpeedHelper | m_helper |
EventId | m_event |
enum Mode | m_mode |
double | m_modeDistance |
Time | m_modeTime |
RandomVariable | m_speed |
RandomVariable | m_direction |
Rectangle | m_bounds |
a 2D random walk position model
Each instance moves with a speed and direction choosen at random with the user-provided random variables until either a fixed distance has been walked or until a fixed amount of time. If we hit one of the boundaries (specified by a rectangle), of the model, we rebound on the boundary with a reflexive angle and speed. This model is often identified as a brownian motion model.
Definition at line 45 of file random-walk-2d-mobility-model.h.
Definition at line 50 of file random-walk-2d-mobility-model.h.
ns3::RandomWalk2dMobilityModel::RandomWalk2dMobilityModel | ( | ) |
Definition at line 75 of file random-walk-2d-mobility-model.cc.
References m_event, ns3::Simulator::ScheduleNow(), and Start().
void ns3::RandomWalk2dMobilityModel::DoDispose | ( | void | ) | [private, virtual] |
This method is called by Object::Dispose or by the object's destructor, whichever comes first.
Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.
Reimplemented from ns3::Object.
Definition at line 149 of file random-walk-2d-mobility-model.cc.
Vector ns3::RandomWalk2dMobilityModel::DoGetPosition | ( | void | ) | const [private, virtual] |
Concrete subclasses of this base class must implement this method.
Implements ns3::MobilityModel.
Definition at line 155 of file random-walk-2d-mobility-model.cc.
References ns3::StaticSpeedHelper::GetCurrentPosition(), m_bounds, m_helper, and ns3::StaticSpeedHelper::UpdateWithBounds().
Vector ns3::RandomWalk2dMobilityModel::DoGetVelocity | ( | void | ) | const [private, virtual] |
Concrete subclasses of this base class must implement this method.
Implements ns3::MobilityModel.
Definition at line 169 of file random-walk-2d-mobility-model.cc.
References ns3::StaticSpeedHelper::GetVelocity(), and m_helper.
void ns3::RandomWalk2dMobilityModel::DoSetPosition | ( | const Vector & | position | ) | [private, virtual] |
position | the position to set. |
Concrete subclasses of this base class must implement this method.
Implements ns3::MobilityModel.
Definition at line 161 of file random-walk-2d-mobility-model.cc.
References ns3::Rectangle::IsInside(), m_bounds, m_event, m_helper, NS_ASSERT, ns3::Simulator::Remove(), ns3::Simulator::ScheduleNow(), ns3::StaticSpeedHelper::SetPosition(), and Start().
void ns3::RandomWalk2dMobilityModel::DoWalk | ( | Time | timeLeft | ) | [private] |
Definition at line 105 of file random-walk-2d-mobility-model.cc.
References ns3::Rectangle::CalculateIntersection(), ns3::StaticSpeedHelper::GetCurrentPosition(), ns3::TimeUnit< 1 >::GetSeconds(), ns3::StaticSpeedHelper::GetVelocity(), ns3::Rectangle::IsInside(), m_bounds, m_event, m_helper, ns3::MobilityModel::NotifyCourseChange(), Rebound(), ns3::Simulator::Schedule(), ns3::Seconds(), Start(), ns3::Vector::x, and ns3::Vector::y.
TypeId ns3::RandomWalk2dMobilityModel::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::RandomWalk2dMobilityModel.
This object is accessible through the following paths with Config::Set and Config::Connect:
Attributes defined for this type:
Attributes defined in parent class ns3::MobilityModel:
No TraceSources defined for this type.
TraceSources defined in parent class ns3::MobilityModel:
Reimplemented from ns3::MobilityModel.
Definition at line 34 of file random-walk-2d-mobility-model.cc.
References ns3::TypeId::AddAttribute(), ns3::TypeId::AddConstructor(), m_bounds, m_direction, m_mode, m_modeDistance, m_modeTime, m_speed, ns3::MakeEnumAccessor(), ns3::MakeEnumChecker(), MODE_DISTANCE, MODE_TIME, ns3::Seconds(), and ns3::TypeId::SetParent().
void ns3::RandomWalk2dMobilityModel::Rebound | ( | Time | timeLeft | ) | [private] |
Definition at line 127 of file random-walk-2d-mobility-model.cc.
References ns3::Rectangle::BOTTOM, DoWalk(), ns3::Rectangle::GetClosestSide(), ns3::StaticSpeedHelper::GetCurrentPosition(), ns3::StaticSpeedHelper::GetVelocity(), ns3::Rectangle::LEFT, m_bounds, m_helper, ns3::Rectangle::RIGHT, ns3::StaticSpeedHelper::SetVelocity(), ns3::Rectangle::TOP, ns3::StaticSpeedHelper::Unpause(), ns3::StaticSpeedHelper::UpdateWithBounds(), ns3::Vector::x, and ns3::Vector::y.
Referenced by DoWalk().
void ns3::RandomWalk2dMobilityModel::Start | ( | void | ) | [private] |
Definition at line 81 of file random-walk-2d-mobility-model.cc.
References DoWalk(), ns3::RandomVariable::GetValue(), m_direction, m_helper, m_mode, m_modeDistance, m_modeTime, m_speed, MODE_TIME, ns3::Seconds(), ns3::StaticSpeedHelper::SetVelocity(), ns3::StaticSpeedHelper::Unpause(), and ns3::StaticSpeedHelper::Update().
Referenced by DoSetPosition(), DoWalk(), and RandomWalk2dMobilityModel().
Definition at line 73 of file random-walk-2d-mobility-model.h.
Referenced by DoGetPosition(), DoSetPosition(), DoWalk(), GetTypeId(), and Rebound().
Definition at line 72 of file random-walk-2d-mobility-model.h.
Referenced by GetTypeId(), and Start().
Definition at line 67 of file random-walk-2d-mobility-model.h.
Referenced by DoSetPosition(), DoWalk(), and RandomWalk2dMobilityModel().
Definition at line 66 of file random-walk-2d-mobility-model.h.
Referenced by DoGetPosition(), DoGetVelocity(), DoSetPosition(), DoWalk(), Rebound(), and Start().
enum Mode ns3::RandomWalk2dMobilityModel::m_mode [private] |
Definition at line 68 of file random-walk-2d-mobility-model.h.
Referenced by GetTypeId(), and Start().
double ns3::RandomWalk2dMobilityModel::m_modeDistance [private] |
Definition at line 69 of file random-walk-2d-mobility-model.h.
Referenced by GetTypeId(), and Start().
Definition at line 70 of file random-walk-2d-mobility-model.h.
Referenced by GetTypeId(), and Start().
Definition at line 71 of file random-walk-2d-mobility-model.h.
Referenced by GetTypeId(), and Start().