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"
27 
28 namespace ns3 {
29 
30 struct RrpaaWifiRemoteStation;
31 
55 {
56  double m_ori;
57  double m_mtl;
58  uint32_t m_ewnd;
59 };
60 
64 typedef std::vector<std::pair<WifiRrpaaThresholds,WifiMode> > RrpaaThresholdsTable;
65 
69 typedef std::vector<std::vector<double> > RrpaaProbabilitiesTable;
70 
72 {
73 public:
78  static TypeId GetTypeId (void);
80  virtual ~RrpaaWifiManager ();
81 
82  // Inherited from WifiRemoteStationManager
83  virtual void SetupPhy (const Ptr<WifiPhy> phy);
84  virtual void SetupMac (const Ptr<WifiMac> mac);
85  virtual void SetHtSupported (bool enable);
86  virtual void SetVhtSupported (bool enable);
87  virtual void SetHeSupported (bool enable);
88 
98  int64_t AssignStreams (int64_t stream);
99 
100 private:
101  //overridden from base class
102  virtual WifiRemoteStation * DoCreateStation (void) const;
103  virtual void DoReportRxOk (WifiRemoteStation *station,
104  double rxSnr, WifiMode txMode);
105  virtual void DoReportRtsFailed (WifiRemoteStation *station);
106  virtual void DoReportDataFailed (WifiRemoteStation *station);
107  virtual void DoReportRtsOk (WifiRemoteStation *station,
108  double ctsSnr, WifiMode ctsMode, double rtsSnr);
109  virtual void DoReportDataOk (WifiRemoteStation *station,
110  double ackSnr, WifiMode ackMode, double dataSnr);
111  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
112  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
115  virtual bool DoNeedRts (WifiRemoteStation *st,
116  Ptr<const Packet> packet, bool normally);
117  virtual bool IsLowLatency (void) const;
118 
123  void CheckInit (RrpaaWifiRemoteStation *station);
124 
130  void CheckTimeout (RrpaaWifiRemoteStation *station);
151 
157  void InitThresholds (RrpaaWifiRemoteStation *station);
158 
168 
177  WifiRrpaaThresholds GetThresholds (RrpaaWifiRemoteStation *station, uint8_t rate) const;
178 
186  Time GetCalcTxTime (WifiMode mode) const;
193  void AddCalcTxTime (WifiMode mode, Time t);
194 
200  typedef std::vector<std::pair<Time,WifiMode> > TxTime;
201 
205 
206  uint32_t m_frameLength;
207  uint32_t m_ackLength;
208 
209  bool m_basic;
211  double m_alpha;
212  double m_beta;
213  double m_tau;
214  double m_gamma;
215  double m_delta;
216 
221  uint8_t m_minPowerLevel;
222  uint8_t m_maxPowerLevel;
223  uint8_t m_nPowerLevels;
224 
233 
235 };
236 
237 } //namespace ns3
238 
239 #endif /* RRPAA__WIFI_MANAGER_H */
std::vector< std::pair< Time, WifiMode > > TxTime
typedef for a vector of a pair of Time, WifiMode.
virtual void DoReportRtsOk(WifiRemoteStation *station, double ctsSnr, WifiMode ctsMode, double rtsSnr)
This method is a pure virtual method that must be implemented by the sub-class.
Hold per-remote-station state for RRPAA Wifi manager.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
uint8_t m_nPowerLevels
Number of power levels.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void CheckInit(RrpaaWifiRemoteStation *station)
Check for initializations.
double m_ori
The Oportunistic Rate Increase threshold.
virtual void SetupMac(const Ptr< WifiMac > mac)
Set up MAC associated with this device since it is the object that knows the full set of timing param...
Time m_sifs
Value of SIFS configured in the device.
Forward calls to a chain of Callback.
uint8_t m_minPowerLevel
Differently form rate, power levels do not depend on the remote station.
WifiRrpaaThresholds GetThresholds(RrpaaWifiRemoteStation *station, WifiMode mode) const
Get the thresholds for the given station and mode.
void AddCalcTxTime(WifiMode mode, Time t)
Add transmission time for the given mode to an internal list.
bool m_basic
If using the basic algorithm (without RTS/CTS).
virtual void DoReportRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
virtual bool IsLowLatency(void) const
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
Definition: wifi-mode.h:97
phy
Definition: third.py:86
virtual void DoReportFinalDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
uint32_t m_ewnd
The Estimation Window size.
void ResetCountersBasic(RrpaaWifiRemoteStation *station)
Reset the counters of the given station.
double m_beta
Beta value for RRPAA (value for calculating ORI threshold).
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Ptr< UniformRandomVariable > m_uniformRandomVariable
Provides uniform random variables for probabilistic changes.
Time m_timeout
Timeout for the RRAA BASIC loss estimation block.
double m_tau
Tau value for RRPAA (value for calculating EWND size).
Time m_difs
Value of DIFS configured in the device.
mac
Definition: third.py:92
static TypeId GetTypeId(void)
Register this type.
virtual void DoReportFinalRtsFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
double m_mtl
The Maximum Tolerable Loss threshold.
virtual void SetHtSupported(bool enable)
Enable or disable HT capability support.
hold a list of per-remote-station state.
double m_delta
Delta value for RRPAA (value for pdTable increments).
TracedCallback< DataRate, DataRate, Mac48Address > m_rateChange
The trace source fired when the transmission rate change.
TracedCallback< double, double, Mac48Address > m_powerChange
The trace source fired when the transmission power change.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Time GetCalcTxTime(WifiMode mode) const
Get the estimated TxTime of a packet with a given mode.
virtual bool DoNeedRts(WifiRemoteStation *st, Ptr< const Packet > packet, bool normally)
virtual void DoReportDataOk(WifiRemoteStation *station, double ackSnr, WifiMode ackMode, double dataSnr)
This method is a pure virtual method that must be implemented by the sub-class.
void RunBasicAlgorithm(RrpaaWifiRemoteStation *station)
Find an appropriate rate and power for the given station, using a basic algorithm.
uint32_t m_frameLength
Data frame length used for calculate mode TxTime.
void InitThresholds(RrpaaWifiRemoteStation *station)
Initialize the thresholds internal list for the given station.
uint8_t m_maxPowerLevel
Maximal power level.
virtual void SetupPhy(const Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
uint32_t m_ackLength
Ack frame length used for calculate mode TxTime.
Robust Rate and Power Adaptation Algorithm.
virtual WifiRemoteStation * DoCreateStation(void) const
virtual WifiTxVector DoGetRtsTxVector(WifiRemoteStation *station)
double m_alpha
Alpha value for RRPAA (value for calculating MTL threshold)
TxTime m_calcTxTime
To hold all the calculated TxTime for all modes.
virtual void DoReportRxOk(WifiRemoteStation *station, double rxSnr, WifiMode txMode)
This method is a pure virtual method that must be implemented by the sub-class.
std::vector< std::pair< WifiRrpaaThresholds, WifiMode > > RrpaaThresholdsTable
List of thresholds for each mode.
virtual void DoReportDataFailed(WifiRemoteStation *station)
This method is a pure virtual method that must be implemented by the sub-class.
virtual WifiTxVector DoGetDataTxVector(WifiRemoteStation *station)
virtual void SetHeSupported(bool enable)
Enable or disable HE capability support.
virtual void SetVhtSupported(bool enable)
Enable or disable VHT capability support.
void RunAdaptiveRtsAlgorithm(RrpaaWifiRemoteStation *station)
Run an enhanced algorithm which activates the use of RTS for the given station if the conditions are ...
a unique identifier for an interface.
Definition: type-id.h:58
hold per-remote-station state.
void CheckTimeout(RrpaaWifiRemoteStation *station)
Check if the counter should be reset.
double m_gamma
Gamma value for RRPAA (value for pdTable decrements).
std::vector< std::vector< double > > RrpaaProbabilitiesTable
List of probabilities.