Helper class which can read ns-2 movement files and configure nodes mobility. More...
#include "ns2-mobility-helper.h"
Classes | |
class | ObjectStore |
a class to hold input objects internally More... | |
Public Member Functions | |
Ns2MobilityHelper (std::string filename) | |
void | Install () const |
Read the ns2 trace file and configure the movement patterns of all nodes contained in the global ns3::NodeList whose nodeId is matches the nodeId of the nodes in the trace file. | |
template<typename T > | |
void | Install (T begin, T end) const |
Private Member Functions | |
void | ConfigNodesMovements (const ObjectStore &store) const |
Parses ns-2 mobility file to create ns-3 mobility events. | |
Ptr< ConstantVelocityMobilityModel > | GetMobilityModel (std::string idString, const ObjectStore &store) const |
Get or create a ConstantVelocityMobilityModel corresponding to idString. | |
Private Attributes | |
std::string | m_filename |
filename of file containing ns-2 mobility trace | |
Helper class which can read ns-2 movement files and configure nodes mobility.
This implementation is based on the ns2 movement documentation of ns2 as described in http://www.isi.edu/nsnam/ns/doc/node172.html
Valid trace files use the following ns2 statements:
$node set X_ x1 $node set Y_ y1 $node set Z_ z1 $ns at $time $node setdest x2 y2 speed $ns at $time $node set X_ x1 $ns at $time $node set Y_ Y1 $ns at $time $node set Z_ Z1
Note that initial position statements may also appear at the end of the mobility file like this:
$ns at $time $node setdest x2 y2 speed $ns at $time $node set X_ x1 $ns at $time $node set Y_ Y1 $ns at $time $node set Z_ Z1 $node set X_ x1 $node set Y_ y1 $node set Z_ z1
The following tools are known to support this format:
See usage example in examples/mobility/ns2-mobility-trace.cc
Definition at line 66 of file ns2-mobility-helper.h.
ns3::Ns2MobilityHelper::Ns2MobilityHelper | ( | std::string | filename | ) |
filename | filename of file which contains the ns2 movement trace. |
Definition at line 222 of file ns2-mobility-helper.cc.
References m_filename, and NS_FATAL_ERROR.
|
private |
Parses ns-2 mobility file to create ns-3 mobility events.
store | Object store containing ns-3 mobility models |
Definition at line 255 of file ns2-mobility-helper.cc.
References ns3::ParseResult::dvals, GetMobilityModel(), ns3::GetNodeIdInt(), ns3::GetNodeIdString(), ns3::IsNumber(), ns3::IsSchedMobilityPos(), ns3::IsSchedSetPos(), ns3::IsSetInitialPos(), m_filename, ns3::DestinationPoint::m_finalPosition, NS_LOG_DEBUG, NS_LOG_ERROR, NS_LOG_LOGIC, NS_LOG_WARN, ns3::ParseNs2Line(), ns3::SetInitialPosition(), ns3::SetMovement(), ns3::SetSchedPosition(), and ns3::ParseResult::tokens.
Referenced by Install().
|
private |
Get or create a ConstantVelocityMobilityModel corresponding to idString.
idString | string name for a node |
store | Object store containing ns-3 mobility models |
Definition at line 234 of file ns2-mobility-helper.cc.
References ns3::CreateObject(), and ns3::Ns2MobilityHelper::ObjectStore::Get().
Referenced by ConfigNodesMovements().
void ns3::Ns2MobilityHelper::Install | ( | ) | const |
Read the ns2 trace file and configure the movement patterns of all nodes contained in the global ns3::NodeList whose nodeId is matches the nodeId of the nodes in the trace file.
Definition at line 851 of file ns2-mobility-helper.cc.
References ns3::NodeList::Begin(), ns3::NodeList::End(), and Install().
Referenced by Install().
void ns3::Ns2MobilityHelper::Install | ( | T | begin, |
T | end ) const |
begin | an iterator which points to the start of the input object array. |
end | an iterator which points to the end of the input object array. |
Read the ns2 trace file and configure the movement patterns of all input objects. Each input object is identified by a unique node id which reflects the index of the object in the input array.
Definition at line 139 of file ns2-mobility-helper.h.
References ConfigNodesMovements().
|
private |
filename of file containing ns-2 mobility trace
Definition at line 129 of file ns2-mobility-helper.h.
Referenced by Ns2MobilityHelper(), and ConfigNodesMovements().