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 (
"LiIonEnergyLowBatteryThreshold",
49 "Low battery threshold for LiIon energy source.",
52 MakeDoubleChecker<double> ())
53 .AddAttribute (
"InitialCellVoltage",
54 "Initial (maximum) voltage of the cell (fully charged).",
58 MakeDoubleChecker<double> ())
59 .AddAttribute (
"NominalCellVoltage",
60 "Nominal voltage of the cell.",
63 MakeDoubleChecker<double> ())
64 .AddAttribute (
"ExpCellVoltage",
65 "Cell voltage at the end of the exponential zone.",
68 MakeDoubleChecker<double> ())
69 .AddAttribute (
"RatedCapacity",
70 "Rated capacity of the cell.",
73 MakeDoubleChecker<double> ())
74 .AddAttribute (
"NomCapacity",
75 "Cell capacity at the end of the nominal zone.",
78 MakeDoubleChecker<double> ())
79 .AddAttribute (
"ExpCapacity",
80 "Cell Capacity at the end of the exponential zone.",
83 MakeDoubleChecker<double> ())
84 .AddAttribute (
"InternalResistance",
85 "Internal resistance of the cell",
88 MakeDoubleChecker<double> ())
89 .AddAttribute (
"TypCurrent",
90 "Typical discharge current used to fit the curves",
93 MakeDoubleChecker<double> ())
94 .AddAttribute (
"ThresholdVoltage",
95 "Minimum threshold voltage to consider the battery depleted.",
98 MakeDoubleChecker<double> ())
99 .AddAttribute (
"PeriodicEnergyUpdateInterval",
100 "Time between two consecutive periodic energy updates.",
105 .AddTraceSource (
"RemainingEnergy",
106 "Remaining energy at BasicEnergySource.",
113 : m_drainedCapacity (0.0),
114 m_lastUpdateTime (
Seconds (0.0))
214 NS_LOG_DEBUG (
"LiIonEnergySource:Updating remaining energy at node #" <<
264 NS_LOG_DEBUG (
"LiIonEnergySource:Energy depleted at node #" <<
Simulation virtual time values and global simulation resolution.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
void SetEnergyUpdateInterval(Time interval)
virtual double GetEnergyFraction(void)
Doxygen introspection did not find any typical Config paths.
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)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
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.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
virtual double GetRemainingEnergy(void)
void BreakDeviceEnergyModelRefCycle(void)
This function is called to break reference cycle between EnergySource and DeviceEnergyModel.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Attribute for 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)
Use NS_LOG to output a message of level LOG_DEBUG.
Time Seconds(double value)
Construct a Time in the indicated unit.
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...
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)