A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
energy-source.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
19  */
20 
21 #ifndef ENERGY_SOURCE_H
22 #define ENERGY_SOURCE_H
23 
24 #include "ns3/object.h"
25 #include "ns3/ptr.h"
26 #include "ns3/type-id.h"
27 #include "ns3/node.h"
28 #include "device-energy-model-container.h" // #include "device-energy-model.h"
29 
30 namespace ns3 {
31 
71 class EnergySource : public Object
72 {
73 public:
74  static TypeId GetTypeId (void);
75  EnergySource ();
76  virtual ~EnergySource ();
77 
84  virtual double GetSupplyVoltage (void) const = 0;
85 
92  virtual double GetInitialEnergy (void) const = 0;
93 
97  virtual double GetRemainingEnergy (void) = 0;
98 
104  virtual double GetEnergyFraction (void) = 0;
105 
111  virtual void UpdateEnergySource (void) = 0;
112 
118  void SetNode (Ptr<Node> node);
119 
126  Ptr<Node> GetNode (void) const;
127 
134  void AppendDeviceEnergyModel (Ptr<DeviceEnergyModel> deviceEnergyModelPtr);
135 
141 
147 
153  void InitializeDeviceModels (void);
154 
160  void DisposeDeviceModels (void);
161 
162 
163 private:
170  virtual void DoDispose (void);
171 
172 private:
177 
183 
184 
185 protected:
189  double CalculateTotalCurrent (void);
190 
195  void NotifyEnergyDrained (void);
196 
206  void BreakDeviceEnergyModelRefCycle (void);
207 
208 };
209 
210 } // namespace ns3
211 
212 #endif /* ENERGY_SOURCE_H */
Energy source base class.
Definition: energy-source.h:71
Ptr< Node > GetNode(void) const
Holds a vector of ns3::DeviceEnergyModel pointers.
virtual void UpdateEnergySource(void)=0
virtual double GetInitialEnergy(void) const =0
void BreakDeviceEnergyModelRefCycle(void)
virtual void DoDispose(void)
double CalculateTotalCurrent(void)
void InitializeDeviceModels(void)
void AppendDeviceEnergyModel(Ptr< DeviceEnergyModel > deviceEnergyModelPtr)
Ptr< Node > m_node
virtual double GetRemainingEnergy(void)=0
void NotifyEnergyDrained(void)
virtual double GetEnergyFraction(void)=0
DeviceEnergyModelContainer m_models
void DisposeDeviceModels(void)
DeviceEnergyModelContainer FindDeviceEnergyModels(TypeId tid)
a base class which provides memory management and object aggregation
Definition: object.h:63
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergySource.
a unique identifier for an interface.
Definition: type-id.h:44
virtual double GetSupplyVoltage(void) const =0