A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
PhyConnectivityTest Class Reference

It tests sending packets over a LoRa physical channel between multiple devices and the resulting possible outcomes. More...

+ Inheritance diagram for PhyConnectivityTest:
+ Collaboration diagram for PhyConnectivityTest:

Public Member Functions

 PhyConnectivityTest ()
 Default constructor.
 
 ~PhyConnectivityTest () override
 Destructor.
 
void Interference (Ptr< const Packet > packet, uint32_t node)
 Callback for tracing LostPacketBecauseInterference.
 
bool IsSamePacket (Ptr< Packet > packet1, Ptr< Packet > packet2)
 Compare two packets to check if they are equal.
 
void ReceivedPacket (Ptr< const Packet > packet, uint32_t node)
 Callback for tracing ReceivedPacket.
 
void Reset ()
 Reset counters and end devices' PHYs for new sub test case.
 
void UnderSensitivity (Ptr< const Packet > packet, uint32_t node)
 Callback for tracing LostPacketBecauseUnderSensitivity.
 
void WrongFrequency (Ptr< const Packet > packet, uint32_t node)
 Callback for tracing LostPacketBecauseWrongFrequency.
 
void WrongSf (Ptr< const Packet > packet, uint32_t node)
 Callback for tracing LostPacketBecauseWrongSpreadingFactor.
 
- Public Member Functions inherited from ns3::TestCase
 TestCase (const TestCase &)=delete
 
virtual ~TestCase ()
 Destructor.
 
std::string GetName () const
 
TestCaseoperator= (const TestCase &)=delete
 

Private Member Functions

void DoRun () override
 Implementation to actually run this TestCase.
 

Private Attributes

Ptr< LoraChannelchannel
 The LoRa channel used for tests.
 
Ptr< SimpleEndDeviceLoraPhyedPhy1
 The first end device's PHY layer used in tests.
 
Ptr< SimpleEndDeviceLoraPhyedPhy2
 The second end device's PHY layer used in tests.
 
Ptr< SimpleEndDeviceLoraPhyedPhy3
 The third end device's PHY layer used in tests.
 
int m_interferenceCalls = 0
 Counter for LostPacketBecauseInterference calls.
 
Ptr< Packetm_latestReceivedPacket
 Pointer to track the last received packet.
 
int m_receivedPacketCalls = 0
 Counter for ReceivedPacket calls.
 
int m_underSensitivityCalls = 0
 Counter for LostPacketBecauseUnderSensitivity calls.
 
int m_wrongFrequencyCalls = 0
 Counter for LostPacketBecauseWrongFrequency calls.
 
int m_wrongSfCalls = 0
 Counter for LostPacketBecauseWrongSpreadingFactor calls.
 

Additional Inherited Members

- Public Types inherited from ns3::TestCase
enum class  Duration { QUICK = 1 , EXTENSIVE = 2 , TAKES_FOREVER = 3 }
 How long the test takes to execute. More...
 
- Static Public Attributes inherited from ns3::TestCase
static constexpr auto QUICK = Duration::QUICK
 Deprecated test duration simple enums.
 
static constexpr auto EXTENSIVE = Duration::EXTENSIVE
 
static constexpr auto TAKES_FOREVER = Duration::TAKES_FOREVER
 
- Protected Member Functions inherited from ns3::TestCase
 TestCase (std::string name)
 Constructor.
 
void AddTestCase (TestCase *testCase, Duration duration=Duration::QUICK)
 Add an individual child TestCase to this test suite.
 
TestCaseGetParent () const
 Get the parent of this TestCase.
 
bool IsStatusFailure () const
 Check if any tests failed.
 
bool IsStatusSuccess () const
 Check if all tests passed.
 
void SetDataDir (std::string directory)
 Set the data directory where reference trace files can be found.
 
void ReportTestFailure (std::string cond, std::string actual, std::string limit, std::string message, std::string file, int32_t line)
 Log the failure of this TestCase.
 
bool MustAssertOnFailure () const
 Check if this run should assert on failure.
 
bool MustContinueOnFailure () const
 Check if this run should continue on failure.
 
std::string CreateDataDirFilename (std::string filename)
 Construct the full path to a file in the data directory.
 
std::string CreateTempDirFilename (std::string filename)
 Construct the full path to a file in a temporary directory.
 

Detailed Description

It tests sending packets over a LoRa physical channel between multiple devices and the resulting possible outcomes.

Definition at line 1103 of file lorawan-test-suite.cc.

Constructor & Destructor Documentation

◆ PhyConnectivityTest()

PhyConnectivityTest::PhyConnectivityTest ( )

Default constructor.

Definition at line 1181 of file lorawan-test-suite.cc.

◆ ~PhyConnectivityTest()

PhyConnectivityTest::~PhyConnectivityTest ( )
override

Destructor.

Definition at line 1187 of file lorawan-test-suite.cc.

Member Function Documentation

◆ DoRun()

void PhyConnectivityTest::DoRun ( )
overrideprivatevirtual

Implementation to actually run this TestCase.

Subclasses should override this method to conduct their tests.

Implements ns3::TestCase.

Definition at line 1339 of file lorawan-test-suite.cc.

References ns3::Create(), ns3::Simulator::Destroy(), ns3::DynamicCast(), edPhy1, edPhy2, edPhy3, ns3::Hours(), IsSamePacket(), m_interferenceCalls, m_latestReceivedPacket, m_receivedPacketCalls, m_underSensitivityCalls, m_wrongFrequencyCalls, m_wrongSfCalls, NS_LOG_DEBUG, NS_TEST_EXPECT_MSG_EQ, Reset(), ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Seconds(), ns3::lorawan::SimpleEndDeviceLoraPhy::Send(), ns3::lorawan::LoraTxParameters::sf, and ns3::Simulator::Stop().

+ Here is the call graph for this function:

◆ Interference()

void PhyConnectivityTest::Interference ( Ptr< const Packet > packet,
uint32_t node )

Callback for tracing LostPacketBecauseInterference.

Parameters
packetThe packet lost.
nodeThe receiver node id if any, 0 otherwise.

Definition at line 1210 of file lorawan-test-suite.cc.

References m_interferenceCalls, and NS_LOG_FUNCTION.

Referenced by Reset().

+ Here is the caller graph for this function:

◆ IsSamePacket()

bool PhyConnectivityTest::IsSamePacket ( Ptr< Packet > packet1,
Ptr< Packet > packet2 )

Compare two packets to check if they are equal.

Parameters
packet1A first packet.
packet2A second packet.
Returns
True if their unique identifiers are equal,
false otherwise.

Definition at line 1234 of file lorawan-test-suite.cc.

Referenced by DoRun().

+ Here is the caller graph for this function:

◆ ReceivedPacket()

void PhyConnectivityTest::ReceivedPacket ( Ptr< const Packet > packet,
uint32_t node )

Callback for tracing ReceivedPacket.

Parameters
packetThe packet received.
nodeThe receiver node id if any, 0 otherwise.

Definition at line 1192 of file lorawan-test-suite.cc.

References m_latestReceivedPacket, m_receivedPacketCalls, and NS_LOG_FUNCTION.

Referenced by Reset().

+ Here is the caller graph for this function:

◆ Reset()

void PhyConnectivityTest::Reset ( )

Reset counters and end devices' PHYs for new sub test case.

Definition at line 1240 of file lorawan-test-suite.cc.

References channel, ns3::CreateObject(), edPhy1, edPhy2, edPhy3, Interference(), m_interferenceCalls, m_receivedPacketCalls, m_underSensitivityCalls, m_wrongFrequencyCalls, m_wrongSfCalls, ns3::MakeCallback(), ReceivedPacket(), UnderSensitivity(), WrongFrequency(), and WrongSf().

Referenced by DoRun().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UnderSensitivity()

void PhyConnectivityTest::UnderSensitivity ( Ptr< const Packet > packet,
uint32_t node )

Callback for tracing LostPacketBecauseUnderSensitivity.

Parameters
packetThe packet lost.
nodeThe receiver node id if any, 0 otherwise.

Definition at line 1202 of file lorawan-test-suite.cc.

References m_underSensitivityCalls, and NS_LOG_FUNCTION.

Referenced by Reset().

+ Here is the caller graph for this function:

◆ WrongFrequency()

void PhyConnectivityTest::WrongFrequency ( Ptr< const Packet > packet,
uint32_t node )

Callback for tracing LostPacketBecauseWrongFrequency.

Parameters
packetThe packet lost.
nodeThe receiver node id if any, 0 otherwise.

Definition at line 1226 of file lorawan-test-suite.cc.

References m_wrongFrequencyCalls, and NS_LOG_FUNCTION.

Referenced by Reset().

+ Here is the caller graph for this function:

◆ WrongSf()

void PhyConnectivityTest::WrongSf ( Ptr< const Packet > packet,
uint32_t node )

Callback for tracing LostPacketBecauseWrongSpreadingFactor.

Parameters
packetThe packet lost.
nodeThe receiver node id if any, 0 otherwise.

Definition at line 1218 of file lorawan-test-suite.cc.

References m_wrongSfCalls, and NS_LOG_FUNCTION.

Referenced by Reset().

+ Here is the caller graph for this function:

Member Data Documentation

◆ channel

Ptr<LoraChannel> PhyConnectivityTest::channel
private

The LoRa channel used for tests.

Definition at line 1167 of file lorawan-test-suite.cc.

Referenced by Reset().

◆ edPhy1

Ptr<SimpleEndDeviceLoraPhy> PhyConnectivityTest::edPhy1
private

The first end device's PHY layer used in tests.

Definition at line 1168 of file lorawan-test-suite.cc.

Referenced by DoRun(), and Reset().

◆ edPhy2

Ptr<SimpleEndDeviceLoraPhy> PhyConnectivityTest::edPhy2
private

The second end device's PHY layer used in tests.

Definition at line 1169 of file lorawan-test-suite.cc.

Referenced by DoRun(), and Reset().

◆ edPhy3

Ptr<SimpleEndDeviceLoraPhy> PhyConnectivityTest::edPhy3
private

The third end device's PHY layer used in tests.

Definition at line 1170 of file lorawan-test-suite.cc.

Referenced by DoRun(), and Reset().

◆ m_interferenceCalls

int PhyConnectivityTest::m_interferenceCalls = 0
private

Counter for LostPacketBecauseInterference calls.

Definition at line 1175 of file lorawan-test-suite.cc.

Referenced by DoRun(), Interference(), and Reset().

◆ m_latestReceivedPacket

Ptr<Packet> PhyConnectivityTest::m_latestReceivedPacket
private

Pointer to track the last received packet.

Definition at line 1172 of file lorawan-test-suite.cc.

Referenced by DoRun(), and ReceivedPacket().

◆ m_receivedPacketCalls

int PhyConnectivityTest::m_receivedPacketCalls = 0
private

Counter for ReceivedPacket calls.

Definition at line 1173 of file lorawan-test-suite.cc.

Referenced by DoRun(), ReceivedPacket(), and Reset().

◆ m_underSensitivityCalls

int PhyConnectivityTest::m_underSensitivityCalls = 0
private

Counter for LostPacketBecauseUnderSensitivity calls.

Definition at line 1174 of file lorawan-test-suite.cc.

Referenced by DoRun(), Reset(), and UnderSensitivity().

◆ m_wrongFrequencyCalls

int PhyConnectivityTest::m_wrongFrequencyCalls = 0
private

Counter for LostPacketBecauseWrongFrequency calls.

Definition at line 1177 of file lorawan-test-suite.cc.

Referenced by DoRun(), Reset(), and WrongFrequency().

◆ m_wrongSfCalls

int PhyConnectivityTest::m_wrongSfCalls = 0
private

Counter for LostPacketBecauseWrongSpreadingFactor calls.

Definition at line 1176 of file lorawan-test-suite.cc.

Referenced by DoRun(), Reset(), and WrongSf().


The documentation for this class was generated from the following file: