23 #include "ns3/assert.h"
24 #include "ns3/double.h"
25 #include "ns3/trace-source-accessor.h"
26 #include "ns3/simulator.h"
41 .AddConstructor<LiIonEnergySource> ()
42 .AddAttribute (
"LiIonEnergySourceInitialEnergyJ",
43 "Initial energy stored in basic energy source.",
47 MakeDoubleChecker<double> ())
48 .AddAttribute (
"InitialCellVoltage",
49 "Initial (maximum) voltage of the cell (fully charged).",
53 MakeDoubleChecker<double> ())
54 .AddAttribute (
"NominalCellVoltage",
55 "Nominal voltage of the cell.",
58 MakeDoubleChecker<double> ())
59 .AddAttribute (
"ExpCellVoltage",
60 "Cell voltage at the end of the exponential zone.",
63 MakeDoubleChecker<double> ())
64 .AddAttribute (
"RatedCapacity",
65 "Rated capacity of the cell.",
68 MakeDoubleChecker<double> ())
69 .AddAttribute (
"NomCapacity",
70 "Cell capacity at the end of the nominal zone.",
73 MakeDoubleChecker<double> ())
74 .AddAttribute (
"ExpCapacity",
75 "Cell Capacity at the end of the exponential zone.",
78 MakeDoubleChecker<double> ())
79 .AddAttribute (
"InternalResistance",
80 "Internal resistance of the cell",
83 MakeDoubleChecker<double> ())
84 .AddAttribute (
"TypCurrent",
85 "Typical discharge current used to fit the curves",
88 MakeDoubleChecker<double> ())
89 .AddAttribute (
"ThresholdVoltage",
90 "Minimum threshold voltage to consider the battery depleted.",
93 MakeDoubleChecker<double> ())
94 .AddAttribute (
"PeriodicEnergyUpdateInterval",
95 "Time between two consecutive periodic energy updates.",
100 .AddTraceSource (
"RemainingEnergy",
101 "Remaining energy at BasicEnergySource.",
108 : m_drainedCapacity (0.0),
109 m_lastUpdateTime (Seconds (0.0))
209 NS_LOG_DEBUG (
"LiIonEnergySource:Updating remaining energy at node #" <<
259 NS_LOG_DEBUG (
"LiIonEnergySource:Energy depleted at node #" <<
keep track of time values and allow control of global simulation resolution
#define NS_LOG_FUNCTION(parameters)
void SetEnergyUpdateInterval(Time interval)
virtual double GetEnergyFraction(void)
Energy source base class.
Ptr< Node > GetNode(void) const
#define NS_ASSERT(condition)
#define NS_LOG_COMPONENT_DEFINE(name)
Time m_energyUpdateInterval
virtual void UpdateEnergySource(void)
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
static TypeId GetTypeId(void)
virtual double GetInitialEnergy(void) const
double GetVoltage(double current) const
void CalculateRemainingEnergy(void)
virtual double GetRemainingEnergy(void)
void BreakDeviceEnergyModelRefCycle(void)
double GetSeconds(void) const
hold objects of type ns3::Time
TracedValue< double > m_remainingEnergyJ
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
void SetInitialSupplyVoltage(double supplyVoltageV)
void HandleEnergyDrainedEvent(void)
double CalculateTotalCurrent(void)
double m_internalResistance
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
void NotifyEnergyDrained(void)
Time GetEnergyUpdateInterval(void) const
virtual ~LiIonEnergySource()
#define NS_LOG_DEBUG(msg)
virtual double GetSupplyVoltage(void) const
virtual void DecreaseRemainingEnergy(double energyJ)
virtual void IncreaseRemainingEnergy(double energyJ)
void SetInitialEnergy(double initialEnergyJ)
static bool IsFinished(void)
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range. Both limits are inclusive.
Hold an floating point type.
a unique identifier for an interface.
EventId m_energyUpdateEvent
TypeId SetParent(TypeId tid)