A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
error-rate-model.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
9#ifndef ERROR_RATE_MODEL_H
10#define ERROR_RATE_MODEL_H
11
12#include "wifi-mode.h"
13
14#include "ns3/object.h"
15
16namespace ns3
17{
18
19/**
20 * @ingroup wifi
21 * @brief the interface for Wifi's error models
22 *
23 */
24class ErrorRateModel : public Object
25{
26 public:
27 /**
28 * @brief Get the type ID.
29 * @return the object TypeId
30 */
31 static TypeId GetTypeId();
32
33 /**
34 * @param txVector a specific transmission vector including WifiMode
35 * @param ber a target BER
36 *
37 * @return the SNR which corresponds to the requested BER
38 */
39 double CalculateSnr(const WifiTxVector& txVector, double ber) const;
40
41 /**
42 * @return true if the model is for AWGN channels,
43 * false otherwise
44 */
45 virtual bool IsAwgn() const;
46
47 /**
48 * This method returns the probability that the given 'chunk' of the
49 * packet will be successfully received by the PHY.
50 *
51 * A chunk can be viewed as a part of a packet with equal SNR.
52 * The probability of successfully receiving the chunk depends on
53 * the mode, the SNR, and the size of the chunk.
54 *
55 * Note that both a WifiMode and a WifiTxVector (which contains a WifiMode)
56 * are passed into this method. The WifiTxVector may be from a signal that
57 * contains multiple modes (e.g. PHY header sent differently from PHY
58 * payload). Consequently, the mode parameter is what the method uses
59 * to calculate the chunk error rate, and the txVector is used for
60 * other information as needed.
61 *
62 * This method handles 802.11b rates by using the DSSS error rate model.
63 * For all other rates, the method implemented by the subclass is called.
64 *
65 * @param mode the Wi-Fi mode applicable to this chunk
66 * @param txVector TXVECTOR of the overall transmission
67 * @param snr the SNR of the chunk
68 * @param nbits the number of bits in this chunk
69 * @param numRxAntennas the number of active RX antennas (1 if not provided)
70 * @param field the PPDU field to which the chunk belongs to (assumes this is for the payload
71 * part if not provided)
72 * @param staId the station ID for MU
73 *
74 * @return probability of successfully receiving the chunk
75 */
76 double GetChunkSuccessRate(WifiMode mode,
77 const WifiTxVector& txVector,
78 double snr,
79 uint64_t nbits,
80 uint8_t numRxAntennas = 1,
82 uint16_t staId = SU_STA_ID) const;
83
84 /**
85 * Assign a fixed random variable stream number to the random variables
86 * used by this model. Return the number of streams (possibly zero) that
87 * have been assigned.
88 *
89 * @param stream first stream index to use
90 * @return the number of stream indices assigned by this model
91 */
92 virtual int64_t AssignStreams(int64_t stream);
93
94 private:
95 /**
96 * A pure virtual method that must be implemented in the subclass.
97 *
98 * @param mode the Wi-Fi mode applicable to this chunk
99 * @param txVector TXVECTOR of the overall transmission
100 * @param snr the SNR of the chunk
101 * @param nbits the number of bits in this chunk
102 * @param numRxAntennas the number of active RX antennas
103 * @param field the PPDU field to which the chunk belongs to
104 * @param staId the station ID for MU
105 *
106 * @return probability of successfully receiving the chunk
107 */
108 virtual double DoGetChunkSuccessRate(WifiMode mode,
109 const WifiTxVector& txVector,
110 double snr,
111 uint64_t nbits,
112 uint8_t numRxAntennas,
113 WifiPpduField field,
114 uint16_t staId) const = 0;
115};
116
117} // namespace ns3
118
119#endif /* ERROR_RATE_MODEL_H */
the interface for Wifi's error models
virtual bool IsAwgn() const
static TypeId GetTypeId()
Get the type ID.
double GetChunkSuccessRate(WifiMode mode, const WifiTxVector &txVector, double snr, uint64_t nbits, uint8_t numRxAntennas=1, WifiPpduField field=WIFI_PPDU_FIELD_DATA, uint16_t staId=SU_STA_ID) const
This method returns the probability that the given 'chunk' of the packet will be successfully receive...
virtual double DoGetChunkSuccessRate(WifiMode mode, const WifiTxVector &txVector, double snr, uint64_t nbits, uint8_t numRxAntennas, WifiPpduField field, uint16_t staId) const =0
A pure virtual method that must be implemented in the subclass.
virtual int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
double CalculateSnr(const WifiTxVector &txVector, double ber) const
A base class which provides memory management and object aggregation.
Definition object.h:78
a unique identifier for an interface.
Definition type-id.h:48
represent a single transmission mode
Definition wifi-mode.h:40
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiPpduField
The type of PPDU field (grouped for convenience)
@ WIFI_PPDU_FIELD_DATA
data field
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Definition wifi-mode.h:24