21 #include "ns3/rng-seed-manager.h"
22 #include <ns3/constant-position-mobility-model.h>
23 #include <ns3/core-module.h>
25 #include <ns3/lr-wpan-module.h>
26 #include <ns3/packet.h>
27 #include <ns3/propagation-delay-model.h>
28 #include <ns3/propagation-loss-model.h>
29 #include <ns3/simulator.h>
30 #include <ns3/single-model-spectrum-channel.h>
50 void DoRun()
override;
64 :
TestCase(
"Test the 802.15.4 energie detection")
74 << LrWpanHelper::LrWpanPhyEnumerationPrinter(status) <<
" and energy level "
75 <<
static_cast<uint32_t
>(level));
103 RngSeedManager::SetSeed(1);
104 RngSeedManager::SetRun(6);
124 CreateObject<ConstantSpeedPropagationDelayModel>();
125 channel->AddPropagationLossModel(propModel);
126 channel->SetPropagationDelayModel(delayModel);
136 CreateObject<ConstantPositionMobilityModel>();
137 sender0Mobility->SetPosition(Vector(0, 0, 0));
138 dev0->
GetPhy()->SetMobility(sender0Mobility);
140 CreateObject<ConstantPositionMobilityModel>();
142 sender1Mobility->SetPosition(Vector(0, 10, 0));
143 dev1->
GetPhy()->SetMobility(sender1Mobility);
150 propModel->SetRss(-107.58);
162 Simulator::ScheduleNow(&LrWpanMac::McpsDataRequest, dev0->
GetMac(),
params, p0);
164 Simulator::Schedule(
Seconds(0.0025), &LrWpanPhy::PlmeEdRequest, dev1->
GetPhy());
172 propModel->SetRss(-106.58);
183 Simulator::ScheduleNow(&LrWpanMac::McpsDataRequest, dev0->
GetMac(),
params, p1);
185 Simulator::Schedule(
Seconds(0.0025), &LrWpanPhy::PlmeEdRequest, dev1->
GetPhy());
193 propModel->SetRss(-81.58);
204 Simulator::ScheduleNow(&LrWpanMac::McpsDataRequest, dev0->
GetMac(),
params, p2);
206 Simulator::Schedule(
Seconds(0.0025), &LrWpanPhy::PlmeEdRequest, dev1->
GetPhy());
214 propModel->SetRss(-66.58);
225 Simulator::ScheduleNow(&LrWpanMac::McpsDataRequest, dev0->
GetMac(),
params, p3);
227 Simulator::Schedule(
Seconds(0.0025), &LrWpanPhy::PlmeEdRequest, dev1->
GetPhy());
244 Simulator::ScheduleNow(&LrWpanMac::McpsDataRequest, dev0->
GetMac(),
params, p4);
246 Simulator::Schedule(
Seconds(0.0025), &LrWpanPhy::PlmeEdRequest, dev0->
GetPhy());
253 Simulator::Destroy();
269 :
TestSuite(
"lr-wpan-energy-detection", UNIT)
LrWpan Energy Detection Test.
void DoRun() override
Implementation to actually run this TestCase.
LrWpanPhyEnumeration m_status
PHY status.
void PlmeEdConfirm(LrWpanPhyEnumeration status, uint8_t level)
Function called when PlmeEdConfirm is hit.
LrWpan Energy Detection TestSuite.
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel to which the NetDevice, and therefore the PHY, should be attached to.
Ptr< LrWpanMac > GetMac() const
Get the MAC used by this NetDevice.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Ptr< LrWpanPhy > GetPhy() const
Get the PHY used by this NetDevice.
void SetAddress(Address address) override
This method indirects to LrWpanMac::SetShortAddress ()
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, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
MCPS-DATA.request params.