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);
123 channel->AddPropagationLossModel (propModel);
124 channel->SetPropagationDelayModel (delayModel);
134 sender0Mobility->SetPosition (Vector (0, 0, 0));
135 dev0->
GetPhy ()->SetMobility (sender0Mobility);
138 sender1Mobility->SetPosition (Vector (0, 10, 0));
139 dev1->
GetPhy ()->SetMobility (sender1Mobility);
146 propModel->SetRss (-107.58);
158 Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->
GetMac (), params, p0);
160 Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev1->
GetPhy ());
169 propModel->SetRss (-106.58);
180 Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->
GetMac (), params, p1);
182 Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev1->
GetPhy ());
191 propModel->SetRss (-81.58);
202 Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->
GetMac (), params, p2);
204 Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev1->
GetPhy ());
213 propModel->SetRss (-66.58);
224 Simulator::ScheduleNow (&LrWpanMac::McpsDataRequest, dev0->
GetMac (), params, p3);
226 Simulator::Schedule (
Seconds (0.0025), &LrWpanPhy::PlmeEdRequest, dev1->
GetPhy ());
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)
LrWpan Energy Detection Test.
LrWpanPhyEnumeration m_status
PHY status.
virtual void DoRun(void)
Implementation to actually run this TestCase.
void PlmeEdConfirm(LrWpanPhyEnumeration status, uint8_t level)
Function called when PlmeEdConfirm is hit.
LrWpan Energy Detection TestSuite.
virtual void SetAddress(Address address)
This method indirects to LrWpanMac::SetShortAddress ()
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel to which the NetDevice, and therefore the PHY, should be attached to.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Ptr< LrWpanPhy > GetPhy(void) const
Get the PHY used by this NetDevice.
Ptr< LrWpanMac > GetMac(void) const
Get the MAC used by this NetDevice.
This class can contain 16 bit addresses.
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
#define NS_LOG_UNCOND(msg)
Output the requested message unconditionally.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
@ IEEE_802_15_4_PHY_SUCCESS
@ IEEE_802_15_4_PHY_UNSPECIFIED
@ IEEE_802_15_4_PHY_TX_ON
@ TX_OPTION_NONE
TX_OPTION_NONE.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
Time Seconds(double value)
Construct a Time in the indicated unit.
static LrWpanEdTestSuite g_lrWpanEdTestSuite
Static variable for test initialization.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
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...
MCPS-DATA.request params.
LrWpanAddressMode m_srcAddrMode
Source address mode.
LrWpanAddressMode m_dstAddrMode
Destination address mode.
uint16_t m_dstPanId
Destination PAN identifier.
Mac16Address m_dstAddr
Destination address.
uint8_t m_msduHandle
MSDU handle.
uint8_t m_txOptions
Tx Options (bitfield)