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  NiChange
 Noise and Interference (thus Ni) event. More...
 
struct  SnrPer
 Signal event for a PPDU. More...
 

Public Member Functions

 InterferenceHelper ()
 
 ~InterferenceHelper ()
 
Ptr< EventAdd (Ptr< const WifiPpdu > ppdu, WifiTxVector txVector, Time duration, double rxPower)
 Add the PPDU-related signal to interference helper. More...
 
void AddForeignSignal (Time duration, double rxPower)
 Add a non-Wifi signal to interference helper. More...
 
struct InterferenceHelper::SnrPer CalculateHtPhyHeaderSnrPer (Ptr< Event > event) const
 Calculate the SNIR at the start of the HT PHY header and accumulate all SNIR changes in the SNIR vector. More...
 
struct InterferenceHelper::SnrPer CalculateNonHtPhyHeaderSnrPer (Ptr< Event > event) const
 Calculate the SNIR at the start of the non-HT PHY header and accumulate all SNIR changes in the SNIR vector. More...
 
struct InterferenceHelper::SnrPer CalculatePayloadSnrPer (Ptr< Event > event, std::pair< Time, Time > relativeMpduStartStop) const
 Calculate the SNIR at the start of the payload and accumulate all SNIR changes in the SNIR vector for each MPDU of an A-MPDU. More...
 
double CalculateSnr (Ptr< Event > event) const
 Calculate the SNIR for the event (starting from now until the event end). More...
 
void EraseEvents (void)
 Erase all events. More...
 
Time GetEnergyDuration (double energyW) const
 
Ptr< ErrorRateModelGetErrorRateModel (void) const
 Return the error rate model. More...
 
void NotifyRxEnd ()
 Notify that RX has ended. More...
 
void NotifyRxStart ()
 Notify that RX has started. More...
 
void SetErrorRateModel (const Ptr< ErrorRateModel > rate)
 Set the error rate model for this interference helper. More...
 
void SetNoiseFigure (double value)
 Set the noise figure. More...
 
void SetNumberOfReceiveAntennas (uint8_t rx)
 Set the number of RX antennas in the receiver corresponding to this interference helper. More...
 

Private Types

typedef std::multimap< Time, NiChangeNiChanges
 typedef for a multimap of NiChanges More...
 

Private Member Functions

NiChanges::iterator AddNiChangeEvent (Time moment, NiChange change)
 Add NiChange to the list at the appropriate position and return the iterator of the new event. 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 CalculateHtPhyHeaderPer (Ptr< const Event > event, NiChanges *ni) const
 Calculate the error rate of the HT PHY header. More...
 
double CalculateNoiseInterferenceW (Ptr< Event > event, NiChanges *ni) const
 Calculate noise and interference power in W. More...
 
double CalculateNonHtPhyHeaderPer (Ptr< const Event > event, NiChanges *ni) const
 Calculate the error rate of the non-HT PHY header. More...
 
double CalculatePayloadChunkSuccessRate (double snir, Time duration, WifiTxVector txVector) const
 Calculate the success rate of the payload chunk given the SINR, duration, and Wi-Fi mode. More...
 
double CalculatePayloadPer (Ptr< const Event > event, NiChanges *ni, std::pair< Time, Time > window) const
 Calculate the error rate of the given PHY payload only in the provided time window (thus enabling per MPDU PER information). More...
 
double CalculateSnr (double signal, double noiseInterference, uint16_t channelWidth) const
 Calculate SNR (linear ratio) from the given signal power and noise+interference power. More...
 
NiChanges::const_iterator GetNextPosition (Time moment) const
 Returns an iterator to the first NiChange that is later than moment. More...
 
NiChanges::const_iterator GetPreviousPosition (Time moment) const
 Returns an iterator to the first NiChange that is later than moment. More...
 

Private Attributes

Ptr< ErrorRateModelm_errorRateModel
 error rate model More...
 
double m_firstPower
 first power in watts More...
 
NiChanges m_niChanges
 Experimental: needed for energy duration calculation. More...
 
double m_noiseFigure
 noise figure (linear) More...
 
uint8_t m_numRxAntennas
 the number of RX antennas in the corresponding receiver More...
 
bool m_rxing
 flag whether it is in receiving state More...
 

Detailed Description

handles interference calculations

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

Member Typedef Documentation

◆ NiChanges

typedef std::multimap<Time, NiChange> ns3::InterferenceHelper::NiChanges
private

typedef for a multimap of NiChanges

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

Constructor & Destructor Documentation

◆ InterferenceHelper()

ns3::InterferenceHelper::InterferenceHelper ( )

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

References AddNiChangeEvent().

+ Here is the call graph for this function:

◆ ~InterferenceHelper()

ns3::InterferenceHelper::~InterferenceHelper ( )

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

References EraseEvents(), and m_errorRateModel.

+ Here is the call graph for this function:

Member Function Documentation

◆ Add()

Ptr< Event > ns3::InterferenceHelper::Add ( Ptr< const WifiPpdu ppdu,
WifiTxVector  txVector,
Time  duration,
double  rxPower 
)

Add the PPDU-related signal to interference helper.

Parameters
ppduthe PPDU
txVectorthe TXVECTOR
rxPowerreceived power (W)
Returns
Event

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

References AppendEvent().

Referenced by AddForeignSignal(), and ns3::WifiPhy::StartReceivePreamble().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddForeignSignal()

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

Add a non-Wifi signal to interference helper.

Parameters
durationthe duration of the signal
rxPowerreceived power (W)

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

References Add(), ns3::WifiMacHeader::SetType(), and ns3::WIFI_MAC_QOSDATA.

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddNiChangeEvent()

InterferenceHelper::NiChanges::iterator ns3::InterferenceHelper::AddNiChangeEvent ( Time  moment,
NiChange  change 
)
private

Add NiChange to the list at the appropriate position and return the iterator of the new event.

Parameters
momenttime to check from
changethe NiChange to add
Returns
the iterator of the new event

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

References GetNextPosition(), and m_niChanges.

Referenced by AppendEvent(), EraseEvents(), and InterferenceHelper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AppendEvent()

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

Append the given Event.

Parameters
event

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

References AddNiChangeEvent(), GetNextPosition(), GetPreviousPosition(), m_firstPower, m_niChanges, m_rxing, and NS_LOG_FUNCTION.

Referenced by Add().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculateChunkSuccessRate()

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
snirthe SINR
durationthe duration of the chunk
modethe WifiMode
txVectorthe TXVECTOR
Returns
the success rate

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

References ns3::WifiTxVector::GetChannelWidth(), ns3::WifiMode::GetDataRate(), ns3::Time::GetSeconds(), ns3::Time::IsZero(), and m_errorRateModel.

Referenced by CalculateHtPhyHeaderPer(), and CalculateNonHtPhyHeaderPer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculateHtPhyHeaderPer()

◆ CalculateHtPhyHeaderSnrPer()

struct InterferenceHelper::SnrPer ns3::InterferenceHelper::CalculateHtPhyHeaderSnrPer ( Ptr< Event event) const

Calculate the SNIR at the start of the HT PHY header and accumulate all SNIR changes in the SNIR vector.

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

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

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculateNoiseInterferenceW()

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

Calculate noise and interference power in W.

Parameters
eventthe event
nithe NiChanges
Returns
noise and interference power

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

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

Referenced by CalculateHtPhyHeaderSnrPer(), CalculateNonHtPhyHeaderSnrPer(), CalculatePayloadSnrPer(), and CalculateSnr().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculateNonHtPhyHeaderPer()

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

Calculate the error rate of the non-HT PHY header.

The non-HT PHY header can be divided into multiple chunks (e.g. due to interference from other transmissions).

Parameters
eventthe event
nithe NiChanges
Returns
the error rate of the non-HT PHY header

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

References CalculateChunkSuccessRate(), CalculateSnr(), ns3::WifiTxVector::GetChannelWidth(), ns3::WifiPhy::GetPhyHeaderDuration(), ns3::WifiPhy::GetPhyHeaderMode(), ns3::WifiPhy::GetPhyHtSigHeaderDuration(), ns3::WifiPhy::GetPhyPreambleDuration(), ns3::WifiPhy::GetPhySigA1Duration(), ns3::WifiPhy::GetPhySigA2Duration(), ns3::WifiPhy::GetPhySigBDuration(), ns3::WifiPhy::GetPhyTrainingSymbolDuration(), ns3::WifiTxVector::GetPreambleType(), m_firstPower, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::WIFI_PREAMBLE_HT_GF, ns3::WIFI_PREAMBLE_LONG, and ns3::WIFI_PREAMBLE_SHORT.

Referenced by CalculateNonHtPhyHeaderSnrPer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculateNonHtPhyHeaderSnrPer()

struct InterferenceHelper::SnrPer ns3::InterferenceHelper::CalculateNonHtPhyHeaderSnrPer ( Ptr< Event event) const

Calculate the SNIR at the start of the non-HT PHY header and accumulate all SNIR changes in the SNIR vector.

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

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

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

Referenced by ns3::WifiPhy::ContinueReceiveHeader(), and ns3::WifiPhy::StartReceiveHeader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculatePayloadChunkSuccessRate()

double ns3::InterferenceHelper::CalculatePayloadChunkSuccessRate ( double  snir,
Time  duration,
WifiTxVector  txVector 
) const
private

Calculate the success rate of the payload 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
snirthe SINR
durationthe duration of the chunk
txVectorthe TXVECTOR
Returns
the success rate

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

References ns3::WifiMode::GetDataRate(), ns3::WifiTxVector::GetMode(), ns3::WifiMode::GetModulationClass(), ns3::WifiTxVector::GetNss(), ns3::WifiTxVector::GetNTx(), ns3::Time::GetSeconds(), ns3::Time::IsZero(), m_errorRateModel, m_numRxAntennas, NS_LOG_DEBUG, and ns3::WIFI_MOD_CLASS_HT.

Referenced by CalculatePayloadPer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculatePayloadPer()

double ns3::InterferenceHelper::CalculatePayloadPer ( Ptr< const Event event,
NiChanges ni,
std::pair< Time, Time window 
) const
private

Calculate the error rate of the given PHY payload only in the provided time window (thus enabling per MPDU PER information).

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

Parameters
eventthe event
nithe NiChanges
windowtime window (pair of start and end times) of PHY payload to focus on
Returns
the error rate of the payload

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

References CalculatePayloadChunkSuccessRate(), CalculateSnr(), ns3::WifiTxVector::GetChannelWidth(), ns3::WifiPhy::GetPhyHeaderDuration(), ns3::WifiPhy::GetPhyHtSigHeaderDuration(), ns3::WifiPhy::GetPhyPreambleDuration(), ns3::WifiPhy::GetPhySigA1Duration(), ns3::WifiPhy::GetPhySigA2Duration(), ns3::WifiPhy::GetPhySigBDuration(), ns3::WifiPhy::GetPhyTrainingSymbolDuration(), ns3::WifiTxVector::GetPreambleType(), m_firstPower, ns3::Min(), NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, and visualizer.ipython_view::window.

Referenced by CalculatePayloadSnrPer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculatePayloadSnrPer()

struct InterferenceHelper::SnrPer ns3::InterferenceHelper::CalculatePayloadSnrPer ( Ptr< Event event,
std::pair< Time, Time relativeMpduStartStop 
) const

Calculate the SNIR at the start of the payload and accumulate all SNIR changes in the SNIR vector for each MPDU of an A-MPDU.

This workaround is required in order to provide one PER per MPDU, for reception success/failure evaluation, while hiding aggregation details from this class.

Parameters
eventthe event corresponding to the first time the corresponding PPDU arrives
relativeMpduStartStopthe time window (pair of start and end times) of PHY payload to focus on
Returns
struct of SNR and PER (with PER being evaluated over the provided time window)

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

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

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculateSnr() [1/2]

double ns3::InterferenceHelper::CalculateSnr ( Ptr< Event event) const

Calculate the SNIR for the event (starting from now until the event end).

Parameters
eventthe event corresponding to the first time the corresponding PPDU arrives
Returns
the SNR for the PPDU in linear scale

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

References CalculateNoiseInterferenceW().

Referenced by CalculateHtPhyHeaderPer(), CalculateHtPhyHeaderSnrPer(), CalculateNonHtPhyHeaderPer(), CalculateNonHtPhyHeaderSnrPer(), CalculatePayloadPer(), CalculatePayloadSnrPer(), and ns3::WifiPhy::EndReceive().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CalculateSnr() [2/2]

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

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

Parameters
signalsignal power, W
noiseInterferencenoise and interference power, W
channelWidthsignal width in MHz
Returns
SNR in linear scale

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

References m_noiseFigure, NS_LOG_DEBUG, and ns3::RatioToDb().

+ Here is the call graph for this function:

◆ EraseEvents()

void ns3::InterferenceHelper::EraseEvents ( void  )

Erase all events.

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

References AddNiChangeEvent(), m_firstPower, m_niChanges, and m_rxing.

Referenced by ns3::WifiPhy::DoChannelSwitch(), ns3::WifiPhy::DoFrequencySwitch(), and ~InterferenceHelper().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetEnergyDuration()

Time ns3::InterferenceHelper::GetEnergyDuration ( double  energyW) const
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 GetPreviousPosition(), m_niChanges, ns3::MicroSeconds(), and ns3::Simulator::Now().

Referenced by ns3::WifiPhy::MaybeCcaBusyDuration(), ns3::WifiPhy::ResumeFromOff(), ns3::WifiPhy::ResumeFromSleep(), and ns3::WifiPhy::SwitchMaybeToCcaBusy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetErrorRateModel()

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

Return the error rate model.

Returns
Error rate model

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

References m_errorRateModel.

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

+ Here is the caller graph for this function:

◆ GetNextPosition()

InterferenceHelper::NiChanges::const_iterator ns3::InterferenceHelper::GetNextPosition ( Time  moment) const
private

Returns an iterator to the first NiChange that is later than moment.

Parameters
momenttime to check from
Returns
an iterator to the list of NiChanges

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

References m_niChanges.

Referenced by AddNiChangeEvent(), AppendEvent(), and GetPreviousPosition().

+ Here is the caller graph for this function:

◆ GetPreviousPosition()

InterferenceHelper::NiChanges::const_iterator ns3::InterferenceHelper::GetPreviousPosition ( Time  moment) const
private

Returns an iterator to the first NiChange that is later than moment.

Parameters
momenttime to check from
Returns
an iterator to the list of NiChanges Returns an iterator to the last NiChange that is before than moment
Parameters
momenttime to check from
Returns
an iterator to the list of NiChanges

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

References GetNextPosition().

Referenced by AppendEvent(), GetEnergyDuration(), and NotifyRxEnd().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NotifyRxEnd()

void ns3::InterferenceHelper::NotifyRxEnd ( )

Notify that RX has ended.

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

References GetPreviousPosition(), m_firstPower, m_rxing, ns3::Simulator::Now(), and NS_LOG_FUNCTION.

Referenced by ns3::WifiPhy::AbortCurrentReception(), ns3::WifiPhy::EndReceive(), ns3::WifiPhy::ResetReceive(), ns3::WifiPhy::StartReceiveHeader(), and ns3::WifiPhy::StartRx().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ NotifyRxStart()

void ns3::InterferenceHelper::NotifyRxStart ( void  )

Notify that RX has started.

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

References m_rxing, and NS_LOG_FUNCTION.

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

+ Here is the caller graph for this function:

◆ SetErrorRateModel()

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

Set the error rate model for this interference helper.

Parameters
rateError rate model

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

References m_errorRateModel.

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

+ Here is the caller graph for this function:

◆ SetNoiseFigure()

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

Set the noise figure.

Parameters
valuenoise figure in linear scale

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:

◆ SetNumberOfReceiveAntennas()

void ns3::InterferenceHelper::SetNumberOfReceiveAntennas ( uint8_t  rx)

Set the number of RX antennas in the receiver corresponding to this interference helper.

Parameters
rxthe number of RX antennas

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

References m_numRxAntennas.

Referenced by ns3::WifiPhy::SetErrorRateModel(), ns3::WifiPhy::SetNumberOfAntennas(), and ns3::WifiPhy::SetRxNoiseFigure().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_errorRateModel

Ptr<ErrorRateModel> ns3::InterferenceHelper::m_errorRateModel
private

◆ m_firstPower

double ns3::InterferenceHelper::m_firstPower
private

◆ m_niChanges

NiChanges ns3::InterferenceHelper::m_niChanges
private

Experimental: needed for energy duration calculation.

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

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

◆ m_noiseFigure

double ns3::InterferenceHelper::m_noiseFigure
private

noise figure (linear)

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

Referenced by CalculateSnr(), and SetNoiseFigure().

◆ m_numRxAntennas

uint8_t ns3::InterferenceHelper::m_numRxAntennas
private

the number of RX antennas in the corresponding receiver

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

Referenced by CalculatePayloadChunkSuccessRate(), and SetNumberOfReceiveAntennas().

◆ m_rxing

bool ns3::InterferenceHelper::m_rxing
private

flag whether it is in receiving state

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

Referenced by AppendEvent(), EraseEvents(), NotifyRxEnd(), and NotifyRxStart().


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