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...
 
using TestDuration = Duration
 
- Static Public Attributes inherited from ns3::TestCase
static constexpr auto EXTENSIVE = Duration::EXTENSIVE
 
static constexpr auto QUICK = Duration::QUICK
 
static constexpr auto 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 1115 of file lorawan-test-suite.cc.

Constructor & Destructor Documentation

◆ PhyConnectivityTest()

PhyConnectivityTest::PhyConnectivityTest ( )

Default constructor.

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

◆ ~PhyConnectivityTest()

PhyConnectivityTest::~PhyConnectivityTest ( )
override

Destructor.

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

Member Function Documentation

◆ DoRun()

void PhyConnectivityTest::DoRun ( )
overrideprivatevirtual

◆ 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 1222 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 1246 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 1204 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 1252 of file lorawan-test-suite.cc.

References ns3::lorawan::LoraChannel::Add(), channel, edPhy1, edPhy2, edPhy3, Interference(), m_interferenceCalls, m_receivedPacketCalls, m_underSensitivityCalls, m_wrongFrequencyCalls, m_wrongSfCalls, ns3::MakeCallback(), ReceivedPacket(), ns3::lorawan::LoraPhy::SetChannel(), ns3::lorawan::EndDeviceLoraPhy::SetFrequency(), ns3::lorawan::LoraPhy::SetMobility(), ns3::lorawan::EndDeviceLoraPhy::SetSpreadingFactor(), ns3::lorawan::EndDeviceLoraPhy::SwitchToStandby(), ns3::ObjectBase::TraceConnectWithoutContext(), 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 1214 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 1238 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 1230 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 1179 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 1180 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 1181 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 1182 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 1187 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 1184 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 1185 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 1186 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 1189 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 1188 of file lorawan-test-suite.cc.

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


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