a RandomDirection mobility model More...
#include <random-direction-2d-mobility-model.h>
Public Member Functions | |
RandomDirection2dMobilityModel () | |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::RandomDirection2dMobilityModel. | |
Private Member Functions | |
void | Start (void) |
void | ResetDirectionAndSpeed (void) |
void | BeginPause (void) |
void | SetDirectionAndSpeed (double direction) |
void | InitializeDirectionAndSpeed (void) |
virtual void | DoDispose (void) |
virtual Vector | DoGetPosition (void) const |
virtual void | DoSetPosition (const Vector &position) |
virtual Vector | DoGetVelocity (void) const |
Private Attributes | |
Rectangle | m_bounds |
RandomVariable | m_speed |
RandomVariable | m_pause |
EventId | m_event |
StaticSpeedHelper | m_helper |
Static Private Attributes | |
static const double | PI = 3.14159265358979323846 |
a RandomDirection mobility model
The movement of objects is based on random directions: each object pauses for a specific delay, chooses a random direction and speed and then travels in the specific direction until it reaches one of the boundaries of the model. When it reaches the boundary, it pauses, selects a new direction and speed, aso.
Definition at line 43 of file random-direction-2d-mobility-model.h.
ns3::RandomDirection2dMobilityModel::RandomDirection2dMobilityModel | ( | ) |
Definition at line 59 of file random-direction-2d-mobility-model.cc.
References m_event, ns3::Simulator::ScheduleNow(), and Start().
void ns3::RandomDirection2dMobilityModel::BeginPause | ( | void | ) | [private] |
Definition at line 77 of file random-direction-2d-mobility-model.cc.
References ns3::RandomVariable::GetValue(), m_event, m_helper, m_pause, ns3::MobilityModel::NotifyCourseChange(), ns3::StaticSpeedHelper::Pause(), ResetDirectionAndSpeed(), ns3::Simulator::Schedule(), ns3::Seconds(), and ns3::StaticSpeedHelper::Update().
Referenced by SetDirectionAndSpeed().
void ns3::RandomDirection2dMobilityModel::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 64 of file random-direction-2d-mobility-model.cc.
Vector ns3::RandomDirection2dMobilityModel::DoGetPosition | ( | void | ) | const [private, virtual] |
Concrete subclasses of this base class must implement this method.
Implements ns3::MobilityModel.
Definition at line 129 of file random-direction-2d-mobility-model.cc.
References ns3::StaticSpeedHelper::GetCurrentPosition(), m_bounds, m_helper, and ns3::StaticSpeedHelper::UpdateWithBounds().
Vector ns3::RandomDirection2dMobilityModel::DoGetVelocity | ( | void | ) | const [private, virtual] |
Concrete subclasses of this base class must implement this method.
Implements ns3::MobilityModel.
Definition at line 142 of file random-direction-2d-mobility-model.cc.
References ns3::StaticSpeedHelper::GetVelocity(), and m_helper.
void ns3::RandomDirection2dMobilityModel::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 135 of file random-direction-2d-mobility-model.cc.
References m_event, m_helper, ns3::Simulator::Remove(), ns3::Simulator::ScheduleNow(), ns3::StaticSpeedHelper::SetPosition(), and Start().
TypeId ns3::RandomDirection2dMobilityModel::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::RandomDirection2dMobilityModel.
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 36 of file random-direction-2d-mobility-model.cc.
References ns3::TypeId::AddConstructor(), m_bounds, m_pause, m_speed, and ns3::TypeId::SetParent().
void ns3::RandomDirection2dMobilityModel::InitializeDirectionAndSpeed | ( | void | ) | [private] |
void ns3::RandomDirection2dMobilityModel::ResetDirectionAndSpeed | ( | void | ) | [private] |
Definition at line 105 of file random-direction-2d-mobility-model.cc.
References ns3::Rectangle::BOTTOM, ns3::Rectangle::GetClosestSide(), ns3::StaticSpeedHelper::GetCurrentPosition(), ns3::UniformVariable::GetSingleValue(), ns3::Rectangle::LEFT, m_bounds, m_helper, PI, ns3::Rectangle::RIGHT, SetDirectionAndSpeed(), ns3::Rectangle::TOP, and ns3::StaticSpeedHelper::UpdateWithBounds().
Referenced by BeginPause().
void ns3::RandomDirection2dMobilityModel::SetDirectionAndSpeed | ( | double | direction | ) | [private] |
Definition at line 87 of file random-direction-2d-mobility-model.cc.
References BeginPause(), ns3::CalculateDistance(), ns3::Rectangle::CalculateIntersection(), ns3::StaticSpeedHelper::GetCurrentPosition(), ns3::RandomVariable::GetValue(), m_bounds, m_event, m_helper, m_speed, ns3::MobilityModel::NotifyCourseChange(), NS_LOG_FUNCTION_NOARGS, ns3::Simulator::Schedule(), ns3::Seconds(), ns3::StaticSpeedHelper::SetVelocity(), ns3::StaticSpeedHelper::Unpause(), and ns3::StaticSpeedHelper::UpdateWithBounds().
Referenced by ResetDirectionAndSpeed(), and Start().
void ns3::RandomDirection2dMobilityModel::Start | ( | void | ) | [private] |
Definition at line 70 of file random-direction-2d-mobility-model.cc.
References ns3::UniformVariable::GetSingleValue(), PI, and SetDirectionAndSpeed().
Referenced by DoSetPosition(), and RandomDirection2dMobilityModel().
Definition at line 61 of file random-direction-2d-mobility-model.h.
Referenced by DoGetPosition(), GetTypeId(), ResetDirectionAndSpeed(), and SetDirectionAndSpeed().
Definition at line 64 of file random-direction-2d-mobility-model.h.
Referenced by BeginPause(), DoSetPosition(), RandomDirection2dMobilityModel(), and SetDirectionAndSpeed().
Definition at line 65 of file random-direction-2d-mobility-model.h.
Referenced by BeginPause(), DoGetPosition(), DoGetVelocity(), DoSetPosition(), ResetDirectionAndSpeed(), and SetDirectionAndSpeed().
Definition at line 63 of file random-direction-2d-mobility-model.h.
Referenced by BeginPause(), and GetTypeId().
Definition at line 62 of file random-direction-2d-mobility-model.h.
Referenced by GetTypeId(), and SetDirectionAndSpeed().
const double ns3::RandomDirection2dMobilityModel::PI = 3.14159265358979323846 [static, private] |
Definition at line 60 of file random-direction-2d-mobility-model.h.
Referenced by ResetDirectionAndSpeed(), and Start().