handles interference calculations More...
#include <interference-helper.h>
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::Event > | Add (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< ErrorRateModel > | GetErrorRateModel (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< NiChange > | NiChanges |
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< ErrorRateModel > | m_errorRateModel |
double | m_firstPower |
NiChanges | m_niChanges |
Experimental: needed for energy duration calculation. More... | |
double | m_noiseFigure |
noise figure (linear) More... | |
bool | m_rxing |
handles interference calculations
Definition at line 41 of file interference-helper.h.
|
private |
typedef for a list of Events
Definition at line 248 of file interference-helper.h.
|
private |
typedef for a vector of NiChanges
Definition at line 244 of file interference-helper.h.
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.
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.
size | packet size |
payloadMode | Wi-Fi mode for the payload |
preamble | Wi-Fi preamble for the packet |
duration | the duration of the signal |
rxPower | receive power (w) |
txvector | TXVECTOR of the packet |
Definition at line 137 of file interference-helper.cc.
References AppendEvent().
Referenced by ns3::YansWifiPhy::StartReceivePacket().
|
private |
Add NiChange to the list at the appropriate position.
change |
Definition at line 575 of file interference-helper.cc.
References GetPosition(), ns3::InterferenceHelper::NiChange::GetTime(), and m_niChanges.
Referenced by AppendEvent().
Append the given Event.
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().
|
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.
snir | SINR |
duration | |
mode |
Definition at line 257 of file interference-helper.cc.
References ns3::WifiMode::GetPhyRate(), ns3::Time::GetSeconds(), and m_errorRateModel.
Referenced by CalculatePer().
|
private |
Calculate noise and interference power in W.
event | |
ni |
Definition at line 239 of file interference-helper.cc.
References m_firstPower, m_niChanges, m_rxing, and NS_ASSERT.
Referenced by CalculateSnrPer().
|
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).
event | |
ni |
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().
|
private |
Calculate SNR (linear ratio) from the given signal power and noise+interference power.
(Mode is not currently used)
signal | |
noiseInterference | |
mode |
Definition at line 225 of file interference-helper.cc.
References ns3::WifiMode::GetBandwidth(), and m_noiseFigure.
Referenced by CalculatePer(), and CalculateSnrPer().
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.
event | the event corresponding to the first time the packet arrives |
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().
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().
Time ns3::InterferenceHelper::GetEnergyDuration | ( | double | energyW | ) |
energyW | the minimum energy (W) requested |
Definition at line 179 of file interference-helper.cc.
References m_firstPower, m_niChanges, and ns3::Simulator::Now().
Referenced by ns3::YansWifiPhy::StartReceivePacket().
Ptr< ErrorRateModel > ns3::InterferenceHelper::GetErrorRateModel | ( | void | ) | const |
Return the error rate model.
Definition at line 173 of file interference-helper.cc.
References m_errorRateModel.
Referenced by ns3::YansWifiPhy::CalculateSnr(), and ns3::YansWifiPhy::GetErrorRateModel().
double ns3::InterferenceHelper::GetNoiseFigure | ( | void | ) | const |
Return the noise figure.
Definition at line 161 of file interference-helper.cc.
References m_noiseFigure.
Referenced by ns3::YansWifiPhy::GetRxNoiseFigure().
|
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().
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().
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().
void ns3::InterferenceHelper::SetErrorRateModel | ( | Ptr< ErrorRateModel > | rate | ) |
Set the error rate model for this interference helper.
rate | Error rate model |
Definition at line 167 of file interference-helper.cc.
References m_errorRateModel.
Referenced by ns3::YansWifiPhy::SetErrorRateModel().
void ns3::InterferenceHelper::SetNoiseFigure | ( | double | value | ) |
Set the noise figure.
value | noise figure |
Definition at line 155 of file interference-helper.cc.
References m_noiseFigure.
Referenced by ns3::YansWifiPhy::SetRxNoiseFigure().
|
private |
Definition at line 297 of file interference-helper.h.
Referenced by CalculateChunkSuccessRate(), GetErrorRateModel(), SetErrorRateModel(), and ~InterferenceHelper().
|
private |
Definition at line 300 of file interference-helper.h.
Referenced by AppendEvent(), CalculateNoiseInterferenceW(), EraseEvents(), and GetEnergyDuration().
|
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().
|
private |
noise figure (linear)
Definition at line 296 of file interference-helper.h.
Referenced by CalculateSnr(), GetNoiseFigure(), and SetNoiseFigure().
|
private |
Definition at line 301 of file interference-helper.h.
Referenced by AppendEvent(), CalculateNoiseInterferenceW(), EraseEvents(), NotifyRxEnd(), and NotifyRxStart().