author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
Tue, 28 Oct 2008 11:26:58 +0100 | |
changeset 3906 | 01acc159ffb1 |
parent 3905 | 99c9346b5d71 |
child 4038 | c6f634d0fc6f |
permissions | -rw-r--r-- |
3903
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
1 |
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
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 |
714f93024a37
add missing license headers
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3902
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
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 |
*/ |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
20 |
#ifndef ERROR_RATE_MODEL_H |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
21 |
#define ERROR_RATE_MODEL_H |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
22 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
23 |
#include <stdint.h> |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
24 |
#include "wifi-mode.h" |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
25 |
#include "ns3/object.h" |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
26 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
27 |
namespace ns3 { |
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 |
class ErrorRateModel : public Object |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
30 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
31 |
public: |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
32 |
static TypeId GetTypeId (void); |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
33 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
34 |
ErrorRateModel (); |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
35 |
|
3905
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3903
diff
changeset
|
36 |
/** |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3903
diff
changeset
|
37 |
* \param txMode a specific transmission mode |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3903
diff
changeset
|
38 |
* \param ber a target ber |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3903
diff
changeset
|
39 |
* \returns the snr which corresponds to the requested |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3903
diff
changeset
|
40 |
* ber. |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3903
diff
changeset
|
41 |
*/ |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3903
diff
changeset
|
42 |
double CalculateSnr (WifiMode txMode, double ber) const; |
99c9346b5d71
split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3903
diff
changeset
|
43 |
|
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
44 |
double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
45 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
46 |
private: |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
47 |
double Log2 (double val) const; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
48 |
double GetBpskBer (double snr, uint32_t signalSpread, uint32_t phyRate) const; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
49 |
double GetQamBer (double snr, unsigned int m, uint32_t signalSpread, uint32_t phyRate) const; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
50 |
uint32_t Factorial (uint32_t k) const; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
51 |
double Binomial (uint32_t k, double p, uint32_t n) const; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
52 |
double CalculatePdOdd (double ber, unsigned int d) const; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
53 |
double CalculatePdEven (double ber, unsigned int d) const; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
54 |
double CalculatePd (double ber, unsigned int d) const; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
55 |
double GetFecBpskBer (double snr, double nbits, |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
56 |
uint32_t signalSpread, uint32_t phyRate, |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
57 |
uint32_t dFree, uint32_t adFree) const; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
58 |
double GetFecQamBer (double snr, uint32_t nbits, |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
59 |
uint32_t signalSpread, |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
60 |
uint32_t phyRate, |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
61 |
uint32_t m, uint32_t dfree, |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
62 |
uint32_t adFree, uint32_t adFreePlusOne) const; |
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 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
65 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
66 |
} // namespace ns3 |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
67 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
68 |
#endif /* ERROR_RATE_MODEL_H */ |