A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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, WifiMode payloadMode, enum WifiPreamble preamble, Time duration, double rxPower, WifiTxVector txvector)
 Add the packet-related signal to interference helper. More...
 
struct InterferenceHelper::SnrPer CalculateSnrPer (Ptr< InterferenceHelper::Event > event)
 Calculate the SNIR at the start of the packet 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) 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 CalculatePer (Ptr< const Event > event, NiChanges *ni) const
 Calculate the error rate of the given packet. More...
 
double CalculateSnr (double signal, double noiseInterference, WifiMode mode) 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 248 of file interference-helper.h.

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

typedef for a vector of NiChanges

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

Constructor & Destructor Documentation

ns3::InterferenceHelper::InterferenceHelper ( )

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

ns3::InterferenceHelper::~InterferenceHelper ( )

Definition at line 130 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,
WifiMode  payloadMode,
enum WifiPreamble  preamble,
Time  duration,
double  rxPower,
WifiTxVector  txvector 
)

Add the packet-related signal to interference helper.

Parameters
sizepacket size
payloadModeWi-Fi mode for the payload
preambleWi-Fi preamble for the packet
durationthe duration of the signal
rxPowerreceive power (w)
txvectorTXVECTOR of the packet
Returns
InterferenceHelper::Event

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

References AppendEvent().

Referenced by ns3::YansWifiPhy::StartReceivePacket().

+ 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 575 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 202 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 
) 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
Returns
the success rate

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

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

Referenced by CalculatePer().

+ 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 239 of file interference-helper.cc.

References m_firstPower, m_niChanges, m_rxing, and NS_ASSERT.

Referenced by CalculateSnrPer().

+ Here is the caller graph for this function:

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

Calculate the error rate of the given packet.

The packet 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 270 of file interference-helper.cc.

References CalculateChunkSuccessRate(), CalculateSnr(), current, ns3::WifiPhy::GetMFPlcpHeaderMode(), ns3::WifiPhy::GetPlcpHeaderDurationMicroSeconds(), ns3::WifiPhy::GetPlcpHeaderMode(), ns3::WifiPhy::GetPlcpHtSigHeaderDurationMicroSeconds(), ns3::WifiPhy::GetPlcpHtTrainingSymbolDurationMicroSeconds(), ns3::WifiPhy::GetPlcpPreambleDurationMicroSeconds(), NS_ASSERT, ns3::WIFI_PREAMBLE_HT_GF, ns3::WIFI_PREAMBLE_HT_MF, ns3::WIFI_PREAMBLE_LONG, and ns3::WIFI_PREAMBLE_SHORT.

Referenced by CalculateSnrPer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

double ns3::InterferenceHelper::CalculateSnr ( double  signal,
double  noiseInterference,
WifiMode  mode 
) const
private

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

(Mode is not currently used)

Parameters
signal
noiseInterference
mode
Returns
SNR in liear ratio

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

References ns3::WifiMode::GetBandwidth(), and m_noiseFigure.

Referenced by CalculatePer(), and CalculateSnrPer().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

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

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

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

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

Referenced by ns3::YansWifiPhy::EndReceive().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::InterferenceHelper::EraseEvents ( void  )

Erase all events.

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

References m_firstPower, m_niChanges, and m_rxing.

Referenced by ns3::YansWifiPhy::SetChannelNumber(), and ~InterferenceHelper().

+ Here is the caller graph for this function:

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 179 of file interference-helper.cc.

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

Referenced by ns3::YansWifiPhy::StartReceivePacket().

+ 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 173 of file interference-helper.cc.

References m_errorRateModel.

Referenced by ns3::YansWifiPhy::CalculateSnr(), and ns3::YansWifiPhy::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 161 of file interference-helper.cc.

References m_noiseFigure.

Referenced by ns3::YansWifiPhy::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 569 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 585 of file interference-helper.cc.

References m_rxing.

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

+ Here is the caller graph for this function:

void ns3::InterferenceHelper::NotifyRxStart ( void  )

Notify that RX has started.

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

References m_rxing.

Referenced by ns3::YansWifiPhy::StartReceivePacket().

+ 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 167 of file interference-helper.cc.

References m_errorRateModel.

Referenced by ns3::YansWifiPhy::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 155 of file interference-helper.cc.

References m_noiseFigure.

Referenced by ns3::YansWifiPhy::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 299 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 296 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: