23 #include <ns3/core-module.h>    24 #include <ns3/lr-wpan-module.h>    25 #include <ns3/propagation-loss-model.h>    26 #include <ns3/propagation-delay-model.h>    27 #include <ns3/simulator.h>    28 #include <ns3/single-model-spectrum-channel.h>    29 #include <ns3/constant-position-mobility-model.h>    30 #include <ns3/packet.h>    31 #include "ns3/rng-seed-manager.h"    51   virtual void DoRun (
void);
    65   : 
TestCase (
"Test the 802.15.4 energie detection")
    74   NS_LOG_UNCOND (
"Energy Detection completed with status " << LrWpanHelper::LrWpanPhyEnumerationPrinter (status) << 
" and energy level " << static_cast<uint32_t> (level));
   102   RngSeedManager::SetSeed (1);
   103   RngSeedManager::SetRun (6);
   113   dev0->AssignStreams (0);
   114   dev1->AssignStreams (10);
   123   channel->AddPropagationLossModel (propModel);
   124   channel->SetPropagationDelayModel (delayModel);
   131   n1->AddDevice (dev1);
   135   dev0->GetPhy ()->SetMobility (sender0Mobility);
   139   dev1->GetPhy ()->SetMobility (sender1Mobility);
   146   propModel->SetRss (-107.58);
   154   params.m_dstPanId = 0;
   156   params.m_msduHandle = 0;
   158   Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->GetMac (), params, p0);
   160   Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev1->GetPhy ());
   169   propModel->SetRss (-106.58);
   176   params.m_dstPanId = 0;
   178   params.m_msduHandle = 0;
   180   Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->GetMac (), params, p1);
   182   Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev1->GetPhy ());
   191   propModel->SetRss (-81.58);
   198   params.m_dstPanId = 0;
   200   params.m_msduHandle = 0;
   202   Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->GetMac (), params, p2);
   204   Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev1->GetPhy ());
   213   propModel->SetRss (-66.58);
   220   params.m_dstPanId = 0;
   222   params.m_msduHandle = 0;
   224   Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->GetMac (), params, p3);
   226   Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev1->GetPhy ());
   239   params.m_dstPanId = 0;
   241   params.m_msduHandle = 0;
   243   Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->GetMac (), params, p4);
   245   Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev0->GetPhy ());
   252   Simulator::Destroy ();
   268   : 
TestSuite (
"lr-wpan-energy-detection", UNIT)
 
static LrWpanEdTestSuite g_lrWpanEdTestSuite
Static variable for test initialization. 
LrWpan Energy Detection Test. 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not. 
LrWpan Energy Detection TestSuite. 
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite. 
LrWpanPhyEnumeration m_status
PHY status. 
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
LrWpanAddressMode m_srcAddrMode
Source address mode. 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
virtual void DoRun(void)
Implementation to actually run this TestCase. 
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally. 
This class can contain 16 bit addresses. 
void SetPosition(const Vector &position)
void PlmeEdConfirm(LrWpanPhyEnumeration status, uint8_t level)
Function called when PlmeEdConfirm is hit. 
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node. 
Time Seconds(double value)
Construct a Time in the indicated unit. 
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3. 
MCPS-DATA.request params.