A Discrete-Event Network Simulator
API
simple-device-energy-model.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 Andrea Sacco
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Andrea Sacco <andrea.sacco85@gmail.com>
18  */
19 
20 #ifndef SIMPLE_DEVICE_ENERGY_MODEL_H
21 #define SIMPLE_DEVICE_ENERGY_MODEL_H
22 
23 #include "device-energy-model.h"
24 
25 #include "ns3/nstime.h"
26 #include "ns3/traced-value.h"
27 
28 namespace ns3
29 {
30 
40 {
41  public:
46  static TypeId GetTypeId();
48  ~SimpleDeviceEnergyModel() override;
49 
57  virtual void SetNode(Ptr<Node> node);
58 
66  virtual Ptr<Node> GetNode() const;
67 
75  void SetEnergySource(Ptr<EnergySource> source) override;
76 
82  double GetTotalEnergyConsumption() const override;
83 
89  void ChangeState(int newState) override
90  {
91  }
92 
98  void HandleEnergyDepletion() override
99  {
100  }
101 
107  void HandleEnergyRecharged() override
108  {
109  }
110 
116  void HandleEnergyChanged() override
117  {
118  }
119 
125  void SetCurrentA(double current);
126 
127  private:
128  void DoDispose() override;
129 
135  double DoGetCurrentA() const override;
136 
142 };
143 
144 } // namespace ns3
145 
146 #endif /* SIMPLE_DEVICE_ENERGY_MODEL_H */
Base class for device energy models.
A simple device energy model where current drain can be set by the user.
void ChangeState(int newState) override
void HandleEnergyChanged() override
Handles energy changed.
static TypeId GetTypeId()
Get the type ID.
virtual Ptr< Node > GetNode() const
Gets pointer to node.
TracedValue< double > m_totalEnergyConsumption
Total energy consumption trace.
double GetTotalEnergyConsumption() const override
void DoDispose() override
Destructor implementation.
virtual void SetNode(Ptr< Node > node)
Sets pointer to node.
void HandleEnergyDepletion() override
Handles energy depletion.
double m_actualCurrentA
actual curred (in Ampere)
void SetEnergySource(Ptr< EnergySource > source) override
Sets pointer to EnergySource installed on node.
Ptr< EnergySource > m_source
Energy source.
void HandleEnergyRecharged() override
Handles energy recharged.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.