A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::GroupMobilityHelper Class Reference

Helper class used to assign positions and mobility models to nodes for a group mobility configuration. More...

#include "group-mobility-helper.h"

+ Collaboration diagram for ns3::GroupMobilityHelper:

Public Member Functions

 GroupMobilityHelper ()
 Construct a group mobility helper.
 
 ~GroupMobilityHelper ()
 Destroy a group mobility helper.
 
int64_t AssignStreams (NodeContainer c, int64_t stream)
 Assign a fixed random variable stream number to the random variables used by the mobility models on these nodes.
 
void Install (NodeContainer container)
 Install and configure a hierarchical mobility model to all nodes in the container, based on the configured reference and member models.
 
void Install (Ptr< Node > node)
 Install and configure a hierarchical mobility model to the given node, based on the configured reference and member models.
 
void Install (std::string nodeName)
 Install and configure a hierarchical mobility model to the given node, based on the configured reference and member models.
 
template<typename... Ts>
void SetMemberMobilityModel (std::string type, Ts &&... args)
 Configure the mobility model which will be installed as the member (child) mobility model during GroupMobilityModel::Install.
 
void SetMemberPositionAllocator (Ptr< PositionAllocator > allocator)
 Set the position allocator which will be used to allocate the initial position of the member mobility models.
 
template<typename... Ts>
void SetMemberPositionAllocator (std::string type, Ts &&... args)
 Configure the position allocator which will be used to allocate the initial position of the member mobility models.
 
void SetReferenceMobilityModel (Ptr< MobilityModel > mobility)
 Set the reference mobility model which will be installed as the parent mobility model during GroupMobilityModel::Install.
 
template<typename... Ts>
void SetReferenceMobilityModel (std::string type, Ts &&... args)
 Configure the reference mobility model which will be installed as the parent mobility model during GroupMobilityModel::Install.
 
void SetReferencePositionAllocator (Ptr< PositionAllocator > allocator)
 Set the position allocator which will be used to allocate the initial position of the reference mobility model.
 
template<typename... Ts>
void SetReferencePositionAllocator (std::string type, Ts &&... args)
 Configure the position allocator which will be used to allocate the initial position of the reference mobility model.
 

Private Attributes

ObjectFactory m_memberMobilityFactory
 Object factory to create member mobility models.
 
Ptr< PositionAllocatorm_memberPosition
 Position allocator for use as member position allocator.
 
Ptr< MobilityModelm_referenceMobility
 Reference mobility model.
 
Ptr< PositionAllocatorm_referencePosition
 Position allocator for use as reference position allocator.
 
bool m_referencePositionSet
 flag for avoiding multiple SetPosition calls on the reference model
 
 NS_LOG_TEMPLATE_DECLARE
 the log component
 

Detailed Description

Helper class used to assign positions and mobility models to nodes for a group mobility configuration.

This helper can be used for group mobility configuration and installation onto a group of nodes, in which there is a reference (parent) mobility model that is the same for all nodes, and similarly configured (but distinct) child mobility models.

Definition at line 47 of file group-mobility-helper.h.

Constructor & Destructor Documentation

◆ GroupMobilityHelper()

ns3::GroupMobilityHelper::GroupMobilityHelper ( )

Construct a group mobility helper.

Definition at line 41 of file group-mobility-helper.cc.

◆ ~GroupMobilityHelper()

ns3::GroupMobilityHelper::~GroupMobilityHelper ( )

Destroy a group mobility helper.

Definition at line 46 of file group-mobility-helper.cc.

Member Function Documentation

◆ AssignStreams()

int64_t ns3::GroupMobilityHelper::AssignStreams ( NodeContainer  c,
int64_t  stream 
)

Assign a fixed random variable stream number to the random variables used by the mobility models on these nodes.

Return the number of streams (possibly zero) that have been assigned. The Install() method should have previously been called by the user.

Note
If the PositionAllocator used contains random variables, they will not be affected by this call to AssignStreams because they are used earlier during Install() time. If the user needs to assign a fixed stream number to a PositionAllocator used with this helper, the user should instantiate it outside of the helper, call AssignStreams() on it, and then pass the pointer of it to this helper.
Parameters
cNodeContainer of the set of nodes containing the MobilityModels that should be modified to use a fixed stream
streamfirst stream index to use
Returns
the number of stream indices assigned by this helper

Definition at line 111 of file group-mobility-helper.cc.

References ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), and NS_FATAL_ERROR.

+ Here is the call graph for this function:

◆ Install() [1/3]

void ns3::GroupMobilityHelper::Install ( NodeContainer  container)

Install and configure a hierarchical mobility model to all nodes in the container, based on the configured reference and member models.

If position allocators are configured, they will be invoked to set the initial positions.

Parameters
containerThe set of nodes to configure

Definition at line 102 of file group-mobility-helper.cc.

References ns3::NodeContainer::Begin(), ns3::NodeContainer::End(), and Install().

+ Here is the call graph for this function:

◆ Install() [2/3]

void ns3::GroupMobilityHelper::Install ( Ptr< Node node)

Install and configure a hierarchical mobility model to the given node, based on the configured reference and member models.

If position allocators are configured, they will be invoked to set the initial position.

Parameters
nodeThe node to configure

Definition at line 69 of file group-mobility-helper.cc.

References ns3::ObjectFactory::Create(), ns3::Object::GetObject(), ns3::ObjectFactory::IsTypeIdSet(), m_memberMobilityFactory, m_memberPosition, m_referenceMobility, m_referencePosition, m_referencePositionSet, NS_ABORT_MSG_IF, NS_ABORT_MSG_UNLESS, NS_LOG_DEBUG, and ns3::MobilityModel::SetPosition().

Referenced by Install().

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

◆ Install() [3/3]

void ns3::GroupMobilityHelper::Install ( std::string  nodeName)

Install and configure a hierarchical mobility model to the given node, based on the configured reference and member models.

If position allocators are configured, they will be invoked to set the initial position.

Parameters
nodeNameThe name of the node to configure

Definition at line 95 of file group-mobility-helper.cc.

References Install().

+ Here is the call graph for this function:

◆ SetMemberMobilityModel()

template<typename... Ts>
void ns3::GroupMobilityHelper::SetMemberMobilityModel ( std::string  type,
Ts &&...  args 
)

Configure the mobility model which will be installed as the member (child) mobility model during GroupMobilityModel::Install.

Calls to MobilityHelper::Install will create an instance of a matching mobility model for each node.

Template Parameters
Ts[deduced] Argument types
Parameters
typethe type of mobility model to use.
[in]argsName and AttributeValue pairs to set.

Definition at line 231 of file group-mobility-helper.h.

References m_memberMobilityFactory, NS_LOG_FUNCTION, ns3::ObjectFactory::Set(), and ns3::ObjectFactory::SetTypeId().

+ Here is the call graph for this function:

◆ SetMemberPositionAllocator() [1/2]

void ns3::GroupMobilityHelper::SetMemberPositionAllocator ( Ptr< PositionAllocator allocator)

Set the position allocator which will be used to allocate the initial position of the member mobility models.

Parameters
allocatorallocate initial member mobility model positions

Definition at line 57 of file group-mobility-helper.cc.

References m_memberPosition.

◆ SetMemberPositionAllocator() [2/2]

template<typename... Ts>
void ns3::GroupMobilityHelper::SetMemberPositionAllocator ( std::string  type,
Ts &&...  args 
)

Configure the position allocator which will be used to allocate the initial position of the member mobility models.

Template Parameters
Ts[deduced] Argument types
Parameters
typethe type of position allocator to use.
[in]argsName and AttributeValue pairs to set.

Definition at line 212 of file group-mobility-helper.h.

References ns3::ObjectFactory::Create(), ns3::Object::GetObject(), m_memberPosition, and NS_ABORT_MSG_IF.

+ Here is the call graph for this function:

◆ SetReferenceMobilityModel() [1/2]

void ns3::GroupMobilityHelper::SetReferenceMobilityModel ( Ptr< MobilityModel mobility)

Set the reference mobility model which will be installed as the parent mobility model during GroupMobilityModel::Install.

Parameters
mobilityreference mobility model

Definition at line 63 of file group-mobility-helper.cc.

References m_referenceMobility.

◆ SetReferenceMobilityModel() [2/2]

template<typename... Ts>
void ns3::GroupMobilityHelper::SetReferenceMobilityModel ( std::string  type,
Ts &&...  args 
)

Configure the reference mobility model which will be installed as the parent mobility model during GroupMobilityModel::Install.

Template Parameters
Ts[deduced] Argument types
Parameters
typethe type of mobility model to use.
[in]argsName and AttributeValue pairs to set.

Definition at line 221 of file group-mobility-helper.h.

References ns3::ObjectFactory::Create(), ns3::Object::GetObject(), m_referenceMobility, NS_ABORT_MSG_IF, and NS_LOG_FUNCTION.

+ Here is the call graph for this function:

◆ SetReferencePositionAllocator() [1/2]

void ns3::GroupMobilityHelper::SetReferencePositionAllocator ( Ptr< PositionAllocator allocator)

Set the position allocator which will be used to allocate the initial position of the reference mobility model.

Parameters
allocatorallocate initial reference mobility model position

Definition at line 51 of file group-mobility-helper.cc.

References m_referencePosition.

◆ SetReferencePositionAllocator() [2/2]

template<typename... Ts>
void ns3::GroupMobilityHelper::SetReferencePositionAllocator ( std::string  type,
Ts &&...  args 
)

Configure the position allocator which will be used to allocate the initial position of the reference mobility model.

Template Parameters
Ts[deduced] Argument types
Parameters
typethe type of position allocator to use.
[in]argsName and AttributeValue pairs to set.

Definition at line 203 of file group-mobility-helper.h.

References ns3::ObjectFactory::Create(), ns3::Object::GetObject(), m_referencePosition, and NS_ABORT_MSG_IF.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_memberMobilityFactory

ObjectFactory ns3::GroupMobilityHelper::m_memberMobilityFactory
private

Object factory to create member mobility models.

Definition at line 192 of file group-mobility-helper.h.

Referenced by Install(), and SetMemberMobilityModel().

◆ m_memberPosition

Ptr<PositionAllocator> ns3::GroupMobilityHelper::m_memberPosition
private

Position allocator for use as member position allocator.

Definition at line 194 of file group-mobility-helper.h.

Referenced by Install(), and SetMemberPositionAllocator().

◆ m_referenceMobility

Ptr<MobilityModel> ns3::GroupMobilityHelper::m_referenceMobility
private

Reference mobility model.

Definition at line 189 of file group-mobility-helper.h.

Referenced by Install(), and SetReferenceMobilityModel().

◆ m_referencePosition

Ptr<PositionAllocator> ns3::GroupMobilityHelper::m_referencePosition
private

Position allocator for use as reference position allocator.

Definition at line 191 of file group-mobility-helper.h.

Referenced by Install(), and SetReferencePositionAllocator().

◆ m_referencePositionSet

bool ns3::GroupMobilityHelper::m_referencePositionSet
private
Initial value:
{
false}

flag for avoiding multiple SetPosition calls on the reference model

Definition at line 187 of file group-mobility-helper.h.

Referenced by Install().

◆ NS_LOG_TEMPLATE_DECLARE

ns3::GroupMobilityHelper::NS_LOG_TEMPLATE_DECLARE
private

the log component

Definition at line 185 of file group-mobility-helper.h.


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