23 #include "ns3/assert.h"
24 #include "ns3/double.h"
25 #include "ns3/trace-source-accessor.h"
26 #include "ns3/simulator.h"
42 .AddConstructor<LiIonEnergySource> ()
43 .AddAttribute (
"LiIonEnergySourceInitialEnergyJ",
44 "Initial energy stored in basic energy source.",
48 MakeDoubleChecker<double> ())
49 .AddAttribute (
"InitialCellVoltage",
50 "Initial (maximum) voltage of the cell (fully charged).",
54 MakeDoubleChecker<double> ())
55 .AddAttribute (
"NominalCellVoltage",
56 "Nominal voltage of the cell.",
59 MakeDoubleChecker<double> ())
60 .AddAttribute (
"ExpCellVoltage",
61 "Cell voltage at the end of the exponential zone.",
64 MakeDoubleChecker<double> ())
65 .AddAttribute (
"RatedCapacity",
66 "Rated capacity of the cell.",
69 MakeDoubleChecker<double> ())
70 .AddAttribute (
"NomCapacity",
71 "Cell capacity at the end of the nominal zone.",
74 MakeDoubleChecker<double> ())
75 .AddAttribute (
"ExpCapacity",
76 "Cell Capacity at the end of the exponential zone.",
79 MakeDoubleChecker<double> ())
80 .AddAttribute (
"InternalResistance",
81 "Internal resistance of the cell",
84 MakeDoubleChecker<double> ())
85 .AddAttribute (
"TypCurrent",
86 "Typical discharge current used to fit the curves",
89 MakeDoubleChecker<double> ())
90 .AddAttribute (
"ThresholdVoltage",
91 "Minimum threshold voltage to consider the battery depleted.",
94 MakeDoubleChecker<double> ())
95 .AddAttribute (
"PeriodicEnergyUpdateInterval",
96 "Time between two consecutive periodic energy updates.",
101 .AddTraceSource (
"RemainingEnergy",
102 "Remaining energy at BasicEnergySource.",
109 : m_drainedCapacity (0.0),
110 m_lastUpdateTime (Seconds (0.0))
210 NS_LOG_DEBUG (
"LiIonEnergySource:Updating remaining energy at node #" <<
260 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)
NS_LOG_COMPONENT_DEFINE("LiIonEnergySource")
void SetEnergyUpdateInterval(Time interval)
virtual double GetEnergyFraction(void)
Energy source base class.
Ptr< Node > GetNode(void) const
void DoDispose(void)
All child's implementation must call BreakDeviceEnergyModelRefCycle to ensure reference cycles to Dev...
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
Time m_energyUpdateInterval
virtual void UpdateEnergySource(void)
Implements UpdateEnergySource.
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached.
static TypeId GetTypeId(void)
virtual double GetInitialEnergy(void) const
double GetVoltage(double current) const
void CalculateRemainingEnergy(void)
Calculates remaining energy.
virtual double GetRemainingEnergy(void)
void BreakDeviceEnergyModelRefCycle(void)
This function is called to break reference cycle between EnergySource and DeviceEnergyModel.
double GetSeconds(void) const
hold objects of type ns3::Time
TracedValue< double > m_remainingEnergyJ
void SetInitialSupplyVoltage(double supplyVoltageV)
void HandleEnergyDrainedEvent(void)
Handles the remaining energy going to zero event.
double CalculateTotalCurrent(void)
double m_internalResistance
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
static Time Now(void)
Return the "current simulation time".
void NotifyEnergyDrained(void)
This function notifies all DeviceEnergyModel of energy depletion event.
Time GetEnergyUpdateInterval(void) const
virtual ~LiIonEnergySource()
#define NS_LOG_DEBUG(msg)
virtual double GetSupplyVoltage(void) const
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::cancel method.
virtual void DecreaseRemainingEnergy(double energyJ)
virtual void IncreaseRemainingEnergy(double energyJ)
void SetInitialEnergy(double initialEnergyJ)
static bool IsFinished(void)
If there are no more events lefts to be scheduled, or if simulation time has already reached the "sto...
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Hold a floating point type.
void DoInitialize(void)
This method is called only once by Object::Initialize.
a unique identifier for an interface.
EventId m_energyUpdateEvent
TypeId SetParent(TypeId tid)