A Discrete-Event Network Simulator
API
rrpaa-wifi-manager.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2017 Universidad de la República - Uruguay
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: Matías Richart <mrichart@fing.edu.uy>
19  */
20 
21 #ifndef RRPAA_WIFI_MANAGER_H
22 #define RRPAA_WIFI_MANAGER_H
23 
24 #include "ns3/nstime.h"
25 #include "ns3/random-variable-stream.h"
26 #include "ns3/wifi-remote-station-manager.h"
27 
28 namespace ns3 {
29 
30 struct RrpaaWifiRemoteStation;
31 
58 {
59  double m_ori;
60  double m_mtl;
61  uint32_t m_ewnd;
62 };
63 
67 typedef std::vector<std::pair<WifiRrpaaThresholds,WifiMode> > RrpaaThresholdsTable;
68 
72 typedef std::vector<std::vector<double> > RrpaaProbabilitiesTable;
73 
75 {
76 public:
81  static TypeId GetTypeId (void);
83  virtual ~RrpaaWifiManager ();
84 
85  void SetupPhy (const Ptr<WifiPhy> phy) override;
86  void SetupMac (const Ptr<WifiMac> mac) override;
87 
97  int64_t AssignStreams (int64_t stream) override;
98 
99 private:
100  void DoInitialize (void) override;
101  WifiRemoteStation * DoCreateStation (void) const override;
102  void DoReportRxOk (WifiRemoteStation *station,
103  double rxSnr, WifiMode txMode) override;
104  void DoReportRtsFailed (WifiRemoteStation *station) override;
105  void DoReportDataFailed (WifiRemoteStation *station) override;
106  void DoReportRtsOk (WifiRemoteStation *station,
107  double ctsSnr, WifiMode ctsMode, double rtsSnr) override;
108  void DoReportDataOk (WifiRemoteStation *station, double ackSnr, WifiMode ackMode,
109  double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss) override;
110  void DoReportFinalRtsFailed (WifiRemoteStation *station) override;
111  void DoReportFinalDataFailed (WifiRemoteStation *station) override;
113  WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station) override;
114  bool DoNeedRts (WifiRemoteStation *st,
115  uint32_t size, bool normally) override;
116 
121  void CheckInit (RrpaaWifiRemoteStation *station);
122 
128  void CheckTimeout (RrpaaWifiRemoteStation *station);
149 
155  void InitThresholds (RrpaaWifiRemoteStation *station);
156 
166 
175  WifiRrpaaThresholds GetThresholds (RrpaaWifiRemoteStation *station, uint8_t index) const;
176 
184  Time GetCalcTxTime (WifiMode mode) const;
191  void AddCalcTxTime (WifiMode mode, Time t);
192 
198  typedef std::vector<std::pair<Time,WifiMode> > TxTime;
199 
203 
204  uint32_t m_frameLength;
205  uint32_t m_ackLength;
206 
207  bool m_basic;
209  double m_alpha;
210  double m_beta;
211  double m_tau;
212  double m_gamma;
213  double m_delta;
214 
219  uint8_t m_minPowerLevel;
220  uint8_t m_maxPowerLevel;
221  uint8_t m_nPowerLevels;
222 
231 
233 };
234 
235 } //namespace ns3
236 
237 #endif /* RRPAA__WIFI_MANAGER_H */
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
ns3::RrpaaWifiManager::m_alpha
double m_alpha
Alpha value for RRPAA (value for calculating MTL threshold)
Definition: rrpaa-wifi-manager.h:209
ns3::RrpaaWifiManager::DoReportRxOk
void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:353
ns3::RrpaaWifiManager::m_timeout
Time m_timeout
Timeout for the RRAA BASIC loss estimation block.
Definition: rrpaa-wifi-manager.h:208
ns3::RrpaaWifiManager::GetThresholds
WifiRrpaaThresholds GetThresholds(RrpaaWifiRemoteStation *station, WifiMode mode) const
Get the thresholds for the given station and mode.
Definition: rrpaa-wifi-manager.cc:218
ns3::RrpaaWifiManager::CheckTimeout
void CheckTimeout(RrpaaWifiRemoteStation *station)
Check if the counter should be reset.
Definition: rrpaa-wifi-manager.cc:457
ns3::RrpaaWifiManager::RrpaaWifiManager
RrpaaWifiManager()
Definition: rrpaa-wifi-manager.cc:128
ns3::RrpaaWifiManager::m_ackLength
uint32_t m_ackLength
Ack frame length used for calculate mode TxTime (in bytes).
Definition: rrpaa-wifi-manager.h:205
ns3::RrpaaWifiManager::DoInitialize
void DoInitialize(void) override
Initialize() implementation.
Definition: rrpaa-wifi-manager.cc:178
ns3::RrpaaWifiManager::DoGetRtsTxVector
WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station) override
Definition: rrpaa-wifi-manager.cc:418
ns3::WifiRrpaaThresholds::m_mtl
double m_mtl
The Maximum Tolerable Loss threshold.
Definition: rrpaa-wifi-manager.h:60
ns3::RrpaaWifiManager::TxTime
std::vector< std::pair< Time, WifiMode > > TxTime
typedef for a vector of a pair of Time, WifiMode.
Definition: rrpaa-wifi-manager.h:198
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::RrpaaThresholdsTable
std::vector< std::pair< WifiRrpaaThresholds, WifiMode > > RrpaaThresholdsTable
List of thresholds for each mode.
Definition: rrpaa-wifi-manager.h:67
ns3::RrpaaWifiManager::~RrpaaWifiManager
virtual ~RrpaaWifiManager()
Definition: rrpaa-wifi-manager.cc:134
ns3::RrpaaWifiManager::DoReportFinalDataFailed
void DoReportFinalDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:384
ns3::WifiRemoteStationManager
hold a list of per-remote-station state.
Definition: wifi-remote-station-manager.h:121
ns3::RrpaaWifiManager::m_basic
bool m_basic
If using the basic algorithm (without RTS/CTS).
Definition: rrpaa-wifi-manager.h:207
ns3::WifiTxVector
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Definition: wifi-tx-vector.h:71
ns3::RrpaaWifiManager::m_sifs
Time m_sifs
Value of SIFS configured in the device.
Definition: rrpaa-wifi-manager.h:201
third.mac
mac
Definition: third.py:99
ns3::RrpaaWifiManager::CheckInit
void CheckInit(RrpaaWifiRemoteStation *station)
Check for initializations.
Definition: rrpaa-wifi-manager.cc:247
ns3::RrpaaWifiManager::ResetCountersBasic
void ResetCountersBasic(RrpaaWifiRemoteStation *station)
Reset the counters of the given station.
Definition: rrpaa-wifi-manager.cc:325
ns3::RrpaaWifiManager::DoGetDataTxVector
WifiTxVector DoGetDataTxVector(WifiRemoteStation *station) override
Definition: rrpaa-wifi-manager.cc:390
ns3::RrpaaWifiManager::DoReportDataFailed
void DoReportDataFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:340
ns3::WifiRrpaaThresholds
Robust Rate and Power Adaptation Algorithm.
Definition: rrpaa-wifi-manager.h:58
ns3::RrpaaWifiManager::DoReportFinalRtsFailed
void DoReportFinalRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:379
ns3::RrpaaWifiRemoteStation
Hold per-remote-station state for RRPAA Wifi manager.
Definition: rrpaa-wifi-manager.cc:43
ns3::WifiRrpaaThresholds::m_ori
double m_ori
The Opportunistic Rate Increase threshold.
Definition: rrpaa-wifi-manager.h:59
ns3::Ptr< WifiPhy >
ns3::RrpaaWifiManager::AddCalcTxTime
void AddCalcTxTime(WifiMode mode, Time t)
Add transmission time for the given mode to an internal list.
Definition: rrpaa-wifi-manager.cc:211
ns3::RrpaaWifiManager::AssignStreams
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Definition: rrpaa-wifi-manager.cc:140
ns3::WifiMode
represent a single transmission mode
Definition: wifi-mode.h:48
ns3::RrpaaWifiManager
Definition: rrpaa-wifi-manager.h:75
ns3::RrpaaWifiManager::RunBasicAlgorithm
void RunBasicAlgorithm(RrpaaWifiRemoteStation *station)
Find an appropriate rate and power for the given station, using a basic algorithm.
Definition: rrpaa-wifi-manager.cc:468
ns3::RrpaaWifiManager::RunAdaptiveRtsAlgorithm
void RunAdaptiveRtsAlgorithm(RrpaaWifiRemoteStation *station)
Run an enhanced algorithm which activates the use of RTS for the given station if the conditions are ...
Definition: rrpaa-wifi-manager.cc:577
ns3::RrpaaWifiManager::m_uniformRandomVariable
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables for probabilistic changes.
Definition: rrpaa-wifi-manager.h:232
ns3::RrpaaWifiManager::m_minPowerLevel
uint8_t m_minPowerLevel
Differently form rate, power levels do not depend on the remote station.
Definition: rrpaa-wifi-manager.h:219
ns3::RrpaaWifiManager::m_gamma
double m_gamma
Gamma value for RRPAA (value for pdTable decrements).
Definition: rrpaa-wifi-manager.h:212
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::RrpaaWifiManager::m_beta
double m_beta
Beta value for RRPAA (value for calculating ORI threshold).
Definition: rrpaa-wifi-manager.h:210
ns3::RrpaaWifiManager::SetupPhy
void SetupPhy(const Ptr< WifiPhy > phy) override
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
Definition: rrpaa-wifi-manager.cc:148
ns3::RrpaaWifiManager::m_nPowerLevels
uint8_t m_nPowerLevels
Number of power levels.
Definition: rrpaa-wifi-manager.h:221
ns3::RrpaaWifiManager::m_calcTxTime
TxTime m_calcTxTime
To hold all the calculated TxTime for all modes.
Definition: rrpaa-wifi-manager.h:200
ns3::WifiRemoteStation
hold per-remote-station state.
Definition: wifi-remote-station-manager.h:62
ns3::RrpaaWifiManager::m_maxPowerLevel
uint8_t m_maxPowerLevel
Maximal power level.
Definition: rrpaa-wifi-manager.h:220
ns3::RrpaaWifiManager::DoReportRtsOk
void DoReportRtsOk(WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:360
ns3::RrpaaWifiManager::DoReportRtsFailed
void DoReportRtsFailed(WifiRemoteStation *station) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:334
ns3::RrpaaWifiManager::DoCreateStation
WifiRemoteStation * DoCreateStation(void) const override
Definition: rrpaa-wifi-manager.cc:234
ns3::RrpaaWifiManager::GetTypeId
static TypeId GetTypeId(void)
Register this type.
Definition: rrpaa-wifi-manager.cc:64
ns3::WifiRrpaaThresholds::m_ewnd
uint32_t m_ewnd
The Estimation Window size.
Definition: rrpaa-wifi-manager.h:61
ns3::RrpaaWifiManager::SetupMac
void SetupMac(const Ptr< WifiMac > mac) override
Set up MAC associated with this device since it is the object that knows the full set of timing param...
Definition: rrpaa-wifi-manager.cc:171
ns3::RrpaaWifiManager::m_frameLength
uint32_t m_frameLength
Data frame length used for calculate mode TxTime (in bytes).
Definition: rrpaa-wifi-manager.h:204
ns3::TracedCallback
Forward calls to a chain of Callback.
Definition: traced-callback.h:53
ns3::RrpaaWifiManager::m_difs
Time m_difs
Value of DIFS configured in the device.
Definition: rrpaa-wifi-manager.h:202
ns3::RrpaaWifiManager::m_tau
double m_tau
Tau value for RRPAA (value for calculating EWND size).
Definition: rrpaa-wifi-manager.h:211
ns3::RrpaaProbabilitiesTable
std::vector< std::vector< double > > RrpaaProbabilitiesTable
List of probabilities.
Definition: rrpaa-wifi-manager.h:72
ns3::RrpaaWifiManager::DoNeedRts
bool DoNeedRts(WifiRemoteStation *st, uint32_t size, bool normally) override
Definition: rrpaa-wifi-manager.cc:442
ns3::RrpaaWifiManager::InitThresholds
void InitThresholds(RrpaaWifiRemoteStation *station)
Initialize the thresholds internal list for the given station.
Definition: rrpaa-wifi-manager.cc:287
ns3::RrpaaWifiManager::DoReportDataOk
void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr, uint16_t dataChannelWidth, uint8_t dataNss) override
This method is a pure virtual method that must be implemented by the sub-class.
Definition: rrpaa-wifi-manager.cc:367
ns3::RrpaaWifiManager::GetCalcTxTime
Time GetCalcTxTime(WifiMode mode) const
Get the estimated TxTime of a packet with a given mode.
Definition: rrpaa-wifi-manager.cc:196
ns3::RrpaaWifiManager::m_delta
double m_delta
Delta value for RRPAA (value for pdTable increments).
Definition: rrpaa-wifi-manager.h:213
third.phy
phy
Definition: third.py:93
ns3::RrpaaWifiManager::m_rateChange
TracedCallback< DataRate, DataRate, Mac48Address > m_rateChange
The trace source fired when the transmission rate change.
Definition: rrpaa-wifi-manager.h:230
ns3::RrpaaWifiManager::m_powerChange
TracedCallback< double, double, Mac48Address > m_powerChange
The trace source fired when the transmission power change.
Definition: rrpaa-wifi-manager.h:226