Keep track of the current position and velocity of an object. More...
#include <mobility-model.h>
Public Member Functions | |
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 |
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) |
Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
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 | Initialize (void) |
This method calls the virtual DoInitialize method on all the objects aggregated to this object. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. 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 |
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) |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Noop. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Protected Member Functions | |
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) | |
virtual void | DoDispose (void) |
This method is called by Object::Dispose or by the object's destructor, whichever comes first. More... | |
virtual void | DoInitialize (void) |
This method is called only once by Object::Initialize. More... | |
virtual void | NotifyNewAggregate (void) |
This method is invoked whenever two sets of objects are aggregated together. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
This method is invoked once all member attributes have been initialized. More... | |
Private Member Functions | |
virtual int64_t | DoAssignStreams (int64_t start) |
The default implementation does nothing but return the passed-in parameter. More... | |
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 |
Used to alert subscribers that a change in direction, velocity, or position has occurred. More... | |
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.
ns3::MobilityModel is accessible through the following paths with Config::Set and Config::Connect:
Definition at line 39 of file mobility-model.h.
ns3::MobilityModel::MobilityModel | ( | ) |
Definition at line 54 of file mobility-model.cc.
|
pure virtual |
Definition at line 58 of file mobility-model.cc.
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.
stream | first stream index to use |
Definition at line 103 of file mobility-model.cc.
References DoAssignStreams().
Referenced by ns3::MobilityHelper::AssignStreams().
|
privatevirtual |
The default implementation does nothing but return the passed-in parameter.
Subclasses using random variables are expected to override this.
Reimplemented in ns3::GaussMarkovMobilityModel, ns3::SteadyStateRandomWaypointMobilityModel, ns3::RandomWalk2dMobilityModel, ns3::RandomWaypointMobilityModel, and ns3::RandomDirection2dMobilityModel.
Definition at line 110 of file mobility-model.cc.
Referenced by AssignStreams().
|
privatepure virtual |
Concrete subclasses of this base class must implement this method.
Implemented in ns3::WaypointMobilityModel, ns3::HierarchicalMobilityModel, ns3::GaussMarkovMobilityModel, ns3::SteadyStateRandomWaypointMobilityModel, ns3::RandomWalk2dMobilityModel, ns3::RandomWaypointMobilityModel, ns3::RandomDirection2dMobilityModel, ns3::ConstantVelocityMobilityModel, ns3::ConstantAccelerationMobilityModel, and ns3::ConstantPositionMobilityModel.
Referenced by GetDistanceFrom(), and GetPosition().
|
privatepure virtual |
Concrete subclasses of this base class must implement this method.
Implemented in ns3::WaypointMobilityModel, ns3::HierarchicalMobilityModel, ns3::GaussMarkovMobilityModel, ns3::SteadyStateRandomWaypointMobilityModel, ns3::RandomWalk2dMobilityModel, ns3::RandomWaypointMobilityModel, ns3::RandomDirection2dMobilityModel, ns3::ConstantVelocityMobilityModel, ns3::ConstantAccelerationMobilityModel, and ns3::ConstantPositionMobilityModel.
Referenced by GetVelocity().
|
privatepure virtual |
position | the position to set. |
Concrete subclasses of this base class must implement this method.
Implemented in ns3::WaypointMobilityModel, ns3::HierarchicalMobilityModel, ns3::GaussMarkovMobilityModel, ns3::SteadyStateRandomWaypointMobilityModel, ns3::RandomWalk2dMobilityModel, ns3::RandomWaypointMobilityModel, ns3::RandomDirection2dMobilityModel, ns3::ConstantVelocityMobilityModel, ns3::ConstantAccelerationMobilityModel, and ns3::ConstantPositionMobilityModel.
Referenced by SetPosition().
double ns3::MobilityModel::GetDistanceFrom | ( | Ptr< const MobilityModel > | position | ) | const |
position | a reference to another mobility model |
Definition at line 80 of file mobility-model.cc.
References ns3::CalculateDistance(), and DoGetPosition().
Referenced by ns3::FriisPropagationLossModel::DoCalcRxPower(), ns3::TwoRayGroundPropagationLossModel::DoCalcRxPower(), ns3::LogDistancePropagationLossModel::DoCalcRxPower(), ns3::ThreeLogDistancePropagationLossModel::DoCalcRxPower(), ns3::NakagamiPropagationLossModel::DoCalcRxPower(), ns3::RangePropagationLossModel::DoCalcRxPower(), ns3::UanPropModelIdeal::GetDelay(), ns3::UanPropModelThorp::GetDelay(), ns3::ConstantSpeedPropagationDelayModel::GetDelay(), ns3::ItuR1238PropagationLossModel::GetLoss(), ns3::Kun2600MhzPropagationLossModel::GetLoss(), ns3::OkumuraHataPropagationLossModel::GetLoss(), ns3::Cost231PropagationLossModel::GetLoss(), ns3::ItuR1411LosPropagationLossModel::GetLoss(), ns3::ItuR1411NlosOverRooftopPropagationLossModel::GetLoss(), ns3::HybridBuildingsPropagationLossModel::GetLoss(), ns3::UanPropModelThorp::GetPathLossDb(), ns3::HybridBuildingsPropagationLossModel::ItuR1411(), ns3::SimpleOfdmWimaxChannel::Send(), ns3::YansWifiChannel::Send(), and ns3::UanChannel::TxPacket().
Vector ns3::MobilityModel::GetPosition | ( | void | ) | const |
Definition at line 63 of file mobility-model.cc.
References DoGetPosition().
Referenced by OcbWifiMacTestCase::AdvancePosition(), ns3::Ns2MobilityHelperTest::CheckInitialPositions(), CourseChange(), CourseChangeCallback(), ns3::SteadyStateRandomWaypointTest::DistribCompare(), ns3::TwoRayGroundPropagationLossModel::DoCalcRxPower(), ns3::HierarchicalMobilityModel::DoGetPosition(), ns3::RandomRoomPositionAllocatorTestCase::DoRun(), ns3::HierarchicalMobilityModel::DoSetPosition(), OcbWifiMacTestCase::GetCurrentPosition(), ns3::ItuR1238PropagationLossModel::GetLoss(), ns3::OkumuraHataPropagationLossModel::GetLoss(), ns3::ItuR1411LosPropagationLossModel::GetLoss(), ns3::ItuR1411NlosOverRooftopPropagationLossModel::GetLoss(), ns3::HybridBuildingsPropagationLossModel::GetLoss(), Experiment::GetPosition(), GetPosition(), GetTypeId(), main(), ns3::BuildingsHelper::MakeConsistent(), OcbWifiMacTestCase::PostDeviceConfiguration(), ns3::AnimationInterface::RecalcTopoBounds(), ns3::HierarchicalMobilityModel::SetChild(), ns3::SetInitialPosition(), ns3::HierarchicalMobilityModel::SetParent(), ns3::SetSchedPosition(), showPosition(), ns3::SingleModelSpectrumChannel::StartTx(), ns3::MultiModelSpectrumChannel::StartTx(), WaypointLazyNotifyFalse::TestXPosition(), WaypointLazyNotifyTrue::TestXPosition(), WaypointInitialPositionIsWaypoint::TestXPosition(), WaypointMobilityModelViaHelper::TestXPosition(), and ns3::AnimationInterface::UpdatePosition().
double ns3::MobilityModel::GetRelativeSpeed | ( | Ptr< const MobilityModel > | other | ) | const |
other | reference to another object's mobility model |
Definition at line 88 of file mobility-model.cc.
References GetVelocity(), sample-rng-plot::x, ns3::Vector3D::x, ns3::Vector3D::y, and ns3::Vector3D::z.
|
static |
Definition at line 32 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().
Vector ns3::MobilityModel::GetVelocity | ( | void | ) | const |
Definition at line 68 of file mobility-model.cc.
References DoGetVelocity().
Referenced by ns3::Ns2MobilityHelperTest::CheckInitialPositions(), CourseChange(), ns3::SteadyStateRandomWaypointTest::DistribCompare(), ns3::HierarchicalMobilityModel::DoGetVelocity(), GetRelativeSpeed(), GetTypeId(), and showPosition().
|
protected |
Must be invoked by subclasses when the course of the position changes to notify course change listeners.
Definition at line 97 of file mobility-model.cc.
References m_courseChangeTrace.
Referenced by ns3::RandomDirection2dMobilityModel::BeginPause(), ns3::RandomWaypointMobilityModel::BeginWalk(), ns3::SteadyStateRandomWaypointMobilityModel::BeginWalk(), ns3::HierarchicalMobilityModel::ChildChanged(), ns3::RandomWaypointMobilityModel::DoInitializePrivate(), ns3::SteadyStateRandomWaypointMobilityModel::DoInitializePrivate(), ns3::ConstantPositionMobilityModel::DoSetPosition(), ns3::ConstantAccelerationMobilityModel::DoSetPosition(), ns3::ConstantVelocityMobilityModel::DoSetPosition(), ns3::WaypointMobilityModel::DoSetPosition(), ns3::RandomWalk2dMobilityModel::DoWalk(), ns3::GaussMarkovMobilityModel::DoWalk(), ns3::HierarchicalMobilityModel::ParentChanged(), ns3::RandomDirection2dMobilityModel::SetDirectionAndSpeed(), ns3::ConstantVelocityMobilityModel::SetVelocity(), ns3::ConstantAccelerationMobilityModel::SetVelocityAndAcceleration(), ns3::SteadyStateRandomWaypointMobilityModel::Start(), ns3::SteadyStateRandomWaypointMobilityModel::SteadyStateBeginWalk(), and ns3::WaypointMobilityModel::Update().
void ns3::MobilityModel::SetPosition | ( | const Vector & | position | ) |
position | the position to set. |
Definition at line 74 of file mobility-model.cc.
References DoSetPosition().
Referenced by OcbWifiMacTestCase::AdvancePosition(), ns3::BuildingsPathlossTestCase::CreateMobilityModel(), ns3::BuildingsShadowingTestCase::CreateMobilityModel(), ns3::aodv::LoopbackTestCase::DoRun(), ns3::LenaMimoTestCase::DoRun(), FriisPropagationLossModelTestCase::DoRun(), ns3::ItuR1411LosPropagationLossModelTestCase::DoRun(), ns3::LenaHarqTestCase::DoRun(), ns3::Kun2600MhzPropagationLossModelTestCase::DoRun(), ns3::ItuR1411NlosOverRooftopPropagationLossModelTestCase::DoRun(), ns3::OkumuraHataPropagationLossModelTestCase::DoRun(), ns3::LenaDataPhyErrorModelTestCase::DoRun(), LenaTtaFfMacSchedulerTestCase::DoRun(), LenaFdMtFfMacSchedulerTestCase::DoRun(), LenaTdMtFfMacSchedulerTestCase::DoRun(), ns3::LtePathlossModelSystemTestCase::DoRun(), ns3::LenaDlCtrlPhyErrorModelTestCase::DoRun(), TwoRayGroundPropagationLossModelTestCase::DoRun(), WaypointInitialPositionIsWaypoint::DoRun(), ns3::aodv::ChainRegressionTest::DoRun(), LogDistancePropagationLossModelTestCase::DoRun(), RangePropagationLossModelTestCase::DoRun(), ns3::HierarchicalMobilityModel::DoSetPosition(), GetTypeId(), ns3::MobilityHelper::Install(), JakesPropagationExample::JakesPropagationExample(), main(), OcbWifiMacTestCase::PostDeviceConfiguration(), HwmpSimplestRegressionTest::ResetPosition(), HwmpReactiveRegressionTest::ResetPosition(), PsrExperiment::Run(), CollisionExperiment::Run(), ns3::HierarchicalMobilityModel::SetChild(), ns3::SetInitialPosition(), ns3::HierarchicalMobilityModel::SetParent(), Experiment::SetPosition(), SetPosition(), ns3::LteHexGridEnbTopologyHelper::SetPositionAndInstallEnbDevice(), ns3::SetSchedPosition(), ns3::LteUeMeasurementsPiecewiseTestCase1::TeleportFar(), ns3::LteUeMeasurementsPiecewiseTestCase2::TeleportFar(), ns3::LteUeMeasurementsPiecewiseTestCase1::TeleportNear(), ns3::LteUeMeasurementsPiecewiseTestCase2::TeleportNear(), ns3::LteUeMeasurementsPiecewiseTestCase1::TeleportVeryFar(), ns3::LteUeMeasurementsPiecewiseTestCase2::TeleportVeryFar(), ns3::LteUeMeasurementsPiecewiseTestCase1::TeleportVeryNear(), ns3::LteUeMeasurementsPiecewiseTestCase2::TeleportVeryNear(), TestDeterministic(), TestDeterministicByTime(), TestProbabilistic(), NetAnimExperiment::UpdatePositions(), and Experiment::UpdatePositions().
|
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().