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, WifiTxVector txvector, enum WifiPreamble preamble, Time duration, double rxPower) |
Add the packet-related 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< 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 | 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, 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 255 of file interference-helper.h.
|
private |
typedef for a vector of NiChanges
Definition at line 251 of file interference-helper.h.
ns3::InterferenceHelper::InterferenceHelper | ( | ) |
Definition at line 122 of file interference-helper.cc.
ns3::InterferenceHelper::~InterferenceHelper | ( | ) |
Definition at line 128 of file interference-helper.cc.
References EraseEvents(), and m_errorRateModel.
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.
size | packet size |
txvector | TXVECTOR of the packet |
preamble | Wi-Fi preamble for the packet |
duration | the duration of the signal |
rxPower | receive power (w) |
Definition at line 135 of file interference-helper.cc.
References AppendEvent().
Referenced by ns3::YansWifiPhy::StartReceivePlcp().
|
private |
Add NiChange to the list at the appropriate position.
change |
Definition at line 649 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 199 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 254 of file interference-helper.cc.
References ns3::WifiMode::GetPhyRate(), ns3::Time::GetSeconds(), m_errorRateModel, and ns3::NanoSeconds().
Referenced by CalculatePlcpHeaderPer(), and CalculatePlcpPayloadPer().
|
private |
Calculate noise and interference power in W.
event | |
ni |
Definition at line 236 of file interference-helper.cc.
References m_firstPower, m_niChanges, m_rxing, and NS_ASSERT.
Referenced by CalculatePlcpHeaderSnrPer(), and CalculatePlcpPayloadSnrPer().
|
private |
Calculate the error rate of the plcp header.
The plcp header can be divided into multiple chunks (e.g. due to interference from other transmissions).
event | |
ni |
Definition at line 363 of file interference-helper.cc.
References CalculateChunkSuccessRate(), CalculateSnr(), ns3::WifiPhy::GetMFPlcpHeaderMode(), ns3::WifiPhy::GetPlcpHeaderDuration(), ns3::WifiPhy::GetPlcpHeaderMode(), ns3::WifiPhy::GetPlcpHtSigHeaderDuration(), ns3::WifiPhy::GetPlcpHtTrainingSymbolDuration(), ns3::WifiPhy::GetPlcpPreambleDuration(), NS_ASSERT, ns3::WIFI_PREAMBLE_HT_GF, ns3::WIFI_PREAMBLE_HT_MF, ns3::WIFI_PREAMBLE_LONG, and ns3::WIFI_PREAMBLE_SHORT.
Referenced by CalculatePlcpHeaderSnrPer().
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.
event | the event corresponding to the first time the corresponding packet arrives |
Definition at line 616 of file interference-helper.cc.
References CalculateNoiseInterferenceW(), CalculatePlcpHeaderPer(), CalculateSnr(), ns3::WifiPhy::GetPlcpHeaderMode(), ns3::InterferenceHelper::SnrPer::per, and ns3::InterferenceHelper::SnrPer::snr.
Referenced by ns3::YansWifiPhy::StartReceivePacket().
|
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).
event | |
ni |
Definition at line 267 of file interference-helper.cc.
References CalculateChunkSuccessRate(), CalculateSnr(), ns3::WifiPhy::GetPlcpHeaderDuration(), ns3::WifiPhy::GetPlcpHtSigHeaderDuration(), ns3::WifiPhy::GetPlcpHtTrainingSymbolDuration(), ns3::WifiPhy::GetPlcpPreambleDuration(), and NS_ASSERT.
Referenced by CalculatePlcpPayloadSnrPer().
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.
event | the event corresponding to the first time the corresponding packet arrives |
Definition at line 596 of file interference-helper.cc.
References CalculateNoiseInterferenceW(), CalculatePlcpPayloadPer(), CalculateSnr(), ns3::InterferenceHelper::SnrPer::per, and ns3::InterferenceHelper::SnrPer::snr.
Referenced by ns3::YansWifiPhy::EndReceive().
|
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 222 of file interference-helper.cc.
References ns3::WifiMode::GetBandwidth(), and m_noiseFigure.
Referenced by CalculatePlcpHeaderPer(), CalculatePlcpHeaderSnrPer(), CalculatePlcpPayloadPer(), and CalculatePlcpPayloadSnrPer().
void ns3::InterferenceHelper::EraseEvents | ( | void | ) |
Erase all events.
Definition at line 636 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 176 of file interference-helper.cc.
References m_firstPower, m_niChanges, ns3::MicroSeconds(), and ns3::Simulator::Now().
Referenced by ns3::YansWifiPhy::ResumeFromSleep(), and ns3::YansWifiPhy::StartReceivePlcp().
Ptr< ErrorRateModel > ns3::InterferenceHelper::GetErrorRateModel | ( | void | ) | const |
Return the error rate model.
Definition at line 170 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 158 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 643 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 659 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 654 of file interference-helper.cc.
References m_rxing.
Referenced by ns3::YansWifiPhy::StartReceivePlcp().
void ns3::InterferenceHelper::SetErrorRateModel | ( | Ptr< ErrorRateModel > | rate | ) |
Set the error rate model for this interference helper.
rate | Error rate model |
Definition at line 164 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 152 of file interference-helper.cc.
References m_noiseFigure.
Referenced by ns3::YansWifiPhy::SetRxNoiseFigure().
|
private |
Definition at line 313 of file interference-helper.h.
Referenced by CalculateChunkSuccessRate(), GetErrorRateModel(), SetErrorRateModel(), and ~InterferenceHelper().
|
private |
Definition at line 316 of file interference-helper.h.
Referenced by AppendEvent(), CalculateNoiseInterferenceW(), EraseEvents(), and GetEnergyDuration().
|
private |
Experimental: needed for energy duration calculation.
Definition at line 315 of file interference-helper.h.
Referenced by AddNiChangeEvent(), AppendEvent(), CalculateNoiseInterferenceW(), EraseEvents(), GetEnergyDuration(), and GetPosition().
|
private |
noise figure (linear)
Definition at line 312 of file interference-helper.h.
Referenced by CalculateSnr(), GetNoiseFigure(), and SetNoiseFigure().
|
private |
Definition at line 317 of file interference-helper.h.
Referenced by AppendEvent(), CalculateNoiseInterferenceW(), EraseEvents(), NotifyRxEnd(), and NotifyRxStart().