src/devices/wifi/ideal-wifi-manager.h
author Pavel Boyko <boyko@iitp.ru>
Tue, 16 Jun 2009 17:58:16 +0400
changeset 5074 355de6af8ea9
parent 3387 c6913c670dca
child 6065 0f012e7d9128
permissions -rw-r--r--
merged with nsnam
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
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
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
     6
 * it under the terms of the GNU General Public License version 2 as 
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
 */
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
    20
#ifndef IDEAL_MAC_STATIONS_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
    21
#define IDEAL_MAC_STATIONS_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
    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
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    32
 *
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    33
 * This class implements an 'ideal' rate control algorithm
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    34
 * similar to RBAR in spirit (see <i>A rate-adaptive MAC
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    35
 * protocol for multihop wireless networks</i> by G. Holland,
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    36
 * N. Vaidya, and P. Bahl.): every station keeps track of the
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    37
 * snr of every packet received and sends back this snr to the
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    38
 * original transmitter by an out-of-band mechanism. Each 
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    39
 * 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
    40
 * and uses it to pick a transmission mode based on a set
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    41
 * of snr thresholds built from a target ber and transmission 
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    42
 * mode-specific snr/ber curves.
d8b7b2de044e doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1977
diff changeset
    43
 */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    44
class IdealWifiManager : public WifiRemoteStationManager 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    45
{
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
    46
public:
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    47
  static TypeId GetTypeId (void);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    48
  IdealWifiManager ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    49
  virtual ~IdealWifiManager ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    50
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    51
  virtual void SetupPhy (Ptr<WifiPhy> phy);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    52
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
    53
  // return the min snr needed to successfully transmit
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
    54
  // data with this mode at the specified ber.
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
    55
  double GetSnrThreshold (WifiMode mode) const;
1964
041240a915f8 build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1931
diff changeset
    56
  void AddModeSnrThreshold (WifiMode mode, double ber);
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
    57
private:
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    58
  virtual class WifiRemoteStation *CreateStation (void);
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
    59
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
    60
  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
    61
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    62
  double m_ber;
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
    63
  Thresholds m_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
    64
  double m_minSnr;
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
    65
  double m_maxSnr;
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
    66
};
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
    67
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    68
class IdealWifiRemoteStation : public WifiRemoteStation
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
    69
{
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
    70
public:
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    71
  IdealWifiRemoteStation (Ptr<IdealWifiManager> stations);
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
    72
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    73
  virtual ~IdealWifiRemoteStation ();
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
    74
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2524
diff changeset
    75
protected:
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2524
diff changeset
    76
  virtual void DoReportRxOk (double rxSnr, WifiMode txMode);
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2524
diff changeset
    77
  virtual void DoReportRtsFailed (void);
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2524
diff changeset
    78
  virtual void DoReportDataFailed (void);
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2524
diff changeset
    79
  virtual void DoReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr);
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2524
diff changeset
    80
  virtual void DoReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr);
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2524
diff changeset
    81
  virtual void DoReportFinalRtsFailed (void);
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2524
diff changeset
    82
  virtual void DoReportFinalDataFailed (void);
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
    83
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
    84
private:
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    85
  virtual Ptr<WifiRemoteStationManager> GetManager (void) const;
2268
0e57ac711220 introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2059
diff changeset
    86
  virtual WifiMode DoGetDataMode (uint32_t size);
0e57ac711220 introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2059
diff changeset
    87
  virtual WifiMode DoGetRtsMode (void);
0e57ac711220 introduce a low latency parameter for rate control algorithms
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2059
diff changeset
    88
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    89
  Ptr<IdealWifiManager> m_manager;
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
    90
  double m_lastSnr;
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
};
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
1977
4303409f3d8e remove uneeded trailing ';'
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1964
diff changeset
    93
} // 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
    94
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
#endif /* MAC_STA_H */