20#include "ns3/li-ion-energy-source.h"
22#include "ns3/command-line.h"
23#include "ns3/energy-source-container.h"
25#include "ns3/simple-device-energy-model.h"
26#include "ns3/simulator.h"
52 <<
" Cell voltage: " << es->GetSupplyVoltage()
53 <<
" V Remaining Capacity: " << es->GetRemainingEnergy() / (3.6 * 3600) <<
" Ah"
56 if (!Simulator::IsFinished())
63main(
int argc,
char** argv)
66 cmd.Parse(argc, argv);
79 es->AppendDeviceEnergyModel(sem);
90 Simulator::Schedule(now, &SimpleDeviceEnergyModel::SetCurrentA, sem, 4.66);
101 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'.
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Smart pointer class similar to boost::intrusive_ptr.
void SetCurrentA(double current)
virtual void SetNode(Ptr< Node > node)
Sets pointer to node.
void SetEnergySource(Ptr< EnergySource > source) override
Sets pointer to EnergySouce installed on node.
Simulation virtual time values and global simulation resolution.
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
static void PrintCellInfo(Ptr< LiIonEnergySource > es)
In this simple example, we show how to create and drain energy from a LiIonEnergySource.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Time Now()
create an ns3::Time instance which contains the current simulation time.
Time Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.