23 #include "ns3/assert.h"
24 #include "ns3/double.h"
25 #include "ns3/trace-source-accessor.h"
26 #include "ns3/simulator.h"
40 .AddConstructor<BasicEnergySource> ()
41 .AddAttribute (
"BasicEnergySourceInitialEnergyJ",
42 "Initial energy stored in basic energy source.",
46 MakeDoubleChecker<double> ())
47 .AddAttribute (
"BasicEnergySupplyVoltageV",
48 "Initial supply voltage for basic energy source.",
52 MakeDoubleChecker<double> ())
53 .AddAttribute (
"PeriodicEnergyUpdateInterval",
54 "Time between two consecutive periodic energy updates.",
59 .AddTraceSource (
"RemainingEnergy",
60 "Remaining energy at BasicEnergySource.",
143 NS_LOG_DEBUG (
"BasicEnergySource:Updating remaining energy.");
void CalculateRemainingEnergy(void)
Calculates remaining energy.
NS_LOG_COMPONENT_DEFINE("BasicEnergySource")
keep track of time values and allow control of global simulation resolution
#define NS_LOG_FUNCTION(parameters)
Time GetEnergyUpdateInterval(void) const
virtual double GetSupplyVoltage(void) const
Energy source base class.
virtual double GetRemainingEnergy(void)
#define NS_ASSERT(condition)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
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.
void HandleEnergyDrainedEvent(void)
Handles the remaining energy going to zero event.
Time m_energyUpdateInterval
void BreakDeviceEnergyModelRefCycle(void)
This function is called to break reference cycle between EnergySource and DeviceEnergyModel.
double GetSeconds(void) const
virtual double GetInitialEnergy(void) const
void DoDispose(void)
Defined in ns3::Object.
hold objects of type ns3::Time
TracedValue< double > m_remainingEnergyJ
static TypeId GetTypeId(void)
double CalculateTotalCurrent(void)
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
void DoInitialize(void)
Defined in ns3::Object.
static Time Now(void)
Return the "current simulation time".
EventId m_energyUpdateEvent
void NotifyEnergyDrained(void)
This function notifies all DeviceEnergyModel of energy depletion event.
void SetSupplyVoltage(double supplyVoltageV)
void SetEnergyUpdateInterval(Time interval)
virtual ~BasicEnergySource()
#define NS_LOG_DEBUG(msg)
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::cancel method.
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.
void SetInitialEnergy(double initialEnergyJ)
Hold a floating point type.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
virtual double GetEnergyFraction(void)