ns3::YansWifiPhy Class Reference

802.11 PHY layer model More...

#include <yans-wifi-phy.h>

Inheritance diagram for ns3::YansWifiPhy:
Inheritance graph
[legend]
Collaboration diagram for ns3::YansWifiPhy:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 YansWifiPhy ()
virtual ~YansWifiPhy ()
void SetChannel (Ptr< YansWifiChannel > channel)
void StartReceivePacket (Ptr< Packet > packet, double rxPowerDbm, WifiMode mode, WifiPreamble preamble)
void SetStandard (enum WifiPhyStandard standard)
void SetRxNoise (double ratio)
double GetRxNoise (void) const
void SetUseConstantNoiseFloor (bool value)
bool GetUseConstantNoiseFloor () const
void SetConstantNoiseFloor (double dbm)
double GetConstantNoiseFloor () const
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)
void SetCcaMode1Threshold (double threshold)
void SetErrorRateModel (Ptr< ErrorRateModel > rate)
void SetDevice (Ptr< Object > device)
void SetMobility (Ptr< Object > mobility)
double GetTxGain (void) const
double GetRxGain (void) const
double GetEdThreshold (void) const
double GetCcaMode1Threshold (void) const
Ptr< ErrorRateModelGetErrorRateModel (void) const
Ptr< ObjectGetDevice (void) const
Ptr< ObjectGetMobility (void)
virtual double GetTxPowerStart (void) const
virtual double GetTxPowerEnd (void) const
virtual uint32_t GetNTxPower (void) const
virtual void SetReceiveOkCallback (WifiPhy::RxOkCallback callback)
virtual void SetReceiveErrorCallback (WifiPhy::RxErrorCallback 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 IsStateSyncing (void)
virtual bool IsStateRx (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 Ptr< WifiChannelGetChannel (void) const

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::YansWifiPhy.

Private Types

typedef std::vector< WifiModeModes

Private Member Functions

 YansWifiPhy (const YansWifiPhy &o)
virtual void DoDispose (void)
void Configure80211a (void)
void ConfigureHolland (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
double GetPowerDbm (uint8_t power) const
void EndReceivePacket (Ptr< Packet > packet, Ptr< InterferenceHelper::Event > event)

Private Attributes

double m_edThresholdW
double m_ccaMode1ThresholdW
double m_txGainDb
double m_rxGainDb
double m_txPowerBaseDbm
double m_txPowerEndDbm
uint32_t m_nTxPower
Ptr< YansWifiChannelm_channel
Ptr< Objectm_device
Ptr< Objectm_mobility
Modes m_modes
EventId m_endRxEvent
UniformVariable m_random
WifiPhyStandard m_standard
Ptr< YansWifiPhyStateHelperm_state
InterferenceHelper m_interference

Detailed Description

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::YansWifiChannel class.

Definition at line 62 of file yans-wifi-phy.h.


Member Typedef Documentation

typedef std::vector<WifiMode> ns3::YansWifiPhy::Modes [private]

Definition at line 130 of file yans-wifi-phy.h.


Constructor & Destructor Documentation

ns3::YansWifiPhy::YansWifiPhy (  ) 

Definition at line 128 of file yans-wifi-phy.cc.

References m_state, and NS_LOG_FUNCTION.

ns3::YansWifiPhy::~YansWifiPhy (  )  [virtual]

Definition at line 136 of file yans-wifi-phy.cc.

References NS_LOG_FUNCTION.

ns3::YansWifiPhy::YansWifiPhy ( const YansWifiPhy o  )  [private]

Member Function Documentation

double ns3::YansWifiPhy::CalculateSnr ( WifiMode  txMode,
double  ber 
) const [virtual]
Parameters:
txMode the transmission mode
ber the probability of bit error rate
Returns:
the minimum snr which is required to achieve the requested ber for the specified transmission mode. (W/W)

Implements ns3::WifiPhy.

Definition at line 313 of file yans-wifi-phy.cc.

References ns3::InterferenceHelper::GetErrorRateModel(), and m_interference.

Time ns3::YansWifiPhy::CalculateTxDuration ( uint32_t  size,
WifiMode  payloadMode,
enum WifiPreamble  preamble 
) const [virtual]
Parameters:
size the number of bytes in the packet to send
payloadMode the transmission mode to use for this packet
preamble the type of preamble to use for this packet.
Returns:
the total amount of time this PHY will stay busy for the transmission of these bytes.

Implements ns3::WifiPhy.

Definition at line 560 of file yans-wifi-phy.cc.

References ns3::InterferenceHelper::CalculateTxDuration(), and m_interference.

Referenced by SendPacket(), and StartReceivePacket().

void ns3::YansWifiPhy::Configure80211a ( void   )  [private]
void ns3::YansWifiPhy::ConfigureHolland ( void   )  [private]
double ns3::YansWifiPhy::DbmToW ( double  dbm  )  const [private]
double ns3::YansWifiPhy::DbToRatio ( double  db  )  const [private]

Definition at line 566 of file yans-wifi-phy.cc.

Referenced by SetRxNoise().

void ns3::YansWifiPhy::DoDispose ( void   )  [private, virtual]

This method is called by Object::Dispose or by the object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.

Reimplemented from ns3::Object.

Definition at line 142 of file yans-wifi-phy.cc.

References m_channel, m_device, m_modes, and NS_LOG_FUNCTION.

void ns3::YansWifiPhy::EndReceivePacket ( Ptr< Packet packet,
Ptr< InterferenceHelper::Event event 
) [private]
double ns3::YansWifiPhy::GetCcaMode1Threshold ( void   )  const

Definition at line 291 of file yans-wifi-phy.cc.

References m_ccaMode1ThresholdW, and WToDbm().

Referenced by GetTypeId().

Ptr< WifiChannel > ns3::YansWifiPhy::GetChannel ( void   )  const [virtual]

Implements ns3::WifiPhy.

Definition at line 319 of file yans-wifi-phy.cc.

References m_channel.

double ns3::YansWifiPhy::GetConstantNoiseFloor ( void   )  const

Definition at line 200 of file yans-wifi-phy.cc.

References ns3::InterferenceHelper::GetConstantNoiseFloorW(), m_interference, and WToDbm().

Referenced by GetTypeId().

Time ns3::YansWifiPhy::GetDelayUntilIdle ( void   )  [virtual]
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.

Implements ns3::WifiPhy.

Definition at line 548 of file yans-wifi-phy.cc.

References m_state.

Ptr< Object > ns3::YansWifiPhy::GetDevice ( void   )  const

Definition at line 302 of file yans-wifi-phy.cc.

References m_device.

double ns3::YansWifiPhy::GetEdThreshold ( void   )  const

Definition at line 285 of file yans-wifi-phy.cc.

References m_edThresholdW, and WToDbm().

Referenced by GetTypeId().

double ns3::YansWifiPhy::GetEdThresholdW ( void   )  const [private]

Definition at line 592 of file yans-wifi-phy.cc.

References m_edThresholdW.

Ptr< ErrorRateModel > ns3::YansWifiPhy::GetErrorRateModel ( void   )  const
Time ns3::YansWifiPhy::GetLastRxStartTime ( void   )  const [virtual]

Implements ns3::WifiPhy.

Definition at line 554 of file yans-wifi-phy.cc.

References m_state.

Ptr< Object > ns3::YansWifiPhy::GetMobility ( void   ) 

Definition at line 307 of file yans-wifi-phy.cc.

References m_mobility.

WifiMode ns3::YansWifiPhy::GetMode ( uint32_t  mode  )  const [virtual]
Parameters:
mode index in array of supported modes
Returns:
the mode whose index is specified.

Implements ns3::WifiPhy.

Definition at line 467 of file yans-wifi-phy.cc.

References m_modes.

uint32_t ns3::YansWifiPhy::GetNModes ( void   )  const [virtual]
Returns:
the number of transmission modes supported by this PHY.

Implements ns3::WifiPhy.

Definition at line 462 of file yans-wifi-phy.cc.

References m_modes.

uint32_t ns3::YansWifiPhy::GetNTxPower ( void   )  const [virtual]
Returns:
the number of tx power levels available for this PHY.

Implements ns3::WifiPhy.

Definition at line 472 of file yans-wifi-phy.cc.

References m_nTxPower.

double ns3::YansWifiPhy::GetPowerDbm ( uint8_t  power  )  const [private]

Definition at line 598 of file yans-wifi-phy.cc.

References m_nTxPower, m_txPowerBaseDbm, m_txPowerEndDbm, and NS_ASSERT.

Referenced by SendPacket().

double ns3::YansWifiPhy::GetRxGain ( void   )  const

Definition at line 279 of file yans-wifi-phy.cc.

References m_rxGainDb.

Referenced by GetTypeId().

double ns3::YansWifiPhy::GetRxNoise ( void   )  const

Definition at line 176 of file yans-wifi-phy.cc.

References ns3::InterferenceHelper::GetRxNoiseRatio(), m_interference, and RatioToDb().

Referenced by GetTypeId().

Time ns3::YansWifiPhy::GetStateDuration ( void   )  [virtual]
Returns:
the amount of time since the current state has started.

Implements ns3::WifiPhy.

Definition at line 543 of file yans-wifi-phy.cc.

References m_state.

double ns3::YansWifiPhy::GetTxGain ( void   )  const

Definition at line 274 of file yans-wifi-phy.cc.

References m_txGainDb.

Referenced by GetTypeId().

double ns3::YansWifiPhy::GetTxPowerEnd ( void   )  const [virtual]

Implements ns3::WifiPhy.

Definition at line 269 of file yans-wifi-phy.cc.

References m_txPowerEndDbm.

Referenced by GetTypeId().

double ns3::YansWifiPhy::GetTxPowerStart ( void   )  const [virtual]

Implements ns3::WifiPhy.

Definition at line 264 of file yans-wifi-phy.cc.

References m_txPowerBaseDbm.

Referenced by GetTypeId().

TypeId ns3::YansWifiPhy::GetTypeId ( void   )  [static]

This method returns the TypeId associated to ns3::YansWifiPhy.

This object is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/DeviceList/[i]/$ns3WifiNetDevice/Phy/$ns3YansWifiPhy

Attributes defined for this type:

  • EnergyDetectionThreshold: The energy of a received signal should be higher than this threshold (dbm) to allow the PHY layer to detect the signal.
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: -140
    • Flags: construct write read
  • CcaMode1Threshold: The energy of a received signal should be higher than this threshold (dbm) to allow the PHY layer to declare CCA BUSY state
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: -140
    • Flags: construct write read
  • TxGain: Transmission gain (dB).
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 1
    • Flags: construct write read
  • RxGain: Reception gain (dB).
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 1
    • Flags: construct write read
  • TxPowerLevels: Number of transmission power levels available between TxPowerBase and TxPowerEnd included.
  • TxPowerEnd: Maximum available transmission level (dbm).
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 16.0206
    • Flags: construct write read
  • TxPowerStart: Minimum available transmission level (dbm).
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 16.0206
    • Flags: construct write read
  • RxNoise: Ratio of energy lost by receiver (dB).
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: 7
    • Flags: construct write read
  • UseConstantNoiseFloor: If false calculate noise floor, if true use ConstantNoiseFloor as noise floor.
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: construct write read
  • ConstantNoiseFloor: Override receiver noise energy calculation with a constant noise floor (dBm).
    • Set with class: ns3::DoubleValue
    • Underlying type: double -1.79769e+308:1.79769e+308
    • Initial value: -101
    • Flags: construct write read
  • Standard: The standard chosen configures a set of transmission modes and some PHY-specific constants.
    • Set with class: ns3::EnumValue
    • Underlying type: 802.11a|holland
    • Initial value: 802.11a
    • Flags: construct write
  • State: The state of the PHY layer

No TraceSources defined for this type.

Reimplemented from ns3::WifiPhy.

Definition at line 47 of file yans-wifi-phy.cc.

References ns3::TypeId::AddAttribute(), GetCcaMode1Threshold(), GetConstantNoiseFloor(), GetEdThreshold(), GetRxGain(), GetRxNoise(), GetTxGain(), GetTxPowerEnd(), GetTxPowerStart(), GetUseConstantNoiseFloor(), m_nTxPower, m_state, ns3::MakeEnumAccessor(), ns3::MakeEnumChecker(), SetCcaMode1Threshold(), SetConstantNoiseFloor(), SetEdThreshold(), ns3::TypeId::SetParent(), SetRxGain(), SetRxNoise(), SetStandard(), SetTxGain(), SetTxPowerEnd(), SetTxPowerStart(), SetUseConstantNoiseFloor(), ns3::WIFI_PHY_STANDARD_80211a, and ns3::WIFI_PHY_STANDARD_holland.

bool ns3::YansWifiPhy::GetUseConstantNoiseFloor (  )  const

Definition at line 188 of file yans-wifi-phy.cc.

References ns3::InterferenceHelper::GetUseConstantNoiseFloor(), and m_interference.

Referenced by GetTypeId().

bool ns3::YansWifiPhy::IsStateBusy ( void   )  [virtual]
Returns:
true of the current state of the PHY layer is not WifiPhy::IDLE, false otherwise.

Implements ns3::WifiPhy.

Definition at line 522 of file yans-wifi-phy.cc.

References m_state.

bool ns3::YansWifiPhy::IsStateCcaBusy ( void   )  [virtual]
Returns:
true of the current state of the PHY layer is WifiPhy::CCA_BUSY, false otherwise.

Implements ns3::WifiPhy.

Definition at line 511 of file yans-wifi-phy.cc.

References m_state.

bool ns3::YansWifiPhy::IsStateIdle ( void   )  [virtual]
Returns:
true of the current state of the PHY layer is WifiPhy::IDLE, false otherwise.

Implements ns3::WifiPhy.

Definition at line 517 of file yans-wifi-phy.cc.

References m_state.

bool ns3::YansWifiPhy::IsStateRx ( void   )  [virtual]
Returns:
true of the current state of the PHY layer is WifiPhy::RX, false otherwise.

Implements ns3::WifiPhy.

Definition at line 532 of file yans-wifi-phy.cc.

References m_state.

Referenced by EndReceivePacket().

bool ns3::YansWifiPhy::IsStateSyncing ( void   )  [virtual]
Returns:
true of the current state of the PHY layer is WifiPhy::SYNCING, false otherwise.

Implements ns3::WifiPhy.

Definition at line 527 of file yans-wifi-phy.cc.

References m_state.

bool ns3::YansWifiPhy::IsStateTx ( void   )  [virtual]
Returns:
true of the current state of the PHY layer is WifiPhy::TX, false otherwise.

Implements ns3::WifiPhy.

Definition at line 537 of file yans-wifi-phy.cc.

References m_state.

double ns3::YansWifiPhy::RatioToDb ( double  ratio  )  const [private]

Definition at line 586 of file yans-wifi-phy.cc.

Referenced by GetRxNoise().

void ns3::YansWifiPhy::RegisterListener ( WifiPhyListener listener  )  [virtual]
Parameters:
listener the new listener

Add the input listener to the list of objects to be notified of PHY-level events.

Implements ns3::WifiPhy.

Definition at line 505 of file yans-wifi-phy.cc.

References m_state.

void ns3::YansWifiPhy::SendPacket ( Ptr< const Packet packet,
WifiMode  mode,
enum WifiPreamble  preamble,
uint8_t  txPowerLevel 
) [virtual]
Parameters:
packet the packet to send
mode the transmission mode to use to send this packet
preamble the type of preamble to use to send this packet.
txPowerLevel a power level to use to send this packet. The real transmission power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels

Implements ns3::WifiPhy.

Definition at line 436 of file yans-wifi-phy.cc.

References CalculateTxDuration(), ns3::EventId::Cancel(), GetPowerDbm(), m_channel, m_endRxEvent, m_state, m_txGainDb, NS_ASSERT, and NS_LOG_FUNCTION.

void ns3::YansWifiPhy::SetCcaMode1Threshold ( double  threshold  ) 

Definition at line 242 of file yans-wifi-phy.cc.

References DbmToW(), m_ccaMode1ThresholdW, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

void ns3::YansWifiPhy::SetChannel ( Ptr< YansWifiChannel channel  ) 

Definition at line 324 of file yans-wifi-phy.cc.

References m_channel.

void ns3::YansWifiPhy::SetConstantNoiseFloor ( double  dbm  ) 
void ns3::YansWifiPhy::SetDevice ( Ptr< Object device  ) 

Definition at line 253 of file yans-wifi-phy.cc.

References m_device.

void ns3::YansWifiPhy::SetEdThreshold ( double  threshold  ) 

Definition at line 236 of file yans-wifi-phy.cc.

References DbmToW(), m_edThresholdW, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

void ns3::YansWifiPhy::SetErrorRateModel ( Ptr< ErrorRateModel rate  ) 
void ns3::YansWifiPhy::SetMobility ( Ptr< Object mobility  ) 

Definition at line 258 of file yans-wifi-phy.cc.

References m_mobility.

void ns3::YansWifiPhy::SetNTxPower ( uint32_t  n  ) 

Definition at line 218 of file yans-wifi-phy.cc.

References m_nTxPower, and NS_LOG_FUNCTION.

void ns3::YansWifiPhy::SetReceiveErrorCallback ( WifiPhy::RxErrorCallback  callback  )  [virtual]
Parameters:
callback the callback to invoke upon erronous packet reception.

Implements ns3::WifiPhy.

Definition at line 336 of file yans-wifi-phy.cc.

References m_state.

void ns3::YansWifiPhy::SetReceiveOkCallback ( WifiPhy::RxOkCallback  callback  )  [virtual]
Parameters:
callback the callback to invoke upon successful packet reception.

Implements ns3::WifiPhy.

Definition at line 331 of file yans-wifi-phy.cc.

References m_state.

void ns3::YansWifiPhy::SetRxGain ( double  gain  ) 

Definition at line 230 of file yans-wifi-phy.cc.

References m_rxGainDb, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

void ns3::YansWifiPhy::SetRxNoise ( double  ratio  ) 
void ns3::YansWifiPhy::SetStandard ( enum WifiPhyStandard  standard  ) 
void ns3::YansWifiPhy::SetTxGain ( double  gain  ) 

Definition at line 224 of file yans-wifi-phy.cc.

References m_txGainDb, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

void ns3::YansWifiPhy::SetTxPowerEnd ( double  end  ) 

Definition at line 212 of file yans-wifi-phy.cc.

References m_txPowerEndDbm, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

void ns3::YansWifiPhy::SetTxPowerStart ( double  start  ) 

Definition at line 206 of file yans-wifi-phy.cc.

References m_txPowerBaseDbm, and NS_LOG_FUNCTION.

Referenced by GetTypeId().

void ns3::YansWifiPhy::SetUseConstantNoiseFloor ( bool  value  ) 
void ns3::YansWifiPhy::StartReceivePacket ( Ptr< Packet packet,
double  rxPowerDbm,
WifiMode  mode,
WifiPreamble  preamble 
)
double ns3::YansWifiPhy::WToDbm ( double  w  )  const [private]

Member Data Documentation

Definition at line 147 of file yans-wifi-phy.h.

Referenced by GetCcaMode1Threshold(), SetCcaMode1Threshold(), and StartReceivePacket().

Definition at line 154 of file yans-wifi-phy.h.

Referenced by DoDispose(), GetChannel(), SendPacket(), and SetChannel().

Definition at line 155 of file yans-wifi-phy.h.

Referenced by DoDispose(), GetDevice(), and SetDevice().

Definition at line 158 of file yans-wifi-phy.h.

Referenced by SendPacket(), and StartReceivePacket().

Definition at line 156 of file yans-wifi-phy.h.

Referenced by GetMobility(), and SetMobility().

Definition at line 157 of file yans-wifi-phy.h.

Referenced by Configure80211a(), ConfigureHolland(), DoDispose(), GetMode(), and GetNModes().

uint32_t ns3::YansWifiPhy::m_nTxPower [private]

Definition at line 152 of file yans-wifi-phy.h.

Referenced by GetNTxPower(), GetPowerDbm(), GetTypeId(), and SetNTxPower().

Definition at line 159 of file yans-wifi-phy.h.

Referenced by EndReceivePacket().

double ns3::YansWifiPhy::m_rxGainDb [private]

Definition at line 149 of file yans-wifi-phy.h.

Referenced by GetRxGain(), SetRxGain(), and StartReceivePacket().

Definition at line 160 of file yans-wifi-phy.h.

Referenced by SetStandard().

double ns3::YansWifiPhy::m_txGainDb [private]

Definition at line 148 of file yans-wifi-phy.h.

Referenced by GetTxGain(), SendPacket(), and SetTxGain().

Definition at line 150 of file yans-wifi-phy.h.

Referenced by GetPowerDbm(), GetTxPowerStart(), and SetTxPowerStart().

Definition at line 151 of file yans-wifi-phy.h.

Referenced by GetPowerDbm(), GetTxPowerEnd(), and SetTxPowerEnd().


The documentation for this class was generated from the following files:
Generated on Thu Dec 3 14:11:31 2009 for NS-3 by  doxygen 1.6.3