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#include "ns3/wifi-export.h"
16
17namespace ns3
18{
19
20/**
21 * @ingroup wifi
22 * @brief the interface for Wifi's error models
23 *
24 */
25class WIFI_EXPORT ErrorRateModel : public Object
26{
27 public:
28 /**
29 * @brief Get the type ID.
30 * @return the object TypeId
31 */
32 static TypeId GetTypeId();
33
34 /**
35 * @param txVector a specific transmission vector including WifiMode
36 * @param ber a target BER
37 *
38 * @return the SNR which corresponds to the requested BER
39 */
40 double CalculateSnr(const WifiTxVector& txVector, double ber) const;
41
42 /**
43 * @return true if the model is for AWGN channels,
44 * false otherwise
45 */
46 virtual bool IsAwgn() const;
47
48 /**
49 * This method returns the probability that the given 'chunk' of the
50 * packet will be successfully received by the PHY.
51 *
52 * A chunk can be viewed as a part of a packet with equal SNR.
53 * The probability of successfully receiving the chunk depends on
54 * the mode, the SNR, and the size of the chunk.
55 *
56 * Note that both a WifiMode and a WifiTxVector (which contains a WifiMode)
57 * are passed into this method. The WifiTxVector may be from a signal that
58 * contains multiple modes (e.g. PHY header sent differently from PHY
59 * payload). Consequently, the mode parameter is what the method uses
60 * to calculate the chunk error rate, and the txVector is used for
61 * other information as needed.
62 *
63 * This method handles 802.11b rates by using the DSSS error rate model.
64 * For all other rates, the method implemented by the subclass is called.
65 *
66 * @param mode the Wi-Fi mode applicable to this chunk
67 * @param txVector TXVECTOR of the overall transmission
68 * @param snr the SNR of the chunk
69 * @param nbits the number of bits in this chunk
70 * @param numRxAntennas the number of active RX antennas (1 if not provided)
71 * @param field the PPDU field to which the chunk belongs to (assumes this is for the payload
72 * part if not provided)
73 * @param staId the station ID for MU
74 *
75 * @return probability of successfully receiving the chunk
76 */
77 double GetChunkSuccessRate(WifiMode mode,
78 const WifiTxVector& txVector,
79 double snr,
80 uint64_t nbits,
81 uint8_t numRxAntennas = 1,
83 uint16_t staId = SU_STA_ID) const;
84
85 /**
86 * Assign a fixed random variable stream number to the random variables
87 * used by this model. Return the number of streams (possibly zero) that
88 * have been assigned.
89 *
90 * @param stream first stream index to use
91 * @return the number of stream indices assigned by this model
92 */
93 virtual int64_t AssignStreams(int64_t stream);
94
95 private:
96 /**
97 * A pure virtual method that must be implemented in the subclass.
98 *
99 * @param mode the Wi-Fi mode applicable to this chunk
100 * @param txVector TXVECTOR of the overall transmission
101 * @param snr the SNR of the chunk
102 * @param nbits the number of bits in this chunk
103 * @param numRxAntennas the number of active RX antennas
104 * @param field the PPDU field to which the chunk belongs to
105 * @param staId the station ID for MU
106 *
107 * @return probability of successfully receiving the chunk
108 */
109 virtual double DoGetChunkSuccessRate(WifiMode mode,
110 const WifiTxVector& txVector,
111 double snr,
112 uint64_t nbits,
113 uint8_t numRxAntennas,
114 WifiPpduField field,
115 uint16_t staId) const = 0;
116};
117
118} // namespace ns3
119
120#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
Object()
Caller graph was not generated because of its size.
Definition object.cc:93
a unique identifier for an interface.
Definition type-id.h:50
represent a single transmission mode
Definition wifi-mode.h:39
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).