author | Nicola Baldo <nbaldo@cttc.es> |
Tue, 26 Oct 2010 13:47:48 +0200 | |
changeset 6643 | be1bb4b0431b |
parent 6357 | 5d6d511ce4e9 |
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 |
*/ |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
20 |
#ifndef YANS_ERROR_RATE_MODEL_H |
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
21 |
#define 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
|
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" |
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
25 |
#include "error-rate-model.h" |
6357
5d6d511ce4e9
Factor out DSSS error rate functions to separate class
Gary Pei <guangyu.pei@boeing.com>
parents:
4477
diff
changeset
|
26 |
#include "dsss-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
|
27 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
28 |
namespace ns3 { |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
29 |
|
4470 | 30 |
/** |
31 |
* \brief Model the error rate for different modulations. |
|
32 |
* |
|
33 |
* A packet of interest (e.g., a packet can potentially be received by the MAC) |
|
34 |
* is divided into chunks. Each chunk is related to an start/end receiving event. |
|
35 |
* For each chunk, it calculates the ratio (SINR) between received power of packet |
|
36 |
* of interest and summation of noise and interfering power of all the other incoming |
|
37 |
* packets. Then, it will calculate the success rate of the chunk based on |
|
38 |
* BER of the modulation. The success reception rate of the packet is derived from |
|
39 |
* the success rate of all chunks. |
|
40 |
* |
|
41 |
* The 802.11b modulations: |
|
42 |
* - 1 Mbps mode is based on DBPSK. BER is from equation 5.2-69 from John G. Proakis |
|
43 |
* Digitial Communications, 2001 edition |
|
44 |
* - 2 Mbps model is based on DQPSK. Equation 8 from "Tight bounds and accurate |
|
45 |
* approximations for dqpsk transmission bit error rate", G. Ferrari and G.E. Corazza |
|
46 |
* ELECTRONICS LETTERS, 40(20):1284-1285, September 2004 |
|
47 |
* - 5.5 Mbps and 11 Mbps are based on equations (18) and (17) from "Properties and |
|
48 |
* performance of the ieee 802.11b complementarycode-key signal sets", |
|
49 |
* Michael B. Pursley and Thomas C. Royster. IEEE TRANSACTIONS ON COMMUNICATIONS, |
|
50 |
* 57(2):440-449, February 2009. |
|
51 |
* - More detailed description and validation can be found in |
|
52 |
* http://www.nsnam.org/~pei/80211b.pdf |
|
53 |
*/ |
|
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
54 |
class YansErrorRateModel : public ErrorRateModel |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
55 |
{ |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
56 |
public: |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
57 |
static TypeId GetTypeId (void); |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
58 |
|
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
59 |
YansErrorRateModel (); |
3902
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
60 |
|
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
61 |
virtual double 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
|
62 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
63 |
private: |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
64 |
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
|
65 |
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
|
66 |
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
|
67 |
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
|
68 |
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
|
69 |
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
|
70 |
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
|
71 |
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
|
72 |
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
|
73 |
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
|
74 |
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
|
75 |
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
|
76 |
uint32_t signalSpread, |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
77 |
uint32_t phyRate, |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
78 |
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
|
79 |
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
|
80 |
}; |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
81 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
82 |
|
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
83 |
} // namespace ns3 |
9e048e073cf0
split the error rate model from the yans phy
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff
changeset
|
84 |
|
4038
c6f634d0fc6f
virtualize ErrorRateModel
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
3905
diff
changeset
|
85 |
#endif /* YANS_ERROR_RATE_MODEL_H */ |