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 "ns3/device-energy-model.h"
24 #include "ns3/nstime.h"
25 #include "ns3/traced-value.h"
26 
27 namespace ns3
28 {
29 
39 {
40  public:
45  static TypeId GetTypeId();
47  ~SimpleDeviceEnergyModel() override;
48 
56  virtual void SetNode(Ptr<Node> node);
57 
65  virtual Ptr<Node> GetNode() const;
66 
74  void SetEnergySource(Ptr<EnergySource> source) override;
75 
81  double GetTotalEnergyConsumption() const override;
82 
88  void ChangeState(int newState) override
89  {
90  }
91 
97  void HandleEnergyDepletion() override
98  {
99  }
100 
106  void HandleEnergyRecharged() override
107  {
108  }
109 
115  void HandleEnergyChanged() override
116  {
117  }
118 
124  void SetCurrentA(double current);
125 
126  private:
127  void DoDispose() override;
128 
134  double DoGetCurrentA() const override;
135 
141 };
142 
143 } // namespace ns3
144 
145 #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 EnergySouce 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:60
Every class exported by the ns3 library is enclosed in the ns3 namespace.