8#include "ns3/rng-seed-manager.h"
9#include <ns3/callback.h>
10#include <ns3/constant-position-mobility-model.h>
12#include <ns3/lr-wpan-error-model.h>
13#include <ns3/lr-wpan-mac.h>
14#include <ns3/lr-wpan-net-device.h>
15#include <ns3/mac16-address.h>
16#include <ns3/net-device.h>
18#include <ns3/packet.h>
19#include <ns3/propagation-loss-model.h>
20#include <ns3/simulator.h>
21#include <ns3/single-model-spectrum-channel.h>
51 void DoRun()
override;
75 void DoRun()
override;
79 :
TestCase(
"Test the 802.15.4 error model vs distance"),
107 dev0->AssignStreams(0);
108 dev1->AssignStreams(10);
114 channel->AddPropagationLossModel(model);
115 dev0->SetChannel(channel);
116 dev1->SetChannel(channel);
120 dev0->GetPhy()->SetMobility(mob0);
122 dev1->GetPhy()->SetMobility(mob1);
126 dev1->GetMac()->SetMcpsDataIndicationCallback(cb0);
131 params.m_dstPanId = 0;
133 params.m_msduHandle = 0;
134 params.m_txOptions = 0;
137 mob0->SetPosition(Vector(0, 0, 0));
138 mob1->SetPosition(Vector(100, 0, 0));
139 for (
int i = 0; i < 1000; i++)
156 :
TestCase(
"Test the 802.15.4 error model")
171 double ber = 1.0 - model->GetChunkSuccessRate(pow(10.0, snr / 10.0), 1);
174 ber = 1.0 - model->GetChunkSuccessRate(pow(10.0, snr / 10.0), 1);
177 ber = 1.0 - model->GetChunkSuccessRate(pow(10.0, snr / 10.0), 1);
180 ber = 1.0 - model->GetChunkSuccessRate(pow(10.0, snr / 10.0), 1);
183 ber = 1.0 - model->GetChunkSuccessRate(pow(10.0, snr / 10.0), 1);
LrWpan Error Vs Distance Test.
void Callback(McpsDataIndicationParams params, Ptr< Packet > p)
Function to be called when a packet is received.
uint32_t GetReceived() const
Get the number of received packets.
LrWpanErrorDistanceTestCase()
uint32_t m_received
The number of received packets.
void DoRun() override
Implementation to actually run this TestCase.
~LrWpanErrorDistanceTestCase() override
void DoRun() override
Implementation to actually run this TestCase.
~LrWpanErrorModelTestCase() override
LrWpanErrorModelTestCase()
LrWpan Error model TestSuite.
LrWpanErrorModelTestSuite()
This class can contain 16 bit addresses.
Smart pointer class similar to boost::intrusive_ptr.
static void SetRun(uint64_t run)
Set the run number of simulation.
static void SetSeed(uint32_t seed)
Set the seed.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
void AddTestCase(TestCase *testCase, Duration duration=Duration::QUICK)
Add an individual child TestCase to this test suite.
void McpsDataRequest(McpsDataRequestParams params, Ptr< Packet > p) override
IEEE 802.15.4-2006, section 7.1.1.1 MCPS-DATA.request Request to transfer a MSDU.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_ASSERT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report and...
Time Seconds(double value)
Construct a Time in the indicated unit.
static LrWpanErrorModelTestSuite g_lrWpanErrorModelTestSuite
Static variable for test initialization.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
MCPS-DATA.indication params.
MCPS-DATA.request params.