A Discrete-Event Network Simulator
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-radio-energy-model.h"
14
15namespace ns3
16{
17
18/**
19 * \ingroup energy
20 * \brief Assign WifiRadioEnergyModel to wifi devices.
21 *
22 * This installer installs WifiRadioEnergyModel for only WifiNetDevice objects.
23 *
24 */
26{
27 public:
28 /**
29 * Construct a helper which is used to add a radio energy model to a node
30 */
32
33 /**
34 * Destroy a RadioEnergy Helper
35 */
37
38 /**
39 * \param name the name of the attribute to set
40 * \param v the value of the attribute
41 *
42 * Sets an attribute of the underlying PHY object.
43 */
44 void Set(std::string name, const AttributeValue& v) override;
45
46 /**
47 * \param callback Callback function for energy depletion handling.
48 *
49 * Sets the callback to be invoked when energy is depleted.
50 */
52
53 /**
54 * \param callback Callback function for energy recharged handling.
55 *
56 * Sets the callback to be invoked when energy is recharged.
57 */
59
60 /**
61 * \tparam Ts \deduced Argument types
62 * \param name the name of the model to set
63 * \param [in] args Name and AttributeValue pairs to set.
64 *
65 * Configure a Transmission Current model for this EnergySource.
66 */
67 template <typename... Ts>
68 void SetTxCurrentModel(std::string name, Ts&&... args);
69
70 private:
71 /**
72 * \param device Pointer to the NetDevice to install DeviceEnergyModel.
73 * \param source Pointer to EnergySource to install.
74 * \returns Ptr<DeviceEnergyModel>
75 *
76 * Implements DeviceEnergyModel::Install.
77 */
79 Ptr<energy::EnergySource> source) const override;
80
81 private:
82 ObjectFactory m_radioEnergy; ///< radio energy
84 m_depletionCallback; ///< radio energy depletion callback
86 m_rechargedCallback; ///< radio energy recharged callback
87 ObjectFactory m_txCurrentModel; ///< transmit current model
88};
89
90/***************************************************************
91 * Implementation of the templates declared above.
92 ***************************************************************/
93
94template <typename... Ts>
95void
96WifiRadioEnergyModelHelper::SetTxCurrentModel(std::string name, Ts&&... args)
97{
98 m_txCurrentModel = ObjectFactory(name, std::forward<Ts>(args)...);
99}
100
101} // namespace ns3
102
103#endif /* WIFI_RADIO_ENERGY_MODEL_HELPER_H */
Hold a value for an Attribute.
Definition attribute.h:59
Creates DeviceEnergyModel objects.
Instantiate subclasses of ns3::Object.
Smart pointer class similar to boost::intrusive_ptr.
Assign WifiRadioEnergyModel to wifi devices.
~WifiRadioEnergyModelHelper() override
Destroy a RadioEnergy Helper.
void SetRechargedCallback(WifiRadioEnergyModel::WifiRadioEnergyRechargedCallback callback)
void SetDepletionCallback(WifiRadioEnergyModel::WifiRadioEnergyDepletionCallback callback)
Ptr< energy::DeviceEnergyModel > DoInstall(Ptr< NetDevice > device, Ptr< energy::EnergySource > source) const override
WifiRadioEnergyModel::WifiRadioEnergyRechargedCallback m_rechargedCallback
radio energy recharged callback
WifiRadioEnergyModelHelper()
Construct a helper which is used to add a radio energy model to a node.
WifiRadioEnergyModel::WifiRadioEnergyDepletionCallback m_depletionCallback
radio energy depletion callback
void Set(std::string name, const AttributeValue &v) override
ObjectFactory m_txCurrentModel
transmit current model
void SetTxCurrentModel(std::string name, Ts &&... args)
Every class exported by the ns3 library is enclosed in the ns3 namespace.