LEFT | RIGHT |
(no file at all) | |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2010 The Boeing Company | 3 * Copyright (c) 2010 The Boeing Company |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 double | 34 double |
35 DsssErrorRateModel::DqpskFunction (double x) | 35 DsssErrorRateModel::DqpskFunction (double x) |
36 { | 36 { |
37 NS_LOG_FUNCTION_NOARGS (); | 37 NS_LOG_FUNCTION_NOARGS (); |
38 return ((std::sqrt (2.0) + 1.0) / std::sqrt (8.0 * M_PI * std::sqrt (2.0))) | 38 return ((std::sqrt (2.0) + 1.0) / std::sqrt (8.0 * M_PI * std::sqrt (2.0))) |
39 * (1.0 / std::sqrt (x)) * std::exp ( -(2.0 - std::sqrt (2.0)) * x); | 39 * (1.0 / std::sqrt (x)) * std::exp ( -(2.0 - std::sqrt (2.0)) * x); |
40 } | 40 } |
41 | 41 |
42 double | 42 double |
43 DsssErrorRateModel::GetDsssDbpskSuccessRate (double sinr, uint32_t nbits) | 43 DsssErrorRateModel::GetDsssDbpskSuccessRate (double sinr, uint64_t nbits) |
44 { | 44 { |
45 NS_LOG_FUNCTION_NOARGS (); | 45 NS_LOG_FUNCTION_NOARGS (); |
46 double EbN0 = sinr * 22000000.0 / 1000000.0; //1 bit per symbol with 1 MSPS | 46 double EbN0 = sinr * 22000000.0 / 1000000.0; //1 bit per symbol with 1 MSPS |
47 double ber = 0.5 * std::exp (-EbN0); | 47 double ber = 0.5 * std::exp (-EbN0); |
48 return std::pow ((1.0 - ber), static_cast<double> (nbits)); | 48 return std::pow ((1.0 - ber), static_cast<double> (nbits)); |
49 } | 49 } |
50 | 50 |
51 double | 51 double |
52 DsssErrorRateModel::GetDsssDqpskSuccessRate (double sinr, uint32_t nbits) | 52 DsssErrorRateModel::GetDsssDqpskSuccessRate (double sinr, uint64_t nbits) |
53 { | 53 { |
54 NS_LOG_FUNCTION_NOARGS (); | 54 NS_LOG_FUNCTION_NOARGS (); |
55 double EbN0 = sinr * 22000000.0 / 1000000.0 / 2.0; //2 bits per symbol, 1 MSPS | 55 double EbN0 = sinr * 22000000.0 / 1000000.0 / 2.0; //2 bits per symbol, 1 MSPS |
56 double ber = DqpskFunction (EbN0); | 56 double ber = DqpskFunction (EbN0); |
57 return std::pow ((1.0 - ber), static_cast<double> (nbits)); | 57 return std::pow ((1.0 - ber), static_cast<double> (nbits)); |
58 } | 58 } |
59 | 59 |
60 double | 60 double |
61 DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (double sinr, uint32_t nbits) | 61 DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (double sinr, uint64_t nbits) |
62 { | 62 { |
63 NS_LOG_FUNCTION_NOARGS (); | 63 NS_LOG_FUNCTION_NOARGS (); |
64 #ifdef HAVE_GSL | 64 #ifdef HAVE_GSL |
65 //symbol error probability | 65 //symbol error probability |
66 double EbN0 = sinr * 22000000.0 / 1375000.0 / 4.0; | 66 double EbN0 = sinr * 22000000.0 / 1375000.0 / 4.0; |
67 double sep = SymbolErrorProb16Cck (4.0 * EbN0 / 2.0); | 67 double sep = SymbolErrorProb16Cck (4.0 * EbN0 / 2.0); |
68 return std::pow (1.0 - sep, nbits / 4.0); | 68 return std::pow (1.0 - sep, nbits / 4.0); |
69 #else | 69 #else |
70 NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model"
); | 70 NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model"
); |
71 //The matlab model | 71 //The matlab model |
(...skipping 13 matching lines...) Expand all Loading... |
85 double a2 = 3.3092430025608586e-003; | 85 double a2 = 3.3092430025608586e-003; |
86 double a3 = 4.1654372361004000e-001; | 86 double a3 = 4.1654372361004000e-001; |
87 double a4 = 1.0288981434358866e+000; | 87 double a4 = 1.0288981434358866e+000; |
88 ber = a1 * std::exp (-std::pow ((sinr - a2) / a3, a4)); | 88 ber = a1 * std::exp (-std::pow ((sinr - a2) / a3, a4)); |
89 } | 89 } |
90 return std::pow ((1.0 - ber), static_cast<double> (nbits)); | 90 return std::pow ((1.0 - ber), static_cast<double> (nbits)); |
91 #endif | 91 #endif |
92 } | 92 } |
93 | 93 |
94 double | 94 double |
95 DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (double sinr, uint32_t nbits) | 95 DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (double sinr, uint64_t nbits) |
96 { | 96 { |
97 NS_LOG_FUNCTION_NOARGS (); | 97 NS_LOG_FUNCTION_NOARGS (); |
98 #ifdef HAVE_GSL | 98 #ifdef HAVE_GSL |
99 NS_LOG_DEBUG ("GSL enabled "); | 99 NS_LOG_DEBUG ("GSL enabled "); |
100 //symbol error probability | 100 //symbol error probability |
101 double EbN0 = sinr * 22000000.0 / 1375000.0 / 8.0; | 101 double EbN0 = sinr * 22000000.0 / 1375000.0 / 8.0; |
102 double sep = SymbolErrorProb256Cck (8.0 * EbN0 / 2.0); | 102 double sep = SymbolErrorProb256Cck (8.0 * EbN0 / 2.0); |
103 return std::pow (1.0 - sep, nbits / 8.0); | 103 return std::pow (1.0 - sep, nbits / 8.0); |
104 #else | 104 #else |
105 NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model"
); | 105 NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model"
); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 double DsssErrorRateModel::SymbolErrorProb256Cck (double e1) | 168 double DsssErrorRateModel::SymbolErrorProb256Cck (double e1) |
169 { | 169 { |
170 return 1.0 - std::pow (1.0 - SymbolErrorProb16Cck (e1 / 2.0), 2.0); | 170 return 1.0 - std::pow (1.0 - SymbolErrorProb16Cck (e1 / 2.0), 2.0); |
171 } | 171 } |
172 | 172 |
173 #endif | 173 #endif |
174 | 174 |
175 } //namespace ns3 | 175 } //namespace ns3 |
LEFT | RIGHT |