src/devices/wifi/yans-wifi-phy.h
author Dean Armstrong <deanarm@gmail.com>
Wed, 23 Jun 2010 08:47:29 +0100
changeset 6372 0fafd9716f44
parent 6273 8d70de29d514
child 6597 7fbc895f7361
permissions -rw-r--r--
Bug 853: Consider mandatory rates for Wi-Fi control responses This changeset modifies the GetControlAnswerMode() method of class WifiRemoteStationManager to correctly identify rates within the same modulation class as the received frame, and then adds a search for a suitable mandatory rate in the case where no suitable (per IEEE Std. 802.11-2007, Section 9.6) basic rate has been found. I've also taken the opportunity to "tidy" the code up a bit - primarily through renaming of variables to something more in line with the nomenclature used in the standard. Note that this change exposes issues in some of the test and example code that uses the Wi-Fi models. These issues are addressed in a following changelist.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2005,2006 INRIA
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as 
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
3888
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
    21
#ifndef YANS_WIFI_PHY_H
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
    22
#define YANS_WIFI_PHY_H
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include <stdint.h>
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
#include "ns3/callback.h"
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
#include "ns3/event-id.h"
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
#include "ns3/packet.h"
2054
ba8e810bae4c derive WifiPhy from Object and manage it with a Ptr<>
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1988
diff changeset
    28
#include "ns3/object.h"
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
    29
#include "ns3/traced-callback.h"
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
#include "ns3/nstime.h"
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
#include "ns3/ptr.h"
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
#include "ns3/random-variable.h"
3888
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
    33
#include "wifi-phy.h"
1902
26a57487bb49 no need for ns3 prefix
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1892
diff changeset
    34
#include "wifi-mode.h"
1920
1d4864775cf8 replace header mode with preamble mode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1919
diff changeset
    35
#include "wifi-preamble.h"
2166
00b5eb43dba2 Improve the accuracy of 802.11a tx duration calculations.
Federico Maguolo <federico.maguolo@dei.unipd.it>
parents: 2159
diff changeset
    36
#include "wifi-phy-standard.h"
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3904
diff changeset
    37
#include "interference-helper.h"
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
namespace ns3 {
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
class RandomUniform;
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
class RxEvent;
3893
94f771c1373a split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3888
diff changeset
    44
class YansWifiChannel;
3900
1687492ff059 re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3897
diff changeset
    45
class WifiPhyStateHelper;
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
2057
73723aad7527 dox for WifiPhy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2056
diff changeset
    48
/**
73723aad7527 dox for WifiPhy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2056
diff changeset
    49
 * \brief 802.11 PHY layer model
73723aad7527 dox for WifiPhy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2056
diff changeset
    50
 *
73723aad7527 dox for WifiPhy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2056
diff changeset
    51
 * This PHY implements a model of 802.11a. The model
73723aad7527 dox for WifiPhy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2056
diff changeset
    52
 * implemented here is based on the model described
73723aad7527 dox for WifiPhy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2056
diff changeset
    53
 * in "Yet Another Network Simulator", 
73723aad7527 dox for WifiPhy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2056
diff changeset
    54
 * (http://cutebugs.net/files/wns2-yans.pdf).
73723aad7527 dox for WifiPhy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2056
diff changeset
    55
 *
2684
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2659
diff changeset
    56
 *
2057
73723aad7527 dox for WifiPhy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2056
diff changeset
    57
 * This PHY model depends on a channel loss and delay
73723aad7527 dox for WifiPhy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2056
diff changeset
    58
 * model as provided by the ns3::PropagationLossModel
2684
68c643329c2b improve doxygen
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2659
diff changeset
    59
 * and ns3::PropagationDelayModel classes, both of which are
3893
94f771c1373a split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3888
diff changeset
    60
 * members of the ns3::YansWifiChannel class.
2057
73723aad7527 dox for WifiPhy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2056
diff changeset
    61
 */
3888
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
    62
class YansWifiPhy : public WifiPhy
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
{
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
public:
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
    66
  static TypeId GetTypeId (void);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
    67
3888
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
    68
  YansWifiPhy ();
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
    69
  virtual ~YansWifiPhy ();
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
    70
3893
94f771c1373a split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3888
diff changeset
    71
  void SetChannel (Ptr<YansWifiChannel> channel);
4690
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    72
  
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    73
  /** 
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    74
   * \brief Set channel number. 
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    75
   * 
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    76
   * Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1)
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    77
   *
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    78
   * where Starting channel frequency is standard-dependent, see SetStandard()
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    79
   * as defined in IEEE 802.11-2007 17.3.8.3.2.
5192
fb3d57fd97e4 Doxy doc for Wifi channel switching
Ramon Bauza
parents: 5189
diff changeset
    80
   *
fb3d57fd97e4 Doxy doc for Wifi channel switching
Ramon Bauza
parents: 5189
diff changeset
    81
   * YansWifiPhy can switch among different channels. Basically, YansWifiPhy 
fb3d57fd97e4 Doxy doc for Wifi channel switching
Ramon Bauza
parents: 5189
diff changeset
    82
   * has a private attribute m_channelNumber that identifies the channel the 
fb3d57fd97e4 Doxy doc for Wifi channel switching
Ramon Bauza
parents: 5189
diff changeset
    83
   * PHY operates on. Channel switching cannot interrupt an ongoing transmission.
fb3d57fd97e4 Doxy doc for Wifi channel switching
Ramon Bauza
parents: 5189
diff changeset
    84
   * When PHY is in TX state, the channel switching is postponed until the end
5820
1c02054740eb Renaming WifiPhy state SYNC to RX to avoid confusion with "synchronizing".
Timo Bingmann <tbns@idlebox.net>
parents: 5747
diff changeset
    85
   * of the current transmission. When the PHY is in RX state, the channel 
1c02054740eb Renaming WifiPhy state SYNC to RX to avoid confusion with "synchronizing".
Timo Bingmann <tbns@idlebox.net>
parents: 5747
diff changeset
    86
   * switching causes the drop of the synchronized packet. 
4690
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    87
   */ 
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    88
  void SetChannelNumber (uint16_t id);
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    89
  /// Return current channel number, see SetChannelNumber()
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    90
  uint16_t GetChannelNumber () const;
6273
8d70de29d514 spell check, mostly in comments.
Andrey Mazo <mazo@iitp.ru>
parents: 5820
diff changeset
    91
  /// Return current center channel frequency in MHz, see SetChannelNumber()
4690
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    92
  double GetChannelFrequencyMhz() const;
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
    93
  
3893
94f771c1373a split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3888
diff changeset
    94
  void StartReceivePacket (Ptr<Packet> packet,
94f771c1373a split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3888
diff changeset
    95
                           double rxPowerDbm,
94f771c1373a split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3888
diff changeset
    96
                           WifiMode mode,
94f771c1373a split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3888
diff changeset
    97
                           WifiPreamble preamble);
94f771c1373a split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3888
diff changeset
    98
4315
56a5bf298339 noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents: 4264
diff changeset
    99
  void SetRxNoiseFigure (double noiseFigureDb);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   100
  void SetTxPowerStart (double start);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   101
  void SetTxPowerEnd (double end);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   102
  void SetNTxPower (uint32_t n);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   103
  void SetTxGain (double gain);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   104
  void SetRxGain (double gain);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   105
  void SetEdThreshold (double threshold);
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3904
diff changeset
   106
  void SetCcaMode1Threshold (double threshold);
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3904
diff changeset
   107
  void SetErrorRateModel (Ptr<ErrorRateModel> rate);
3912
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3906
diff changeset
   108
  void SetDevice (Ptr<Object> device);
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3906
diff changeset
   109
  void SetMobility (Ptr<Object> mobility);
4315
56a5bf298339 noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents: 4264
diff changeset
   110
  double GetRxNoiseFigure (void) const;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   111
  double GetTxGain (void) const;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   112
  double GetRxGain (void) const;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   113
  double GetEdThreshold (void) const;
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3904
diff changeset
   114
  double GetCcaMode1Threshold (void) const;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3904
diff changeset
   115
  Ptr<ErrorRateModel> GetErrorRateModel (void) const;
3912
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3906
diff changeset
   116
  Ptr<Object> GetDevice (void) const;
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3906
diff changeset
   117
  Ptr<Object> GetMobility (void);
4690
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
   118
  
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
   119
  
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   120
1891
add6fb8761f3 use WifiMode rather than TransmissionMode
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1890
diff changeset
   121
3888
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   122
  virtual double GetTxPowerStart (void) const;
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   123
  virtual double GetTxPowerEnd (void) const;
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   124
  virtual uint32_t GetNTxPower (void) const;
5820
1c02054740eb Renaming WifiPhy state SYNC to RX to avoid confusion with "synchronizing".
Timo Bingmann <tbns@idlebox.net>
parents: 5747
diff changeset
   125
  virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback);
1c02054740eb Renaming WifiPhy state SYNC to RX to avoid confusion with "synchronizing".
Timo Bingmann <tbns@idlebox.net>
parents: 5747
diff changeset
   126
  virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback callback);
3888
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   127
  virtual void SendPacket (Ptr<const Packet> packet, WifiMode mode, enum WifiPreamble preamble, uint8_t txPowerLevel);
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   128
  virtual void RegisterListener (WifiPhyListener *listener);
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   129
  virtual bool IsStateCcaBusy (void);
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   130
  virtual bool IsStateIdle (void);
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   131
  virtual bool IsStateBusy (void);
5820
1c02054740eb Renaming WifiPhy state SYNC to RX to avoid confusion with "synchronizing".
Timo Bingmann <tbns@idlebox.net>
parents: 5747
diff changeset
   132
  virtual bool IsStateRx (void);
3888
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   133
  virtual bool IsStateTx (void);
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5152
diff changeset
   134
  virtual bool IsStateSwitching (void); 
3888
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   135
  virtual Time GetStateDuration (void);
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   136
  virtual Time GetDelayUntilIdle (void);
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   137
  virtual Time GetLastRxStartTime (void) const;
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   138
  virtual Time CalculateTxDuration (uint32_t size, WifiMode payloadMode, enum WifiPreamble preamble) const;
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   139
  virtual uint32_t GetNModes (void) const;
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   140
  virtual WifiMode GetMode (uint32_t mode) const;
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   141
  virtual double CalculateSnr (WifiMode txMode, double ber) const;
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   142
  virtual Ptr<WifiChannel> GetChannel (void) const;
4720
15221757964f bug 641: CwMin setting for 802.11b
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4690
diff changeset
   143
  virtual void ConfigureStandard (enum WifiPhyStandard standard);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   144
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   145
private:
3906
01acc159ffb1 merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3543 3905
diff changeset
   146
  YansWifiPhy (const YansWifiPhy &o);
2530
05f9cec44621 avoid memory leaks
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
   147
  virtual void DoDispose (void);
1964
041240a915f8 build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1920
diff changeset
   148
  void Configure80211a (void);
4470
51b5c1a272d3 802.11b PHY support
Gary Pei <guangyu.pei@boeing.com>
parents: 4315
diff changeset
   149
  void Configure80211b (void);
4680
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4492
diff changeset
   150
  void Configure80211_10Mhz (void);
a52c39181dd4 Support for 5 and 10Mhz wifi channels
Ramon Bauza <monbauza@gmail.com>
parents: 4492
diff changeset
   151
  void Configure80211_5Mhz ();
2083
c7541b84285e add the holland 802.11a set of modes.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2071
diff changeset
   152
  void ConfigureHolland (void);
5747
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 5192
diff changeset
   153
  void Configure80211p_CCH (void);
a171e73c4dae add support for 802.11p PHY and MAC parameters
Michael Nowatkowski <nowatkom@gmail.com>
parents: 5192
diff changeset
   154
  void Configure80211p_SCH (void);
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   155
  double GetEdThresholdW (void) const;
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   156
  double DbmToW (double dbm) const;
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   157
  double DbToRatio (double db) const;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   158
  double WToDbm (double w) const;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2166
diff changeset
   159
  double RatioToDb (double ratio) const;
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   160
  double GetPowerDbm (uint8_t power) const;
5820
1c02054740eb Renaming WifiPhy state SYNC to RX to avoid confusion with "synchronizing".
Timo Bingmann <tbns@idlebox.net>
parents: 5747
diff changeset
   161
  void EndReceive (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event);
3897
44645cec42f2 split state management in a helper class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3893
diff changeset
   162
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   163
private:
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3904
diff changeset
   164
  double   m_edThresholdW;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3904
diff changeset
   165
  double   m_ccaMode1ThresholdW;
2071
122c95ffccdd use dB instead of dbm where appropriate
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2057
diff changeset
   166
  double   m_txGainDb;
122c95ffccdd use dB instead of dbm where appropriate
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2057
diff changeset
   167
  double   m_rxGainDb;
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   168
  double   m_txPowerBaseDbm;
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   169
  double   m_txPowerEndDbm;
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   170
  uint32_t m_nTxPower;
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   171
3893
94f771c1373a split WifiChannel in WifiChannel + YansWifiChannel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3888
diff changeset
   172
  Ptr<YansWifiChannel> m_channel;
5189
8fcdf87a790a Channel switching support for Wifi
Ramon Bauza
parents: 5152
diff changeset
   173
  uint16_t m_channelNumber;
3912
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3906
diff changeset
   174
  Ptr<Object> m_device;
4d1a61f80745 new wifi API
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3906
diff changeset
   175
  Ptr<Object> m_mobility;
6372
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   176
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   177
  /**
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   178
   * This vector holds the set of transmission modes that this
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   179
   * WifiPhy(-derived class) can support. In conversation we call this
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   180
   * the DeviceRateSet (not a term you'll find in the standard), and
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   181
   * it is a superset of standard-defined parameters such as the
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   182
   * OperationalRateSet, and the BSSBasicRateSet (which, themselves,
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   183
   * have a superset/subset relationship).
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   184
   *
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   185
   * Mandatory rates relevant to this WifiPhy can be found by
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   186
   * iterating over this vector looking for WifiMode objects for which
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   187
   * WifiMode::IsMandatory() is true.
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   188
   *
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   189
   * A quick note is appropriate here (well, here is as good a place
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   190
   * as any I can find)...
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   191
   *
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   192
   * In the standard there is no text that explicitly precludes
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   193
   * production of a device that does not support some rates that are
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   194
   * mandatory (according to the standard) for PHYs that the device
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   195
   * happens to fully or partially support.
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   196
   *
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   197
   * This approach is taken by some devices which choose to only support,
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   198
   * for example, 6 and 9 Mbps ERP-OFDM rates for cost and power
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   199
   * consumption reasons (i.e., these devices don't need to be designed
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   200
   * for and waste current on the increased linearity requirement of
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   201
   * higher-order constellations when 6 and 9 Mbps more than meet their
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   202
   * data requirements). The wording of the standard allows such devices
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   203
   * to have an OperationalRateSet which includes 6 and 9 Mbps ERP-OFDM
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   204
   * rates, despite 12 and 24 Mbps being "mandatory" rates for the
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   205
   * ERP-OFDM PHY.
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   206
   *
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   207
   * Now this doesn't actually have any impact on code, yet. It is,
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   208
   * however, something that we need to keep in mind for the
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   209
   * future. Basically, the key point is that we can't be making
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   210
   * assumptions like "the Operational Rate Set will contain all the
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   211
   * mandatory rates".
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   212
   */
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   213
  WifiModeList m_deviceRateSet;
0fafd9716f44 Bug 853: Consider mandatory rates for Wi-Fi control responses
Dean Armstrong <deanarm@gmail.com>
parents: 6273
diff changeset
   214
5820
1c02054740eb Renaming WifiPhy state SYNC to RX to avoid confusion with "synchronizing".
Timo Bingmann <tbns@idlebox.net>
parents: 5747
diff changeset
   215
  EventId m_endRxEvent;
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   216
  UniformVariable m_random;
4690
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
   217
  /// Standard-dependent center frequency of 0-th channel, MHz 
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
   218
  double m_channelStartingFrequency;
3900
1687492ff059 re-enable tracing of wifi phy state.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3897
diff changeset
   219
  Ptr<WifiPhyStateHelper> m_state;
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3904
diff changeset
   220
  InterferenceHelper m_interference;
4690
86343f7d6bfd Initial multichannel support in Yans Wifi PHY.
Pavel Boyko <boyko@iitp.ru>
parents: 4680
diff changeset
   221
  Time m_channelSwitchDelay;
4263
fec2f830d015 trace consistency changes
Craig Dowell <craigdo@ee.washington.edu>
parents: 3912
diff changeset
   222
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   223
};
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   224
1977
4303409f3d8e remove uneeded trailing ';'
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1964
diff changeset
   225
} // namespace ns3
1889
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   226
41589561e4a7 WifiPhy class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   227
3888
a15618dcd0eb rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3887
diff changeset
   228
#endif /* YANS_WIFI_PHY_H */