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" 
   47   virtual void DoRun (
void);
 
   56   : 
TestCase (
"Test the 802.15.4 energie detection")
 
   65   NS_LOG_UNCOND (
"Energy Detection completed with status " << LrWpanHelper::LrWpanPhyEnumerationPrinter (status) << 
" and energy level " << static_cast<uint32_t> (level));
 
   93   RngSeedManager::SetSeed (1);
 
   94   RngSeedManager::SetRun (6);
 
  104   dev0->AssignStreams (0);
 
  105   dev1->AssignStreams (10);
 
  117   dev0->SetChannel (channel);
 
  118   dev1->SetChannel (channel);
 
  122   n1->AddDevice (dev1);
 
  126   dev0->GetPhy ()->SetMobility (sender0Mobility);
 
  130   dev1->GetPhy ()->SetMobility (sender1Mobility);
 
  137   propModel->SetRss (-107.58);
 
  145   params.m_dstPanId = 0;
 
  147   params.m_msduHandle = 0;
 
  149   Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->GetMac (), params, p0);
 
  151   Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev1->GetPhy ());
 
  160   propModel->SetRss (-106.58);
 
  167   params.m_dstPanId = 0;
 
  169   params.m_msduHandle = 0;
 
  171   Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->GetMac (), params, p1);
 
  173   Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev1->GetPhy ());
 
  182   propModel->SetRss (-81.58);
 
  189   params.m_dstPanId = 0;
 
  191   params.m_msduHandle = 0;
 
  193   Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->GetMac (), params, p2);
 
  195   Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev1->GetPhy ());
 
  204   propModel->SetRss (-66.58);
 
  211   params.m_dstPanId = 0;
 
  213   params.m_msduHandle = 0;
 
  215   Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->GetMac (), params, p3);
 
  217   Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev1->GetPhy ());
 
  230   params.m_dstPanId = 0;
 
  232   params.m_msduHandle = 0;
 
  234   Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->GetMac (), params, p4);
 
  236   Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev0->GetPhy ());
 
  243   Simulator::Destroy ();
 
  253   : 
TestSuite (
"lr-wpan-energy-detection", UNIT)
 
static LrWpanEdTestSuite g_lrWpanEdTestSuite
 
#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. 
 
virtual void AddPropagationLossModel(Ptr< PropagationLossModel > loss)
set the single-frequency propagation loss model to be used 
 
void AddTestCase(TestCase *testCase, enum TestDuration duration)
Add an individual child TestCase to this test suite. 
 
LrWpanPhyEnumeration m_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 unconditionaly. 
 
This class can contain 16 bit addresses. 
 
void SetPosition(const Vector &position)
 
void PlmeEdConfirm(LrWpanPhyEnumeration status, uint8_t level)
 
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node. 
 
Time Seconds(double value)
Construct a Time in the indicated unit. 
 
virtual void SetPropagationDelayModel(Ptr< PropagationDelayModel > delay)
set the propagation delay model to be used 
 
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3. 
 
MCPS-DATA.request params.