src/devices/wifi/ideal-wifi-manager.cc
author Federico Maguolo <maguolof@dei.unipd.it>
Fri, 28 Mar 2008 12:14:02 -0700
changeset 2784 49006cbbfac7
parent 2602 d9262bff6df2
child 2965 4b28e9740e3b
child 2985 fa0747c4ad5e
permissions -rw-r--r--
GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
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
 */
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    20
#include "ideal-wifi-manager.h"
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    21
#include "wifi-phy.h"
1964
041240a915f8 build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1935
diff changeset
    22
#include "ns3/assert.h"
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    23
#include "ns3/double.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
    24
#include <math.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
    25
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
    26
#define noIDEAL_DEBUG 1
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
#ifdef IDEAL_DEBUG
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
#include <iostream>
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
    30
#  define TRACE(x) \
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
    31
std::cout << "IDEAL TRACE " << x << std::endl;
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
    32
#else
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
    33
#  define TRACE(x)
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
    34
#endif
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
    35
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
    36
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
    37
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
    38
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    39
NS_OBJECT_ENSURE_REGISTERED (IdealWifiManager);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    40
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    41
TypeId 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    42
IdealWifiManager::GetTypeId (void)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    43
{
2602
d9262bff6df2 add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2524
diff changeset
    44
  static TypeId tid = TypeId ("ns3::IdealWifiManager")
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    45
    .SetParent<WifiRemoteStationManager> ()
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    46
    .AddConstructor<IdealWifiManager> ()
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    47
    .AddAttribute ("BerThreshold",
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    48
                   "The maximum Bit Error Rate acceptable at any transmission mode",
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    49
                   Double (10e-6),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    50
                   MakeDoubleAccessor (&IdealWifiManager::m_ber),
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    51
                   MakeDoubleChecker<double> ())
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    52
    ;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    53
  return tid;
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    54
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    55
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    56
IdealWifiManager::IdealWifiManager ()
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
{}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    58
IdealWifiManager::~IdealWifiManager ()
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
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    61
void 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    62
IdealWifiManager::SetupPhy (Ptr<WifiPhy> phy)
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
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    64
  uint32_t nModes = phy->GetNModes ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    65
  for (uint32_t i = 0; i < nModes; i++) 
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    66
    {
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    67
      WifiMode mode = phy->GetMode (i);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    68
      AddModeSnrThreshold (mode, phy->CalculateSnr (mode, m_ber));
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    69
    }
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    70
  
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    71
  WifiRemoteStationManager::SetupPhy (phy);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    72
}
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    73
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    74
WifiRemoteStation *
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    75
IdealWifiManager::CreateStation (void)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    76
{
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    77
  return new IdealWifiRemoteStation (this);
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
}
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
    79
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
    80
double 
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    81
IdealWifiManager::GetSnrThreshold (WifiMode mode) const
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
    82
{
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
  for (Thresholds::const_iterator i = m_thresholds.begin (); i != m_thresholds.end (); i++) 
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
    {
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
    85
      if (mode == i->second)
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
    86
        {
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
          return i->first;
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
    88
        }
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
    89
    }
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
  NS_ASSERT (false);
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
  return 0.0;
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
}
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
    93
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
void 
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
    95
IdealWifiManager::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
    96
{
1964
041240a915f8 build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1935
diff changeset
    97
  m_thresholds.push_back (std::make_pair (snr,mode));
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
}
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
    99
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   100
IdealWifiRemoteStation::IdealWifiRemoteStation (Ptr<IdealWifiManager> manager)
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   101
  : m_manager (manager),
2162
4bf1541c02cf initialize variable
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1964
diff changeset
   102
    m_lastSnr (0.0)
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
   103
{}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   104
IdealWifiRemoteStation::~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
   105
{}
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
   106
void 
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   107
IdealWifiRemoteStation::DoReportRxOk (double rxSnr, WifiMode txMode)
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
   108
{}
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
   109
void 
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   110
IdealWifiRemoteStation::DoReportRtsFailed (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
   111
{}
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
   112
void 
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   113
IdealWifiRemoteStation::DoReportDataFailed (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
   114
{}
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
   115
void 
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   116
IdealWifiRemoteStation::DoReportRtsOk (double ctsSnr, WifiMode ctsMode, double rtsSnr)
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
   117
{
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
   118
  TRACE ("got cts for rts snr="<<rtsSnr);
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
   119
  m_lastSnr = rtsSnr;
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
   120
}
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
   121
void 
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   122
IdealWifiRemoteStation::DoReportDataOk (double ackSnr, WifiMode ackMode, double dataSnr)
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
   123
{
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
   124
  TRACE ("got cts for rts snr="<<dataSnr);
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
   125
  m_lastSnr = dataSnr;
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
   126
}
2269
06c660ffc070 add MacStation::ReportFinal* methods for onoe rate control model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2268
diff changeset
   127
void 
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   128
IdealWifiRemoteStation::DoReportFinalRtsFailed (void)
2269
06c660ffc070 add MacStation::ReportFinal* methods for onoe rate control model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2268
diff changeset
   129
{}
06c660ffc070 add MacStation::ReportFinal* methods for onoe rate control model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2268
diff changeset
   130
void 
2784
49006cbbfac7 GetMaxSsrc -> NeedRtsTransmission and GetMaxSlrc -> NeedDataRetransmission
Federico Maguolo <maguolof@dei.unipd.it>
parents: 2602
diff changeset
   131
IdealWifiRemoteStation::DoReportFinalDataFailed (void)
2269
06c660ffc070 add MacStation::ReportFinal* methods for onoe rate control model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2268
diff changeset
   132
{}
06c660ffc070 add MacStation::ReportFinal* methods for onoe rate control model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2268
diff changeset
   133
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
   134
WifiMode
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   135
IdealWifiRemoteStation::DoGetDataMode (uint32_t size)
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
   136
{
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
   137
  // We search within the Supported rate set the mode with 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
   138
  // highest snr threshold possible which is smaller than 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
   139
  // to ensure correct packet delivery.
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
   140
  double maxThreshold = 0.0;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   141
  WifiMode maxMode = m_manager->GetDefaultMode ();
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
   142
  for (uint32_t i = 0; i < GetNSupportedModes (); i++)
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
   143
    {
1935
c7ac48654295 avoid calling un-implemented method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1931
diff changeset
   144
      WifiMode mode = GetSupportedMode (i);
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   145
      double threshold = m_manager->GetSnrThreshold (mode);
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
   146
      if (threshold > maxThreshold && 
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
   147
          threshold < 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
   148
        {
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
   149
          maxThreshold = threshold;
1935
c7ac48654295 avoid calling un-implemented method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1931
diff changeset
   150
          maxMode = mode;
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
   151
        }
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
   152
    }
1935
c7ac48654295 avoid calling un-implemented method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1931
diff changeset
   153
  return maxMode;
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
   154
}
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
   155
WifiMode
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   156
IdealWifiRemoteStation::DoGetRtsMode (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
   157
{
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
   158
  // We search within the Basic rate set the mode with the highest 
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
   159
  // snr threshold possible which is smaller than m_lastSnr to 
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
   160
  // ensure correct packet delivery.
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
   161
  double maxThreshold = 0.0;
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   162
  WifiMode maxMode = m_manager->GetDefaultMode ();
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   163
  for (uint32_t i = 0; i < m_manager->GetNBasicModes (); i++)
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
   164
    {
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   165
      WifiMode mode = m_manager->GetBasicMode (i);
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   166
      double threshold = m_manager->GetSnrThreshold (mode);
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
   167
      if (threshold > maxThreshold && 
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
   168
          threshold < 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
   169
        {
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
   170
          maxThreshold = threshold;
1935
c7ac48654295 avoid calling un-implemented method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1931
diff changeset
   171
          maxMode = mode;
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
   172
        }
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
   173
    }
1935
c7ac48654295 avoid calling un-implemented method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1931
diff changeset
   174
  return maxMode;
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
   175
}
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   176
Ptr<WifiRemoteStationManager>
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   177
IdealWifiRemoteStation::GetManager (void) const
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
   178
{
2524
db72c0e7743e port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 2269
diff changeset
   179
  return 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
   180
}
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
   181
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
   182
} // namespace ns3