src/wifi/model/interference-helper.h
author Sébastien Deronne <sebastien.deronne@gmail.com>
Sun, 03 May 2015 16:06:01 +0200
changeset 11348 ded786322135
parent 10483 e3a02ed14587
child 11384 935dc1cc08a4
permissions -rw-r--r--
Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 7143
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
4325
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
     2
/*
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
     3
 * Copyright (c) 2005,2006 INRIA
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
     4
 *
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
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
4325
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
     7
 * published by the Free Software Foundation;
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
     8
 *
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
    12
 * GNU General Public License for more details.
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
    13
 *
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
    14
 * You should have received a copy of the GNU General Public License
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
    15
 * along with this program; if not, write to the Free Software
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
    17
 *
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
acc6c801f785 bug 548: missing license header
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4315
diff changeset
    19
 */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
#ifndef INTERFERENCE_HELPER_H
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#define INTERFERENCE_HELPER_H
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
#include <stdint.h>
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include <vector>
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
#include <list>
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
#include "wifi-mode.h"
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
#include "wifi-preamble.h"
4470
51b5c1a272d3 802.11b PHY support
Gary Pei <guangyu.pei@boeing.com>
parents: 4325
diff changeset
    28
#include "wifi-phy-standard.h"
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
#include "ns3/nstime.h"
5505
c0ac392289c3 replace RefCountBase with SimpleRefCount<> to avoid duplicate refcounting implementations.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5413
diff changeset
    30
#include "ns3/simple-ref-count.h"
10139
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 7600
diff changeset
    31
#include "ns3/wifi-tx-vector.h"
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
namespace ns3 {
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
class ErrorRateModel;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
7139
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    37
/**
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    38
 * \ingroup wifi
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    39
 * \brief handles interference calculations
79dd02ed46ec doxygen wifi module grouping all wifi classes
Nicola Baldo <nbaldo@cttc.es>
parents: 6852
diff changeset
    40
 */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
class InterferenceHelper
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
{
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
public:
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    44
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    45
   * Signal event for a packet.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    46
   */
5505
c0ac392289c3 replace RefCountBase with SimpleRefCount<> to avoid duplicate refcounting implementations.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5413
diff changeset
    47
  class Event : public SimpleRefCount<InterferenceHelper::Event>
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
  {
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    49
public:
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    50
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    51
     * Create an Event with the given parameters.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    52
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    53
     * \param size packet size
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    54
     * \param payloadMode Wi-Fi mode used for the payload
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    55
     * \param preamble preamble type
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    56
     * \param duration duration of the signal
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    57
     * \param rxPower the receive power (w)
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    58
     * \param txvector TXVECTOR of the packet
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    59
     */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    60
    Event (uint32_t size, WifiMode payloadMode,
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    61
           enum WifiPreamble preamble,
10139
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 7600
diff changeset
    62
           Time duration, double rxPower, WifiTxVector txvector);
5505
c0ac392289c3 replace RefCountBase with SimpleRefCount<> to avoid duplicate refcounting implementations.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 5413
diff changeset
    63
    ~Event ();
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
    64
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    65
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    66
     * Return the duration of the signal.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    67
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    68
     * \return the duration of the signal
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    69
     */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
    Time GetDuration (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    71
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    72
     * Return the start time of the signal.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    73
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    74
     * \return the start time of the signal
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    75
     */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
    Time GetStartTime (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    77
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    78
     * Return the end time of the signal.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    79
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    80
     * \return the end time of the signal
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    81
     */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    82
    Time GetEndTime (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    83
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    84
     * Return the receive power (w).
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    85
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    86
     * \return the receive power (w)
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    87
     */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    88
    double GetRxPowerW (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    89
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    90
     * Return the size of the packet (bytes).
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    91
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    92
     * \return the size of the packet (bytes)
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    93
     */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    94
    uint32_t GetSize (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    95
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    96
     * Return the Wi-Fi mode used for the payload.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    97
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    98
     * \return the Wi-Fi mode used for the payload
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
    99
     */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
    WifiMode GetPayloadMode (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   101
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   102
     * Return the preamble type of the packet.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   103
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   104
     * \return the preamble type of the packet
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   105
     */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   106
    enum WifiPreamble GetPreambleType (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   107
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   108
     * Return the TXVECTOR of the packet.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   109
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   110
     * \return the TXVECTOR of the packet
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   111
     */
10139
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 7600
diff changeset
   112
    WifiTxVector GetTxVector (void) const;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   113
private:
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   114
    uint32_t m_size;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   115
    WifiMode m_payloadMode;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   116
    enum WifiPreamble m_preamble;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   117
    Time m_startTime;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   118
    Time m_endTime;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   119
    double m_rxPowerW;
10139
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 7600
diff changeset
   120
    WifiTxVector m_txVector;
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   121
  };
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   122
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   123
   * A struct for both SNR and PER
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   124
   */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   125
  struct SnrPer
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   126
  {
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   127
    double snr;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   128
    double per;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   129
  };
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
  InterferenceHelper ();
3906
01acc159ffb1 merge with HEAD
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 3905
diff changeset
   132
  ~InterferenceHelper ();
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   133
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   134
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   135
   * Set the noise figure.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   136
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   137
   * \param value noise figure
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   138
   */
4315
56a5bf298339 noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents: 3906
diff changeset
   139
  void SetNoiseFigure (double value);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   140
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   141
   * Set the error rate model for this interference helper.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   142
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   143
   * \param rate Error rate model
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   144
   */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   145
  void SetErrorRateModel (Ptr<ErrorRateModel> rate);
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   146
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   147
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   148
   * Return the noise figure.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   149
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   150
   * \return the noise figure
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   151
   */
4315
56a5bf298339 noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents: 3906
diff changeset
   152
  double GetNoiseFigure (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   153
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   154
   * Return the error rate model.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   155
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   156
   * \return Error rate model
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   157
   */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
  Ptr<ErrorRateModel> GetErrorRateModel (void) const;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   159
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   160
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   161
  /**
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   162
   * \param energyW the minimum energy (W) requested
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   163
   * \returns the expected amount of time the observed
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   164
   *          energy on the medium will be higher than
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   165
   *          the requested threshold.
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   166
   */
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   167
  Time GetEnergyDuration (double energyW);
4681
8558474b6149 made InterferenceHelper::CalculateTxDuration () static
Nicola Baldo <nbaldo@cttc.es>
parents: 4680
diff changeset
   168
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   169
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   170
   * Add the packet-related signal to interference helper.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   171
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   172
   * \param size packet size
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   173
   * \param payloadMode Wi-Fi mode for the payload
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   174
   * \param preamble Wi-Fi preamble for the packet
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   175
   * \param duration the duration of the signal
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   176
   * \param rxPower receive power (w)
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   177
   * \param txvector TXVECTOR of the packet
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   178
   * \return InterferenceHelper::Event
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   179
   */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   180
  Ptr<InterferenceHelper::Event> Add (uint32_t size, WifiMode payloadMode,
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   181
                                      enum WifiPreamble preamble,
10139
17a71cd49da3 partial 802.11n support
Ghada Badawy <gbadawy@gmail.com>
parents: 7600
diff changeset
   182
                                      Time duration, double rxPower, WifiTxVector txvector);
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   183
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   184
  /**
11348
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   185
   * Calculate the SNIR at the start of the plcp payload and accumulate
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   186
   * all SNIR changes in the snir vector.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   187
   *
11348
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   188
   * \param event the event corresponding to the first time the corresponding packet arrives
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   189
   * \return struct of SNR and PER
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   190
   */
11348
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   191
  struct InterferenceHelper::SnrPer CalculatePlcpPayloadSnrPer (Ptr<InterferenceHelper::Event> event);
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   192
  /**
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   193
   * Calculate the SNIR at the start of the plcp header and accumulate
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   194
   * all SNIR changes in the snir vector.
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   195
   *
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   196
   * \param event the event corresponding to the first time the corresponding packet arrives
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   197
   * \return struct of SNR and PER
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   198
   */
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   199
  struct InterferenceHelper::SnrPer CalculatePlcpHeaderSnrPer (Ptr<InterferenceHelper::Event> event);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   200
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   201
   * Notify that RX has started.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   202
   */
6474
0894b2a245e9 fixed Bug 799 - Interference helper is too slow
Kirill Andreev <andreev@iitp.ru>
parents: 5819
diff changeset
   203
  void NotifyRxStart ();
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   204
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   205
   * Notify that RX has ended.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   206
   */
6474
0894b2a245e9 fixed Bug 799 - Interference helper is too slow
Kirill Andreev <andreev@iitp.ru>
parents: 5819
diff changeset
   207
  void NotifyRxEnd ();
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   208
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   209
   * Erase all events.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   210
   */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   211
  void EraseEvents (void);
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   212
private:
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   213
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   214
   * Noise and Interference (thus Ni) event.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   215
   */
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   216
  class NiChange
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   217
  {
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   218
public:
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   219
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   220
     * Create a NiChange at the given time and the amount of NI change.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   221
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   222
     * \param time time of the event
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   223
     * \param delta the power
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   224
     */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   225
    NiChange (Time time, double delta);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   226
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   227
     * Return the event time.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   228
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   229
     * \return the event time.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   230
     */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   231
    Time GetTime (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   232
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   233
     * Return the power
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   234
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   235
     * \return the power
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   236
     */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   237
    double GetDelta (void) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   238
    /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   239
     * Compare the event time of two NiChange objects (a < o).
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   240
     *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   241
     * \param o
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   242
     * \return true if a < o.time, false otherwise
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   243
     */
5819
514ec98954ab Wifi code cleanup: Correcting various const keyword ordering and removing superfluous (boolean)?true:false.
Timo Bingmann <tbns@idlebox.net>
parents: 5505
diff changeset
   244
    bool operator < (const NiChange& o) const;
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 7139
diff changeset
   245
private:
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   246
    Time m_time;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   247
    double m_delta;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   248
  };
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   249
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   250
   * typedef for a vector of NiChanges
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   251
   */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   252
  typedef std::vector <NiChange> NiChanges;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   253
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   254
   * typedef for a list of Events
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   255
   */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   256
  typedef std::list<Ptr<Event> > Events;
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   257
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   258
  //InterferenceHelper (const InterferenceHelper &o);
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   259
  //InterferenceHelper &operator = (const InterferenceHelper &o);
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   260
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   261
   * Append the given Event.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   262
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   263
   * \param event
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   264
   */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   265
  void AppendEvent (Ptr<Event> event);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   266
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   267
   * Calculate noise and interference power in W.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   268
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   269
   * \param event
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   270
   * \param ni
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   271
   * \return noise and interference power
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   272
   */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   273
  double CalculateNoiseInterferenceW (Ptr<Event> event, NiChanges *ni) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   274
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   275
   * Calculate SNR (linear ratio) from the given signal power and noise+interference power.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   276
   * (Mode is not currently used)
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   277
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   278
   * \param signal
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   279
   * \param noiseInterference
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   280
   * \param mode
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   281
   * \return SNR in liear ratio
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   282
   */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   283
  double CalculateSnr (double signal, double noiseInterference, WifiMode mode) const;
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   284
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   285
   * Calculate the success rate of the chunk given the SINR, duration, and Wi-Fi mode.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   286
   * The duration and mode are used to calculate how many bits are present in the chunk.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   287
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   288
   * \param snir SINR
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   289
   * \param duration
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   290
   * \param mode
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   291
   * \return the success rate
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   292
   */
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   293
  double CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode) const;
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   294
  /**
11348
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   295
   * Calculate the error rate of the given plcp payload. The plcp payload can be divided into
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   296
   * multiple chunks (e.g. due to interference from other transmissions).
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   297
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   298
   * \param event
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   299
   * \param ni
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   300
   * \return the error rate of the packet
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   301
   */
11348
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   302
  double CalculatePlcpPayloadPer (Ptr<const Event> event, NiChanges *ni) const;
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   303
  /**
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   304
   * Calculate the error rate of the plcp header. The plcp header can be divided into
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   305
   * multiple chunks (e.g. due to interference from other transmissions).
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   306
   *
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   307
   * \param event
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   308
   * \param ni
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   309
   * \return the error rate of the packet
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   310
   */
ded786322135 Bug 2066 [wifi] - A-MPDU reception should check for successful preamble
Sébastien Deronne <sebastien.deronne@gmail.com>
parents: 10483
diff changeset
   311
  double CalculatePlcpHeaderPer (Ptr<const Event> event, NiChanges *ni) const;
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   312
4315
56a5bf298339 noiseFloor -> noiseFigure (bug 543)
Nicola Baldo <nbaldo@cttc.es>
parents: 3906
diff changeset
   313
  double m_noiseFigure; /**< noise figure (linear) */
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   314
  Ptr<ErrorRateModel> m_errorRateModel;
7600
57ba46094a0d fix various doxygen errors
Vedran Miletić <rivanvx@gmail.com>
parents: 7385
diff changeset
   315
  /// Experimental: needed for energy duration calculation
6474
0894b2a245e9 fixed Bug 799 - Interference helper is too slow
Kirill Andreev <andreev@iitp.ru>
parents: 5819
diff changeset
   316
  NiChanges m_niChanges;
0894b2a245e9 fixed Bug 799 - Interference helper is too slow
Kirill Andreev <andreev@iitp.ru>
parents: 5819
diff changeset
   317
  double m_firstPower;
0894b2a245e9 fixed Bug 799 - Interference helper is too slow
Kirill Andreev <andreev@iitp.ru>
parents: 5819
diff changeset
   318
  bool m_rxing;
0894b2a245e9 fixed Bug 799 - Interference helper is too slow
Kirill Andreev <andreev@iitp.ru>
parents: 5819
diff changeset
   319
  /// Returns an iterator to the first nichange, which is later than moment
0894b2a245e9 fixed Bug 799 - Interference helper is too slow
Kirill Andreev <andreev@iitp.ru>
parents: 5819
diff changeset
   320
  NiChanges::iterator GetPosition (Time moment);
10483
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   321
  /**
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   322
   * Add NiChange to the list at the appropriate position.
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   323
   *
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   324
   * \param change
e3a02ed14587 [doxygen] wifi module
Daniel Lertpratchya <nikkipui@gmail.com>
parents: 10139
diff changeset
   325
   */
6474
0894b2a245e9 fixed Bug 799 - Interference helper is too slow
Kirill Andreev <andreev@iitp.ru>
parents: 5819
diff changeset
   326
  void AddNiChangeEvent (NiChange change);
3905
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   327
};
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   328
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   329
} // namespace ns3
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   330
99c9346b5d71 split interference calculation from YansWifiPhy. Move them to InterferenceHelper
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   331
#endif /* INTERFERENCE_HELPER_H */