energy: doxygen fixes

This commit is contained in:
Tommaso Pecorella
2022-01-08 21:28:59 -06:00
parent 5813be9cd5
commit d5dff3a6c5
20 changed files with 165 additions and 93 deletions

View File

@@ -64,11 +64,11 @@ private:
bool StateSwitchTest (WifiPhyState state);
private:
double m_timeS; // in seconds
double m_tolerance; // tolerance for power estimation
double m_timeS; //!< Time in seconds
double m_tolerance; //!< Tolerance for power estimation
ObjectFactory m_energySource;
ObjectFactory m_deviceEnergyModel;
ObjectFactory m_energySource; //!< Energy source factory
ObjectFactory m_deviceEnergyModel; //!< Device energy model factory
};
BasicEnergyUpdateTest::BasicEnergyUpdateTest ()
@@ -281,11 +281,11 @@ private:
bool DepletionTestCase (double simTimeS, double updateIntervalS);
private:
int m_numOfNodes; // number of nodes in simulation
int m_callbackCount; // counter for # of callbacks invoked
double m_simTimeS; // maximum simulation time, in seconds
double m_timeStepS; // simulation time step size, in seconds
double m_updateIntervalS; // update interval of each device model
int m_numOfNodes; //!< number of nodes in simulation
int m_callbackCount; //!< counter for # of callbacks invoked
double m_simTimeS; //!< maximum simulation time, in seconds
double m_timeStepS; //!< simulation time step size, in seconds
double m_updateIntervalS; //!< update interval of each device model
};

View File

@@ -39,6 +39,8 @@ using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("RvBatteryModelTestSuite");
/**
* \ingroup energy
*
* This example was originally devised as a test, then it was converted
* to an example.
*
@@ -86,17 +88,18 @@ public:
std::vector<Time> timeStamps,
Time expLifetime);
/// Load profile of the battery
typedef struct LoadProfile
{
std::vector<double> loads;
std::vector<Time> timeStamps;
Time itsyLifetime;
Time dualFoilLifeTime;
std::vector<double> loads; //!< Loads container
std::vector<Time> timeStamps; //!< Timestamps container
Time itsyLifetime; //!< Expected lifetime for an ITSY battery
Time dualFoilLifeTime; //!< Expected lifetime for a Dualfoil battery
} LoadProfile;
std::vector<LoadProfile> m_loadProfiles;
double m_alpha;
double m_beta;
std::vector<LoadProfile> m_loadProfiles; //!< Load profiles
double m_alpha; //!< Alpha parameter of the battery model
double m_beta; //!< Beta parameter of the battery model
};
BatteryLifetimeTest::BatteryLifetimeTest ()

View File

@@ -44,7 +44,7 @@ private:
virtual Ptr<EnergyHarvester> DoInstall (Ptr<EnergySource> source) const;
private:
ObjectFactory m_basicEnergyHarvester;
ObjectFactory m_basicEnergyHarvester; //!< Energy source factory
};

View File

@@ -43,7 +43,7 @@ private:
virtual Ptr<EnergySource> DoInstall (Ptr<Node> node) const;
private:
ObjectFactory m_basicEnergySource;
ObjectFactory m_basicEnergySource; //!< Energy source factory
};

View File

@@ -45,9 +45,14 @@ class EnergyHarvester;
class EnergyHarvesterContainer : public Object
{
public:
/// Const iterator for EnergyHarvester container
typedef std::vector< Ptr<EnergyHarvester> >::const_iterator Iterator;
public:
/**
* \brief Get the type ID.
* \return The object TypeId.
*/
static TypeId GetTypeId (void);
/**
* Creates an empty EnergyHarvesterContainer.
@@ -180,7 +185,7 @@ private:
virtual void DoInitialize (void);
private:
std::vector< Ptr<EnergyHarvester> > m_harvesters;
std::vector< Ptr<EnergyHarvester> > m_harvesters; //!< Harvester container
};

View File

@@ -72,7 +72,7 @@ public:
EnergyHarvesterContainer Install (EnergySourceContainer sourceContainer) const;
/**
* \param nodeName Name of node where EnergyHarvester will be installed.
* \param sourceName Name of node where EnergyHarvester will be installed.
* \returns An EnergyHarvesterContainer which contains all the EnergyHarvesters.
*
* This function installs an EnergyHarvester onto a node.
@@ -81,7 +81,7 @@ public:
private:
/**
* \param node Pointer to node where the energy harvester is to be installed.
* \param source Pointer to node where the energy harvester is to be installed.
* \returns Pointer to the created EnergyHarvester.
*
* Child classes of EnergyHarvesterHelper only have to implement this function,

View File

@@ -44,9 +44,14 @@ namespace ns3 {
class EnergySourceContainer : public Object
{
public:
/// Const iterator for EnergySource container
typedef std::vector< Ptr<EnergySource> >::const_iterator Iterator;
public:
/**
* \brief Get the type ID.
* \return The object TypeId.
*/
static TypeId GetTypeId (void);
/**
* Creates an empty EnergySourceContainer.
@@ -173,7 +178,7 @@ private:
virtual void DoInitialize (void);
private:
std::vector< Ptr<EnergySource> > m_sources;
std::vector< Ptr<EnergySource> > m_sources; //!< Energy source container
};

View File

@@ -45,7 +45,7 @@ private:
virtual Ptr<EnergySource> DoInstall (Ptr<Node> node) const;
private:
ObjectFactory m_liIonEnergySource;
ObjectFactory m_liIonEnergySource; //!< LiIon Battery factory
};

View File

@@ -43,7 +43,7 @@ private:
virtual Ptr<EnergySource> DoInstall (Ptr<Node> node) const;
private:
ObjectFactory m_rvBatteryModel;
ObjectFactory m_rvBatteryModel; //!< RV Battery factory
};

View File

@@ -48,6 +48,10 @@ namespace ns3 {
class BasicEnergyHarvester: public EnergyHarvester
{
public:
/**
* \brief Get the type ID.
* \return The object TypeId.
*/
static TypeId GetTypeId (void);
BasicEnergyHarvester ();
@@ -115,14 +119,14 @@ private:
private:
Ptr<RandomVariableStream> m_harvestablePower; // Random variable for the harvestable power
Ptr<RandomVariableStream> m_harvestablePower; //!< Random variable for the harvestable power
TracedValue<double> m_harvestedPower; // current harvested power, in Watt
TracedValue<double> m_totalEnergyHarvestedJ; // total harvested energy, in Joule
TracedValue<double> m_harvestedPower; //!< current harvested power, in Watt
TracedValue<double> m_totalEnergyHarvestedJ; //!< total harvested energy, in Joule
EventId m_energyHarvestingUpdateEvent; // energy harvesting event
Time m_lastHarvestingUpdateTime; // last harvesting time
Time m_harvestedPowerUpdateInterval; // harvestable energy update interval
EventId m_energyHarvestingUpdateEvent; //!< energy harvesting event
Time m_lastHarvestingUpdateTime; //!< last harvesting time
Time m_harvestedPowerUpdateInterval; //!< harvestable energy update interval
};

View File

@@ -37,6 +37,10 @@ namespace ns3 {
class BasicEnergySource : public EnergySource
{
public:
/**
* \brief Get the type ID.
* \return The object TypeId.
*/
static TypeId GetTypeId (void);
BasicEnergySource ();
virtual ~BasicEnergySource ();
@@ -136,16 +140,19 @@ private:
void CalculateRemainingEnergy (void);
private:
double m_initialEnergyJ; // initial energy, in Joules
double m_supplyVoltageV; // supply voltage, in Volts
double m_lowBatteryTh; // low battery threshold, as a fraction of the initial energy
double m_highBatteryTh; // high battery threshold, as a fraction of the initial energy
bool m_depleted; // set to true when the remaining energy goes below the low threshold,
// set to false again when the remaining energy exceeds the high threshold
TracedValue<double> m_remainingEnergyJ; // remaining energy, in Joules
EventId m_energyUpdateEvent; // energy update event
Time m_lastUpdateTime; // last update time
Time m_energyUpdateInterval; // energy update interval
double m_initialEnergyJ; //!< initial energy, in Joules
double m_supplyVoltageV; //!< supply voltage, in Volts
double m_lowBatteryTh; //!< low battery threshold, as a fraction of the initial energy
double m_highBatteryTh; //!< high battery threshold, as a fraction of the initial energy
/**
* set to true when the remaining energy goes below the low threshold,
* set to false again when the remaining energy exceeds the high threshold
*/
bool m_depleted;
TracedValue<double> m_remainingEnergyJ; //!< remaining energy, in Joules
EventId m_energyUpdateEvent; //!< energy update event
Time m_lastUpdateTime; //!< last update time
Time m_energyUpdateInterval; //!< energy update interval
};

View File

@@ -43,6 +43,7 @@ namespace ns3 {
class DeviceEnergyModelContainer
{
public:
/// Const iterator of DeviceEnergyModel container
typedef std::vector< Ptr<DeviceEnergyModel> >::const_iterator Iterator;
public:
@@ -168,7 +169,7 @@ public:
void Clear (void);
private:
std::vector< Ptr<DeviceEnergyModel> > m_models;
std::vector< Ptr<DeviceEnergyModel> > m_models; //!< Container of Energy models
};

View File

@@ -50,6 +50,10 @@ public:
typedef Callback<void, int> ChangeStateCallback;
public:
/**
* \brief Get the type ID.
* \return The object TypeId.
*/
static TypeId GetTypeId (void);
DeviceEnergyModel ();
virtual ~DeviceEnergyModel ();

View File

@@ -35,22 +35,19 @@ namespace ns3 {
class EnergySource;
/**
* \defgroup energy Energy Models
*
*/
/**
* \ingroup energy
*
* \brief Energy harvester base class.
*
*
*/
class EnergyHarvester : public Object
{
public:
/**
* \brief Get the type ID.
* \return The object TypeId.
*/
static TypeId GetTypeId (void);
EnergyHarvester ();
@@ -82,7 +79,7 @@ public:
void SetEnergySource (Ptr<EnergySource> source);
/**
* \returns source Pointer to energy source connected to the harvester.
* \returns Pointer to energy source connected to the harvester.
*
* When a subclass needs to get access to the connected energy source,
* it can invoke this method.
@@ -90,7 +87,7 @@ public:
Ptr<EnergySource> GetEnergySource (void) const;
/**
* \returns power Amount of power currently provided by the harvester.
* \returns Amount of power currently provided by the harvester.
*
* This method is called by the energy source connected to the harvester in order
* to determine the amount of energy that the harvester provided since last update.
@@ -111,6 +108,8 @@ private:
*
* This method should be used to connect the logic behind the particular implementation
* of the energy harvester with the energy source.
*
* \returns Amount of power currently provided by the harvester.
*/
virtual double DoGetPower (void) const;

View File

@@ -38,7 +38,12 @@ namespace ns3 {
/**
* \defgroup energy Energy Models
*
*/
/**
* \ingroup energy
* \ingroup tests
* \defgroup energy-tests Energy module tests
*/
/**
@@ -81,6 +86,10 @@ class EnergyHarvester;
class EnergySource : public Object
{
public:
/**
* \brief Get the type ID.
* \return The object TypeId.
*/
static TypeId GetTypeId (void);
EnergySource ();
virtual ~EnergySource ();

View File

@@ -72,6 +72,10 @@ namespace ns3 {
class LiIonEnergySource : public EnergySource
{
public:
/**
* \brief Get the type ID.
* \return The object TypeId.
*/
static TypeId GetTypeId (void);
LiIonEnergySource ();
virtual ~LiIonEnergySource ();
@@ -173,6 +177,7 @@ private:
/**
* \param current the actual discharge current value.
* \return the cell voltage
*
* Get the cell voltage in function of the discharge current.
* It consider different discharge curves for different discharge currents
@@ -181,23 +186,23 @@ private:
double GetVoltage (double current) const;
private:
double m_initialEnergyJ; // initial energy, in Joules
TracedValue<double> m_remainingEnergyJ; // remaining energy, in Joules
double m_drainedCapacity; // capacity drained from the cell, in Ah
double m_supplyVoltageV; // actual voltage of the cell
double m_lowBatteryTh; // low battery threshold, as a fraction of the initial energy
EventId m_energyUpdateEvent; // energy update event
Time m_lastUpdateTime; // last update time
Time m_energyUpdateInterval; // energy update interval
double m_eFull; // initial voltage of the cell, in Volts
double m_eNom; // nominal voltage of the cell, in Volts
double m_eExp; // cell voltage at the end of the exponential zone, in Volts
double m_internalResistance; // internal resistance of the cell, in Ohms
double m_qRated; // rated capacity of the cell, in Ah
double m_qNom; // cell capacity at the end of the nominal zone, in Ah
double m_qExp; // capacity value at the end of the exponential zone, in Ah
double m_typCurrent; // typical discharge current used to fit the curves
double m_minVoltTh; // minimum threshold voltage to consider the battery depleted
double m_initialEnergyJ; //!< initial energy, in Joules
TracedValue<double> m_remainingEnergyJ; //!< remaining energy, in Joules
double m_drainedCapacity; //!< capacity drained from the cell, in Ah
double m_supplyVoltageV; //!< actual voltage of the cell
double m_lowBatteryTh; //!< low battery threshold, as a fraction of the initial energy
EventId m_energyUpdateEvent; //!< energy update event
Time m_lastUpdateTime; //!< last update time
Time m_energyUpdateInterval; //!< energy update interval
double m_eFull; //!< initial voltage of the cell, in Volts
double m_eNom; //!< nominal voltage of the cell, in Volts
double m_eExp; //!< cell voltage at the end of the exponential zone, in Volts
double m_internalResistance; //!< internal resistance of the cell, in Ohms
double m_qRated; //!< rated capacity of the cell, in Ah
double m_qNom; //!< cell capacity at the end of the nominal zone, in Ah
double m_qExp; //!< capacity value at the end of the exponential zone, in Ah
double m_typCurrent; //!< typical discharge current used to fit the curves
double m_minVoltTh; //!< minimum threshold voltage to consider the battery depleted
};
} // namespace ns3

View File

@@ -50,6 +50,10 @@ namespace ns3 {
class RvBatteryModel : public EnergySource
{
public:
/**
* \brief Get the type ID.
* \return The object TypeId.
*/
static TypeId GetTypeId (void);
RvBatteryModel ();
virtual ~RvBatteryModel ();
@@ -216,17 +220,17 @@ private:
double RvModelAFunction (Time t, Time sk, Time sk_1, double beta);
private:
double m_openCircuitVoltage;
double m_cutoffVoltage;
double m_alpha; // alpha value of RV model, in Coulomb
double m_beta; // beta value of RV model, in second^-1
double m_openCircuitVoltage; //!< Open circuit voltage (in Volts)
double m_cutoffVoltage; //!< Cutoff voltage (in Volts)
double m_alpha; //!< alpha value of RV model, in Coulomb
double m_beta; //!< beta value of RV model, in second^-1
double m_previousLoad; // load value (total current) of previous sampling
std::vector<double> m_load; // load profile
std::vector<Time> m_timeStamps; // time stamps of load profile
Time m_lastSampleTime;
double m_previousLoad; //!< load value (total current) of previous sampling
std::vector<double> m_load; //!< load profile
std::vector<Time> m_timeStamps; //!< time stamps of load profile
Time m_lastSampleTime; //!< Last sample time
int m_numOfTerms; // # of terms for infinite sum in battery level estimation
int m_numOfTerms; //!< Number# of terms for infinite sum in battery level estimation
/**
* Battery level is defined as: output of Discharge function / alpha value
@@ -246,15 +250,16 @@ private:
*/
TracedValue<double> m_batteryLevel;
double m_lowBatteryTh; // low battery threshold, as a fraction of the initial energy
double m_lowBatteryTh; //!< low battery threshold, as a fraction of the initial energy
/**
* Sampling interval.
* (1 / sampling interval) = sampling frequency
*/
Time m_samplingInterval;
EventId m_currentSampleEvent;
Time m_samplingInterval;
EventId m_currentSampleEvent; //!< Current sample event
TracedValue<Time> m_lifetime; // time of death of the battery
TracedValue<Time> m_lifetime; //!< time of death of the battery
};
} // namespace ns3

View File

@@ -38,6 +38,10 @@ namespace ns3 {
class SimpleDeviceEnergyModel : public DeviceEnergyModel
{
public:
/**
* \brief Get the type ID.
* \return The object TypeId.
*/
static TypeId GetTypeId (void);
SimpleDeviceEnergyModel ();
virtual ~SimpleDeviceEnergyModel ();
@@ -128,11 +132,11 @@ private:
*/
virtual double DoGetCurrentA (void) const;
Time m_lastUpdateTime;
double m_actualCurrentA;
Ptr<EnergySource> m_source;
Ptr<Node> m_node;
TracedValue<double> m_totalEnergyConsumption;
Time m_lastUpdateTime; //!< Last update time
double m_actualCurrentA; //!< actual curred (in Ampere)
Ptr<EnergySource> m_source; //!< Energy source
Ptr<Node> m_node; //!< Node
TracedValue<double> m_totalEnergyConsumption; //!< Total energy consumption trace
};
} // namespace ns3

View File

@@ -33,6 +33,11 @@ using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("BasicEnergyHarvesterTestSuite");
/**
* \ingroup energy-tests
*
* \brief Energy Harvester Test
*/
class BasicEnergyHarvesterTestCase : public TestCase
{
public:
@@ -41,11 +46,11 @@ public:
void DoRun (void);
double m_timeS; // in seconds
double m_tolerance; // tolerance for energy estimation
double m_timeS; //!< Time, in seconds
double m_tolerance; //!< Tolerance for energy estimation
ObjectFactory m_energySource;
ObjectFactory m_energyHarvester;
ObjectFactory m_energySource; //!< Energy source factory
ObjectFactory m_energyHarvester; //!< Energy harvester factory
};
@@ -118,6 +123,11 @@ BasicEnergyHarvesterTestCase::DoRun ()
}
/**
* \ingroup energy-tests
*
* \brief Energy harvester TestSuite
*/
class BasicEnergyHarvesterTestSuite : public TestSuite
{
public:
@@ -130,5 +140,5 @@ BasicEnergyHarvesterTestSuite::BasicEnergyHarvesterTestSuite ()
AddTestCase (new BasicEnergyHarvesterTestCase, TestCase::QUICK);
}
// create an instance of the test suite
/// create an instance of the test suite
static BasicEnergyHarvesterTestSuite g_basicEnergyHarvesterTestSuite;

View File

@@ -29,6 +29,12 @@ using namespace ns3;
NS_LOG_COMPONENT_DEFINE ("LiIonEnergySourceTestSuite");
/**
* \ingroup energy-tests
*
* \brief LiIon battery Test
*/
class LiIonEnergyTestCase : public TestCase
{
public:
@@ -37,7 +43,7 @@ public:
void DoRun (void);
Ptr<Node> m_node;
Ptr<Node> m_node; //!< Node to aggreagte the source to.
};
LiIonEnergyTestCase::LiIonEnergyTestCase ()
@@ -77,6 +83,11 @@ LiIonEnergyTestCase::DoRun ()
"Incorrect consumed energy!");
}
/**
* \ingroup energy-tests
*
* \brief LiIon battery TestSuite
*/
class LiIonEnergySourceTestSuite : public TestSuite
{
public:
@@ -89,5 +100,5 @@ LiIonEnergySourceTestSuite::LiIonEnergySourceTestSuite ()
AddTestCase (new LiIonEnergyTestCase, TestCase::QUICK);
}
// create an instance of the test suite
/// create an instance of the test suite
static LiIonEnergySourceTestSuite g_liIonEnergySourceTestSuite;