9#include "ns3/command-line.h"
10#include "ns3/energy-source-container.h"
11#include "ns3/li-ion-energy-source.h"
13#include "ns3/simple-device-energy-model.h"
14#include "ns3/simulator.h"
51 <<
" Cell voltage: " << es->GetSupplyVoltage()
52 <<
" V Remaining Capacity: " << es->GetRemainingEnergy() / (3.6 * 3600) <<
" Ah"
62main(
int argc,
char** argv)
65 cmd.Parse(argc, argv);
79 sem->SetEnergySource(es);
80 es->AppendDeviceEnergyModel(sem);
82 node->AggregateObject(esCont);
87 sem->SetCurrentA(2.33);
102 es->GetAttribute(
"ThresholdVoltage", v);
Parse command-line arguments.
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Smart pointer class similar to boost::intrusive_ptr.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Destroy()
Execute the events scheduled with ScheduleDestroy().
static bool IsFinished()
Check if the simulation should finish.
static Time Now()
Return the current simulation virtual time.
static void Run()
Run the simulation.
static void Stop()
Tell the Simulator the calling event should be the last one executed.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
void SetCurrentA(double current)
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Ptr< T > CreateObject(Args &&... args)
Create an object by type, with varying number of constructor parameters.
Time Seconds(double value)
Construct a Time in the indicated unit.
#define NS_WARNING_POP
Pops the diagnostic warning list from the stack, restoring it to the previous state.
NS_WARNING_PUSH_DEPRECATED
In this simple example, we show how to create and drain energy from a LiIonEnergySource.
static void PrintCellInfo(Ptr< LiIonEnergySource > es)
Every class exported by the ns3 library is enclosed in the ns3 namespace.