A Discrete-Event Network Simulator
API
ns3::InterferenceHelper Class Reference

handles interference calculations More...

#include "interference-helper.h"

+ Collaboration diagram for ns3::InterferenceHelper:

Classes

class  Event
 Signal event for a packet. More...
 
class  NiChange
 Noise and Interference (thus Ni) event. More...
 
struct  SnrPer
 A struct for both SNR and PER. More...
 

Public Member Functions

 InterferenceHelper ()
 
 ~InterferenceHelper ()
 
Ptr< InterferenceHelper::EventAdd (uint32_t size, WifiTxVector txVector, enum WifiPreamble preamble, Time duration, double rxPower)
 Add the packet-related signal to interference helper. More...
 
void AddForeignSignal (Time duration, double rxPower)
 Add a non-Wifi signal to interference helper. More...
 
struct InterferenceHelper::SnrPer CalculatePlcpHeaderSnrPer (Ptr< InterferenceHelper::Event > event)
 Calculate the SNIR at the start of the plcp header and accumulate all SNIR changes in the snir vector. More...
 
struct InterferenceHelper::SnrPer CalculatePlcpPayloadSnrPer (Ptr< InterferenceHelper::Event > event)
 Calculate the SNIR at the start of the plcp payload and accumulate all SNIR changes in the snir vector. More...
 
void EraseEvents (void)
 Erase all events. More...
 
Time GetEnergyDuration (double energyW)
 
Ptr< ErrorRateModelGetErrorRateModel (void) const
 Return the error rate model. More...
 
double GetNoiseFigure (void) const
 Return the noise figure. More...
 
void NotifyRxEnd ()
 Notify that RX has ended. More...
 
void NotifyRxStart ()
 Notify that RX has started. More...
 
void SetErrorRateModel (Ptr< ErrorRateModel > rate)
 Set the error rate model for this interference helper. More...
 
void SetNoiseFigure (double value)
 Set the noise figure. More...
 

Private Types

typedef std::list< Ptr< Event > > Events
 typedef for a list of Events More...
 
typedef std::vector< NiChangeNiChanges
 typedef for a vector of NiChanges More...
 

Private Member Functions

void AddNiChangeEvent (NiChange change)
 Add NiChange to the list at the appropriate position. More...
 
void AppendEvent (Ptr< Event > event)
 Append the given Event. More...
 
double CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode, WifiTxVector txVector) const
 Calculate the success rate of the chunk given the SINR, duration, and Wi-Fi mode. More...
 
double CalculateNoiseInterferenceW (Ptr< Event > event, NiChanges *ni) const
 Calculate noise and interference power in W. More...
 
double CalculatePlcpHeaderPer (Ptr< const Event > event, NiChanges *ni) const
 Calculate the error rate of the plcp header. More...
 
double CalculatePlcpPayloadPer (Ptr< const Event > event, NiChanges *ni) const
 Calculate the error rate of the given plcp payload. More...
 
double CalculateSnr (double signal, double noiseInterference, uint32_t channelWidth) const
 Calculate SNR (linear ratio) from the given signal power and noise+interference power. More...
 
NiChanges::iterator GetPosition (Time moment)
 Returns an iterator to the first nichange, which is later than moment. More...
 

Private Attributes

Ptr< ErrorRateModelm_errorRateModel
 
double m_firstPower
 
NiChanges m_niChanges
 Experimental: needed for energy duration calculation. More...
 
double m_noiseFigure
 noise figure (linear) More...
 
bool m_rxing
 

Detailed Description

handles interference calculations

Definition at line 41 of file interference-helper.h.

Member Typedef Documentation

typedef for a list of Events

Definition at line 270 of file interference-helper.h.

typedef std::vector<NiChange> ns3::InterferenceHelper::NiChanges
private

typedef for a vector of NiChanges

Definition at line 266 of file interference-helper.h.

Constructor & Destructor Documentation

ns3::InterferenceHelper::InterferenceHelper ( )

Definition at line 136 of file interference-helper.cc.

ns3::InterferenceHelper::~InterferenceHelper ( )

Definition at line 143 of file interference-helper.cc.

References EraseEvents(), and m_errorRateModel.

+ Here is the call graph for this function:

Member Function Documentation

Ptr< InterferenceHelper::Event > ns3::InterferenceHelper::Add ( uint32_t  size,
WifiTxVector  txVector,
enum WifiPreamble  preamble,
Time  duration,
double  rxPower 
)

Add the packet-related signal to interference helper.

Parameters
sizepacket size
txVectorTXVECTOR of the packet
preambleWi-Fi preamble for the packet
durationthe duration of the signal
rxPowerreceive power (W)
Returns
InterferenceHelper::Event

Definition at line 150 of file interference-helper.cc.

References AppendEvent().

Referenced by AddForeignSignal(), ns3::YansWifiPhy::StartReceivePreambleAndHeader(), and ns3::SpectrumWifiPhy::StartRx().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::InterferenceHelper::AddForeignSignal ( Time  duration,
double  rxPower 
)

Add a non-Wifi signal to interference helper.

Parameters
durationthe duration of the signal
rxPowerreceive power (W)

Definition at line 166 of file interference-helper.cc.

References Add(), and ns3::WIFI_PREAMBLE_NONE.

Referenced by ns3::SpectrumWifiPhy::StartRx().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::InterferenceHelper::AddNiChangeEvent ( NiChange  change)
private

Add NiChange to the list at the appropriate position.

Parameters
change

Definition at line 851 of file interference-helper.cc.

References GetPosition(), ns3::InterferenceHelper::NiChange::GetTime(), and m_niChanges.

Referenced by AppendEvent().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::InterferenceHelper::AppendEvent ( Ptr< Event event)
private

Append the given Event.

Parameters
event

Definition at line 222 of file interference-helper.cc.

References AddNiChangeEvent(), GetPosition(), m_firstPower, m_niChanges, m_rxing, and ns3::Simulator::Now().

Referenced by Add().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double ns3::InterferenceHelper::CalculateChunkSuccessRate ( double  snir,
Time  duration,
WifiMode  mode,
WifiTxVector  txVector 
) const
private

Calculate the success rate of the chunk given the SINR, duration, and Wi-Fi mode.

The duration and mode are used to calculate how many bits are present in the chunk.

Parameters
snirSINR
duration
mode
txVector
Returns
the success rate

Definition at line 278 of file interference-helper.cc.

References ns3::WifiMode::GetPhyRate(), ns3::Time::GetSeconds(), m_errorRateModel, and ns3::NanoSeconds().

Referenced by CalculatePlcpHeaderPer(), and CalculatePlcpPayloadPer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double ns3::InterferenceHelper::CalculateNoiseInterferenceW ( Ptr< Event event,
NiChanges ni 
) const
private

Calculate noise and interference power in W.

Parameters
event
ni
Returns
noise and interference power

Definition at line 260 of file interference-helper.cc.

References m_firstPower, m_niChanges, m_rxing, and NS_ASSERT.

Referenced by CalculatePlcpHeaderSnrPer(), and CalculatePlcpPayloadSnrPer().

+ Here is the caller graph for this function:

double ns3::InterferenceHelper::CalculatePlcpHeaderPer ( Ptr< const Event event,
NiChanges ni 
) const
private
struct InterferenceHelper::SnrPer ns3::InterferenceHelper::CalculatePlcpHeaderSnrPer ( Ptr< InterferenceHelper::Event event)

Calculate the SNIR at the start of the plcp header and accumulate all SNIR changes in the snir vector.

Parameters
eventthe event corresponding to the first time the corresponding packet arrives
Returns
struct of SNR and PER

Definition at line 817 of file interference-helper.cc.

References CalculateNoiseInterferenceW(), CalculatePlcpHeaderPer(), CalculateSnr(), ns3::InterferenceHelper::SnrPer::per, and ns3::InterferenceHelper::SnrPer::snr.

Referenced by ns3::YansWifiPhy::StartReceivePacket(), and ns3::SpectrumWifiPhy::StartReceivePacket().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double ns3::InterferenceHelper::CalculatePlcpPayloadPer ( Ptr< const Event event,
NiChanges ni 
) const
private

Calculate the error rate of the given plcp payload.

The plcp payload can be divided into multiple chunks (e.g. due to interference from other transmissions).

Parameters
event
ni
Returns
the error rate of the packet

Definition at line 291 of file interference-helper.cc.

References CalculateChunkSuccessRate(), CalculateSnr(), ns3::WifiPhy::GetPlcpHeaderDuration(), ns3::WifiPhy::GetPlcpHtSigHeaderDuration(), ns3::WifiPhy::GetPlcpHtTrainingSymbolDuration(), ns3::WifiPhy::GetPlcpPreambleDuration(), ns3::WifiPhy::GetPlcpVhtSigA1Duration(), ns3::WifiPhy::GetPlcpVhtSigA2Duration(), ns3::WifiPhy::GetPlcpVhtSigBDuration(), NS_ASSERT, NS_LOG_DEBUG, and NS_LOG_FUNCTION.

Referenced by CalculatePlcpPayloadSnrPer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

struct InterferenceHelper::SnrPer ns3::InterferenceHelper::CalculatePlcpPayloadSnrPer ( Ptr< InterferenceHelper::Event event)

Calculate the SNIR at the start of the plcp payload and accumulate all SNIR changes in the snir vector.

Parameters
eventthe event corresponding to the first time the corresponding packet arrives
Returns
struct of SNR and PER

Definition at line 797 of file interference-helper.cc.

References CalculateNoiseInterferenceW(), CalculatePlcpPayloadPer(), CalculateSnr(), ns3::InterferenceHelper::SnrPer::per, and ns3::InterferenceHelper::SnrPer::snr.

Referenced by ns3::YansWifiPhy::EndReceive(), and ns3::SpectrumWifiPhy::EndReceive().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double ns3::InterferenceHelper::CalculateSnr ( double  signal,
double  noiseInterference,
uint32_t  channelWidth 
) const
private

Calculate SNR (linear ratio) from the given signal power and noise+interference power.

(Mode is not currently used)

Parameters
signal
noiseInterference
channelWidth
Returns
SNR in liear ratio

Definition at line 245 of file interference-helper.cc.

References m_noiseFigure, and NS_LOG_DEBUG.

Referenced by CalculatePlcpHeaderPer(), CalculatePlcpHeaderSnrPer(), CalculatePlcpPayloadPer(), and CalculatePlcpPayloadSnrPer().

+ Here is the caller graph for this function:

void ns3::InterferenceHelper::EraseEvents ( void  )
Time ns3::InterferenceHelper::GetEnergyDuration ( double  energyW)
Parameters
energyWthe minimum energy (W) requested
Returns
the expected amount of time the observed energy on the medium will be higher than the requested threshold.

Definition at line 199 of file interference-helper.cc.

References m_firstPower, m_niChanges, ns3::MicroSeconds(), and ns3::Simulator::Now().

Referenced by ns3::YansWifiPhy::ResumeFromSleep(), ns3::SpectrumWifiPhy::ResumeFromSleep(), ns3::YansWifiPhy::StartReceivePreambleAndHeader(), and ns3::SpectrumWifiPhy::SwitchMaybeToCcaBusy().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Ptr< ErrorRateModel > ns3::InterferenceHelper::GetErrorRateModel ( void  ) const

Return the error rate model.

Returns
Error rate model

Definition at line 193 of file interference-helper.cc.

References m_errorRateModel.

Referenced by ns3::WifiPhy::CalculateSnr(), and ns3::WifiPhy::GetErrorRateModel().

+ Here is the caller graph for this function:

double ns3::InterferenceHelper::GetNoiseFigure ( void  ) const

Return the noise figure.

Returns
the noise figure

Definition at line 181 of file interference-helper.cc.

References m_noiseFigure.

Referenced by ns3::WifiPhy::GetRxNoiseFigure().

+ Here is the caller graph for this function:

InterferenceHelper::NiChanges::iterator ns3::InterferenceHelper::GetPosition ( Time  moment)
private

Returns an iterator to the first nichange, which is later than moment.

Definition at line 845 of file interference-helper.cc.

References m_niChanges.

Referenced by AddNiChangeEvent(), and AppendEvent().

+ Here is the caller graph for this function:

void ns3::InterferenceHelper::NotifyRxEnd ( )

Notify that RX has ended.

Definition at line 864 of file interference-helper.cc.

References m_rxing, and NS_LOG_FUNCTION.

Referenced by ns3::YansWifiPhy::EndReceive(), ns3::SpectrumWifiPhy::EndReceive(), ns3::YansWifiPhy::SendPacket(), and ns3::SpectrumWifiPhy::SendPacket().

+ Here is the caller graph for this function:

void ns3::InterferenceHelper::NotifyRxStart ( void  )

Notify that RX has started.

Definition at line 857 of file interference-helper.cc.

References m_rxing, and NS_LOG_FUNCTION.

Referenced by ns3::YansWifiPhy::StartReceivePreambleAndHeader(), and ns3::SpectrumWifiPhy::StartRx().

+ Here is the caller graph for this function:

void ns3::InterferenceHelper::SetErrorRateModel ( Ptr< ErrorRateModel rate)

Set the error rate model for this interference helper.

Parameters
rateError rate model

Definition at line 187 of file interference-helper.cc.

References m_errorRateModel.

Referenced by ns3::WifiPhy::SetErrorRateModel().

+ Here is the caller graph for this function:

void ns3::InterferenceHelper::SetNoiseFigure ( double  value)

Set the noise figure.

Parameters
valuenoise figure

Definition at line 175 of file interference-helper.cc.

References m_noiseFigure.

Referenced by ns3::WifiPhy::SetRxNoiseFigure().

+ Here is the caller graph for this function:

Member Data Documentation

Ptr<ErrorRateModel> ns3::InterferenceHelper::m_errorRateModel
private
double ns3::InterferenceHelper::m_firstPower
private
NiChanges ns3::InterferenceHelper::m_niChanges
private

Experimental: needed for energy duration calculation.

Definition at line 334 of file interference-helper.h.

Referenced by AddNiChangeEvent(), AppendEvent(), CalculateNoiseInterferenceW(), EraseEvents(), GetEnergyDuration(), and GetPosition().

double ns3::InterferenceHelper::m_noiseFigure
private

noise figure (linear)

Definition at line 331 of file interference-helper.h.

Referenced by CalculateSnr(), GetNoiseFigure(), and SetNoiseFigure().

bool ns3::InterferenceHelper::m_rxing
private

The documentation for this class was generated from the following files: