author | Vedran Miletić <rivanvx@gmail.com> |
Sat, 01 Sep 2012 20:57:21 +0200 | |
changeset 9063 | 32755d0516f4 |
parent 7385 | 10beb0e53130 |
child 9070 | 0d6be2f9c438 |
permissions | -rw-r--r-- |
7385
10beb0e53130
standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents:
7252
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
3903
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
2 |
/* |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
3 |
* Copyright (c) 2005,2006 INRIA |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
4 |
* |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
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 |
3903
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
7 |
* published by the Free Software Foundation; |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
8 |
* |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
12 |
* GNU General Public License for more details. |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
13 |
* |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
17 |
* |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
19 |
*/ |
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
20 |
|
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
21 |
#include <cmath> |
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
22 |
|
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
23 |
#include "yans-error-rate-model.h" |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
24 |
#include "wifi-phy.h" |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include "ns3/log.h" |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
|
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
27 |
NS_LOG_COMPONENT_DEFINE ("YansErrorRateModel"); |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
namespace ns3 { |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
|
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
31 |
NS_OBJECT_ENSURE_REGISTERED (YansErrorRateModel); |
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3903
diff
changeset
|
32 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
33 |
TypeId |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
34 |
YansErrorRateModel::GetTypeId (void) |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
{ |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
36 |
static TypeId tid = TypeId ("ns3::YansErrorRateModel") |
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
37 |
.SetParent<ErrorRateModel> () |
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
38 |
.AddConstructor<YansErrorRateModel> () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
39 |
; |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
40 |
return tid; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
41 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
42 |
|
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
43 |
YansErrorRateModel::YansErrorRateModel () |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
44 |
{ |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
45 |
} |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
47 |
double |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
48 |
YansErrorRateModel::Log2 (double val) const |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
49 |
{ |
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
50 |
return std::log (val) / std::log (2.0); |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
51 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
52 |
double |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
53 |
YansErrorRateModel::GetBpskBer (double snr, uint32_t signalSpread, uint32_t phyRate) const |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
54 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
55 |
double EbNo = snr * signalSpread / phyRate; |
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
56 |
double z = std::sqrt (EbNo); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
57 |
double ber = 0.5 * erfc (z); |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
58 |
NS_LOG_INFO ("bpsk snr=" << snr << " ber=" << ber); |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
59 |
return ber; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
60 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
61 |
double |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
62 |
YansErrorRateModel::GetQamBer (double snr, unsigned int m, uint32_t signalSpread, uint32_t phyRate) const |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
63 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
64 |
double EbNo = snr * signalSpread / phyRate; |
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
65 |
double z = std::sqrt ((1.5 * Log2 (m) * EbNo) / (m - 1.0)); |
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
66 |
double z1 = ((1.0 - 1.0 / std::sqrt (m)) * erfc (z)); |
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
67 |
double z2 = 1 - std::pow ((1 - z1), 2.0); |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
68 |
double ber = z2 / Log2 (m); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
69 |
NS_LOG_INFO ("Qam m=" << m << " rate=" << phyRate << " snr=" << snr << " ber=" << ber); |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
70 |
return ber; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
71 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
72 |
uint32_t |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
73 |
YansErrorRateModel::Factorial (uint32_t k) const |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
74 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
75 |
uint32_t fact = 1; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
76 |
while (k > 0) |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
77 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
78 |
fact *= k; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
79 |
k--; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
80 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
81 |
return fact; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
82 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
83 |
double |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
84 |
YansErrorRateModel::Binomial (uint32_t k, double p, uint32_t n) const |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
85 |
{ |
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
86 |
double retval = Factorial (n) / (Factorial (k) * Factorial (n - k)) * std::pow (p, k) * std::pow (1 - p, n - k); |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
87 |
return retval; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
88 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
89 |
double |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
90 |
YansErrorRateModel::CalculatePdOdd (double ber, unsigned int d) const |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
91 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
92 |
NS_ASSERT ((d % 2) == 1); |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
93 |
unsigned int dstart = (d + 1) / 2; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
94 |
unsigned int dend = d; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
95 |
double pd = 0; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
96 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
97 |
for (unsigned int i = dstart; i < dend; i++) |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
98 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
99 |
pd += Binomial (i, ber, d); |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
100 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
101 |
return pd; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
102 |
} |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
103 |
double |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
104 |
YansErrorRateModel::CalculatePdEven (double ber, unsigned int d) const |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
105 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
106 |
NS_ASSERT ((d % 2) == 0); |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
107 |
unsigned int dstart = d / 2 + 1; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
108 |
unsigned int dend = d; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
109 |
double pd = 0; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
110 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
111 |
for (unsigned int i = dstart; i < dend; i++) |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
112 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
113 |
pd += Binomial (i, ber, d); |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
114 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
115 |
pd += 0.5 * Binomial (d / 2, ber, d); |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
116 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
117 |
return pd; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
118 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
119 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
120 |
double |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
121 |
YansErrorRateModel::CalculatePd (double ber, unsigned int d) const |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
122 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
123 |
double pd; |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
124 |
if ((d % 2) == 0) |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
125 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
126 |
pd = CalculatePdEven (ber, d); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
127 |
} |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
128 |
else |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
129 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
130 |
pd = CalculatePdOdd (ber, d); |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
131 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
132 |
return pd; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
133 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
134 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
135 |
double |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
136 |
YansErrorRateModel::GetFecBpskBer (double snr, double nbits, |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
137 |
uint32_t signalSpread, uint32_t phyRate, |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
138 |
uint32_t dFree, uint32_t adFree) const |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
139 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
140 |
double ber = GetBpskBer (snr, signalSpread, phyRate); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
141 |
if (ber == 0.0) |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
142 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
143 |
return 1.0; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
144 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
145 |
double pd = CalculatePd (ber, dFree); |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
146 |
double pmu = adFree * pd; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
147 |
pmu = std::min (pmu, 1.0); |
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
148 |
double pms = std::pow (1 - pmu, nbits); |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
149 |
return pms; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
150 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
151 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
152 |
double |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
153 |
YansErrorRateModel::GetFecQamBer (double snr, uint32_t nbits, |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
154 |
uint32_t signalSpread, |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
155 |
uint32_t phyRate, |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
156 |
uint32_t m, uint32_t dFree, |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
157 |
uint32_t adFree, uint32_t adFreePlusOne) const |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
158 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
159 |
double ber = GetQamBer (snr, m, signalSpread, phyRate); |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
160 |
if (ber == 0.0) |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
161 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
162 |
return 1.0; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
163 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
164 |
/* first term */ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
165 |
double pd = CalculatePd (ber, dFree); |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
166 |
double pmu = adFree * pd; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
167 |
/* second term */ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
168 |
pd = CalculatePd (ber, dFree + 1); |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
169 |
pmu += adFreePlusOne * pd; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
170 |
pmu = std::min (pmu, 1.0); |
9063
32755d0516f4
Bug 1237 - code cleanups related to includes
Vedran Miletić <rivanvx@gmail.com>
parents:
7385
diff
changeset
|
171 |
double pms = std::pow (1 - pmu, nbits); |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
172 |
return pms; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
173 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
174 |
|
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
175 |
double |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
176 |
YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
177 |
{ |
7141
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
178 |
if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM |
072fb225b714
run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents:
6852
diff
changeset
|
179 |
|| mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM) |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
180 |
{ |
6360
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
181 |
if (mode.GetConstellationSize () == 2) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
182 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
183 |
if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
184 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
185 |
return GetFecBpskBer (snr, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
186 |
nbits, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
187 |
mode.GetBandwidth (), // signal spread |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
188 |
mode.GetPhyRate (), // phy rate |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
189 |
10, // dFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
190 |
11 // adFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
191 |
); |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
192 |
} |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
193 |
else |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
194 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
195 |
return GetFecBpskBer (snr, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
196 |
nbits, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
197 |
mode.GetBandwidth (), // signal spread |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
198 |
mode.GetPhyRate (), // phy rate |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
199 |
5, // dFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
200 |
8 // adFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
201 |
); |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
202 |
} |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
203 |
} |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
204 |
else if (mode.GetConstellationSize () == 4) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
205 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
206 |
if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
207 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
208 |
return GetFecQamBer (snr, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
209 |
nbits, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
210 |
mode.GetBandwidth (), // signal spread |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
211 |
mode.GetPhyRate (), // phy rate |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
212 |
4, // m |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
213 |
10, // dFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
214 |
11, // adFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
215 |
0 // adFreePlusOne |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
216 |
); |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
217 |
} |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
218 |
else |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
219 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
220 |
return GetFecQamBer (snr, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
221 |
nbits, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
222 |
mode.GetBandwidth (), // signal spread |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
223 |
mode.GetPhyRate (), // phy rate |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
224 |
4, // m |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
225 |
5, // dFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
226 |
8, // adFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
227 |
31 // adFreePlusOne |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
228 |
); |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
229 |
} |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
230 |
} |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
231 |
else if (mode.GetConstellationSize () == 16) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
232 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
233 |
if (mode.GetCodeRate () == WIFI_CODE_RATE_1_2) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
234 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
235 |
return GetFecQamBer (snr, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
236 |
nbits, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
237 |
mode.GetBandwidth (), // signal spread |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
238 |
mode.GetPhyRate (), // phy rate |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
239 |
16, // m |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
240 |
10, // dFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
241 |
11, // adFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
242 |
0 // adFreePlusOne |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
243 |
); |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
244 |
} |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
245 |
else |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
246 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
247 |
return GetFecQamBer (snr, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
248 |
nbits, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
249 |
mode.GetBandwidth (), // signal spread |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
250 |
mode.GetPhyRate (), // phy rate |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
251 |
16, // m |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
252 |
5, // dFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
253 |
8, // adFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
254 |
31 // adFreePlusOne |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
255 |
); |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
256 |
} |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
257 |
} |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
258 |
else if (mode.GetConstellationSize () == 64) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
259 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
260 |
if (mode.GetCodeRate () == WIFI_CODE_RATE_2_3) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
261 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
262 |
return GetFecQamBer (snr, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
263 |
nbits, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
264 |
mode.GetBandwidth (), // signal spread |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
265 |
mode.GetPhyRate (), // phy rate |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
266 |
64, // m |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
267 |
6, // dFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
268 |
1, // adFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
269 |
16 // adFreePlusOne |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
270 |
); |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
271 |
} |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
272 |
else |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
273 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
274 |
return GetFecQamBer (snr, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
275 |
nbits, |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
276 |
mode.GetBandwidth (), // signal spread |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
277 |
mode.GetPhyRate (), // phy rate |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
278 |
64, // m |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
279 |
5, // dFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
280 |
8, // adFree |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
281 |
31 // adFreePlusOne |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
282 |
); |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
283 |
} |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
284 |
} |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
285 |
} |
6360
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
286 |
else if (mode.GetModulationClass () == WIFI_MOD_CLASS_DSSS) |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
287 |
{ |
6360
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
288 |
switch (mode.GetDataRate ()) |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
289 |
{ |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
290 |
case 1000000: |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
291 |
return DsssErrorRateModel::GetDsssDbpskSuccessRate (snr, nbits); |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
292 |
case 2000000: |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
293 |
return DsssErrorRateModel::GetDsssDqpskSuccessRate (snr, nbits); |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
294 |
case 5500000: |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
295 |
return DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (snr, nbits); |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
296 |
case 11000000: |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
297 |
return DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (snr, nbits); |
d8975477ff6a
Bug 871: Rework construction of Wi-Fi rates
Dean Armstrong <deanarm@gmail.com>
parents:
6357
diff
changeset
|
298 |
} |
4470 | 299 |
} |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
300 |
return 0; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
301 |
} |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
302 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
303 |
} // namespace ns3 |