A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
wifi-phy.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2005,2006 INRIA
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19
*/
20
21
#include "
wifi-phy.h
"
22
#include "
wifi-mode.h
"
23
#include "
wifi-channel.h
"
24
#include "
wifi-preamble.h
"
25
#include "ns3/simulator.h"
26
#include "ns3/packet.h"
27
#include "ns3/assert.h"
28
#include "ns3/log.h"
29
#include "ns3/double.h"
30
#include "ns3/uinteger.h"
31
#include "ns3/enum.h"
32
#include "ns3/trace-source-accessor.h"
33
#include <cmath>
34
35
NS_LOG_COMPONENT_DEFINE
(
"WifiPhy"
);
36
37
namespace
ns3 {
38
39
/****************************************************************
40
* This destructor is needed.
41
****************************************************************/
42
43
WifiPhyListener::~WifiPhyListener
()
44
{
45
}
46
47
/****************************************************************
48
* The actual WifiPhy class
49
****************************************************************/
50
51
NS_OBJECT_ENSURE_REGISTERED
(
WifiPhy
);
52
53
TypeId
54
WifiPhy::GetTypeId
(
void
)
55
{
56
static
TypeId
tid =
TypeId
(
"ns3::WifiPhy"
)
57
.
SetParent
<
Object
> ()
58
.AddTraceSource (
"PhyTxBegin"
,
59
"Trace source indicating a packet has begun transmitting over the channel medium"
,
60
MakeTraceSourceAccessor
(&
WifiPhy::m_phyTxBeginTrace
))
61
.AddTraceSource (
"PhyTxEnd"
,
62
"Trace source indicating a packet has been completely transmitted over the channel. NOTE: the only official WifiPhy implementation available to this date (YansWifiPhy) never fires this trace source."
,
63
MakeTraceSourceAccessor
(&
WifiPhy::m_phyTxEndTrace
))
64
.AddTraceSource (
"PhyTxDrop"
,
65
"Trace source indicating a packet has been dropped by the device during transmission"
,
66
MakeTraceSourceAccessor
(&
WifiPhy::m_phyTxDropTrace
))
67
.AddTraceSource (
"PhyRxBegin"
,
68
"Trace source indicating a packet has begun being received from the channel medium by the device"
,
69
MakeTraceSourceAccessor
(&
WifiPhy::m_phyRxBeginTrace
))
70
.AddTraceSource (
"PhyRxEnd"
,
71
"Trace source indicating a packet has been completely received from the channel medium by the device"
,
72
MakeTraceSourceAccessor
(&
WifiPhy::m_phyRxEndTrace
))
73
.AddTraceSource (
"PhyRxDrop"
,
74
"Trace source indicating a packet has been dropped by the device during reception"
,
75
MakeTraceSourceAccessor
(&
WifiPhy::m_phyRxDropTrace
))
76
.AddTraceSource (
"MonitorSnifferRx"
,
77
"Trace source simulating a wifi device in monitor mode sniffing all received frames"
,
78
MakeTraceSourceAccessor
(&
WifiPhy::m_phyMonitorSniffRxTrace
))
79
.AddTraceSource (
"MonitorSnifferTx"
,
80
"Trace source simulating the capability of a wifi device in monitor mode to sniff all frames being transmitted"
,
81
MakeTraceSourceAccessor
(&
WifiPhy::m_phyMonitorSniffTxTrace
))
82
;
83
return
tid;
84
}
85
86
WifiPhy::WifiPhy
()
87
{
88
NS_LOG_FUNCTION
(
this
);
89
}
90
91
WifiPhy::~WifiPhy
()
92
{
93
NS_LOG_FUNCTION
(
this
);
94
}
95
96
97
WifiMode
98
WifiPhy::GetPlcpHeaderMode
(
WifiMode
payloadMode,
WifiPreamble
preamble)
99
{
100
switch
(payloadMode.
GetModulationClass
())
101
{
102
case
WIFI_MOD_CLASS_OFDM
:
103
{
104
switch
(payloadMode.
GetBandwidth
())
105
{
106
case
5000000:
107
return
WifiPhy::GetOfdmRate1_5MbpsBW5MHz
();
108
case
10000000:
109
return
WifiPhy::GetOfdmRate3MbpsBW10MHz
();
110
default
:
111
// IEEE Std 802.11-2007, 17.3.2
112
// actually this is only the first part of the PlcpHeader,
113
// because the last 16 bits of the PlcpHeader are using the
114
// same mode of the payload
115
return
WifiPhy::GetOfdmRate6Mbps
();
116
}
117
}
118
119
case
WIFI_MOD_CLASS_ERP_OFDM
:
120
return
WifiPhy::GetErpOfdmRate6Mbps
();
121
122
case
WIFI_MOD_CLASS_DSSS
:
123
if
(preamble ==
WIFI_PREAMBLE_LONG
)
124
{
125
// IEEE Std 802.11-2007, sections 15.2.3 and 18.2.2.1
126
return
WifiPhy::GetDsssRate1Mbps
();
127
}
128
else
// WIFI_PREAMBLE_SHORT
129
{
130
// IEEE Std 802.11-2007, section 18.2.2.2
131
return
WifiPhy::GetDsssRate2Mbps
();
132
}
133
134
default
:
135
NS_FATAL_ERROR
(
"unsupported modulation class"
);
136
return
WifiMode
();
137
}
138
}
139
140
uint32_t
141
WifiPhy::GetPlcpHeaderDurationMicroSeconds
(
WifiMode
payloadMode,
WifiPreamble
preamble)
142
{
143
switch
(payloadMode.
GetModulationClass
())
144
{
145
case
WIFI_MOD_CLASS_OFDM
:
146
{
147
switch
(payloadMode.
GetBandwidth
())
148
{
149
case
20000000:
150
default
:
151
// IEEE Std 802.11-2007, section 17.3.3 and figure 17-4
152
// also section 17.3.2.3, table 17-4
153
// We return the duration of the SIGNAL field only, since the
154
// SERVICE field (which strictly speaking belongs to the PLCP
155
// header, see section 17.3.2 and figure 17-1) is sent using the
156
// payload mode.
157
return
4;
158
case
10000000:
159
// IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
160
return
8;
161
case
5000000:
162
// IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
163
return
16;
164
}
165
}
166
167
case
WIFI_MOD_CLASS_ERP_OFDM
:
168
return
16;
169
170
case
WIFI_MOD_CLASS_DSSS
:
171
if
(preamble ==
WIFI_PREAMBLE_SHORT
)
172
{
173
// IEEE Std 802.11-2007, section 18.2.2.2 and figure 18-2
174
return
24;
175
}
176
else
// WIFI_PREAMBLE_LONG
177
{
178
// IEEE Std 802.11-2007, sections 18.2.2.1 and figure 18-1
179
return
48;
180
}
181
182
default
:
183
NS_FATAL_ERROR
(
"unsupported modulation class"
);
184
return
0;
185
}
186
}
187
188
uint32_t
189
WifiPhy::GetPlcpPreambleDurationMicroSeconds
(
WifiMode
payloadMode,
WifiPreamble
preamble)
190
{
191
switch
(payloadMode.
GetModulationClass
())
192
{
193
case
WIFI_MOD_CLASS_OFDM
:
194
{
195
switch
(payloadMode.
GetBandwidth
())
196
{
197
case
20000000:
198
default
:
199
// IEEE Std 802.11-2007, section 17.3.3, figure 17-4
200
// also section 17.3.2.3, table 17-4
201
return
16;
202
case
10000000:
203
// IEEE Std 802.11-2007, section 17.3.3, table 17-4
204
// also section 17.3.2.3, table 17-4
205
return
32;
206
case
5000000:
207
// IEEE Std 802.11-2007, section 17.3.3
208
// also section 17.3.2.3, table 17-4
209
return
64;
210
}
211
}
212
213
case
WIFI_MOD_CLASS_ERP_OFDM
:
214
return
4;
215
216
case
WIFI_MOD_CLASS_DSSS
:
217
if
(preamble ==
WIFI_PREAMBLE_SHORT
)
218
{
219
// IEEE Std 802.11-2007, section 18.2.2.2 and figure 18-2
220
return
72;
221
}
222
else
// WIFI_PREAMBLE_LONG
223
{
224
// IEEE Std 802.11-2007, sections 18.2.2.1 and figure 18-1
225
return
144;
226
}
227
228
default
:
229
NS_FATAL_ERROR
(
"unsupported modulation class"
);
230
return
0;
231
}
232
}
233
234
uint32_t
235
WifiPhy::GetPayloadDurationMicroSeconds
(uint32_t size,
WifiMode
payloadMode)
236
{
237
NS_LOG_FUNCTION
(size << payloadMode);
238
239
switch
(payloadMode.
GetModulationClass
())
240
{
241
case
WIFI_MOD_CLASS_OFDM
:
242
case
WIFI_MOD_CLASS_ERP_OFDM
:
243
{
244
// IEEE Std 802.11-2007, section 17.3.2.3, table 17-4
245
// corresponds to T_{SYM} in the table
246
uint32_t symbolDurationUs;
247
248
switch
(payloadMode.
GetBandwidth
())
249
{
250
case
20000000:
251
default
:
252
symbolDurationUs = 4;
253
break
;
254
case
10000000:
255
symbolDurationUs = 8;
256
break
;
257
case
5000000:
258
symbolDurationUs = 16;
259
break
;
260
}
261
262
// IEEE Std 802.11-2007, section 17.3.2.2, table 17-3
263
// corresponds to N_{DBPS} in the table
264
double
numDataBitsPerSymbol = payloadMode.
GetDataRate
() * symbolDurationUs / 1e6;
265
266
// IEEE Std 802.11-2007, section 17.3.5.3, equation (17-11)
267
uint32_t numSymbols = lrint (std::ceil ((16 + size * 8.0 + 6.0) / numDataBitsPerSymbol));
268
269
// Add signal extension for ERP PHY
270
if
(payloadMode.
GetModulationClass
() ==
WIFI_MOD_CLASS_ERP_OFDM
)
271
{
272
return
numSymbols * symbolDurationUs + 6;
273
}
274
else
275
{
276
return
numSymbols * symbolDurationUs;
277
}
278
}
279
280
case
WIFI_MOD_CLASS_DSSS
:
281
// IEEE Std 802.11-2007, section 18.2.3.5
282
NS_LOG_LOGIC
(
" size="
<< size
283
<<
" mode="
<< payloadMode
284
<<
" rate="
<< payloadMode.
GetDataRate
() );
285
return
lrint (std::ceil ((size * 8.0) / (payloadMode.
GetDataRate
() / 1.0e6)));
286
287
default
:
288
NS_FATAL_ERROR
(
"unsupported modulation class"
);
289
return
0;
290
}
291
}
292
293
Time
294
WifiPhy::CalculateTxDuration
(uint32_t size,
WifiMode
payloadMode,
WifiPreamble
preamble)
295
{
296
uint32_t duration =
GetPlcpPreambleDurationMicroSeconds
(payloadMode, preamble)
297
+
GetPlcpHeaderDurationMicroSeconds
(payloadMode, preamble)
298
+
GetPayloadDurationMicroSeconds
(size, payloadMode);
299
return
MicroSeconds
(duration);
300
}
301
302
303
void
304
WifiPhy::NotifyTxBegin
(
Ptr<const Packet>
packet)
305
{
306
m_phyTxBeginTrace
(packet);
307
}
308
309
void
310
WifiPhy::NotifyTxEnd
(
Ptr<const Packet>
packet)
311
{
312
m_phyTxEndTrace
(packet);
313
}
314
315
void
316
WifiPhy::NotifyTxDrop
(
Ptr<const Packet>
packet)
317
{
318
m_phyTxDropTrace
(packet);
319
}
320
321
void
322
WifiPhy::NotifyRxBegin
(
Ptr<const Packet>
packet)
323
{
324
m_phyRxBeginTrace
(packet);
325
}
326
327
void
328
WifiPhy::NotifyRxEnd
(
Ptr<const Packet>
packet)
329
{
330
m_phyRxEndTrace
(packet);
331
}
332
333
void
334
WifiPhy::NotifyRxDrop
(
Ptr<const Packet>
packet)
335
{
336
m_phyRxDropTrace
(packet);
337
}
338
339
void
340
WifiPhy::NotifyMonitorSniffRx
(
Ptr<const Packet>
packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate,
bool
isShortPreamble,
double
signalDbm,
double
noiseDbm)
341
{
342
m_phyMonitorSniffRxTrace
(packet, channelFreqMhz, channelNumber, rate, isShortPreamble, signalDbm, noiseDbm);
343
}
344
345
void
346
WifiPhy::NotifyMonitorSniffTx
(
Ptr<const Packet>
packet, uint16_t channelFreqMhz, uint16_t channelNumber, uint32_t rate,
bool
isShortPreamble)
347
{
348
m_phyMonitorSniffTxTrace
(packet, channelFreqMhz, channelNumber, rate, isShortPreamble);
349
}
350
351
356
WifiMode
357
WifiPhy::GetDsssRate1Mbps
()
358
{
359
static
WifiMode
mode =
360
WifiModeFactory::CreateWifiMode
(
"DsssRate1Mbps"
,
361
WIFI_MOD_CLASS_DSSS
,
362
true
,
363
22000000, 1000000,
364
WIFI_CODE_RATE_UNDEFINED
,
365
2);
366
return
mode;
367
}
368
369
WifiMode
370
WifiPhy::GetDsssRate2Mbps
()
371
{
372
static
WifiMode
mode =
373
WifiModeFactory::CreateWifiMode
(
"DsssRate2Mbps"
,
374
WIFI_MOD_CLASS_DSSS
,
375
true
,
376
22000000, 2000000,
377
WIFI_CODE_RATE_UNDEFINED
,
378
4);
379
return
mode;
380
}
381
382
386
WifiMode
387
WifiPhy::GetDsssRate5_5Mbps
()
388
{
389
static
WifiMode
mode =
390
WifiModeFactory::CreateWifiMode
(
"DsssRate5_5Mbps"
,
391
WIFI_MOD_CLASS_DSSS
,
392
true
,
393
22000000, 5500000,
394
WIFI_CODE_RATE_UNDEFINED
,
395
4);
396
return
mode;
397
}
398
399
WifiMode
400
WifiPhy::GetDsssRate11Mbps
()
401
{
402
static
WifiMode
mode =
403
WifiModeFactory::CreateWifiMode
(
"DsssRate11Mbps"
,
404
WIFI_MOD_CLASS_DSSS
,
405
true
,
406
22000000, 11000000,
407
WIFI_CODE_RATE_UNDEFINED
,
408
4);
409
return
mode;
410
}
411
412
416
WifiMode
417
WifiPhy::GetErpOfdmRate6Mbps
()
418
{
419
static
WifiMode
mode =
420
WifiModeFactory::CreateWifiMode
(
"ErpOfdmRate6Mbps"
,
421
WIFI_MOD_CLASS_ERP_OFDM
,
422
true
,
423
20000000, 6000000,
424
WIFI_CODE_RATE_1_2
,
425
2);
426
return
mode;
427
}
428
429
WifiMode
430
WifiPhy::GetErpOfdmRate9Mbps
()
431
{
432
static
WifiMode
mode =
433
WifiModeFactory::CreateWifiMode
(
"ErpOfdmRate9Mbps"
,
434
WIFI_MOD_CLASS_ERP_OFDM
,
435
false
,
436
20000000, 9000000,
437
WIFI_CODE_RATE_3_4
,
438
2);
439
return
mode;
440
}
441
442
WifiMode
443
WifiPhy::GetErpOfdmRate12Mbps
()
444
{
445
static
WifiMode
mode =
446
WifiModeFactory::CreateWifiMode
(
"ErpOfdmRate12Mbps"
,
447
WIFI_MOD_CLASS_ERP_OFDM
,
448
true
,
449
20000000, 12000000,
450
WIFI_CODE_RATE_1_2
,
451
4);
452
return
mode;
453
}
454
455
WifiMode
456
WifiPhy::GetErpOfdmRate18Mbps
()
457
{
458
static
WifiMode
mode =
459
WifiModeFactory::CreateWifiMode
(
"ErpOfdmRate18Mbps"
,
460
WIFI_MOD_CLASS_ERP_OFDM
,
461
false
,
462
20000000, 18000000,
463
WIFI_CODE_RATE_3_4
,
464
4);
465
return
mode;
466
}
467
468
WifiMode
469
WifiPhy::GetErpOfdmRate24Mbps
()
470
{
471
static
WifiMode
mode =
472
WifiModeFactory::CreateWifiMode
(
"ErpOfdmRate24Mbps"
,
473
WIFI_MOD_CLASS_ERP_OFDM
,
474
true
,
475
20000000, 24000000,
476
WIFI_CODE_RATE_1_2
,
477
16);
478
return
mode;
479
}
480
481
WifiMode
482
WifiPhy::GetErpOfdmRate36Mbps
()
483
{
484
static
WifiMode
mode =
485
WifiModeFactory::CreateWifiMode
(
"ErpOfdmRate36Mbps"
,
486
WIFI_MOD_CLASS_ERP_OFDM
,
487
false
,
488
20000000, 36000000,
489
WIFI_CODE_RATE_3_4
,
490
16);
491
return
mode;
492
}
493
494
WifiMode
495
WifiPhy::GetErpOfdmRate48Mbps
()
496
{
497
static
WifiMode
mode =
498
WifiModeFactory::CreateWifiMode
(
"ErpOfdmRate48Mbps"
,
499
WIFI_MOD_CLASS_ERP_OFDM
,
500
false
,
501
20000000, 48000000,
502
WIFI_CODE_RATE_2_3
,
503
64);
504
return
mode;
505
}
506
507
WifiMode
508
WifiPhy::GetErpOfdmRate54Mbps
()
509
{
510
static
WifiMode
mode =
511
WifiModeFactory::CreateWifiMode
(
"ErpOfdmRate54Mbps"
,
512
WIFI_MOD_CLASS_ERP_OFDM
,
513
false
,
514
20000000, 54000000,
515
WIFI_CODE_RATE_3_4
,
516
64);
517
return
mode;
518
}
519
520
524
WifiMode
525
WifiPhy::GetOfdmRate6Mbps
()
526
{
527
static
WifiMode
mode =
528
WifiModeFactory::CreateWifiMode
(
"OfdmRate6Mbps"
,
529
WIFI_MOD_CLASS_OFDM
,
530
true
,
531
20000000, 6000000,
532
WIFI_CODE_RATE_1_2
,
533
2);
534
return
mode;
535
}
536
537
WifiMode
538
WifiPhy::GetOfdmRate9Mbps
()
539
{
540
static
WifiMode
mode =
541
WifiModeFactory::CreateWifiMode
(
"OfdmRate9Mbps"
,
542
WIFI_MOD_CLASS_OFDM
,
543
false
,
544
20000000, 9000000,
545
WIFI_CODE_RATE_3_4
,
546
2);
547
return
mode;
548
}
549
550
WifiMode
551
WifiPhy::GetOfdmRate12Mbps
()
552
{
553
static
WifiMode
mode =
554
WifiModeFactory::CreateWifiMode
(
"OfdmRate12Mbps"
,
555
WIFI_MOD_CLASS_OFDM
,
556
true
,
557
20000000, 12000000,
558
WIFI_CODE_RATE_1_2
,
559
4);
560
return
mode;
561
}
562
563
WifiMode
564
WifiPhy::GetOfdmRate18Mbps
()
565
{
566
static
WifiMode
mode =
567
WifiModeFactory::CreateWifiMode
(
"OfdmRate18Mbps"
,
568
WIFI_MOD_CLASS_OFDM
,
569
false
,
570
20000000, 18000000,
571
WIFI_CODE_RATE_3_4
,
572
4);
573
return
mode;
574
}
575
576
WifiMode
577
WifiPhy::GetOfdmRate24Mbps
()
578
{
579
static
WifiMode
mode =
580
WifiModeFactory::CreateWifiMode
(
"OfdmRate24Mbps"
,
581
WIFI_MOD_CLASS_OFDM
,
582
true
,
583
20000000, 24000000,
584
WIFI_CODE_RATE_1_2
,
585
16);
586
return
mode;
587
}
588
589
WifiMode
590
WifiPhy::GetOfdmRate36Mbps
()
591
{
592
static
WifiMode
mode =
593
WifiModeFactory::CreateWifiMode
(
"OfdmRate36Mbps"
,
594
WIFI_MOD_CLASS_OFDM
,
595
false
,
596
20000000, 36000000,
597
WIFI_CODE_RATE_3_4
,
598
16);
599
return
mode;
600
}
601
602
WifiMode
603
WifiPhy::GetOfdmRate48Mbps
()
604
{
605
static
WifiMode
mode =
606
WifiModeFactory::CreateWifiMode
(
"OfdmRate48Mbps"
,
607
WIFI_MOD_CLASS_OFDM
,
608
false
,
609
20000000, 48000000,
610
WIFI_CODE_RATE_2_3
,
611
64);
612
return
mode;
613
}
614
615
WifiMode
616
WifiPhy::GetOfdmRate54Mbps
()
617
{
618
static
WifiMode
mode =
619
WifiModeFactory::CreateWifiMode
(
"OfdmRate54Mbps"
,
620
WIFI_MOD_CLASS_OFDM
,
621
false
,
622
20000000, 54000000,
623
WIFI_CODE_RATE_3_4
,
624
64);
625
return
mode;
626
}
627
628
/* 10 MHz channel rates */
629
WifiMode
630
WifiPhy::GetOfdmRate3MbpsBW10MHz
()
631
{
632
static
WifiMode
mode =
633
WifiModeFactory::CreateWifiMode
(
"OfdmRate3MbpsBW10MHz"
,
634
WIFI_MOD_CLASS_OFDM
,
635
true
,
636
10000000, 3000000,
637
WIFI_CODE_RATE_1_2
,
638
2);
639
return
mode;
640
}
641
642
WifiMode
643
WifiPhy::GetOfdmRate4_5MbpsBW10MHz
()
644
{
645
static
WifiMode
mode =
646
WifiModeFactory::CreateWifiMode
(
"OfdmRate4_5MbpsBW10MHz"
,
647
WIFI_MOD_CLASS_OFDM
,
648
false
,
649
10000000, 4500000,
650
WIFI_CODE_RATE_3_4
,
651
2);
652
return
mode;
653
}
654
655
WifiMode
656
WifiPhy::GetOfdmRate6MbpsBW10MHz
()
657
{
658
static
WifiMode
mode =
659
WifiModeFactory::CreateWifiMode
(
"OfdmRate6MbpsBW10MHz"
,
660
WIFI_MOD_CLASS_OFDM
,
661
true
,
662
10000000, 6000000,
663
WIFI_CODE_RATE_1_2
,
664
4);
665
return
mode;
666
}
667
668
WifiMode
669
WifiPhy::GetOfdmRate9MbpsBW10MHz
()
670
{
671
static
WifiMode
mode =
672
WifiModeFactory::CreateWifiMode
(
"OfdmRate9MbpsBW10MHz"
,
673
WIFI_MOD_CLASS_OFDM
,
674
false
,
675
10000000, 9000000,
676
WIFI_CODE_RATE_3_4
,
677
4);
678
return
mode;
679
}
680
681
WifiMode
682
WifiPhy::GetOfdmRate12MbpsBW10MHz
()
683
{
684
static
WifiMode
mode =
685
WifiModeFactory::CreateWifiMode
(
"OfdmRate12MbpsBW10MHz"
,
686
WIFI_MOD_CLASS_OFDM
,
687
true
,
688
10000000, 12000000,
689
WIFI_CODE_RATE_1_2
,
690
16);
691
return
mode;
692
}
693
694
WifiMode
695
WifiPhy::GetOfdmRate18MbpsBW10MHz
()
696
{
697
static
WifiMode
mode =
698
WifiModeFactory::CreateWifiMode
(
"OfdmRate18MbpsBW10MHz"
,
699
WIFI_MOD_CLASS_OFDM
,
700
false
,
701
10000000, 18000000,
702
WIFI_CODE_RATE_3_4
,
703
16);
704
return
mode;
705
}
706
707
WifiMode
708
WifiPhy::GetOfdmRate24MbpsBW10MHz
()
709
{
710
static
WifiMode
mode =
711
WifiModeFactory::CreateWifiMode
(
"OfdmRate24MbpsBW10MHz"
,
712
WIFI_MOD_CLASS_OFDM
,
713
false
,
714
10000000, 24000000,
715
WIFI_CODE_RATE_2_3
,
716
64);
717
return
mode;
718
}
719
720
WifiMode
721
WifiPhy::GetOfdmRate27MbpsBW10MHz
()
722
{
723
static
WifiMode
mode =
724
WifiModeFactory::CreateWifiMode
(
"OfdmRate27MbpsBW10MHz"
,
725
WIFI_MOD_CLASS_OFDM
,
726
false
,
727
10000000, 27000000,
728
WIFI_CODE_RATE_3_4
,
729
64);
730
return
mode;
731
}
732
733
/* 5 MHz channel rates */
734
WifiMode
735
WifiPhy::GetOfdmRate1_5MbpsBW5MHz
()
736
{
737
static
WifiMode
mode =
738
WifiModeFactory::CreateWifiMode
(
"OfdmRate1_5MbpsBW5MHz"
,
739
WIFI_MOD_CLASS_OFDM
,
740
true
,
741
5000000, 1500000,
742
WIFI_CODE_RATE_1_2
,
743
2);
744
return
mode;
745
}
746
747
WifiMode
748
WifiPhy::GetOfdmRate2_25MbpsBW5MHz
()
749
{
750
static
WifiMode
mode =
751
WifiModeFactory::CreateWifiMode
(
"OfdmRate2_25MbpsBW5MHz"
,
752
WIFI_MOD_CLASS_OFDM
,
753
false
,
754
5000000, 2250000,
755
WIFI_CODE_RATE_3_4
,
756
2);
757
return
mode;
758
}
759
760
WifiMode
761
WifiPhy::GetOfdmRate3MbpsBW5MHz
()
762
{
763
static
WifiMode
mode =
764
WifiModeFactory::CreateWifiMode
(
"OfdmRate3MbpsBW5MHz"
,
765
WIFI_MOD_CLASS_OFDM
,
766
true
,
767
5000000, 3000000,
768
WIFI_CODE_RATE_1_2
,
769
4);
770
return
mode;
771
}
772
773
WifiMode
774
WifiPhy::GetOfdmRate4_5MbpsBW5MHz
()
775
{
776
static
WifiMode
mode =
777
WifiModeFactory::CreateWifiMode
(
"OfdmRate4_5MbpsBW5MHz"
,
778
WIFI_MOD_CLASS_OFDM
,
779
false
,
780
5000000, 4500000,
781
WIFI_CODE_RATE_3_4
,
782
4);
783
return
mode;
784
}
785
786
WifiMode
787
WifiPhy::GetOfdmRate6MbpsBW5MHz
()
788
{
789
static
WifiMode
mode =
790
WifiModeFactory::CreateWifiMode
(
"OfdmRate6MbpsBW5MHz"
,
791
WIFI_MOD_CLASS_OFDM
,
792
true
,
793
5000000, 6000000,
794
WIFI_CODE_RATE_1_2
,
795
16);
796
return
mode;
797
}
798
799
WifiMode
800
WifiPhy::GetOfdmRate9MbpsBW5MHz
()
801
{
802
static
WifiMode
mode =
803
WifiModeFactory::CreateWifiMode
(
"OfdmRate9MbpsBW5MHz"
,
804
WIFI_MOD_CLASS_OFDM
,
805
false
,
806
5000000, 9000000,
807
WIFI_CODE_RATE_3_4
,
808
16);
809
return
mode;
810
}
811
812
WifiMode
813
WifiPhy::GetOfdmRate12MbpsBW5MHz
()
814
{
815
static
WifiMode
mode =
816
WifiModeFactory::CreateWifiMode
(
"OfdmRate12MbpsBW5MHz"
,
817
WIFI_MOD_CLASS_OFDM
,
818
false
,
819
5000000, 12000000,
820
WIFI_CODE_RATE_2_3
,
821
64);
822
return
mode;
823
}
824
825
WifiMode
826
WifiPhy::GetOfdmRate13_5MbpsBW5MHz
()
827
{
828
static
WifiMode
mode =
829
WifiModeFactory::CreateWifiMode
(
"OfdmRate13_5MbpsBW5MHz"
,
830
WIFI_MOD_CLASS_OFDM
,
831
false
,
832
5000000, 13500000,
833
WIFI_CODE_RATE_3_4
,
834
64);
835
return
mode;
836
}
837
838
std::ostream&
operator<<
(std::ostream& os,
enum
WifiPhy::State
state)
839
{
840
switch
(state)
841
{
842
case
WifiPhy::IDLE
:
843
return
(os <<
"IDLE"
);
844
case
WifiPhy::CCA_BUSY
:
845
return
(os <<
"CCA_BUSY"
);
846
case
WifiPhy::TX
:
847
return
(os <<
"TX"
);
848
case
WifiPhy::RX
:
849
return
(os <<
"RX"
);
850
case
WifiPhy::SWITCHING
:
851
return
(os <<
"SWITCHING"
);
852
default
:
853
NS_FATAL_ERROR
(
"Invalid WifiPhy state"
);
854
return
(os <<
"INVALID"
);
855
}
856
}
857
858
}
// namespace ns3
859
860
namespace
{
861
862
static
class
Constructor
863
{
864
public
:
865
Constructor
()
866
{
867
ns3::WifiPhy::GetDsssRate1Mbps
();
868
ns3::WifiPhy::GetDsssRate2Mbps
();
869
ns3::WifiPhy::GetDsssRate5_5Mbps
();
870
ns3::WifiPhy::GetDsssRate11Mbps
();
871
ns3::WifiPhy::GetErpOfdmRate6Mbps
();
872
ns3::WifiPhy::GetErpOfdmRate9Mbps
();
873
ns3::WifiPhy::GetErpOfdmRate12Mbps
();
874
ns3::WifiPhy::GetErpOfdmRate18Mbps
();
875
ns3::WifiPhy::GetErpOfdmRate24Mbps
();
876
ns3::WifiPhy::GetErpOfdmRate36Mbps
();
877
ns3::WifiPhy::GetErpOfdmRate48Mbps
();
878
ns3::WifiPhy::GetErpOfdmRate54Mbps
();
879
ns3::WifiPhy::GetOfdmRate6Mbps
();
880
ns3::WifiPhy::GetOfdmRate9Mbps
();
881
ns3::WifiPhy::GetOfdmRate12Mbps
();
882
ns3::WifiPhy::GetOfdmRate18Mbps
();
883
ns3::WifiPhy::GetOfdmRate24Mbps
();
884
ns3::WifiPhy::GetOfdmRate36Mbps
();
885
ns3::WifiPhy::GetOfdmRate48Mbps
();
886
ns3::WifiPhy::GetOfdmRate54Mbps
();
887
ns3::WifiPhy::GetOfdmRate3MbpsBW10MHz
();
888
ns3::WifiPhy::GetOfdmRate4_5MbpsBW10MHz
();
889
ns3::WifiPhy::GetOfdmRate6MbpsBW10MHz
();
890
ns3::WifiPhy::GetOfdmRate9MbpsBW10MHz
();
891
ns3::WifiPhy::GetOfdmRate12MbpsBW10MHz
();
892
ns3::WifiPhy::GetOfdmRate18MbpsBW10MHz
();
893
ns3::WifiPhy::GetOfdmRate24MbpsBW10MHz
();
894
ns3::WifiPhy::GetOfdmRate27MbpsBW10MHz
();
895
ns3::WifiPhy::GetOfdmRate1_5MbpsBW5MHz
();
896
ns3::WifiPhy::GetOfdmRate2_25MbpsBW5MHz
();
897
ns3::WifiPhy::GetOfdmRate3MbpsBW5MHz
();
898
ns3::WifiPhy::GetOfdmRate4_5MbpsBW5MHz
();
899
ns3::WifiPhy::GetOfdmRate6MbpsBW5MHz
();
900
ns3::WifiPhy::GetOfdmRate9MbpsBW5MHz
();
901
ns3::WifiPhy::GetOfdmRate12MbpsBW5MHz
();
902
ns3::WifiPhy::GetOfdmRate13_5MbpsBW5MHz
();
903
}
904
}
g_constructor
;
905
}
src
wifi
model
wifi-phy.cc
Generated on Tue May 14 2013 11:08:36 for ns-3 by
1.8.1.2