src/wifi/model/nist-error-rate-model.h
author Junling Bu <linlinjavaer@gmail.com>
Tue, 03 Dec 2013 11:25:59 -0800
changeset 10459 f2e90c12a44f
parent 10424 9d29c9a5ddcb
child 10483 e3a02ed14587
permissions -rw-r--r--
base implementation of the IEEE 802.11p standard
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 7141
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
6358
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
     2
/*
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
     3
 * Copyright (c) 2010 The Boeing Company
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
     4
 *
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
6358
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
     8
 *
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    13
 *
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    17
 *
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    18
 * Author: Gary Pei <guangyu.pei@boeing.com>
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    19
 */
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    20
#ifndef NIST_ERROR_RATE_MODEL_H
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    21
#define NIST_ERROR_RATE_MODEL_H
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    22
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    23
#include <stdint.h>
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    24
#include "wifi-mode.h"
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    25
#include "error-rate-model.h"
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    26
#include "dsss-error-rate-model.h"
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    27
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    28
namespace ns3 {
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    29
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    30
/**
7139
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    31
 * \ingroup wifi
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    32
 *
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    33
 * A model for the error rate for different modulations.  For OFDM modulation,
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    34
 * the model description and validation can be found in
6358
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    35
 * http://www.nsnam.org/~pei/80211ofdm.pdf.  For DSSS modulations (802.11b),
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    36
 * the model uses the DsssErrorRateModel.
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    37
 */
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    38
class NistErrorRateModel : public ErrorRateModel
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    39
{
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    40
public:
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    41
  static TypeId GetTypeId (void);
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    42
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    43
  NistErrorRateModel ();
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    44
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    45
  virtual double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const;
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    46
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    47
private:
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    48
  double CalculatePe (double p, uint32_t bValue) const;
10424
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    49
  /**
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    50
   * Return BER of BPSK at the given SNR.
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    51
   *
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    52
   * \param snr snr value
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    53
   * \return BER of BPSK at the given SNR
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    54
   */
6358
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    55
  double GetBpskBer (double snr) const;
10424
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    56
  /**
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    57
   * Return BER of QPSK at the given SNR.
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    58
   *
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    59
   * \param snr snr value
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    60
   * \return BER of QPSK at the given SNR
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    61
   */
6358
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    62
  double GetQpskBer (double snr) const;
10424
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    63
  /**
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    64
   * Return BER of QAM16 at the given SNR.
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    65
   *
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    66
   * \param snr snr value
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    67
   * \return BER of QAM16 at the given SNR
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    68
   */
6358
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    69
  double Get16QamBer (double snr) const;
10424
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    70
  /**
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    71
   * Return BER of QAM64 at the given SNR.
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    72
   *
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    73
   * \param snr snr value
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    74
   * \return BER of QAM64 at the given SNR
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    75
   */
6358
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    76
  double Get64QamBer (double snr) const;
10424
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    77
  /**
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    78
   * Return BER of BPSK at the given SNR after applying FEC.
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    79
   *
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    80
   * \param snr snr value
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    81
   * \param nbits the number of bits in the chunk
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    82
   * \param bValue
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    83
   * \return BER of BPSK at the given SNR after applying FEC
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    84
   */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    85
  double GetFecBpskBer (double snr, double nbits,
6358
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    86
                        uint32_t bValue) const;
10424
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    87
  /**
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    88
   * Return BER of QPSK at the given SNR after applying FEC.
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    89
   *
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    90
   * \param snr snr value
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    91
   * \param nbits the number of bits in the chunk
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    92
   * \param bValue
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    93
   * \return BER of QPSK at the given SNR after applying FEC
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    94
   */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    95
  double GetFecQpskBer (double snr, double nbits,
6358
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
    96
                        uint32_t bValue) const;
10424
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    97
  /**
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    98
   * Return BER of QAM16 at the given SNR after applying FEC.
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
    99
   *
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   100
   * \param snr snr value
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   101
   * \param nbits the number of bits in the chunk
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   102
   * \param bValue
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   103
   * \return BER of QAM16 at the given SNR after applying FEC
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   104
   */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   105
  double GetFec16QamBer (double snr, uint32_t nbits,
6358
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
   106
                         uint32_t bValue) const;
10424
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   107
  /**
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   108
   * Return BER of QAM64 at the given SNR after applying FEC.
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   109
   *
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   110
   * \param snr snr value
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   111
   * \param nbits the number of bits in the chunk
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   112
   * \param bValue
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   113
   * \return BER of QAM64 at the given SNR after applying FEC
9d29c9a5ddcb doxygen warnings for wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 7385
diff changeset
   114
   */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   115
  double GetFec64QamBer (double snr, uint32_t nbits,
6358
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
   116
                         uint32_t bValue) const;
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
   117
};
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
   118
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
   119
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
   120
} // namespace ns3
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
   121
5205e0dde26a Add NistErrorRateModel for wifi
Gary Pei <guangyu.pei@boeing.com>
parents:
diff changeset
   122
#endif /* NIST_ERROR_RATE_MODEL_H */