10#include "ns3/constant-position-mobility-model.h"
12#include "ns3/lora-helper.h"
13#include "ns3/mobility-helper.h"
14#include "ns3/one-shot-sender-helper.h"
15#include "ns3/simple-end-device-lora-phy.h"
16#include "ns3/simple-gateway-lora-phy.h"
22using namespace lorawan;
39 void DoRun()
override;
44 :
TestCase(
"Verify that LoraInterferenceHelper works as expected")
63 uint32_t differentFrequencyHz = 868300000;
69 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
70 event1 = interferenceHelper.
Add(
Seconds(1), 14, 12,
nullptr, frequencyHz);
73 "Overlap computation didn't give the expected result");
76 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
77 event1 = interferenceHelper.
Add(
Seconds(1.5), 14, 12,
nullptr, frequencyHz);
80 "Overlap computation didn't give the expected result");
83 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
84 event1 = interferenceHelper.
Add(
Seconds(3), 14, 12,
nullptr, frequencyHz);
87 "Overlap computation didn't give the expected result");
90 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
91 event1 = interferenceHelper.
Add(
Seconds(2), 14, 12,
nullptr, frequencyHz);
99 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
100 interferenceHelper.
Add(
Seconds(2), 14, 12,
nullptr, frequencyHz);
103 "Packet did not survive interference as expected");
107 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
108 interferenceHelper.
Add(
Seconds(2), 14 - 7, 7,
nullptr, frequencyHz);
111 "Packet did not survive interference as expected");
115 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
116 interferenceHelper.
Add(
Seconds(2), 14 - 6, 7,
nullptr, frequencyHz);
119 "Packet was not destroyed by interference as expected");
123 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
124 interferenceHelper.
Add(
Seconds(1), 14 - 6, 7,
nullptr, frequencyHz);
127 "Packet did not survive interference as expected");
133 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
134 interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, differentFrequencyHz);
137 "Packet did not survive interference as expected");
143 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
144 interferenceHelper.
Add(
Seconds(2), 14 + 16, 8,
nullptr, frequencyHz);
147 "Packet did not survive interference as expected");
152 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
153 interferenceHelper.
Add(
Seconds(2), 14 + 17, 8,
nullptr, frequencyHz);
156 "Packet was not destroyed by interference as expected");
160 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
161 interferenceHelper.
Add(
Seconds(2), 14 + 17, 10,
nullptr, frequencyHz);
164 "Packet was destroyed by interference while it should have survived");
169 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
170 interferenceHelper.
Add(
Seconds(2), 14 + 16, 8,
nullptr, frequencyHz);
171 interferenceHelper.
Add(
Seconds(2), 14 + 16, 8,
nullptr, frequencyHz);
172 interferenceHelper.
Add(
Seconds(2), 14 + 16, 8,
nullptr, frequencyHz);
175 "Packet was not destroyed by interference as expected");
180 event = interferenceHelper.
Add(
Seconds(2), 14, 7,
nullptr, frequencyHz);
181 interferenceHelper.
Add(
Seconds(2), 14 + 16, 8,
nullptr, frequencyHz);
182 interferenceHelper.
Add(
Seconds(2), 14 + 16, 9,
nullptr, frequencyHz);
183 interferenceHelper.
Add(
Seconds(2), 14 + 16, 10,
nullptr, frequencyHz);
186 "Packet did not survive interference as expected");
203 void DoRun()
override;
208 :
TestCase(
"Verify that LoraDeviceAddress works as expected")
238 "> function for addresses doesn't work correctly");
244 address.SetNwkAddr(0xFFFFFFF);
245 address.SetNwkID(0b1111111);
248 "Addresses set to be equal don't match");
257 "Serialization + Deserialization doesn't yield an equal address");
264 for (
int i = 0; i < 200; i++)
271 "LoraDeviceAddressGenerator doesn't increment as expected");
287 void DoRun()
override;
292 :
TestCase(
"Verify that LorawanMacHeader and LoraFrameHeader work as expected")
324 "MType changes in the serialization/deserialization process");
327 "MType changes in the serialization/deserialization process");
350 uint8_t margin = command->GetMargin();
351 uint8_t gwCnt = command->GetGwCnt();
355 "ACK bit changes in the serialization/deserialization process");
358 "ADR bit changes in the serialization/deserialization process");
361 "FCnt changes in the serialization/deserialization process");
364 "Address changes in the serialization/deserialization process");
367 "Margin changes in the serialization/deserialization process");
374 pkt->AddHeader(frameHdr);
375 pkt->AddHeader(macHdr);
383 pkt->RemoveHeader(macHdr1);
390 pkt->RemoveHeader(frameHdr1);
395 "Wrong size of packet + headers - macHeader - frameHeader");
400 "Removed header contents don't match");
403 "Removed header contents don't match");
408 "Removed header contents don't match");
411 "Removed header contents don't match");
414 "Removed header contents don't match");
417 "Removed header contents don't match");
420 "Removed header's MAC command contents don't match");
423 "Removed header's MAC command contents don't match");
440 void DoRun()
override;
484 :
TestCase(
"Verify that ReceivePaths work as expected")
872 void DoRun()
override;
877 :
TestCase(
"Verify that LogicalLoraChannel and LogicalLoraChannelHelper work as expected")
920 "Contains does not behave as expected");
923 "Contains does not behave as expected");
926 "Contains does not behave as expected");
945 channelHelper->AddSubBand(subBand);
946 channelHelper->AddSubBand(subBand1);
947 channelHelper->SetChannel(0, channel1);
948 channelHelper->SetChannel(1, channel2);
949 channelHelper->SetChannel(2, channel3);
955 channelHelper->AddEvent(
Seconds(2), channel1);
961 "Wait time doesn't behave as expected");
966 "Wait time doesn't behave as expected");
971 "Wait time affects other subbands");
987 void DoRun()
override;
993 "Verify that LoraPhy's function to compute the time on air of a packet works as expected")
1155 void DoRun()
override;
1172 :
TestCase(
"Verify that PhyConnectivity works as expected")
1226 return packet1->GetUid() == packet2->GetUid();
1239 loss->SetPathLossExponent(3.76);
1240 loss->SetReference(1, 7.7);
1252 edPhy1->SetFrequency(868100000);
1253 edPhy2->SetFrequency(868100000);
1254 edPhy3->SetFrequency(868100000);
1260 mob1->SetPosition(Vector(0.0, 0.0, 0.0));
1261 mob2->SetPosition(Vector(10.0, 0.0, 0.0));
1262 mob3->SetPosition(Vector(20.0, 0.0, 0.0));
1264 edPhy1->SetMobility(mob1);
1265 edPhy2->SetMobility(mob2);
1266 edPhy3->SetMobility(mob3);
1268 edPhy1->SwitchToStandby();
1269 edPhy2->SwitchToStandby();
1270 edPhy3->SwitchToStandby();
1281 edPhy1->SetSpreadingFactor(12);
1282 edPhy2->SetSpreadingFactor(12);
1283 edPhy3->SetSpreadingFactor(12);
1286 edPhy1->SetFrequency(868100000);
1287 edPhy2->SetFrequency(868100000);
1288 edPhy3->SetFrequency(868100000);
1290 edPhy1->TraceConnectWithoutContext(
"ReceivedPacket",
1292 edPhy2->TraceConnectWithoutContext(
"ReceivedPacket",
1294 edPhy3->TraceConnectWithoutContext(
"ReceivedPacket",
1297 edPhy1->TraceConnectWithoutContext(
"LostPacketBecauseUnderSensitivity",
1299 edPhy2->TraceConnectWithoutContext(
"LostPacketBecauseUnderSensitivity",
1301 edPhy3->TraceConnectWithoutContext(
"LostPacketBecauseUnderSensitivity",
1304 edPhy1->TraceConnectWithoutContext(
"LostPacketBecauseInterference",
1306 edPhy2->TraceConnectWithoutContext(
"LostPacketBecauseInterference",
1308 edPhy3->TraceConnectWithoutContext(
"LostPacketBecauseInterference",
1311 edPhy1->TraceConnectWithoutContext(
"LostPacketBecauseWrongFrequency",
1313 edPhy2->TraceConnectWithoutContext(
"LostPacketBecauseWrongFrequency",
1315 edPhy3->TraceConnectWithoutContext(
"LostPacketBecauseWrongFrequency",
1318 edPhy1->TraceConnectWithoutContext(
"LostPacketBecauseWrongSpreadingFactor",
1320 edPhy2->TraceConnectWithoutContext(
"LostPacketBecauseWrongSpreadingFactor",
1322 edPhy3->TraceConnectWithoutContext(
"LostPacketBecauseWrongSpreadingFactor",
1341 uint8_t buffer[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
1365 "Channel skipped some PHYs when delivering a packet");
1388 "Packet was received by a PHY in SLEEP mode");
1395 edPhy2->SetSpreadingFactor(7);
1397 ->SetPosition(Vector(2990, 0, 0));
1414 "Packet that should have been lost because of low receive power was received");
1420 edPhy2->SetSpreadingFactor(8);
1422 ->SetPosition(Vector(2990, 0, 0));
1438 "Packets that should have arrived above sensitivity were under it");
1466 "Packets that should be destroyed by interference weren't");
1486 "Packets were received even though PHY was on a different frequency");
1508 "Packets were received even though PHY was listening for a different spreading factor.");
1530 "Packet changed contents when going through the channel");
1552 SimpleEndDeviceLoraPhy::STANDBY,
1553 "State didn't switch to STANDBY as expected");
1555 SimpleEndDeviceLoraPhy::STANDBY,
1556 "State didn't switch to STANDBY as expected");
1573 void DoRun()
override;
1578 :
TestCase(
"Verify that the MAC layer of end devices behaves as expected")
1620 template <
typename T,
typename... Ts>
1630 void DoRun()
override;
1636 :
TestCase(
"Test functionality of MAC commands when received by a device")
1645template <
typename T,
typename... Ts>
1646std::vector<Ptr<MacCommand>>
1657 pkt->AddHeader(fhdr);
1659 pkt->AddHeader(mhdr);
1662 ->SwitchToStandby();
1663 m_mac->Receive(pkt);
1668 pkt->RemoveHeader(mhdr);
1670 pkt->RemoveHeader(fhdr);
1698 uint8_t margin = 20;
1703 "m_lastKnownMarginDb differs from Margin field of LinkCheckAns");
1706 "m_lastKnownGatewayCount differs GwCnt field of LinkCheckAns");
1709 "Unexpected uplink MAC command answer(s) to LinkCheckAns");
1715 uint8_t dataRate = 5;
1716 uint8_t txPower = 2;
1717 uint16_t chMask = 0b101;
1718 uint8_t chMaskCntl = 0;
1719 uint8_t nbTrans = 13;
1723 "m_dataRate does not match DataRate field of LinkAdrReq");
1726 "m_txPowerDbm does not match txPower field of LinkAdrReq");
1729 "m_nbTrans does not match nbTrans field of LinkAdrReq");
1730 auto channels =
m_mac->GetLogicalLoraChannelHelper()->GetRawChannelArray();
1731 for (
size_t i = 0; i < channels.size(); i++)
1733 const auto& c = channels.at(i + 16 * chMaskCntl);
1734 bool actual = (c) ? c->IsEnabledForUplink() :
false;
1735 bool expected = (chMask & 0b1 << i);
1749 uint8_t dataRate = 5;
1750 uint8_t txPower = 2;
1751 uint16_t chMask = 0b010;
1752 uint8_t chMaskCntl = 0;
1753 uint8_t nbTrans = 13;
1754 m_mac->SetUplinkAdrBit(
false);
1758 "m_dataRate expected to differ from DataRate field of LinkAdrReq");
1761 "m_txPowerDbm expected to not match txPower field of LinkAdrReq");
1764 "m_nbTrans expected to differ from nbTrans field of LinkAdrReq");
1765 auto channels =
m_mac->GetLogicalLoraChannelHelper()->GetRawChannelArray();
1766 for (
size_t i = 0; i < channels.size(); i++)
1768 const auto& c = channels.at(i + 16 * chMaskCntl);
1769 bool actual = (c) ? c->IsEnabledForUplink() :
false;
1770 bool expected = (chMask & 0b1 << i);
1784 uint8_t dataRate = 12;
1785 uint8_t txPower = 8;
1786 uint16_t chMask = 0b0;
1787 uint8_t chMaskCntl = 0;
1788 uint8_t nbTrans = 6;
1792 "m_dataRate expected to be default value");
1795 "m_txPowerDbm expected to be default value");
1798 "m_nbTrans expected to be default value");
1799 auto channels =
m_mac->GetLogicalLoraChannelHelper()->GetRawChannelArray();
1800 for (
size_t i = 0; i < channels.size(); i++)
1802 const auto& c = channels.at(i + 16 * chMaskCntl);
1803 bool actual = (c) ? c->IsEnabledForUplink() :
false;
1804 bool expected = (uint16_t(0b111) & 0b1 << i);
1818 uint8_t dataRate = 1;
1819 uint8_t txPower = 7;
1820 uint16_t chMask = 0b1000;
1821 uint8_t chMaskCntl = 0;
1822 uint8_t nbTrans = 3;
1826 "m_dataRate expected to be default value");
1829 "m_txPowerDbm expected to be default value");
1832 "m_nbTrans expected to be default value");
1833 auto channels =
m_mac->GetLogicalLoraChannelHelper()->GetRawChannelArray();
1834 for (
size_t i = 0; i < channels.size(); i++)
1836 const auto& c = channels.at(i + 16 * chMaskCntl);
1837 bool actual = (c) ? c->IsEnabledForUplink() :
false;
1838 bool expected = (uint16_t(0b111) & 0b1 << i);
1852 uint8_t dataRate = 0xF;
1853 uint8_t txPower = 0xF;
1854 uint16_t chMask = 0b0;
1855 uint8_t chMaskCntl = 6;
1856 uint8_t nbTrans = 0;
1858 m_mac->SetDataRate(3);
1859 m_mac->SetTransmissionPowerDbm(12);
1860 m_mac->SetMaxNumberOfTransmissions(15);
1861 auto channels =
m_mac->GetLogicalLoraChannelHelper()->GetRawChannelArray();
1862 channels.at(0)->DisableForUplink();
1866 "m_dataRate expected to be default value");
1869 "m_txPowerDbm expected to be default value");
1872 "m_nbTrans expected to be default value");
1873 for (
size_t i = 0; i < channels.size(); i++)
1875 const auto& c = channels.at(i);
1876 bool actual = (c) ? c->IsEnabledForUplink() :
false;
1877 bool expected = (uint16_t(0b111) & 0b1 << i);
1891 uint8_t maxDutyCycle = 0;
1894 1 / std::pow(2, maxDutyCycle),
1895 "m_aggregatedDutyCycle != 1");
1904 uint8_t maxDutyCycle = 3;
1907 1 / std::pow(2, maxDutyCycle),
1908 "m_aggregatedDutyCycle != 1");
1917 uint8_t rx1DrOffset = 5;
1918 uint8_t rx2DataRate = 5;
1919 double frequencyHz = 863500000;
1920 m_mac->SetDataRate(5);
1923 unsigned(5 - rx1DrOffset),
1924 "Rx1DataRate does not match rx1DrOffset from RxParamSetupReq");
1926 unsigned(rx2DataRate),
1927 "Rx2DataRate does not match rx2DataRate from RxParamSetupReq");
1930 "Rx2 frequency does not match frequency from RxParamSetupReq");
1942 uint8_t rx1DrOffset = 6;
1943 uint8_t rx2DataRate = 12;
1944 double frequencyHz = 871000000;
1945 m_mac->SetDataRate(5);
1949 "Rx1DataRate expected to be default value");
1952 "Rx2DataRate expected to be default value");
1955 "Rx2 frequency expected to be default value");
1978 uint8_t chIndex = 4;
1979 double frequencyHz = 865100000;
1980 uint8_t minDataRate = 1;
1981 uint8_t maxDataRate = 4;
1984 auto c =
m_mac->GetLogicalLoraChannelHelper()->GetRawChannelArray().at(chIndex);
1988 "Channel frequency expected to equal NewChannelReq frequency");
1990 unsigned(minDataRate),
1991 "Channel minDataRate expected to equal NewChannelReq minDataRate");
1993 unsigned(maxDataRate),
1994 "Channel maxDataRate expected to equal NewChannelReq maxDataRate");
2004 uint8_t chIndex = 1;
2005 double frequencyHz = 862000000;
2006 uint8_t minDataRate = 14;
2007 uint8_t maxDataRate = 13;
2010 double defaultFrequenciesHz[3] = {868100000, 868300000, 868500000};
2011 auto channels =
m_mac->GetLogicalLoraChannelHelper()->GetRawChannelArray();
2012 for (
size_t i = 0; i < channels.size(); i++)
2014 const auto& c = channels.at(i);
2021 defaultFrequenciesHz[i],
2022 "Channel frequency expected to equal NewChannelReq frequency");
2025 "Channel " << i <<
" minDataRate expected to be default");
2028 "Channel " << i <<
" maxDataRate expected to be default");
2031 "Channel " << i <<
" state expected to be active by default");
It tests LoraDeviceAddress comparison operators overrides and generation of new addresses with LoraDe...
AddressTest()
Default constructor.
void DoRun() override
Implementation to actually run this TestCase.
~AddressTest() override
Destructor.
It tests interference computations in a number of possible scenarios using the LoraInterferenceHelper...
~InterferenceTest() override
Destructor.
void DoRun() override
Implementation to actually run this TestCase.
InterferenceTest()
Default constructor.
It tests functionality of the LogicalLoraChannel, SubBand and LogicalLoraChannelHelper classes.
LogicalLoraChannelTest()
Default constructor.
~LogicalLoraChannelTest() override
Destructor.
void DoRun() override
Implementation to actually run this TestCase.
It tests the functionalities of the MAC layer of LoRaWAN devices.
~LorawanMacTest() override
Destructor.
LorawanMacTest()
Default constructor.
void DoRun() override
Implementation to actually run this TestCase.
The TestSuite class names the TestSuite, identifies what type of TestSuite, and enables the TestCases...
LorawanTestSuite()
Default constructor.
It tests the functionalities of LoRaWAN MAC commands received by devices.
~MacCommandTest() override
Destructor.
MacCommandTest()
Default constructor.
void Reset()
This function resets the state of the MAC layer used for tests.
void DoRun() override
Implementation to actually run this TestCase.
Ptr< ClassAEndDeviceLorawanMac > m_mac
The end device's MAC layer used in tests.
std::vector< Ptr< MacCommand > > RunMacCommand(Ts &&... args)
Have this class' MAC layer receive a downlink packet carrying the input MAC command.
It tests sending packets over a LoRa physical channel between multiple devices and the resulting poss...
int m_interferenceCalls
Counter for LostPacketBecauseInterference calls.
void Reset()
Reset counters and end devices' PHYs for new sub test case.
Ptr< SimpleEndDeviceLoraPhy > edPhy2
The second end device's PHY layer used in tests.
void WrongFrequency(Ptr< const Packet > packet, uint32_t node)
Callback for tracing LostPacketBecauseWrongFrequency.
void DoRun() override
Implementation to actually run this TestCase.
void UnderSensitivity(Ptr< const Packet > packet, uint32_t node)
Callback for tracing LostPacketBecauseUnderSensitivity.
bool IsSamePacket(Ptr< Packet > packet1, Ptr< Packet > packet2)
Compare two packets to check if they are equal.
Ptr< SimpleEndDeviceLoraPhy > edPhy3
The third end device's PHY layer used in tests.
Ptr< SimpleEndDeviceLoraPhy > edPhy1
The first end device's PHY layer used in tests.
int m_wrongSfCalls
Counter for LostPacketBecauseWrongSpreadingFactor calls.
int m_wrongFrequencyCalls
Counter for LostPacketBecauseWrongFrequency calls.
~PhyConnectivityTest() override
Destructor.
int m_underSensitivityCalls
Counter for LostPacketBecauseUnderSensitivity calls.
int m_receivedPacketCalls
Counter for ReceivedPacket calls.
void WrongSf(Ptr< const Packet > packet, uint32_t node)
Callback for tracing LostPacketBecauseWrongSpreadingFactor.
Ptr< LoraChannel > channel
The LoRa channel used for tests.
PhyConnectivityTest()
Default constructor.
void Interference(Ptr< const Packet > packet, uint32_t node)
Callback for tracing LostPacketBecauseInterference.
Ptr< Packet > m_latestReceivedPacket
Pointer to track the last received packet.
void ReceivedPacket(Ptr< const Packet > packet, uint32_t node)
Callback for tracing ReceivedPacket.
It tests a number of cases related to SimpleGatewayLoraPhy's parallel reception paths.
~ReceivePathTest() override
Destructor.
ReceivePathTest()
Default constructor.
int m_receivedPacketCalls
Counter for ReceivedPacket calls.
void OccupiedReceptionPaths(int oldValue, int newValue)
Callback for tracing OccupiedReceptionPaths.
Ptr< SimpleGatewayLoraPhy > gatewayPhy
PHY layer of a gateway to be tested.
void ReceivedPacket(Ptr< const Packet > packet, uint32_t node)
Callback for tracing ReceivedPacket.
void Interference(Ptr< const Packet > packet, uint32_t node)
Callback for tracing LostPacketBecauseInterference.
void NoMoreDemodulators(Ptr< const Packet > packet, uint32_t node)
Callback for tracing LostPacketBecauseNoMoreReceivers.
void DoRun() override
Implementation to actually run this TestCase.
int m_noMoreDemodulatorsCalls
Counter for LostPacketBecauseNoMoreReceivers calls.
void Reset()
Reset counters and gateway PHY for new sub test case.
int m_interferenceCalls
Counter for LostPacketBecauseInterference calls.
int m_maxOccupiedReceptionPaths
Max number of concurrent OccupiedReceptionPaths.
It tests the correctness of the LoraPhy::GetOnAirTime calculator against a number of pre-sourced time...
void DoRun() override
Implementation to actually run this TestCase.
~TimeOnAirTest() override
Destructor.
TimeOnAirTest()
Default constructor.
iterator in a Buffer instance
automatically resized byte buffer
void AddAtStart(uint32_t start)
Buffer::Iterator Begin() const
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
void AddTestCase(TestCase *testCase, Duration duration=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.
This class generates sequential LoraDeviceAddress instances.
LoraDeviceAddress NextAddress()
Allocate the next LoraDeviceAddress.
LoraDeviceAddress GetNextAddress()
Get the LoraDeviceAddress that will be allocated upon a call to NextAddress.
This class represents the device address of a LoraWAN end device.
static LoraDeviceAddress Deserialize(const uint8_t buf[4])
Convert the input buffer into a new address.
void Serialize(uint8_t buf[4]) const
Convert this address to a buffer.
Helper for LoraPhy that manages interference calculations.
Time GetOverlapTime(Ptr< LoraInterferenceHelper::Event > event1, Ptr< LoraInterferenceHelper::Event > event2)
Compute the time duration in which two given events are overlapping.
Ptr< LoraInterferenceHelper::Event > Add(Time duration, double rxPower, uint8_t spreadingFactor, Ptr< Packet > packet, uint32_t frequencyHz)
Add an event to the InterferenceHelper.
void ClearAllEvents()
Delete all events in the LoraInterferenceHelper.
uint8_t IsDestroyedByInterference(Ptr< LoraInterferenceHelper::Event > event)
Determine whether the event was destroyed by interference or not.
static Time GetOnAirTime(Ptr< Packet > packet, LoraTxParameters txParams)
Compute the time that a packet with certain characteristics will take to be transmitted.
Helper class for configuring and installing the LorawanMac class on devices and gateways.
void SetDeviceType(enum DeviceType dt)
Set the kind of MAC this helper will create.
void SetRegion(enum Regions region)
Set the region in which the device is to operate.
Ptr< LorawanMac > Install(Ptr< Node > node, Ptr< NetDevice > device) const
Create the LorawanMac instance and connect it to a device.
void Send(Ptr< Packet > packet, LoraTxParameters txParams, uint32_t frequencyHz, double txPowerDbm) override
Instruct the PHY to send a packet according to some parameters.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
#define NS_TEST_ASSERT_MSG_EQ(actual, limit, msg)
Test that an actual and expected (limit) value are equal and report and abort if not.
#define NS_TEST_EXPECT_MSG_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report if not.
#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_NE(actual, limit, msg)
Test that an actual and expected (limit) value are not equal and report and abort if not.
#define NS_TEST_EXPECT_MSG_EQ_TOL(actual, limit, tol, msg)
Test that actual and expected (limit) values are equal to plus or minus some tolerance and report if ...
Time Seconds(double value)
Construct a Time in the indicated unit.
Time Hours(double value)
Construct a Time in the indicated unit.
static LorawanTestSuite lorawanTestSuite
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...
Ptr< T1 > DynamicCast(const Ptr< T2 > &p)
Cast a Ptr.
Structure to collect all parameters that are used to compute the duration of a packet (excluding payl...
uint8_t codingRate
Code rate (obtained as 4/(codingRate+4))
uint32_t nPreamble
Number of preamble symbols.
uint32_t bandwidthHz
Bandwidth in Hz.
bool headerDisabled
Whether to use implicit header mode.
bool lowDataRateOptimizationEnabled
Whether low data rate optimization is enabled.
bool crcEnabled
Whether Cyclic Redundancy Check (CRC) is enabled.
uint8_t sf
Spreading Factor.