54 #include "ns3/core-module.h"
55 #include "ns3/mobility-module.h"
56 #include "ns3/ns2-mobility-helper.h"
69 <<
", z=" << pos.z <<
"; VEL:" << vel.x <<
", y=" << vel.y
70 <<
", z=" << vel.z << std::endl;
74 int main (
int argc,
char *argv[])
76 std::string traceFile;
87 cmd.
AddValue (
"traceFile",
"Ns2 movement trace file", traceFile);
88 cmd.
AddValue (
"nodeNum",
"Number of nodes", nodeNum);
89 cmd.
AddValue (
"duration",
"Duration of Simulation", duration);
90 cmd.
AddValue (
"logFile",
"Log file", logFile);
91 cmd.
Parse (argc,argv);
94 if (traceFile.empty () || nodeNum <= 0 || duration <= 0 || logFile.empty ())
96 std::cout <<
"Usage of " << argv[0] <<
" :\n\n"
97 "./waf --run \"ns2-mobility-trace"
98 " --traceFile=src/mobility/examples/default.ns_movements"
99 " --nodeNum=2 --duration=100.0 --logFile=ns2-mob.log\" \n\n"
100 "NOTE: ns2-traces-file could be an absolute or relative path. You could use the file default.ns_movements\n"
101 " included in the same directory of this example file.\n\n"
102 "NOTE 2: Number of nodes present in the trace file must match with the command line argument and must\n"
103 " be a positive number. Note that you must know it before to be able to load it.\n\n"
104 "NOTE 3: Duration must be a positive number. Note that you must know it before to be able to load it.\n\n";
114 os.open (logFile.c_str ());
Smart pointer class similar to boost::intrusive_ptr.
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
static void Run(void)
Run the simulation.
Vector GetPosition(void) const
Vector GetVelocity(void) const
static void CourseChange(std::ostream *os, std::string foo, Ptr< const MobilityModel > mobility)
void Install(void) const
Read the ns2 trace file and configure the movement patterns of all nodes contained in the global ns3:...
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Helper class which can read ns-2 movement files and configure nodes mobility.
Parse command-line arguments.
void Connect(std::string path, const CallbackBase &cb)
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Every class exported by the ns3 library is enclosed in the ns3 namespace.
keep track of a set of node pointers.
static Time Now(void)
Return the current simulation virtual time.
void AddValue(const std::string &name, const std::string &help, T &value)
Add a program argument, assigning to POD.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Time Seconds(double value)
Construct a Time in the indicated unit.
void Parse(int argc, char *argv[])
Parse the program arguments.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.