rename WifiPhy to YansWifiPhy and add WifiPhy abstract base class.
This commit is contained in:
@@ -137,7 +137,7 @@ main (int argc, char *argv[])
|
||||
//
|
||||
WifiHelper wifi;
|
||||
wifi.SetMac ("ns3::AdhocWifiMac");
|
||||
wifi.SetPhy ("ns3::WifiPhy");
|
||||
wifi.SetPhy ("ns3::YansWifiPhy");
|
||||
NetDeviceContainer backboneDevices = wifi.Install (backbone);
|
||||
//
|
||||
// Add the IPv4 protocol stack to the nodes in our container
|
||||
@@ -246,7 +246,7 @@ main (int argc, char *argv[])
|
||||
//
|
||||
WifiHelper wifiInfra;
|
||||
wifiInfra.SetMac ("ns3::AdhocWifiMac");
|
||||
wifiInfra.SetPhy ("ns3::WifiPhy");
|
||||
wifiInfra.SetPhy ("ns3::YansWifiPhy");
|
||||
NetDeviceContainer infraDevices = wifiInfra.Install (infra);
|
||||
|
||||
// Add the IPv4 protocol stack to the nodes in our container
|
||||
|
||||
@@ -172,7 +172,7 @@ int main (int argc, char *argv[])
|
||||
GnuplotDataset dataset;
|
||||
|
||||
wifi.SetMac ("ns3::AdhocWifiMac");
|
||||
wifi.SetPhy ("ns3::WifiPhy");
|
||||
wifi.SetPhy ("ns3::YansWifiPhy");
|
||||
|
||||
NS_LOG_DEBUG ("54");
|
||||
experiment = Experiment ("54mb");
|
||||
@@ -234,7 +234,7 @@ int main (int argc, char *argv[])
|
||||
|
||||
|
||||
gnuplot = Gnuplot ("rate-control.png");
|
||||
Config::SetDefault ("ns3::WifiPhy::Standard", StringValue ("holland"));
|
||||
Config::SetDefault ("ns3::YansWifiPhy::Standard", StringValue ("holland"));
|
||||
|
||||
|
||||
NS_LOG_DEBUG ("arf");
|
||||
|
||||
@@ -138,7 +138,7 @@ int main (int argc, char *argv[])
|
||||
channel->SetPropagationLossModel (log);
|
||||
|
||||
Ssid ssid = Ssid ("wifi-default");
|
||||
wifi.SetPhy ("ns3::WifiPhy");
|
||||
wifi.SetPhy ("ns3::YansWifiPhy");
|
||||
wifi.SetRemoteStationManager ("ns3::ArfWifiManager");
|
||||
// setup stas.
|
||||
wifi.SetMac ("ns3::NqstaWifiMac",
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/pointer.h"
|
||||
#include "wifi-channel.h"
|
||||
#include "wifi-phy.h"
|
||||
#include "propagation-loss-model.h"
|
||||
#include "propagation-delay-model.h"
|
||||
|
||||
|
||||
@@ -27,13 +27,13 @@
|
||||
#include "ns3/net-device.h"
|
||||
#include "wifi-mode.h"
|
||||
#include "wifi-preamble.h"
|
||||
#include "wifi-phy.h"
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class NetDevice;
|
||||
class PropagationLossModel;
|
||||
class PropagationDelayModel;
|
||||
class WifiPhy;
|
||||
|
||||
/**
|
||||
* \brief A 802.11 Channel
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "wifi-phy.h"
|
||||
#include "wifi-channel.h"
|
||||
#include "yans-wifi-phy.h"
|
||||
#include "propagation-loss-model.h"
|
||||
#include "propagation-delay-model.h"
|
||||
#include "ns3/ptr.h"
|
||||
@@ -77,8 +78,8 @@ PsrExperiment::Run (struct PsrExperiment::Input input)
|
||||
Ptr<MobilityModel> posRx = CreateObject<StaticMobilityModel> ();
|
||||
posRx->SetPosition (Vector (m_input.distance, 0.0, 0.0));
|
||||
|
||||
Ptr<WifiPhy> tx = CreateObject<WifiPhy> ();
|
||||
Ptr<WifiPhy> rx = CreateObject<WifiPhy> ();
|
||||
Ptr<WifiPhy> tx = CreateObject<YansWifiPhy> ();
|
||||
Ptr<WifiPhy> rx = CreateObject<YansWifiPhy> ();
|
||||
rx->SetReceiveOkCallback (MakeCallback (&PsrExperiment::Receive, this));
|
||||
|
||||
Ptr<WifiChannel> channel = CreateObject<WifiChannel> ();
|
||||
@@ -204,9 +205,9 @@ CollisionExperiment::Run (struct CollisionExperiment::Input input)
|
||||
Ptr<MobilityModel> posRx = CreateObject<StaticMobilityModel> ();
|
||||
posRx->SetPosition (Vector (0, 0.0, 0.0));
|
||||
|
||||
Ptr<WifiPhy> txA = CreateObject<WifiPhy> ();
|
||||
Ptr<WifiPhy> txB = CreateObject<WifiPhy> ();
|
||||
Ptr<WifiPhy> rx = CreateObject<WifiPhy> ();
|
||||
Ptr<WifiPhy> txA = CreateObject<YansWifiPhy> ();
|
||||
Ptr<WifiPhy> txB = CreateObject<YansWifiPhy> ();
|
||||
Ptr<WifiPhy> rx = CreateObject<YansWifiPhy> ();
|
||||
rx->SetReceiveOkCallback (MakeCallback (&CollisionExperiment::Receive, this));
|
||||
|
||||
Ptr<WifiChannel> channel = CreateObject<WifiChannel> ();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -39,10 +39,6 @@
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class RandomUniform;
|
||||
class RxEvent;
|
||||
class TraceContainer;
|
||||
class WifiNetDevice;
|
||||
class WifiChannel;
|
||||
|
||||
/**
|
||||
@@ -93,16 +89,6 @@ public:
|
||||
/**
|
||||
* \brief 802.11 PHY layer model
|
||||
*
|
||||
* This PHY implements a model of 802.11a. The model
|
||||
* implemented here is based on the model described
|
||||
* in "Yet Another Network Simulator",
|
||||
* (http://cutebugs.net/files/wns2-yans.pdf).
|
||||
*
|
||||
*
|
||||
* This PHY model depends on a channel loss and delay
|
||||
* model as provided by the ns3::PropagationLossModel
|
||||
* and ns3::PropagationDelayModel classes, both of which are
|
||||
* members of the ns3::WifiChannel class.
|
||||
*/
|
||||
class WifiPhy : public Object
|
||||
{
|
||||
@@ -147,40 +133,28 @@ public:
|
||||
WifiPhy ();
|
||||
virtual ~WifiPhy ();
|
||||
|
||||
void SetStandard (enum WifiPhyStandard standard);
|
||||
void SetRxNoise (double ratio);
|
||||
void SetTxPowerStart (double start);
|
||||
void SetTxPowerEnd (double end);
|
||||
void SetNTxPower (uint32_t n);
|
||||
void SetTxGain (double gain);
|
||||
void SetRxGain (double gain);
|
||||
void SetEdThreshold (double threshold);
|
||||
double GetRxNoise (void) const;
|
||||
double GetTxPowerStart (void) const;
|
||||
double GetTxPowerEnd (void) const;
|
||||
virtual double GetTxPowerStart (void) const = 0;
|
||||
virtual double GetTxPowerEnd (void) const = 0;
|
||||
/**
|
||||
* \returns the number of tx power levels available for this PHY.
|
||||
*/
|
||||
uint32_t GetNTxPower (void) const;
|
||||
double GetTxGain (void) const;
|
||||
double GetRxGain (void) const;
|
||||
double GetEdThreshold (void) const;
|
||||
virtual uint32_t GetNTxPower (void) const = 0;
|
||||
|
||||
/**
|
||||
* \param channel the channel to connect to.
|
||||
*/
|
||||
void SetChannel (Ptr<WifiChannel> channel);
|
||||
virtual void SetChannel (Ptr<WifiChannel> channel) = 0;
|
||||
|
||||
/**
|
||||
* \param callback the callback to invoke
|
||||
* upon successful packet reception.
|
||||
*/
|
||||
void SetReceiveOkCallback (SyncOkCallback callback);
|
||||
virtual void SetReceiveOkCallback (SyncOkCallback callback) = 0;
|
||||
/**
|
||||
* \param callback the callback to invoke
|
||||
* upon erronous packet reception.
|
||||
*/
|
||||
void SetReceiveErrorCallback (SyncErrorCallback callback);
|
||||
virtual void SetReceiveErrorCallback (SyncErrorCallback callback) = 0;
|
||||
|
||||
/**
|
||||
* \param packet the packet to send
|
||||
@@ -189,7 +163,7 @@ public:
|
||||
* \param txPowerLevel a power level to use to send this packet. The real
|
||||
* transmission power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
|
||||
*/
|
||||
void SendPacket (Ptr<const Packet> packet, WifiMode mode, enum WifiPreamble preamble, uint8_t txPowerLevel);
|
||||
virtual void SendPacket (Ptr<const Packet> packet, WifiMode mode, enum WifiPreamble preamble, uint8_t txPowerLevel) = 0;
|
||||
|
||||
/**
|
||||
* \param listener the new listener
|
||||
@@ -197,41 +171,41 @@ public:
|
||||
* Add the input listener to the list of objects to be notified of
|
||||
* PHY-level events.
|
||||
*/
|
||||
void RegisterListener (WifiPhyListener *listener);
|
||||
virtual void RegisterListener (WifiPhyListener *listener) = 0;
|
||||
|
||||
/**
|
||||
* \returns true of the current state of the PHY layer is WifiPhy:LCCA_BUSY, false otherwise.
|
||||
*/
|
||||
bool IsStateCcaBusy (void);
|
||||
virtual bool IsStateCcaBusy (void) = 0;
|
||||
/**
|
||||
* \returns true of the current state of the PHY layer is WifiPhy::IDLE, false otherwise.
|
||||
*/
|
||||
bool IsStateIdle (void);
|
||||
virtual bool IsStateIdle (void) = 0;
|
||||
/**
|
||||
* \returns true of the current state of the PHY layer is not WifiPhy::IDLE, false otherwise.
|
||||
*/
|
||||
bool IsStateBusy (void);
|
||||
virtual bool IsStateBusy (void) = 0;
|
||||
/**
|
||||
* \returns true of the current state of the PHY layer is WifiPhy::SYNC, false otherwise.
|
||||
*/
|
||||
bool IsStateSync (void);
|
||||
virtual bool IsStateSync (void) = 0;
|
||||
/**
|
||||
* \returns true of the current state of the PHY layer is WifiPhy::TX, false otherwise.
|
||||
*/
|
||||
bool IsStateTx (void);
|
||||
virtual bool IsStateTx (void) = 0;
|
||||
/**
|
||||
* \returns the amount of time since the current state has started.
|
||||
*/
|
||||
Time GetStateDuration (void);
|
||||
virtual Time GetStateDuration (void) = 0;
|
||||
/**
|
||||
* \returns the predicted delay until this PHY can become WifiPhy::IDLE.
|
||||
*
|
||||
* The PHY will never become WifiPhy::IDLE _before_ the delay returned by
|
||||
* this method but it could become really idle later.
|
||||
*/
|
||||
Time GetDelayUntilIdle (void);
|
||||
virtual Time GetDelayUntilIdle (void) = 0;
|
||||
|
||||
Time GetLastRxStartTime (void) const;
|
||||
virtual Time GetLastRxStartTime (void) const = 0;
|
||||
|
||||
/**
|
||||
* \param size the number of bytes in the packet to send
|
||||
@@ -240,17 +214,17 @@ public:
|
||||
* \returns the total amount of time this PHY will stay busy for
|
||||
* the transmission of these bytes.
|
||||
*/
|
||||
Time CalculateTxDuration (uint32_t size, WifiMode payloadMode, enum WifiPreamble preamble) const;
|
||||
virtual Time CalculateTxDuration (uint32_t size, WifiMode payloadMode, enum WifiPreamble preamble) const = 0;
|
||||
|
||||
/**
|
||||
* \returns the number of transmission modes supported by this PHY.
|
||||
*/
|
||||
uint32_t GetNModes (void) const;
|
||||
virtual uint32_t GetNModes (void) const = 0;
|
||||
/**
|
||||
* \param mode index in array of supported modes
|
||||
* \returns the mode whose index is specified.
|
||||
*/
|
||||
WifiMode GetMode (uint32_t mode) const;
|
||||
virtual WifiMode GetMode (uint32_t mode) const = 0;
|
||||
/* return snr: W/W */
|
||||
/**
|
||||
* \param txMode the transmission mode
|
||||
@@ -258,122 +232,24 @@ public:
|
||||
* \returns the minimum snr which is required to achieve
|
||||
* the requested ber for the specified transmission mode.
|
||||
*/
|
||||
double CalculateSnr (WifiMode txMode, double ber) const;
|
||||
virtual double CalculateSnr (WifiMode txMode, double ber) const = 0;
|
||||
|
||||
/* rxPower unit is Watt */
|
||||
void StartReceivePacket (Ptr<Packet> packet,
|
||||
double rxPowerDbm,
|
||||
WifiMode mode,
|
||||
WifiPreamble preamble);
|
||||
virtual void StartReceivePacket (Ptr<Packet> packet,
|
||||
double rxPowerDbm,
|
||||
WifiMode mode,
|
||||
WifiPreamble preamble) = 0;
|
||||
|
||||
Ptr<WifiChannel> GetChannel (void) const;
|
||||
virtual Ptr<WifiChannel> GetChannel (void) const = 0;
|
||||
|
||||
private:
|
||||
class NiChange {
|
||||
public:
|
||||
NiChange (Time time, double delta);
|
||||
Time GetTime (void) const;
|
||||
double GetDelta (void) const;
|
||||
bool operator < (NiChange const &o) const;
|
||||
private:
|
||||
Time m_time;
|
||||
double m_delta;
|
||||
};
|
||||
typedef std::vector<WifiMode> Modes;
|
||||
typedef std::list<WifiPhyListener *> Listeners;
|
||||
typedef std::list<Ptr<RxEvent> > Events;
|
||||
typedef std::vector <NiChange> NiChanges;
|
||||
|
||||
private:
|
||||
virtual void DoDispose (void);
|
||||
void Configure80211aParameters (void);
|
||||
void PrintModes (void) const;
|
||||
void Configure80211a (void);
|
||||
void ConfigureHolland (void);
|
||||
char const *StateToString (enum State state);
|
||||
enum WifiPhy::State GetState (void);
|
||||
double GetEdThresholdW (void) const;
|
||||
double DbmToW (double dbm) const;
|
||||
double DbToRatio (double db) const;
|
||||
double WToDbm (double w) const;
|
||||
double RatioToDb (double ratio) const;
|
||||
Time GetMaxPacketDuration (void) const;
|
||||
void CancelRx (void);
|
||||
double GetPowerDbm (uint8_t power) const;
|
||||
void NotifyTxStart (Time duration);
|
||||
void NotifyWakeup (void);
|
||||
void NotifySyncStart (Time duration);
|
||||
void NotifySyncEndOk (void);
|
||||
void NotifySyncEndError (void);
|
||||
void NotifyCcaBusyStart (Time duration);
|
||||
void LogPreviousIdleAndCcaBusyStates (void);
|
||||
void SwitchToTx (Time txDuration);
|
||||
void SwitchToSync (Time syncDuration);
|
||||
void SwitchFromSync (void);
|
||||
void SwitchMaybeToCcaBusy (Time duration);
|
||||
void AppendEvent (Ptr<RxEvent> event);
|
||||
double CalculateNoiseInterferenceW (Ptr<RxEvent> event, NiChanges *ni) const;
|
||||
double CalculateSnr (double signal, double noiseInterference, WifiMode mode) const;
|
||||
double CalculateChunkSuccessRate (double snir, Time delay, WifiMode mode) const;
|
||||
double CalculatePer (Ptr<const RxEvent> event, NiChanges *ni) const;
|
||||
void EndSync (Ptr<Packet> packet, Ptr<RxEvent> event);
|
||||
double Log2 (double val) const;
|
||||
double GetBpskBer (double snr, uint32_t signalSpread, uint32_t phyRate) const;
|
||||
double GetQamBer (double snr, unsigned int m, uint32_t signalSpread, uint32_t phyRate) const;
|
||||
uint32_t Factorial (uint32_t k) const;
|
||||
double Binomial (uint32_t k, double p, uint32_t n) const;
|
||||
double CalculatePdOdd (double ber, unsigned int d) const;
|
||||
double CalculatePdEven (double ber, unsigned int d) const;
|
||||
double CalculatePd (double ber, unsigned int d) const;
|
||||
double GetFecBpskBer (double snr, double nbits,
|
||||
uint32_t signalSpread, uint32_t phyRate,
|
||||
uint32_t dFree, uint32_t adFree) const;
|
||||
double GetFecQamBer (double snr, uint32_t nbits,
|
||||
uint32_t signalSpread,
|
||||
uint32_t phyRate,
|
||||
uint32_t m, uint32_t dfree,
|
||||
uint32_t adFree, uint32_t adFreePlusOne) const;
|
||||
double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const;
|
||||
private:
|
||||
uint64_t m_txPrepareDelayUs;
|
||||
uint64_t m_plcpLongPreambleDelayUs;
|
||||
uint64_t m_plcpShortPreambleDelayUs;
|
||||
WifiMode m_longPlcpHeaderMode;
|
||||
WifiMode m_shortPlcpHeaderMode;
|
||||
uint32_t m_plcpHeaderLength;
|
||||
Time m_maxPacketDuration;
|
||||
|
||||
double m_edThresholdW; /* unit: W */
|
||||
double m_txGainDb;
|
||||
double m_rxGainDb;
|
||||
double m_rxNoiseRatio;
|
||||
double m_txPowerBaseDbm;
|
||||
double m_txPowerEndDbm;
|
||||
uint32_t m_nTxPower;
|
||||
|
||||
|
||||
bool m_syncing;
|
||||
Time m_endTx;
|
||||
Time m_endSync;
|
||||
Time m_endCcaBusy;
|
||||
Time m_startTx;
|
||||
Time m_startSync;
|
||||
Time m_startCcaBusy;
|
||||
Time m_previousStateChangeTime;
|
||||
|
||||
Ptr<WifiChannel> m_channel;
|
||||
SyncOkCallback m_syncOkCallback;
|
||||
SyncErrorCallback m_syncErrorCallback;
|
||||
TracedCallback<Ptr<const Packet>, double, WifiMode, enum WifiPreamble> m_rxOkTrace;
|
||||
TracedCallback<Ptr<const Packet>, double> m_rxErrorTrace;
|
||||
TracedCallback<Ptr<const Packet>,WifiMode,WifiPreamble,uint8_t> m_txTrace;
|
||||
Modes m_modes;
|
||||
Listeners m_listeners;
|
||||
EventId m_endSyncEvent;
|
||||
Events m_events;
|
||||
UniformVariable m_random;
|
||||
TracedCallback<Time,Time,enum WifiPhy::State> m_stateLogger;
|
||||
WifiPhyStandard m_standard;
|
||||
static WifiMode g_6mba;
|
||||
static WifiMode g_9mba;
|
||||
static WifiMode g_12mba;
|
||||
static WifiMode g_18mba;
|
||||
static WifiMode g_24mba;
|
||||
static WifiMode g_36mba;
|
||||
static WifiMode g_48mba;
|
||||
static WifiMode g_54mba;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "wifi-net-device.h"
|
||||
#include "wifi-channel.h"
|
||||
#include "adhoc-wifi-mac.h"
|
||||
#include "wifi-phy.h"
|
||||
#include "yans-wifi-phy.h"
|
||||
#include "arf-wifi-manager.h"
|
||||
#include "propagation-delay-model.h"
|
||||
#include "propagation-loss-model.h"
|
||||
@@ -50,7 +50,7 @@ WifiTest::CreateOne (Vector pos, Ptr<WifiChannel> channel)
|
||||
|
||||
Ptr<WifiMac> mac = m_mac.Create<WifiMac> ();
|
||||
Ptr<StaticMobilityModel> mobility = CreateObject<StaticMobilityModel> ();
|
||||
Ptr<WifiPhy> phy = CreateObject<WifiPhy> ();
|
||||
Ptr<WifiPhy> phy = CreateObject<YansWifiPhy> ();
|
||||
Ptr<WifiRemoteStationManager> manager = m_manager.Create<WifiRemoteStationManager> ();
|
||||
|
||||
mobility->SetPosition (pos);
|
||||
|
||||
@@ -11,6 +11,7 @@ def build(bld):
|
||||
'wifi-mode.cc',
|
||||
'ssid.cc',
|
||||
'wifi-phy.cc',
|
||||
'yans-wifi-phy.cc',
|
||||
'wifi-mac-header.cc',
|
||||
'wifi-mac-trailer.cc',
|
||||
'mac-low.cc',
|
||||
@@ -53,6 +54,7 @@ def build(bld):
|
||||
'ssid.h',
|
||||
'wifi-preamble.h',
|
||||
'wifi-phy-standard.h',
|
||||
'yans-wifi-phy.h',
|
||||
'wifi-phy.h',
|
||||
'wifi-remote-station-manager.h',
|
||||
'arf-wifi-manager.h',
|
||||
|
||||
1361
src/devices/wifi/yans-wifi-phy.cc
Normal file
1361
src/devices/wifi/yans-wifi-phy.cc
Normal file
File diff suppressed because it is too large
Load Diff
222
src/devices/wifi/yans-wifi-phy.h
Normal file
222
src/devices/wifi/yans-wifi-phy.h
Normal file
@@ -0,0 +1,222 @@
|
||||
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2005,2006 INRIA
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
|
||||
#ifndef YANS_WIFI_PHY_H
|
||||
#define YANS_WIFI_PHY_H
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <stdint.h>
|
||||
#include "ns3/callback.h"
|
||||
#include "ns3/event-id.h"
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/object.h"
|
||||
#include "ns3/traced-callback.h"
|
||||
#include "ns3/nstime.h"
|
||||
#include "ns3/ptr.h"
|
||||
#include "ns3/random-variable.h"
|
||||
#include "wifi-phy.h"
|
||||
#include "wifi-mode.h"
|
||||
#include "wifi-preamble.h"
|
||||
#include "wifi-phy-standard.h"
|
||||
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class RandomUniform;
|
||||
class RxEvent;
|
||||
class WifiChannel;
|
||||
|
||||
|
||||
/**
|
||||
* \brief 802.11 PHY layer model
|
||||
*
|
||||
* This PHY implements a model of 802.11a. The model
|
||||
* implemented here is based on the model described
|
||||
* in "Yet Another Network Simulator",
|
||||
* (http://cutebugs.net/files/wns2-yans.pdf).
|
||||
*
|
||||
*
|
||||
* This PHY model depends on a channel loss and delay
|
||||
* model as provided by the ns3::PropagationLossModel
|
||||
* and ns3::PropagationDelayModel classes, both of which are
|
||||
* members of the ns3::WifiChannel class.
|
||||
*/
|
||||
class YansWifiPhy : public WifiPhy
|
||||
{
|
||||
public:
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
YansWifiPhy ();
|
||||
virtual ~YansWifiPhy ();
|
||||
|
||||
void SetStandard (enum WifiPhyStandard standard);
|
||||
void SetRxNoise (double ratio);
|
||||
void SetTxPowerStart (double start);
|
||||
void SetTxPowerEnd (double end);
|
||||
void SetNTxPower (uint32_t n);
|
||||
void SetTxGain (double gain);
|
||||
void SetRxGain (double gain);
|
||||
void SetEdThreshold (double threshold);
|
||||
double GetRxNoise (void) const;
|
||||
double GetTxGain (void) const;
|
||||
double GetRxGain (void) const;
|
||||
double GetEdThreshold (void) const;
|
||||
|
||||
|
||||
virtual double GetTxPowerStart (void) const;
|
||||
virtual double GetTxPowerEnd (void) const;
|
||||
virtual uint32_t GetNTxPower (void) const;
|
||||
virtual void SetChannel (Ptr<WifiChannel> channel);
|
||||
virtual void SetReceiveOkCallback (WifiPhy::SyncOkCallback callback);
|
||||
virtual void SetReceiveErrorCallback (WifiPhy::SyncErrorCallback callback);
|
||||
virtual void SendPacket (Ptr<const Packet> packet, WifiMode mode, enum WifiPreamble preamble, uint8_t txPowerLevel);
|
||||
virtual void RegisterListener (WifiPhyListener *listener);
|
||||
virtual bool IsStateCcaBusy (void);
|
||||
virtual bool IsStateIdle (void);
|
||||
virtual bool IsStateBusy (void);
|
||||
virtual bool IsStateSync (void);
|
||||
virtual bool IsStateTx (void);
|
||||
virtual Time GetStateDuration (void);
|
||||
virtual Time GetDelayUntilIdle (void);
|
||||
virtual Time GetLastRxStartTime (void) const;
|
||||
virtual Time CalculateTxDuration (uint32_t size, WifiMode payloadMode, enum WifiPreamble preamble) const;
|
||||
virtual uint32_t GetNModes (void) const;
|
||||
virtual WifiMode GetMode (uint32_t mode) const;
|
||||
virtual double CalculateSnr (WifiMode txMode, double ber) const;
|
||||
virtual void StartReceivePacket (Ptr<Packet> packet,
|
||||
double rxPowerDbm,
|
||||
WifiMode mode,
|
||||
WifiPreamble preamble);
|
||||
virtual Ptr<WifiChannel> GetChannel (void) const;
|
||||
|
||||
private:
|
||||
class NiChange {
|
||||
public:
|
||||
NiChange (Time time, double delta);
|
||||
Time GetTime (void) const;
|
||||
double GetDelta (void) const;
|
||||
bool operator < (NiChange const &o) const;
|
||||
private:
|
||||
Time m_time;
|
||||
double m_delta;
|
||||
};
|
||||
typedef std::vector<WifiMode> Modes;
|
||||
typedef std::list<WifiPhyListener *> Listeners;
|
||||
typedef std::list<Ptr<RxEvent> > Events;
|
||||
typedef std::vector <NiChange> NiChanges;
|
||||
|
||||
private:
|
||||
virtual void DoDispose (void);
|
||||
void Configure80211aParameters (void);
|
||||
void PrintModes (void) const;
|
||||
void Configure80211a (void);
|
||||
void ConfigureHolland (void);
|
||||
char const *StateToString (enum State state);
|
||||
enum YansWifiPhy::State GetState (void);
|
||||
double GetEdThresholdW (void) const;
|
||||
double DbmToW (double dbm) const;
|
||||
double DbToRatio (double db) const;
|
||||
double WToDbm (double w) const;
|
||||
double RatioToDb (double ratio) const;
|
||||
Time GetMaxPacketDuration (void) const;
|
||||
void CancelRx (void);
|
||||
double GetPowerDbm (uint8_t power) const;
|
||||
void NotifyTxStart (Time duration);
|
||||
void NotifyWakeup (void);
|
||||
void NotifySyncStart (Time duration);
|
||||
void NotifySyncEndOk (void);
|
||||
void NotifySyncEndError (void);
|
||||
void NotifyCcaBusyStart (Time duration);
|
||||
void LogPreviousIdleAndCcaBusyStates (void);
|
||||
void SwitchToTx (Time txDuration);
|
||||
void SwitchToSync (Time syncDuration);
|
||||
void SwitchFromSync (void);
|
||||
void SwitchMaybeToCcaBusy (Time duration);
|
||||
void AppendEvent (Ptr<RxEvent> event);
|
||||
double CalculateNoiseInterferenceW (Ptr<RxEvent> event, NiChanges *ni) const;
|
||||
double CalculateSnr (double signal, double noiseInterference, WifiMode mode) const;
|
||||
double CalculateChunkSuccessRate (double snir, Time delay, WifiMode mode) const;
|
||||
double CalculatePer (Ptr<const RxEvent> event, NiChanges *ni) const;
|
||||
void EndSync (Ptr<Packet> packet, Ptr<RxEvent> event);
|
||||
double Log2 (double val) const;
|
||||
double GetBpskBer (double snr, uint32_t signalSpread, uint32_t phyRate) const;
|
||||
double GetQamBer (double snr, unsigned int m, uint32_t signalSpread, uint32_t phyRate) const;
|
||||
uint32_t Factorial (uint32_t k) const;
|
||||
double Binomial (uint32_t k, double p, uint32_t n) const;
|
||||
double CalculatePdOdd (double ber, unsigned int d) const;
|
||||
double CalculatePdEven (double ber, unsigned int d) const;
|
||||
double CalculatePd (double ber, unsigned int d) const;
|
||||
double GetFecBpskBer (double snr, double nbits,
|
||||
uint32_t signalSpread, uint32_t phyRate,
|
||||
uint32_t dFree, uint32_t adFree) const;
|
||||
double GetFecQamBer (double snr, uint32_t nbits,
|
||||
uint32_t signalSpread,
|
||||
uint32_t phyRate,
|
||||
uint32_t m, uint32_t dfree,
|
||||
uint32_t adFree, uint32_t adFreePlusOne) const;
|
||||
double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const;
|
||||
private:
|
||||
uint64_t m_txPrepareDelayUs;
|
||||
uint64_t m_plcpLongPreambleDelayUs;
|
||||
uint64_t m_plcpShortPreambleDelayUs;
|
||||
WifiMode m_longPlcpHeaderMode;
|
||||
WifiMode m_shortPlcpHeaderMode;
|
||||
uint32_t m_plcpHeaderLength;
|
||||
Time m_maxPacketDuration;
|
||||
|
||||
double m_edThresholdW; /* unit: W */
|
||||
double m_txGainDb;
|
||||
double m_rxGainDb;
|
||||
double m_rxNoiseRatio;
|
||||
double m_txPowerBaseDbm;
|
||||
double m_txPowerEndDbm;
|
||||
uint32_t m_nTxPower;
|
||||
|
||||
|
||||
bool m_syncing;
|
||||
Time m_endTx;
|
||||
Time m_endSync;
|
||||
Time m_endCcaBusy;
|
||||
Time m_startTx;
|
||||
Time m_startSync;
|
||||
Time m_startCcaBusy;
|
||||
Time m_previousStateChangeTime;
|
||||
|
||||
Ptr<WifiChannel> m_channel;
|
||||
SyncOkCallback m_syncOkCallback;
|
||||
SyncErrorCallback m_syncErrorCallback;
|
||||
TracedCallback<Ptr<const Packet>, double, WifiMode, enum WifiPreamble> m_rxOkTrace;
|
||||
TracedCallback<Ptr<const Packet>, double> m_rxErrorTrace;
|
||||
TracedCallback<Ptr<const Packet>,WifiMode,WifiPreamble,uint8_t> m_txTrace;
|
||||
Modes m_modes;
|
||||
Listeners m_listeners;
|
||||
EventId m_endSyncEvent;
|
||||
Events m_events;
|
||||
UniformVariable m_random;
|
||||
TracedCallback<Time,Time,enum YansWifiPhy::State> m_stateLogger;
|
||||
WifiPhyStandard m_standard;
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
#endif /* YANS_WIFI_PHY_H */
|
||||
Reference in New Issue
Block a user