author | Nicola Baldo <nicola@baldo.biz> |
Sat, 07 May 2011 21:49:46 +0200 | |
changeset 7141 | 072fb225b714 |
parent 6852 | 8f1a53d3f6ca |
child 7385 | 10beb0e53130 |
permissions | -rw-r--r-- |
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 |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
1930
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
8 |
* |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
13 |
* |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
17 |
* |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
ec22299cf6bb
rework MacStations to handle correctly Supported vs Basic rate sets and add IdealMacStations to build
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
19 |
*/ |
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 |
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
|
27 |
|
6065 | 28 |
struct IdealWifiRemoteStation : public WifiRemoteStation |
29 |
{ |
|
30 |
double m_lastSnr; |
|
31 |
}; |
|
32 |
||
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
33 |
NS_OBJECT_ENSURE_REGISTERED (IdealWifiManager); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
34 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
35 |
TypeId |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
36 |
IdealWifiManager::GetTypeId (void) |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
37 |
{ |
2602
d9262bff6df2
add back support for introspected doxygen.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2524
diff
changeset
|
38 |
static TypeId tid = TypeId ("ns3::IdealWifiManager") |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
39 |
.SetParent<WifiRemoteStationManager> () |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
40 |
.AddConstructor<IdealWifiManager> () |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
41 |
.AddAttribute ("BerThreshold", |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
42 |
"The maximum Bit Error Rate acceptable at any transmission mode", |
2965
4b28e9740e3b
get rid of Attribute class. Use AttributeValue subclasses directly.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2784
diff
changeset
|
43 |
DoubleValue (10e-6), |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
44 |
MakeDoubleAccessor (&IdealWifiManager::m_ber), |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
45 |
MakeDoubleChecker<double> ()) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
46 |
; |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
47 |
return tid; |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
48 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
49 |
|
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
50 |
IdealWifiManager::IdealWifiManager () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
51 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
52 |
} |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
53 |
IdealWifiManager::~IdealWifiManager () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
54 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
55 |
} |
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
|
56 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
57 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
58 |
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
|
59 |
{ |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
60 |
uint32_t nModes = phy->GetNModes (); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
61 |
for (uint32_t i = 0; i < nModes; i++) |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
62 |
{ |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
63 |
WifiMode mode = phy->GetMode (i); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
64 |
AddModeSnrThreshold (mode, phy->CalculateSnr (mode, m_ber)); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
65 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
66 |
|
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
67 |
WifiRemoteStationManager::SetupPhy (phy); |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
68 |
} |
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
69 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
70 |
double |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
71 |
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
|
72 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
73 |
for (Thresholds::const_iterator i = m_thresholds.begin (); i != m_thresholds.end (); 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
|
74 |
{ |
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
|
75 |
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
|
76 |
{ |
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
|
77 |
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
|
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 |
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
|
81 |
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
|
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 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
84 |
void |
2524
db72c0e7743e
port wifi model to Attributes
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2269
diff
changeset
|
85 |
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
|
86 |
{ |
1964
041240a915f8
build and link
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1935
diff
changeset
|
87 |
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
|
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 |
|
6065 | 90 |
WifiRemoteStation * |
91 |
IdealWifiManager::DoCreateStation (void) const |
|
92 |
{ |
|
93 |
IdealWifiRemoteStation *station = new IdealWifiRemoteStation (); |
|
94 |
station->m_lastSnr = 0.0; |
|
95 |
return station; |
|
96 |
} |
|
97 |
||
98 |
||
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
99 |
void |
6065 | 100 |
IdealWifiManager::DoReportRxOk (WifiRemoteStation *station, |
101 |
double rxSnr, WifiMode txMode) |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
102 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
103 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
104 |
void |
6065 | 105 |
IdealWifiManager::DoReportRtsFailed (WifiRemoteStation *station) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
106 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
107 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
108 |
void |
6065 | 109 |
IdealWifiManager::DoReportDataFailed (WifiRemoteStation *station) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
110 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
111 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
112 |
void |
6065 | 113 |
IdealWifiManager::DoReportRtsOk (WifiRemoteStation *st, |
114 |
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
|
115 |
{ |
6065 | 116 |
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st; |
117 |
station->m_lastSnr = 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
|
118 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
119 |
void |
6065 | 120 |
IdealWifiManager::DoReportDataOk (WifiRemoteStation *st, |
121 |
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
|
122 |
{ |
6065 | 123 |
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st; |
124 |
station->m_lastSnr = 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
|
125 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
126 |
void |
6065 | 127 |
IdealWifiManager::DoReportFinalRtsFailed (WifiRemoteStation *station) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
128 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
129 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
130 |
void |
6065 | 131 |
IdealWifiManager::DoReportFinalDataFailed (WifiRemoteStation *station) |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
132 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
133 |
} |
2269
06c660ffc070
add MacStation::ReportFinal* methods for onoe rate control model
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
2268
diff
changeset
|
134 |
|
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
|
135 |
WifiMode |
6065 | 136 |
IdealWifiManager::DoGetDataMode (WifiRemoteStation *st, 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
|
137 |
{ |
6065 | 138 |
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
139 |
// We search within the Supported rate set the mode with the |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
140 |
// highest snr threshold possible which is smaller than m_lastSnr |
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
|
141 |
// 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
|
142 |
double maxThreshold = 0.0; |
6065 | 143 |
WifiMode maxMode = GetDefaultMode (); |
144 |
for (uint32_t i = 0; i < GetNSupported (station); 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
|
145 |
{ |
6065 | 146 |
WifiMode mode = GetSupported (station, i); |
147 |
double threshold = GetSnrThreshold (mode); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
148 |
if (threshold > maxThreshold |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
149 |
&& threshold < station->m_lastSnr) |
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
|
150 |
{ |
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 |
maxThreshold = threshold; |
1935
c7ac48654295
avoid calling un-implemented method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1931
diff
changeset
|
152 |
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
|
153 |
} |
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 |
} |
1935
c7ac48654295
avoid calling un-implemented method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1931
diff
changeset
|
155 |
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
|
156 |
} |
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 |
WifiMode |
6065 | 158 |
IdealWifiManager::DoGetRtsMode (WifiRemoteStation *st) |
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
|
159 |
{ |
6065 | 160 |
IdealWifiRemoteStation *station = (IdealWifiRemoteStation *)st; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
161 |
// We search within the Basic rate set the mode with the highest |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
162 |
// snr threshold possible which is smaller than m_lastSnr to |
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
|
163 |
// 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
|
164 |
double maxThreshold = 0.0; |
6065 | 165 |
WifiMode maxMode = GetDefaultMode (); |
166 |
for (uint32_t i = 0; i < 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
|
167 |
{ |
6065 | 168 |
WifiMode mode = GetBasicMode (i); |
169 |
double threshold = GetSnrThreshold (mode); |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
170 |
if (threshold > maxThreshold |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
171 |
&& threshold < station->m_lastSnr) |
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 |
maxThreshold = threshold; |
1935
c7ac48654295
avoid calling un-implemented method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1931
diff
changeset
|
174 |
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
|
175 |
} |
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
|
176 |
} |
1935
c7ac48654295
avoid calling un-implemented method
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
1931
diff
changeset
|
177 |
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
|
178 |
} |
6065 | 179 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
180 |
bool |
6065 | 181 |
IdealWifiManager::IsLowLatency (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
|
182 |
{ |
6065 | 183 |
return true; |
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
|
184 |
} |
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
|
185 |
|
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
|
186 |
} // namespace ns3 |