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

Test case of update remaining energy for BasicEnergySource and WifiRadioEnergyModel. More...

+ Collaboration diagram for BasicEnergyUpdateTest:

Public Member Functions

 BasicEnergyUpdateTest ()
 
virtual ~BasicEnergyUpdateTest ()
 
bool DoRun ()
 Performs some tests involving state updates and the relative energy consumption.
 

Private Member Functions

bool StateSwitchTest (WifiPhyState state)
 

Private Attributes

ObjectFactory m_deviceEnergyModel
 Device energy model factory.
 
ObjectFactory m_energySource
 Energy source factory.
 
double m_timeS
 Time in seconds.
 
double m_tolerance
 Tolerance for power estimation.
 

Detailed Description

Test case of update remaining energy for BasicEnergySource and WifiRadioEnergyModel.

Definition at line 34 of file basic-energy-model-test.cc.

Constructor & Destructor Documentation

◆ BasicEnergyUpdateTest()

BasicEnergyUpdateTest::BasicEnergyUpdateTest ( )

Definition at line 64 of file basic-energy-model-test.cc.

References m_timeS, and m_tolerance.

◆ ~BasicEnergyUpdateTest()

BasicEnergyUpdateTest::~BasicEnergyUpdateTest ( )
virtual

Definition at line 70 of file basic-energy-model-test.cc.

Member Function Documentation

◆ DoRun()

bool BasicEnergyUpdateTest::DoRun ( )

Performs some tests involving state updates and the relative energy consumption.

Returns
true is some error happened.

Definition at line 75 of file basic-energy-model-test.cc.

References m_deviceEnergyModel, m_energySource, ns3::ObjectFactory::SetTypeId(), and StateSwitchTest().

+ Here is the call graph for this function:

◆ StateSwitchTest()

bool BasicEnergyUpdateTest::StateSwitchTest ( WifiPhyState state)
private
Parameters
stateRadio state to switch to.
Returns
False if no error occurs.

Runs simulation for a while, check if final state & remaining energy is correctly updated.

Definition at line 116 of file basic-energy-model-test.cc.

References ns3::WifiRadioEnergyModel::ChangeState(), ns3::ObjectFactory::Create(), ns3::CreateObject(), ns3::Simulator::Destroy(), ns3::DynamicCast(), ns3::energy::DeviceEnergyModelContainer::Get(), ns3::energy::DeviceEnergyModelContainer::GetN(), m_deviceEnergyModel, m_energySource, m_timeS, m_tolerance, NS_FATAL_ERROR, NS_LOG_DEBUG, ns3::Simulator::Run(), ns3::Simulator::Schedule(), ns3::Seconds(), ns3::Simulator::Stop(), and ns3::energy::BasicEnergySource::UpdateEnergySource().

Referenced by DoRun().

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

Member Data Documentation

◆ m_deviceEnergyModel

ObjectFactory BasicEnergyUpdateTest::m_deviceEnergyModel
private

Device energy model factory.

Definition at line 61 of file basic-energy-model-test.cc.

Referenced by DoRun(), and StateSwitchTest().

◆ m_energySource

ObjectFactory BasicEnergyUpdateTest::m_energySource
private

Energy source factory.

Definition at line 60 of file basic-energy-model-test.cc.

Referenced by DoRun(), and StateSwitchTest().

◆ m_timeS

double BasicEnergyUpdateTest::m_timeS
private

Time in seconds.

Definition at line 57 of file basic-energy-model-test.cc.

Referenced by BasicEnergyUpdateTest(), and StateSwitchTest().

◆ m_tolerance

double BasicEnergyUpdateTest::m_tolerance
private

Tolerance for power estimation.

Definition at line 58 of file basic-energy-model-test.cc.

Referenced by BasicEnergyUpdateTest(), and StateSwitchTest().


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