22 #include "ns3/simulator.h"
23 #include "ns3/command-line.h"
24 #include "ns3/simple-device-energy-model.h"
25 #include "ns3/li-ion-energy-source.h"
26 #include "ns3/energy-source-container.h"
50 std::cout <<
"At " <<
Simulator::Now ().
As (
Time::S) <<
" Cell voltage: " << es->GetSupplyVoltage () <<
" V Remaining Capacity: " <<
51 es->GetRemainingEnergy () / (3.6 * 3600) <<
" Ah" << std::endl;
62 main (
int argc,
char **argv)
65 cmd.Parse (argc, argv);
78 es->AppendDeviceEnergyModel (sem);
104 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.
virtual void SetEnergySource(Ptr< EnergySource > source)
Sets pointer to EnergySouce installed on node.
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static void Run(void)
Run the simulation.
static bool IsFinished(void)
Check if the simulation should finish.
static Time Now(void)
Return the current simulation virtual time.
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 Seconds(double value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.