It tests that LoRa device correctly turning OFF on energy depletion. More...
Public Member Functions | |
| EnergyDepletionTest () | |
| Default constructor. | |
| ~EnergyDepletionTest () override | |
| Destructor. | |
| void | Reset (double energyJ, double batteryTh, Time rxTime=Time()) |
| Reset device for new sub test case. | |
| Public Member Functions inherited from ns3::TestCase | |
| TestCase (const TestCase &)=delete | |
| Caller graph was not generated because of its size. | |
| virtual | ~TestCase () |
| Destructor. | |
| std::string | GetName () const |
| TestCase & | operator= (const TestCase &)=delete |
Private Types | |
| using | State = EndDeviceLoraPhy::State |
| PHY state. | |
Private Member Functions | |
| void | DoRun () override |
| Implementation to actually run this TestCase. | |
| void | OnEndDeviceStateChange (State prev, State curr) |
| Callback for tracing changes in the LoRa PHY state. | |
| void | OnTotalEnergyConsumptionChange (double prev, double curr) |
| Callback for tracing a device PHY's energy model energy consumption. | |
Private Attributes | |
| size_t | m_currentDeviceStateIndex |
| Track current PHY state of the device. | |
| std::vector< State > | m_expectedStates |
| States the PHY must go through. | |
| Ptr< Node > | m_node |
| LoRaWAN end device node used in tests. | |
| double | m_totalEnergyConsumption |
| Track PHY energy consumption in Joules. | |
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... | |
| 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. | |
| TestCase * | GetParent () 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. | |
It tests that LoRa device correctly turning OFF on energy depletion.
Definition at line 3237 of file lorawan-test-suite.cc.
|
private |
PHY state.
Definition at line 3239 of file lorawan-test-suite.cc.
| EnergyDepletionTest::EnergyDepletionTest | ( | ) |
Default constructor.
Definition at line 3281 of file lorawan-test-suite.cc.
References ns3::TestCase::TestCase().
|
override |
|
overrideprivatevirtual |
Implementation to actually run this TestCase.
Subclasses should override this method to conduct their tests.
Implements ns3::TestCase.
Definition at line 3413 of file lorawan-test-suite.cc.
References ns3::lorawan::DbmToW(), ns3::lorawan::LoraRadioEnergyModel::ENERGY_EPSILON_J, ns3::lorawan::LoraPhy::GetTimeOnAir(), ns3::lorawan::LoraPhy::GetTSym(), m_currentDeviceStateIndex, m_expectedStates, m_totalEnergyConsumption, NS_LOG_DEBUG, NS_TEST_EXPECT_MSG_EQ, NS_TEST_EXPECT_MSG_GT_OR_EQ, NS_TEST_EXPECT_MSG_LT, Reset(), ns3::Simulator::Run(), and ns3::Seconds().
Callback for tracing changes in the LoRa PHY state.
| prev | old PHY state |
| curr | new PHY state |
Definition at line 3398 of file lorawan-test-suite.cc.
References m_currentDeviceStateIndex, m_expectedStates, NS_TEST_EXPECT_MSG_EQ, and NS_TEST_EXPECT_MSG_LT.
Referenced by Reset().
Callback for tracing a device PHY's energy model energy consumption.
| prev | old value of total energy consumption in Joules |
| curr | new value of total energy consumption in Joules |
Definition at line 3392 of file lorawan-test-suite.cc.
References m_totalEnergyConsumption, and prev.
Referenced by Reset().
Reset device for new sub test case.
| energyJ | Initial battery energy in Joule |
| batteryTh | Battery depletion threshold (0-1 percentage) |
| rxTime | (optional) Schedule a PHY RX at provided time > 0 |
Definition at line 3292 of file lorawan-test-suite.cc.
References ns3::Create(), ns3::CreateObject(), ns3::Simulator::Destroy(), ns3::lorawan::DOWN, ns3::DynamicCast(), ns3::lorawan::LorawanMacHelper::ED_A, ns3::lorawan::LorawanMacHelper::EU, ns3::energy::DeviceEnergyModelContainer::Get(), ns3::energy::EnergySourceContainer::Get(), ns3::lorawan::LoraPhy::GetTimeOnAir(), ns3::DeviceEnergyModelHelper::Install(), ns3::EnergySourceHelper::Install(), ns3::lorawan::LorawanMacHelper::Install(), ns3::Time::IsStrictlyPositive(), m_currentDeviceStateIndex, m_node, m_totalEnergyConsumption, ns3::MakeCallback(), ns3::Time::Max(), OnEndDeviceStateChange(), OnTotalEnergyConsumptionChange(), ns3::Simulator::ScheduleWithContext(), ns3::Seconds(), ns3::BasicEnergySourceHelper::Set(), ns3::lorawan::LoraRadioEnergyModelHelper::Set(), ns3::lorawan::LoraFrameHeader::SetAsDownlink(), ns3::lorawan::LorawanMacHelper::SetDeviceType(), ns3::lorawan::LorawanMacHeader::SetFType(), ns3::lorawan::LorawanMacHelper::SetRegion(), ns3::lorawan::LoraRadioEnergyModelHelper::SetTxCurrentModel(), ns3::lorawan::SimpleEndDeviceLoraPhy::StartReceive(), ns3::Simulator::Stop(), and ns3::lorawan::LorawanMacHeader::UNCONFIRMED_DATA_DOWN.
Referenced by DoRun().
|
private |
Track current PHY state of the device.
Definition at line 3278 of file lorawan-test-suite.cc.
Referenced by DoRun(), OnEndDeviceStateChange(), and Reset().
|
private |
States the PHY must go through.
Definition at line 3275 of file lorawan-test-suite.cc.
Referenced by DoRun(), and OnEndDeviceStateChange().
LoRaWAN end device node used in tests.
Definition at line 3273 of file lorawan-test-suite.cc.
Referenced by ~EnergyDepletionTest(), and Reset().
|
private |
Track PHY energy consumption in Joules.
Definition at line 3277 of file lorawan-test-suite.cc.
Referenced by DoRun(), OnTotalEnergyConsumptionChange(), and Reset().