A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
yans-error-rate-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 */
19
20#ifndef YANS_ERROR_RATE_MODEL_H
21#define YANS_ERROR_RATE_MODEL_H
22
23#include "error-rate-model.h"
24
25namespace ns3
26{
27
28/**
29 * \brief Model the error rate for different modulations.
30 * \ingroup wifi
31 *
32 * A packet of interest (e.g., a packet can potentially be received by the MAC)
33 * is divided into chunks. Each chunk is related to an start/end receiving event.
34 * For each chunk, it calculates the ratio (SINR) between received power of packet
35 * of interest and summation of noise and interfering power of all the other incoming
36 * packets. Then, it will calculate the success rate of the chunk based on
37 * BER of the modulation. The success reception rate of the packet is derived from
38 * the success rate of all chunks.
39 *
40 * The 802.11b modulations:
41 * - 1 Mbps mode is based on DBPSK. BER is from equation 5.2-69 from John G. Proakis
42 * Digital Communications, 2001 edition
43 * - 2 Mbps model is based on DQPSK. Equation 8 from "Tight bounds and accurate
44 * approximations for DQPSK transmission bit error rate", G. Ferrari and G.E. Corazza
45 * ELECTRONICS LETTERS, 40(20):1284-1285, September 2004
46 * - 5.5 Mbps and 11 Mbps are based on equations (18) and (17) from "Properties and
47 * performance of the IEEE 802.11b complementary code-key signal sets",
48 * Michael B. Pursley and Thomas C. Royster. IEEE TRANSACTIONS ON COMMUNICATIONS,
49 * 57(2):440-449, February 2009.
50 * - More detailed description and validation can be found in
51 * http://www.nsnam.org/~pei/80211b.pdf
52 */
54{
55 public:
56 /**
57 * \brief Get the type ID.
58 * \return the object TypeId
59 */
60 static TypeId GetTypeId();
61
63
64 private:
66 const WifiTxVector& txVector,
67 double snr,
68 uint64_t nbits,
69 uint8_t numRxAntennas,
70 WifiPpduField field,
71 uint16_t staId) const override;
72 /**
73 * Return BER of BPSK with the given parameters.
74 *
75 * \param snr SNR ratio (not dB)
76 * \param signalSpread
77 * \param phyRate
78 *
79 * \return BER of BPSK at the given SNR
80 */
81 double GetBpskBer(double snr, uint32_t signalSpread, uint64_t phyRate) const;
82 /**
83 * Return BER of QAM-m with the given parameters.
84 *
85 * \param snr SNR ratio (not dB)
86 * \param m
87 * \param signalSpread
88 * \param phyRate
89 *
90 * \return BER of BPSK at the given SNR
91 */
92 double GetQamBer(double snr, unsigned int m, uint32_t signalSpread, uint64_t phyRate) const;
93 /**
94 * Return k!
95 *
96 * \param k
97 *
98 * \return k!
99 */
100 uint32_t Factorial(uint32_t k) const;
101 /**
102 * Return Binomial distribution for a given k, p, and n
103 *
104 * \param k
105 * \param p
106 * \param n
107 *
108 * \return a Binomial distribution
109 */
110 double Binomial(uint32_t k, double p, uint32_t n) const;
111 /**
112 * \param ber
113 * \param d
114 *
115 * \return double
116 */
117 double CalculatePdOdd(double ber, unsigned int d) const;
118 /**
119 * \param ber
120 * \param d
121 *
122 * \return double
123 */
124 double CalculatePdEven(double ber, unsigned int d) const;
125 /**
126 * \param ber
127 * \param d
128 *
129 * \return double
130 */
131 double CalculatePd(double ber, unsigned int d) const;
132 /**
133 * \param snr SNR ratio (not dB)
134 * \param nbits
135 * \param signalSpread
136 * \param phyRate
137 * \param dFree
138 * \param adFree
139 *
140 * \return double
141 */
142 double GetFecBpskBer(double snr,
143 uint64_t nbits,
144 uint32_t signalSpread,
145 uint64_t phyRate,
146 uint32_t dFree,
147 uint32_t adFree) const;
148 /**
149 * \param snr SNR ratio (not dB)
150 * \param nbits
151 * \param signalSpread
152 * \param phyRate
153 * \param m
154 * \param dfree
155 * \param adFree
156 * \param adFreePlusOne
157 *
158 * \return double
159 */
160 double GetFecQamBer(double snr,
161 uint64_t nbits,
162 uint32_t signalSpread,
163 uint64_t phyRate,
164 uint32_t m,
165 uint32_t dfree,
166 uint32_t adFree,
167 uint32_t adFreePlusOne) const;
168};
169
170} // namespace ns3
171
172#endif /* YANS_ERROR_RATE_MODEL_H */
the interface for Wifi's error models
a unique identifier for an interface.
Definition: type-id.h:59
represent a single transmission mode
Definition: wifi-mode.h:51
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
Model the error rate for different modulations.
double GetFecBpskBer(double snr, uint64_t nbits, uint32_t signalSpread, uint64_t phyRate, uint32_t dFree, uint32_t adFree) const
double DoGetChunkSuccessRate(WifiMode mode, const WifiTxVector &txVector, double snr, uint64_t nbits, uint8_t numRxAntennas, WifiPpduField field, uint16_t staId) const override
A pure virtual method that must be implemented in the subclass.
static TypeId GetTypeId()
Get the type ID.
double Binomial(uint32_t k, double p, uint32_t n) const
Return Binomial distribution for a given k, p, and n.
double CalculatePdEven(double ber, unsigned int d) const
double GetQamBer(double snr, unsigned int m, uint32_t signalSpread, uint64_t phyRate) const
Return BER of QAM-m with the given parameters.
uint32_t Factorial(uint32_t k) const
Return k!
double CalculatePdOdd(double ber, unsigned int d) const
double GetFecQamBer(double snr, uint64_t nbits, uint32_t signalSpread, uint64_t phyRate, uint32_t m, uint32_t dfree, uint32_t adFree, uint32_t adFreePlusOne) const
double CalculatePd(double ber, unsigned int d) const
double GetBpskBer(double snr, uint32_t signalSpread, uint64_t phyRate) const
Return BER of BPSK with the given parameters.
WifiPpduField
The type of PPDU field (grouped for convenience)
Every class exported by the ns3 library is enclosed in the ns3 namespace.