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>
100 void DoRun()
override;
179 Simulator::ScheduleNow(&LrWpanMac::McpsDataRequest, dev->
GetMac(), params1, p0);
222 CreateObject<LogDistancePropagationLossModel>();
224 CreateObject<ConstantSpeedPropagationDelayModel>();
225 channel->AddPropagationLossModel(propModel);
226 channel->SetPropagationDelayModel(delayModel);
236 dev0->
GetMac()->TraceConnectWithoutContext(
239 dev0->
GetMac()->TraceConnectWithoutContext(
242 dev0->
GetPhy()->TraceConnectWithoutContext(
245 dev1->
GetMac()->TraceConnectWithoutContext(
250 CreateObject<ConstantPositionMobilityModel>();
251 sender0Mobility->SetPosition(Vector(0, 0, 0));
252 dev0->
GetPhy()->SetMobility(sender0Mobility);
254 CreateObject<ConstantPositionMobilityModel>();
256 sender1Mobility->SetPosition(Vector(0, 10, 0));
257 dev1->
GetPhy()->SetMobility(sender1Mobility);
261 dev0->
GetMac()->SetMcpsDataConfirmCallback(cb0);
265 dev1->
GetMac()->SetMcpsDataConfirmCallback(cb1);
283 Simulator::ScheduleWithContext(1,
285 &LrWpanMac::McpsDataRequest,
298 "Wrong Short InterFrame Space (SIFS) Size after dataframe Tx");
299 std::cout <<
"----------------------------------\n";
303 p0 = Create<Packet>(8);
305 Simulator::ScheduleWithContext(1,
307 &LrWpanMac::McpsDataRequest,
320 "Wrong Long InterFrame Space (LIFS) Size after dataframe Tx");
321 std::cout <<
"----------------------------------\n";
326 p0 = Create<Packet>(2);
328 Simulator::ScheduleWithContext(1,
330 &LrWpanMac::McpsDataRequest,
343 "Wrong Short InterFrame Space (SIFS) Size after ACK Rx");
344 std::cout <<
"----------------------------------\n";
349 p0 = Create<Packet>(8);
351 Simulator::ScheduleWithContext(1,
353 &LrWpanMac::McpsDataRequest,
366 "Wrong Long InterFrame Space (LIFS) Size after ACK Rx");
367 std::cout <<
"----------------------------------\n";
382 p0 = Create<Packet>(50);
389 Simulator::ScheduleWithContext(1,
391 &LrWpanMac::McpsDataRequest,
400 "Error, IFS end time should be greater than PHY start Rx time");
404 Simulator::Destroy();
LrWpan Dataframe transmission with Interframe Space.
~LrWpanDataIfsTestCase() override
static void IfsEnd(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, Time IfsTime)
Function called when the IFS ends.
Time m_endIfs
The time where the Interframe Space ended.
static void DataReceivedDev1(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, Ptr< const Packet >)
Function called when DataConfirm is hit.
void DoRun() override
Implementation to actually run this TestCase.
Time m_phyStartRx
The time the phy start receiving a packet.
Time m_lastTxTime
The time of the last transmitted packet.
static void DataReceivedDev0(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, Ptr< const Packet > p)
Function called when DataReceived is hit.
Time m_ackRxTime
The time of the received acknowledgment.
static void PhyDataRxStart(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, Ptr< const Packet > p)
Function called when PhyDataRxStart is hit.
static void DataConfirm(LrWpanDataIfsTestCase *testcase, Ptr< LrWpanNetDevice > dev, McpsDataConfirmParams params)
Function called when DataConfirm is hit.
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.
Ptr< LrWpanPhy > GetPhy() const
Get the PHY used by this NetDevice.
void SetAddress(Address address) override
This method indirects to LrWpanMac::SetShortAddress ()
Ptr< LrWpanCsmaCa > GetCsmaCa() const
Get the CSMA/CA implementation used by this NetDevice.
This class can contain 16 bit addresses.
bool IsBroadcast() const
Checks if the address is a broadcast address according to 802.15.4 scheme (i.e., 0xFFFF).
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Ptr< Packet > Copy() const
performs a COW copy of the packet.
void AddTestCase(TestCase *testCase, TestDuration duration=QUICK)
Add an individual child TestCase to this test suite.
Simulation virtual time values and global simulation resolution.
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
@ TX_OPTION_ACK
TX_OPTION_ACK.
auto MakeBoundCallback(R(*fnPtr)(Args...), BArgs &&... bargs)
Make Callbacks with varying number of bound arguments.
Time Now()
create an ns3::Time instance which contains the current simulation time.
#define NS_TEST_EXPECT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report if not.
#define NS_TEST_ASSERT_MSG_GT(actual, limit, msg)
Test that an actual value is greater than a limit and report and abort if not.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time Seconds(double value)
Construct a Time in the indicated unit.
static void DataConfirm(McpsDataConfirmParams params)
Function called when a Data confirm is invoked.
static LrWpanIfsTestSuite lrWpanIfsTestSuite
Static variable for test initialization.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void LogComponentEnable(const std::string &name, LogLevel level)
Enable the logging output associated with that log component.
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
@ LOG_LEVEL_DEBUG
LOG_DEBUG and above.
void LogComponentEnableAll(LogLevel level)
Enable the logging output for all registered log components.
params
Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ##.
MCPS-DATA.confirm params.
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.