22 #include <ns3/callback.h>
23 #include <ns3/packet.h>
24 #include <ns3/simulator.h>
25 #include <ns3/lr-wpan-error-model.h>
26 #include <ns3/propagation-loss-model.h>
27 #include <ns3/lr-wpan-net-device.h>
28 #include <ns3/lr-wpan-mac.h>
30 #include <ns3/net-device.h>
31 #include <ns3/single-model-spectrum-channel.h>
32 #include <ns3/mac16-address.h>
33 #include <ns3/constant-position-mobility-model.h>
34 #include "ns3/rng-seed-manager.h"
51 virtual void DoRun (
void);
63 virtual void DoRun (
void);
67 :
TestCase (
"Test the 802.15.4 error model vs distance"),
86 RngSeedManager::SetSeed (1);
87 RngSeedManager::SetRun (6);
95 dev0->AssignStreams (0);
96 dev1->AssignStreams (10);
103 dev0->SetChannel (channel);
104 dev1->SetChannel (channel);
106 n1->AddDevice (dev1);
108 dev0->GetPhy ()->SetMobility (mob0);
110 dev1->GetPhy ()->SetMobility (mob1);
114 dev1->GetMac ()->SetMcpsDataIndicationCallback (cb0);
127 for (
int i = 0; i < 1000; i++)
129 p = Create<Packet> (20);
130 Simulator::Schedule (
Seconds (i),
131 &LrWpanMac::McpsDataRequest,
132 dev0->GetMac (), params, p);
141 Simulator::Destroy ();
146 :
TestCase (
"Test the 802.15.4 error model")
186 :
TestSuite (
"lr-wpan-error-model", UNIT)
double GetChunkSuccessRate(double snr, uint32_t nbits) const
Return chunk success rate for given SNR.
uint16_t m_dstPanId
Destination PAN identifier.
Mac16Address m_dstAddr
Destination address.
LrWpanErrorDistanceTestCase()
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual void DoRun(void)
Implementation to actually run this TestCase.
virtual void AddPropagationLossModel(Ptr< PropagationLossModel > loss)
Set the single-frequency propagation loss model to be used.
uint8_t m_msduHandle
MSDU handle.
uint32_t GetReceived(void) const
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite.
#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.
virtual void DoRun(void)
Implementation to actually run this TestCase.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
uint8_t m_txOptions
Tx Options (bitfield)
static LrWpanErrorModelTestSuite lrWpanErrorModelTestSuite
#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...
LrWpanAddressMode m_srcAddrMode
Source address mode.
LrWpanAddressMode m_dstAddrMode
Destination address mode.
LrWpanErrorModelTestCase()
This class can contain 16 bit addresses.
LrWpanErrorModelTestSuite()
void SetPosition(const Vector &position)
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Time Seconds(double value)
Construct a Time in the indicated unit.
virtual ~LrWpanErrorModelTestCase()
MCPS-DATA.request params.
virtual ~LrWpanErrorDistanceTestCase()
MCPS-DATA.indication params.
void Callback(McpsDataIndicationParams params, Ptr< Packet > p)