A Discrete-Event Network Simulator
API
basic-energy-model-test.cc
Go to the documentation of this file.
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  * Author: He Wu <mdzz@u.washington.edu>
19  */
20 
21 #include "ns3/basic-energy-source.h"
22 #include "ns3/wifi-radio-energy-model.h"
23 #include "ns3/basic-energy-source-helper.h"
24 #include "ns3/wifi-radio-energy-model-helper.h"
25 #include "ns3/energy-source-container.h"
26 #include "ns3/device-energy-model-container.h"
27 #include "ns3/log.h"
28 #include "ns3/node.h"
29 #include "ns3/simulator.h"
30 #include "ns3/double.h"
31 #include "ns3/config.h"
32 #include "ns3/string.h"
33 #include "ns3/yans-wifi-helper.h"
34 #include <cmath>
35 
36 using namespace ns3;
37 
38 NS_LOG_COMPONENT_DEFINE ("BasicEnergyModelTestSuite");
39 
45 {
46 public:
48  virtual ~BasicEnergyUpdateTest ();
49 
54  bool DoRun (void);
55 
56 private:
64  bool StateSwitchTest (WifiPhyState state);
65 
66 private:
67  double m_timeS; // in seconds
68  double m_tolerance; // tolerance for power estimation
69 
72 };
73 
75 {
76  m_timeS = 15.5; // idle for 15 seconds before changing state
77  m_tolerance = 1.0e-5; //
78 }
79 
81 {
82 }
83 
84 bool
86 {
87  // set types
88  m_energySource.SetTypeId ("ns3::BasicEnergySource");
89  m_deviceEnergyModel.SetTypeId ("ns3::WifiRadioEnergyModel");
90 
91  // run state switch tests
92  if (StateSwitchTest (WifiPhyState::IDLE))
93  {
94  return 1;
95  std::cerr << "Problem with state switch test (WifiPhy idle)." << std::endl;
96  }
97  if (StateSwitchTest (WifiPhyState::CCA_BUSY))
98  {
99  return 1;
100  std::cerr << "Problem with state switch test (WifiPhy cca busy)." << std::endl;
101  }
102  if (StateSwitchTest (WifiPhyState::TX))
103  {
104  return 1;
105  std::cerr << "Problem with state switch test (WifiPhy tx)." << std::endl;
106  }
107  if (StateSwitchTest (WifiPhyState::RX))
108  {
109  return 1;
110  std::cerr << "Problem with state switch test (WifiPhy rx)." << std::endl;
111  }
112  if (StateSwitchTest (WifiPhyState::SWITCHING))
113  {
114  return 1;
115  std::cerr << "Problem with state switch test (WifiPhy switching)." << std::endl;
116  }
117  if (StateSwitchTest (WifiPhyState::SLEEP))
118  {
119  return 1;
120  std::cerr << "Problem with state switch test (WifiPhy sleep)." << std::endl;
121  }
122  return 0;
123 }
124 
125 bool
127 {
128  // create node
129  Ptr<Node> node = CreateObject<Node> ();
130 
131  // create energy source
132  Ptr<BasicEnergySource> source = m_energySource.Create<BasicEnergySource> ();
133  source->SetInitialEnergy (50);
134  // aggregate energy source to node
135  node->AggregateObject (source);
136  source->SetNode (node);
137 
138  // create device energy model
140  m_deviceEnergyModel.Create<WifiRadioEnergyModel> ();
141  // set energy source pointer
142  model->SetEnergySource (source);
143  // add device energy model to model list in energy source
144  source->AppendDeviceEnergyModel (model);
145 
146  // retrieve device energy model from energy source
148  source->FindDeviceEnergyModels ("ns3::WifiRadioEnergyModel");
149  // check list
150  if ((models.GetN () == 0))
151  {
152  std::cerr << "Model list is empty!." << std::endl;
153  return true;
154  }
155  // get pointer
156  Ptr<WifiRadioEnergyModel> devModel =
157  DynamicCast<WifiRadioEnergyModel> (models.Get (0));
158  // check pointer
159  if ((devModel == 0))
160  {
161  std::cerr << "NULL pointer to device model!." << std::endl;
162  return true;
163  }
164 
165  /*
166  * The radio will stay IDLE for m_timeS seconds. Then it will switch into a
167  * different state.
168  */
169 
170  // schedule change of state
171  Simulator::Schedule (Seconds (m_timeS),
172  &WifiRadioEnergyModel::ChangeState, devModel, state);
173 
174  // Calculate remaining energy at simulation stop time
175  Simulator::Schedule (Seconds (m_timeS * 2),
177 
178  double timeDelta = 0.000000001; // 1 nanosecond
179  // run simulation; stop just after last scheduled event
180  Simulator::Stop (Seconds (m_timeS * 2 + timeDelta));
181  Simulator::Run ();
182 
183  // energy = current * voltage * time
184 
185  // calculate idle power consumption
186  double estRemainingEnergy = source->GetInitialEnergy ();
187  double voltage = source->GetSupplyVoltage ();
188  estRemainingEnergy -= devModel->GetIdleCurrentA () * voltage * m_timeS;
189 
190  // calculate new state power consumption
191  double current = 0.0;
192  switch (state)
193  {
194  case WifiPhyState::IDLE:
195  current = devModel->GetIdleCurrentA ();
196  break;
198  current = devModel->GetCcaBusyCurrentA ();
199  break;
200  case WifiPhyState::TX:
201  current = devModel->GetTxCurrentA ();
202  break;
203  case WifiPhyState::RX:
204  current = devModel->GetRxCurrentA ();
205  break;
207  current = devModel->GetSwitchingCurrentA ();
208  break;
209  case WifiPhyState::SLEEP:
210  current = devModel->GetSleepCurrentA ();
211  break;
212  case WifiPhyState::OFF:
213  current = 0;
214  break;
215  default:
216  NS_FATAL_ERROR ("Undefined radio state: " << state);
217  break;
218  }
219  estRemainingEnergy -= current * voltage * m_timeS;
220  estRemainingEnergy = std::max (0.0, estRemainingEnergy);
221 
222  // obtain remaining energy from source
223  double remainingEnergy = source->GetRemainingEnergy ();
224  NS_LOG_DEBUG ("Remaining energy is " << remainingEnergy);
225  NS_LOG_DEBUG ("Estimated remaining energy is " << estRemainingEnergy);
226  NS_LOG_DEBUG ("Difference is " << estRemainingEnergy - remainingEnergy);
227 
228  // check remaining energy
229  if ((remainingEnergy > (estRemainingEnergy + m_tolerance))
230  || (remainingEnergy < (estRemainingEnergy - m_tolerance)))
231  {
232  std::cerr << "Incorrect remaining energy!" << std::endl;
233  return true;
234  }
235 
236  // obtain radio state
237  WifiPhyState endState = devModel->GetCurrentState ();
238  NS_LOG_DEBUG ("Radio state is " << endState);
239  // check end state
240  if (endState != state)
241  {
242  std::cerr << "Incorrect end state!" << std::endl;
243  return true;
244  }
246 
247  return false; // no error
248 }
249 
250 // -------------------------------------------------------------------------- //
251 
257 {
258 public:
260  virtual ~BasicEnergyDepletionTest ();
261 
266  bool DoRun (void);
267 
268 private:
272  void DepletionHandler (void);
273 
281  bool DepletionTestCase (double simTimeS, double updateIntervalS);
282 
283 private:
284  int m_numOfNodes; // number of nodes in simulation
285  int m_callbackCount; // counter for # of callbacks invoked
286  double m_simTimeS; // maximum simulation time, in seconds
287  double m_timeStepS; // simulation time step size, in seconds
288  double m_updateIntervalS; // update interval of each device model
289 
290 };
291 
293 {
294  m_numOfNodes = 10;
295  m_callbackCount = 0;
296  m_simTimeS = 4.5;
297  m_timeStepS = 0.5;
298  m_updateIntervalS = 1.5;
299 }
300 
302 {
303 }
304 
305 bool
307 {
308  /*
309  * Run simulation with different simulation time and update interval.
310  */
311  uint8_t ret = 0;
312 
313  for (double simTimeS = 0.0; simTimeS <= m_simTimeS; simTimeS += m_timeStepS)
314  {
315  for (double updateIntervalS = 0.5; updateIntervalS <= m_updateIntervalS;
316  updateIntervalS += m_timeStepS)
317  {
318  if (DepletionTestCase (simTimeS, updateIntervalS))
319  {
320  ret = 1;
321  std::cerr << "Depletion test case problem." << std::endl;
322  }
323  // reset callback count
324  m_callbackCount = 0;
325  }
326  }
327  return ret;
328 }
329 
330 void
332 {
333  m_callbackCount++;
334 }
335 
336 bool
338  double updateIntervalS)
339 {
340  // create node
341  NodeContainer c;
342  c.Create (m_numOfNodes);
343 
344  std::string phyMode ("DsssRate1Mbps");
345 
346  // disable fragmentation for frames below 2200 bytes
347  Config::SetDefault ("ns3::WifiRemoteStationManager::FragmentationThreshold",
348  StringValue ("2200"));
349  // turn off RTS/CTS for frames below 2200 bytes
350  Config::SetDefault ("ns3::WifiRemoteStationManager::RtsCtsThreshold",
351  StringValue ("2200"));
352  // Fix non-unicast data rate to be the same as that of unicast
353  Config::SetDefault ("ns3::WifiRemoteStationManager::NonUnicastMode",
354  StringValue (phyMode));
355 
356  // install YansWifiPhy
358  wifi.SetStandard (WIFI_STANDARD_80211b);
359 
360  YansWifiPhyHelper wifiPhy;
361  /*
362  * This is one parameter that matters when using FixedRssLossModel, set it to
363  * zero; otherwise, gain will be added.
364  */
365  wifiPhy.Set ("RxGain", DoubleValue (0));
366  // ns-3 supports RadioTap and Prism tracing extensions for 802.11b
368 
369  YansWifiChannelHelper wifiChannel;
370  wifiChannel.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
371  wifiPhy.SetChannel (wifiChannel.Create ());
372 
373  // Add a MAC and disable rate control
374  WifiMacHelper wifiMac;
375  wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
376  "DataMode", StringValue (phyMode),
377  "ControlMode", StringValue (phyMode));
378  // Set it to ad-hoc mode
379  wifiMac.SetType ("ns3::AdhocWifiMac");
380  NetDeviceContainer devices = wifi.Install (wifiPhy, wifiMac, c);
381 
382  /*
383  * Create and install energy source and a single basic radio energy model on
384  * the node using helpers.
385  */
386  // source helper
387  BasicEnergySourceHelper basicSourceHelper;
388  // set energy to 0 so that we deplete energy at the beginning of simulation
389  basicSourceHelper.Set ("BasicEnergySourceInitialEnergyJ", DoubleValue (0.0));
390  // set update interval
391  basicSourceHelper.Set ("PeriodicEnergyUpdateInterval",
392  TimeValue (Seconds (updateIntervalS)));
393  // install source
394  EnergySourceContainer sources = basicSourceHelper.Install (c);
395 
396  // device energy model helper
397  WifiRadioEnergyModelHelper radioEnergyHelper;
398  // set energy depletion callback
401  radioEnergyHelper.SetDepletionCallback (callback);
402  // install on node
403  DeviceEnergyModelContainer deviceModels = radioEnergyHelper.Install (devices, sources);
404 
405  // run simulation
406  Simulator::Stop (Seconds (simTimeS));
407  Simulator::Run ();
409 
410  NS_LOG_DEBUG ("Simulation time = " << simTimeS << "s");
411  NS_LOG_DEBUG ("Update interval = " << updateIntervalS << "s");
412  NS_LOG_DEBUG ("Expected callback count is " << m_numOfNodes);
413  NS_LOG_DEBUG ("Actual callback count is " << m_callbackCount);
414 
415  // check result, call back should only be invoked once
416  if (m_numOfNodes != m_callbackCount)
417  {
418  std::cerr << "Not all callbacks are invoked!" << std::endl;
419  return true;
420  }
421 
422  return false;
423 }
424 
425 // -------------------------------------------------------------------------- //
426 
427 int
428 main (int argc, char **argv)
429 {
430  BasicEnergyUpdateTest testEnergyUpdate;
431  if (testEnergyUpdate.DoRun ())
432  {
433  return 1;
434  }
435 
436  BasicEnergyDepletionTest testEnergyDepletion;
437  if (testEnergyDepletion.DoRun ())
438  {
439  return 1;
440  }
441 
442  return 0;
443 }
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition: net-device-container.h:42
ns3::DeviceEnergyModelHelper::Install
DeviceEnergyModelContainer Install(Ptr< NetDevice > device, Ptr< EnergySource > source) const
Definition: energy-model-helper.cc:91
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::YansWifiPhyHelper
Make it easy to create and manage PHY objects for the YANS model.
Definition: yans-wifi-helper.h:161
ns3::YansWifiChannelHelper::SetPropagationDelay
void SetPropagationDelay(std::string name, std::string n0="", const AttributeValue &v0=EmptyAttributeValue(), std::string n1="", const AttributeValue &v1=EmptyAttributeValue(), std::string n2="", const AttributeValue &v2=EmptyAttributeValue(), std::string n3="", const AttributeValue &v3=EmptyAttributeValue(), std::string n4="", const AttributeValue &v4=EmptyAttributeValue(), std::string n5="", const AttributeValue &v5=EmptyAttributeValue(), std::string n6="", const AttributeValue &v6=EmptyAttributeValue(), std::string n7="", const AttributeValue &v7=EmptyAttributeValue())
Definition: yans-wifi-helper.cc:74
ns3::DeviceEnergyModelContainer::Get
Ptr< DeviceEnergyModel > Get(uint32_t i) const
Get the i-th Ptr<DeviceEnergyModel> stored in this container.
Definition: device-energy-model-container.cc:81
ns3::Callback< void >
BasicEnergyDepletionTest
Test case of energy depletion handling for BasicEnergySource and WifiRadioEnergyModel.
Definition: basic-energy-model-test.cc:257
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
RX
@ RX
The PHY layer is receiving a packet.
Definition: wifi-phy-state.h:48
ns3::WifiHelper
helps to create WifiNetDevice objects
Definition: wifi-helper.h:327
ns3::WifiRadioEnergyModelHelper::SetDepletionCallback
void SetDepletionCallback(WifiRadioEnergyModel::WifiRadioEnergyDepletionCallback callback)
Definition: wifi-radio-energy-model-helper.cc:46
BasicEnergyUpdateTest::m_timeS
double m_timeS
Definition: basic-energy-model-test.cc:67
ns3::WifiRadioEnergyModel::GetCcaBusyCurrentA
double GetCcaBusyCurrentA(void) const
Gets CCA busy current in Amperes.
Definition: wifi-radio-energy-model.cc:155
IDLE
@ IDLE
The PHY layer is IDLE.
Definition: wifi-phy-state.h:36
BasicEnergyDepletionTest::DoRun
bool DoRun(void)
Performs some tests involving energy depletion.
Definition: basic-energy-model-test.cc:306
BasicEnergyUpdateTest::m_energySource
ObjectFactory m_energySource
Definition: basic-energy-model-test.cc:70
ns3::BasicEnergySource::UpdateEnergySource
virtual void UpdateEnergySource(void)
Implements UpdateEnergySource.
Definition: basic-energy-source.cc:152
OFF
@ OFF
The PHY layer is switched off.
Definition: wifi-phy-state.h:60
ns3::WifiRadioEnergyModel::GetTxCurrentA
double GetTxCurrentA(void) const
Gets transmit current in Amperes.
Definition: wifi-radio-energy-model.cc:169
BasicEnergyDepletionTest::~BasicEnergyDepletionTest
virtual ~BasicEnergyDepletionTest()
Definition: basic-energy-model-test.cc:301
ns3::WifiRadioEnergyModel::GetSleepCurrentA
double GetSleepCurrentA(void) const
Gets sleep current in Amperes.
Definition: wifi-radio-energy-model.cc:211
ns3::WifiPhyHelper::DLT_IEEE802_11_RADIO
@ DLT_IEEE802_11_RADIO
Include Radiotap link layer information.
Definition: wifi-helper.h:180
ns3::WifiRadioEnergyModel::GetCurrentState
WifiPhyState GetCurrentState(void) const
Definition: wifi-radio-energy-model.cc:225
ns3::WifiRadioEnergyModel::GetIdleCurrentA
double GetIdleCurrentA(void) const
Gets idle current in Amperes.
Definition: wifi-radio-energy-model.cc:141
ns3::Simulator::Schedule
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
ns3::BasicEnergySource::SetInitialEnergy
void SetInitialEnergy(double initialEnergyJ)
Definition: basic-energy-source.cc:90
CCA_BUSY
@ CCA_BUSY
The PHY layer has sense the medium busy through the CCA mechanism.
Definition: wifi-phy-state.h:40
ns3::YansWifiPhyHelper::SetChannel
void SetChannel(Ptr< YansWifiChannel > channel)
Definition: yans-wifi-helper.cc:134
ns3::WifiRadioEnergyModel::ChangeState
void ChangeState(int newState)
Changes state of the WifiRadioEnergyMode.
Definition: wifi-radio-energy-model.cc:284
first.devices
devices
Definition: first.py:39
ns3::DoubleValue
This class can be used to hold variables of floating point type such as 'double' or 'float'.
Definition: double.h:41
ns3::NodeContainer::Create
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Definition: node-container.cc:98
ns3::WifiRadioEnergyModel::GetRxCurrentA
double GetRxCurrentA(void) const
Gets receive current in Amperes.
Definition: wifi-radio-energy-model.cc:183
ns3::BasicEnergySourceHelper::Set
void Set(std::string name, const AttributeValue &v)
Definition: basic-energy-source-helper.cc:36
BasicEnergyUpdateTest::BasicEnergyUpdateTest
BasicEnergyUpdateTest()
Definition: basic-energy-model-test.cc:74
BasicEnergyDepletionTest::m_timeStepS
double m_timeStepS
Definition: basic-energy-model-test.cc:287
ns3::EnergySourceContainer
Holds a vector of ns3::EnergySource pointers.
Definition: energy-source-container.h:45
ns3::EnergySourceHelper::Install
EnergySourceContainer Install(Ptr< Node > node) const
Definition: energy-model-helper.cc:35
third.wifi
wifi
Definition: third.py:96
BasicEnergyDepletionTest::DepletionTestCase
bool DepletionTestCase(double simTimeS, double updateIntervalS)
Definition: basic-energy-model-test.cc:337
ns3::WifiRadioEnergyModel::SetEnergySource
void SetEnergySource(const Ptr< EnergySource > source)
Sets pointer to EnergySouce installed on node.
Definition: wifi-radio-energy-model.cc:112
ns3::Ptr< Node >
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
BasicEnergyUpdateTest::m_deviceEnergyModel
ObjectFactory m_deviceEnergyModel
Definition: basic-energy-model-test.cc:71
BasicEnergyUpdateTest::~BasicEnergyUpdateTest
virtual ~BasicEnergyUpdateTest()
Definition: basic-energy-model-test.cc:80
ns3::BasicEnergySource::GetSupplyVoltage
virtual double GetSupplyVoltage(void) const
Definition: basic-energy-source.cc:120
ns3::YansWifiChannelHelper::Create
Ptr< YansWifiChannel > Create(void) const
Definition: yans-wifi-helper.cc:98
BasicEnergyUpdateTest::DoRun
bool DoRun(void)
Performs some tests involving state updates and the relative energy consumption.
Definition: basic-energy-model-test.cc:85
ns3::Simulator::Stop
static void Stop(void)
Tell the Simulator the calling event should be the last one executed.
Definition: simulator.cc:180
ns3::BasicEnergySource
BasicEnergySource decreases/increases remaining energy stored in itself in linearly.
Definition: basic-energy-source.h:38
max
#define max(a, b)
Definition: 80211b.c:43
ns3::BasicEnergySourceHelper
Creates a BasicEnergySource object.
Definition: basic-energy-source-helper.h:35
BasicEnergyDepletionTest::DepletionHandler
void DepletionHandler(void)
Callback invoked when energy is drained from source.
Definition: basic-energy-model-test.cc:331
ns3::WifiRadioEnergyModelHelper
Assign WifiRadioEnergyModel to wifi devices.
Definition: wifi-radio-energy-model-helper.h:37
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition: object-factory.h:48
ns3::Object::AggregateObject
void AggregateObject(Ptr< Object > other)
Aggregate two Objects together.
Definition: object.cc:252
ns3::EnergySource::SetNode
void SetNode(Ptr< Node > node)
Sets pointer to node containing this EnergySource.
Definition: energy-source.cc:56
ns3::WIFI_STANDARD_80211b
@ WIFI_STANDARD_80211b
Definition: wifi-standards.h:128
ns3::DeviceEnergyModelContainer
Holds a vector of ns3::DeviceEnergyModel pointers.
Definition: device-energy-model-container.h:44
ns3::BasicEnergySource::GetInitialEnergy
virtual double GetInitialEnergy(void) const
Definition: basic-energy-source.cc:127
SLEEP
@ SLEEP
The PHY layer is sleeping.
Definition: wifi-phy-state.h:56
ns3::MakeCallback
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
ns3::Simulator::Run
static void Run(void)
Run the simulation.
Definition: simulator.cc:172
ns3::StringValue
Hold variables of type string.
Definition: string.h:41
WifiPhyState
WifiPhyState
The state of the PHY layer.
Definition: wifi-phy-state.h:32
ns3::WifiPhyHelper::SetPcapDataLinkType
void SetPcapDataLinkType(SupportedPcapDataLinkTypes dlt)
Set the data link type of PCAP traces to be used.
Definition: wifi-helper.cc:573
BasicEnergyDepletionTest::m_numOfNodes
int m_numOfNodes
Definition: basic-energy-model-test.cc:284
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
SWITCHING
@ SWITCHING
The PHY layer is switching to other channel.
Definition: wifi-phy-state.h:52
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
BasicEnergyUpdateTest::m_tolerance
double m_tolerance
Definition: basic-energy-model-test.cc:68
ns3::Simulator::Destroy
static void Destroy(void)
Execute the events scheduled with ScheduleDestroy().
Definition: simulator.cc:136
BasicEnergyDepletionTest::BasicEnergyDepletionTest
BasicEnergyDepletionTest()
Definition: basic-energy-model-test.cc:292
ns3::TimeValue
AttributeValue implementation for Time.
Definition: nstime.h:1353
ns3::WifiRadioEnergyModel
A WiFi radio energy model.
Definition: wifi-radio-energy-model.h:214
ns3::NodeContainer
keep track of a set of node pointers.
Definition: node-container.h:39
ns3::WifiMacHelper::SetType
void SetType(std::string type, Args &&... args)
Definition: wifi-mac-helper.h:130
ns3::YansWifiChannelHelper
manage and create wifi channel objects for the YANS model.
Definition: yans-wifi-helper.h:37
ns3::BasicEnergySource::GetRemainingEnergy
virtual double GetRemainingEnergy(void)
Definition: basic-energy-source.cc:134
ns3::WifiMacHelper
create MAC layers for a ns3::WifiNetDevice.
Definition: wifi-mac-helper.h:48
ns3::Config::SetDefault
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:849
BasicEnergyDepletionTest::m_callbackCount
int m_callbackCount
Definition: basic-energy-model-test.cc:285
BasicEnergyDepletionTest::m_simTimeS
double m_simTimeS
Definition: basic-energy-model-test.cc:286
TX
@ TX
The PHY layer is sending a packet.
Definition: wifi-phy-state.h:44
ns3::EnergySource::FindDeviceEnergyModels
DeviceEnergyModelContainer FindDeviceEnergyModels(TypeId tid)
Definition: energy-source.cc:78
ns3::WifiPhyHelper::Set
void Set(std::string name, const AttributeValue &v)
Definition: wifi-helper.cc:140
ns3::DeviceEnergyModelContainer::GetN
uint32_t GetN(void) const
Get the number of Ptr<DeviceEnergyModel> stored in this container.
Definition: device-energy-model-container.cc:74
BasicEnergyUpdateTest::StateSwitchTest
bool StateSwitchTest(WifiPhyState state)
Definition: basic-energy-model-test.cc:126
BasicEnergyUpdateTest
Test case of update remaining energy for BasicEnergySource and WifiRadioEnergyModel.
Definition: basic-energy-model-test.cc:45
ns3::WifiRadioEnergyModel::GetSwitchingCurrentA
double GetSwitchingCurrentA(void) const
Gets switching current in Amperes.
Definition: wifi-radio-energy-model.cc:197
ns3::EnergySource::AppendDeviceEnergyModel
void AppendDeviceEnergyModel(Ptr< DeviceEnergyModel > deviceEnergyModelPtr)
Definition: energy-source.cc:70
BasicEnergyDepletionTest::m_updateIntervalS
double m_updateIntervalS
Definition: basic-energy-model-test.cc:288