|
A Discrete-Event Network Simulator
|
API
|
Go to the documentation of this file.
21 #include "ns3/simulator.h"
22 #include "ns3/boolean.h"
23 #include "ns3/config.h"
24 #include "ns3/waypoint-mobility-model.h"
44 :
TestCase (lazy ?
"Check Waypoint Mobility Model LAZY notification accuracy"
45 :
"Check Waypoint Mobility Model NON-LAZY notification accuracy"),
60 virtual void DoRun (
void);
61 virtual void DoTeardown (
void);
63 void ForceUpdates (
void);
74 mobilityStack.clear();
85 mobilityFactory.
SetTypeId (
"ns3::WaypointMobilityModel");
89 for (uint32_t i = 0; i < mobilityCount; i++)
95 mobilityStack.push_back (model);
102 for ( uint32_t iw = 0; iw < waypointCount; ++iw )
105 waypoints.push_back (wpt);
109 std::vector<Ptr<MobilityModel> >::iterator i;
110 for (i = mobilityStack.begin (); i != mobilityStack.end (); ++i)
115 for ( std::deque<Waypoint>::iterator w = waypoints.begin (); w != waypoints.end (); ++w )
122 for (
double updateTime = 0.5; updateTime <= ((double)waypointCount + 1.5); updateTime += 1.0 )
134 std::vector<Ptr<MobilityModel> >::iterator i;
135 for (i = mobilityStack.begin (); i != mobilityStack.end (); ++i)
154 "Course didn't change on one second time boundary with NON-LAZY notifications");
160 "Course didn't change between waypoints with LAZY notifications");
174 :
TestCase (
"Check Waypoint Mobility Model waypoint add")
187 virtual void DoRun (
void);
188 virtual void DoTeardown (
void);
206 m_waypointCount = 10;
207 m_waypointCounter = 1;
210 mobilityFactory.
SetTypeId (
"ns3::WaypointMobilityModel");
221 Waypoint m_nextWaypoint (
Seconds (m_waypointCounter), Vector (0.0, 0.0, 0.0));
235 std::cout << now <<
" CourseChangeCallback" << std::endl;
239 if (now <
Seconds ((
double)m_waypointCount) )
241 m_waypointCounter ++;
242 m_nextWaypoint =
Waypoint (
Seconds (m_waypointCounter), Vector (0.0, 0.0, 0.0));
Waypoint Mobility Model Test Suite.
Ptr< MobilityModel > m_mobilityModel
mobility model
AttributeValue implementation for Boolean.
virtual ~WaypointMobilityModelAddWaypointTest()
static Time Now(void)
Return the current simulation virtual time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t m_waypointCounter
waypoint counter
virtual ~WaypointMobilityModelNotifyTest()
Waypoint Mobility Model Add Waypoint Test.
Ptr< T > GetObject(void) const
Get a pointer to the requested aggregated Object.
void AddWaypoint(const Waypoint &waypoint)
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
bool lazyNotify
lazy notify?
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
WaypointMobilityModelTestSuite g_waypointMobilityModelTestSuite
the test suite
virtual void DoTeardown(void)
Implementation to do any local setup required for this TestCase.
WaypointMobilityModelTestSuite()
Waypoint m_nextWaypoint
next waypoint
Smart pointer class similar to boost::intrusive_ptr.
virtual void Update(void) const
Update the underlying state corresponding to the stored waypoints.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Waypoint-based mobility model.
Instantiate subclasses of ns3::Object.
uint32_t m_waypointCount
waypoint count
void ForceUpdates(void)
Force updates.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Simulation virtual time values and global simulation resolution.
WaypointMobilityModelAddWaypointTest()
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
static void Run(void)
Run the simulation.
Waypoint Mobility Model Notify Test.
Time time
The waypoint time.
uint32_t waypointCount
waypoint count
Time Seconds(double value)
Construct a Time in the indicated unit.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
void Set(const std::string &name, const AttributeValue &value, Args &&... args)
Set an attribute to be set during construction.
Keep track of the current position and velocity of an object.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void CourseChangeCallback(Ptr< const MobilityModel > model)
Course change callback.
void SetTypeId(TypeId tid)
Set the TypeId of the Objects to be created by this factory.
static void CourseChangeCallback(std::string path, Ptr< const MobilityModel > model)
std::deque< Waypoint > waypoints
waypoints
uint32_t mobilityCount
mobility count
Waypoint m_current
The ns3::Waypoint currently being used.
Ptr< Object > Create(void) const
Create an Object instance of the configured TypeId.
bool TraceConnectWithoutContext(std::string name, const CallbackBase &cb)
Connect a TraceSource to a Callback without a context.
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
virtual void DoRun(void)
Implementation to actually run this TestCase.
WaypointMobilityModelNotifyTest(bool lazy)
Constructor.
std::vector< Ptr< MobilityModel > > mobilityStack
mobilty model
void CourseChangeCallback(Ptr< const MobilityModel > model)
Course change calback.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.