A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
Loading...
Searching...
No Matches
wifi-radio-energy-model-helper.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010 Network Security Lab, University of Washington, Seattle.
3
*
4
* SPDX-License-Identifier: GPL-2.0-only
5
*
6
* Author: Sidharth Nabar <snabar@uw.edu>, He Wu <mdzz@u.washington.edu>
7
*/
8
9
#ifndef WIFI_RADIO_ENERGY_MODEL_HELPER_H
10
#define WIFI_RADIO_ENERGY_MODEL_HELPER_H
11
12
#include "ns3/energy-model-helper.h"
13
#include "ns3/wifi-export.h"
14
#include "ns3/wifi-radio-energy-model.h"
15
16
namespace
ns3
17
{
18
19
/**
20
* @ingroup energy
21
* @brief Assign WifiRadioEnergyModel to wifi devices.
22
*
23
* This installer installs WifiRadioEnergyModel for only WifiNetDevice objects.
24
*
25
*/
26
class
WIFI_EXPORT
WifiRadioEnergyModelHelper
:
public
DeviceEnergyModelHelper
27
{
28
public
:
29
/**
30
* Construct a helper which is used to add a radio energy model to a node
31
*/
32
WifiRadioEnergyModelHelper
();
33
34
/**
35
* Destroy a RadioEnergy Helper
36
*/
37
~WifiRadioEnergyModelHelper
()
override
;
38
39
/**
40
* @param name the name of the attribute to set
41
* @param v the value of the attribute
42
*
43
* Sets an attribute of the underlying PHY object.
44
*/
45
void
Set
(std::string name,
const
AttributeValue
& v)
override
;
46
47
/**
48
* @param callback Callback function for energy depletion handling.
49
*
50
* Sets the callback to be invoked when energy is depleted.
51
*/
52
void
SetDepletionCallback
(
WifiRadioEnergyModel::WifiRadioEnergyDepletionCallback
callback);
53
54
/**
55
* @param callback Callback function for energy recharged handling.
56
*
57
* Sets the callback to be invoked when energy is recharged.
58
*/
59
void
SetRechargedCallback
(
WifiRadioEnergyModel::WifiRadioEnergyRechargedCallback
callback);
60
61
/**
62
* @tparam Ts \deduced Argument types
63
* @param name the name of the model to set
64
* @param [in] args Name and AttributeValue pairs to set.
65
*
66
* Configure a Transmission Current model for this EnergySource.
67
*/
68
template
<
typename
... Ts>
69
void
SetTxCurrentModel
(std::string name, Ts&&... args);
70
71
private
:
72
/**
73
* @param device Pointer to the NetDevice to install DeviceEnergyModel.
74
* @param source Pointer to EnergySource to install.
75
* @returns Ptr<DeviceEnergyModel>
76
*
77
* Implements DeviceEnergyModel::Install.
78
*/
79
Ptr<energy::DeviceEnergyModel>
DoInstall
(
Ptr<NetDevice>
device,
80
Ptr<energy::EnergySource>
source)
const override
;
81
82
private
:
83
ObjectFactory
m_radioEnergy
;
///< radio energy
84
WifiRadioEnergyModel::WifiRadioEnergyDepletionCallback
85
m_depletionCallback
;
///< radio energy depletion callback
86
WifiRadioEnergyModel::WifiRadioEnergyRechargedCallback
87
m_rechargedCallback
;
///< radio energy recharged callback
88
ObjectFactory
m_txCurrentModel
;
///< transmit current model
89
};
90
91
/***************************************************************
92
* Implementation of the templates declared above.
93
***************************************************************/
94
95
template
<
typename
... Ts>
96
void
97
WifiRadioEnergyModelHelper::SetTxCurrentModel
(std::string name, Ts&&... args)
98
{
99
m_txCurrentModel
=
ObjectFactory
(name, std::forward<Ts>(args)...);
100
}
101
102
}
// namespace ns3
103
104
#endif
/* WIFI_RADIO_ENERGY_MODEL_HELPER_H */
ns3::AttributeValue
Hold a value for an Attribute.
Definition
attribute.h:59
ns3::DeviceEnergyModelHelper
Creates DeviceEnergyModel objects.
Definition
energy-model-helper.h:104
ns3::ObjectFactory
Instantiate subclasses of ns3::Object.
Definition
object-factory.h:37
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition
ptr.h:67
ns3::WifiRadioEnergyModelHelper::SetRechargedCallback
void SetRechargedCallback(WifiRadioEnergyModel::WifiRadioEnergyRechargedCallback callback)
Definition
wifi-radio-energy-model-helper.cc:43
ns3::WifiRadioEnergyModelHelper::SetDepletionCallback
void SetDepletionCallback(WifiRadioEnergyModel::WifiRadioEnergyDepletionCallback callback)
Definition
wifi-radio-energy-model-helper.cc:36
ns3::WifiRadioEnergyModelHelper::DoInstall
Ptr< energy::DeviceEnergyModel > DoInstall(Ptr< NetDevice > device, Ptr< energy::EnergySource > source) const override
Definition
wifi-radio-energy-model-helper.cc:54
ns3::WifiRadioEnergyModelHelper::m_rechargedCallback
WifiRadioEnergyModel::WifiRadioEnergyRechargedCallback m_rechargedCallback
radio energy recharged callback
Definition
wifi-radio-energy-model-helper.h:87
ns3::WifiRadioEnergyModelHelper::WifiRadioEnergyModelHelper
WifiRadioEnergyModelHelper()
Construct a helper which is used to add a radio energy model to a node.
Definition
wifi-radio-energy-model-helper.cc:18
ns3::WifiRadioEnergyModelHelper::m_depletionCallback
WifiRadioEnergyModel::WifiRadioEnergyDepletionCallback m_depletionCallback
radio energy depletion callback
Definition
wifi-radio-energy-model-helper.h:85
ns3::WifiRadioEnergyModelHelper::Set
void Set(std::string name, const AttributeValue &v) override
Definition
wifi-radio-energy-model-helper.cc:30
ns3::WifiRadioEnergyModelHelper::m_radioEnergy
ObjectFactory m_radioEnergy
radio energy
Definition
wifi-radio-energy-model-helper.h:83
ns3::WifiRadioEnergyModelHelper::m_txCurrentModel
ObjectFactory m_txCurrentModel
transmit current model
Definition
wifi-radio-energy-model-helper.h:88
ns3::WifiRadioEnergyModelHelper::SetTxCurrentModel
void SetTxCurrentModel(std::string name, Ts &&... args)
Definition
wifi-radio-energy-model-helper.h:97
ns3::WifiRadioEnergyModel::WifiRadioEnergyRechargedCallback
Callback< void > WifiRadioEnergyRechargedCallback
Callback type for energy recharged handling.
Definition
wifi-radio-energy-model.h:151
ns3::WifiRadioEnergyModel::WifiRadioEnergyDepletionCallback
Callback< void > WifiRadioEnergyDepletionCallback
Callback type for energy depletion handling.
Definition
wifi-radio-energy-model.h:146
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
wifi
helper
wifi-radio-energy-model-helper.h
Generated on Mon Sep 1 2025 18:21:04 for ns-3 by
1.13.2