src/wifi/model/ideal-wifi-manager.h
author Daniel Lertpratchya <nikkipui@gmail.com>
Thu, 12 Dec 2013 12:04:31 -0500
changeset 10507 2081aa152526
parent 10424 9d29c9a5ddcb
child 11450 9f4ae69f12b7
permissions -rw-r--r--
[doxygen] wifi module
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 7141
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
1930
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2006 INRIA
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
1930
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    20
#ifndef IDEAL_WIFI_MANAGER_H
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    21
#define IDEAL_WIFI_MANAGER_H
1930
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
#include <stdint.h>
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include <vector>
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
#include "wifi-mode.h"
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    26
#include "wifi-remote-station-manager.h"
1930
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
namespace ns3 {
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
2059
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    30
/**
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    31
 * \brief Ideal rate control algorithm
7139
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    32
 * \ingroup wifi
2059
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    33
 *
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    34
 * This class implements an 'ideal' rate control algorithm
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    35
 * similar to RBAR in spirit (see <i>A rate-adaptive MAC
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    36
 * protocol for multihop wireless networks</i> by G. Holland,
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    37
 * N. Vaidya, and P. Bahl.): every station keeps track of the
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    38
 * snr of every packet received and sends back this snr to the
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    39
 * original transmitter by an out-of-band mechanism. Each
2059
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    40
 * transmitter keeps track of the last snr sent back by a receiver
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    41
 * and uses it to pick a transmission mode based on a set
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    42
 * of snr thresholds built from a target ber and transmission
2059
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    43
 * mode-specific snr/ber curves.
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    44
 */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    45
class IdealWifiManager : public WifiRemoteStationManager
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    46
{
1930
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
public:
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    48
  static TypeId GetTypeId (void);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    49
  IdealWifiManager ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    50
  virtual ~IdealWifiManager ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    51
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    52
  virtual void SetupPhy (Ptr<WifiPhy> phy);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    53
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    54
private:
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    55
  // overriden from base class
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    56
  virtual WifiRemoteStation* DoCreateStation (void) const;
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    57
  virtual void DoReportRxOk (WifiRemoteStation *station,
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    58
                             double rxSnr, WifiMode txMode);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    59
  virtual void DoReportRtsFailed (WifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    60
  virtual void DoReportDataFailed (WifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    61
  virtual void DoReportRtsOk (WifiRemoteStation *station,
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    62
                              double ctsSnr, WifiMode ctsMode, double rtsSnr);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    63
  virtual void DoReportDataOk (WifiRemoteStation *station,
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    64
                               double ackSnr, WifiMode ackMode, double dataSnr);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    65
  virtual void DoReportFinalRtsFailed (WifiRemoteStation *station);
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    66
  virtual void DoReportFinalDataFailed (WifiRemoteStation *station);
10139
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 7385
diff changeset
    67
  virtual WifiTxVector DoGetDataTxVector (WifiRemoteStation *station, uint32_t size);
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 7385
diff changeset
    68
  virtual WifiTxVector DoGetRtsTxVector (WifiRemoteStation *station);
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    69
  virtual bool IsLowLatency (void) const;
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    70
10424
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    71
  /**
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    72
   * Return the minimum SNR needed to successfully transmit
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    73
   * data with this mode at the specified BER.
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    74
   *
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    75
   * \param mode WifiMode
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    76
   * \return the minimum SNR for the given mode
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    77
   */
1930
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    78
  double GetSnrThreshold (WifiMode mode) const;
10424
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    79
  /**
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    80
   * Adds a pair of WifiMode and the minimum SNR for that given mode
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    81
   * to the list.
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    82
   *
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    83
   * \param mode WifiMode
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    84
   * \param snr the minimum SNR for the given mode
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    85
   */
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    86
  void AddModeSnrThreshold (WifiMode mode, double snr);
1930
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
10424
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    88
  /**
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    89
   * A vector of <snr, mode> pair that holds the minimum SNR for different mode
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10218
diff changeset
    90
   */
1930
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    91
  typedef std::vector<std::pair<double,WifiMode> > Thresholds;
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    92
10507
2081aa152526 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10424
diff changeset
    93
  double m_ber;  //!< The maximum Bit Error Rate acceptable at any transmission mode
2081aa152526 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10424
diff changeset
    94
  Thresholds m_thresholds;  //!< List of WifiMode and the minimum SNR pair
1930
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    95
};
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    96
1977
4303409f3d8e remove uneeded trailing ';'
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1964
diff changeset
    97
} // namespace ns3
1930
ec22299cf6bb rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    98
6065
0f012e7d9128 bug 602
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3387
diff changeset
    99
#endif /* IDEAL_WIFI_MANAGER_H */