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::Event > | Add (Ptr< const Packet > packet, WifiTxVector txVector, 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) const |
| 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) const |
| 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) const |
| 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 (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, NiChange > | NiChanges |
| 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 | 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, uint8_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< ErrorRateModel > | m_errorRateModel |
| error rate model More... | |
| double | m_firstPower |
| first power 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... | |
handles interference calculations
Definition at line 36 of file interference-helper.h.
|
private |
typedef for a multimap of NiChanges
Definition at line 248 of file interference-helper.h.
| ns3::InterferenceHelper::InterferenceHelper | ( | ) |
Definition at line 120 of file interference-helper.cc.
References AddNiChangeEvent().
Here is the call graph for this function:| 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:| Ptr< InterferenceHelper::Event > ns3::InterferenceHelper::Add | ( | Ptr< const Packet > | packet, |
| WifiTxVector | txVector, | ||
| Time | duration, | ||
| double | rxPower | ||
| ) |
Add the packet-related signal to interference helper.
| packet | the packet |
| txVector | TXVECTOR of the packet |
| duration | the duration of the signal |
| rxPower | receive power (W) |
Definition at line 137 of file interference-helper.cc.
References AppendEvent().
Referenced by AddForeignSignal(), and ns3::WifiPhy::StartReceivePreambleAndHeader().
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.
| duration | the duration of the signal |
| rxPower | receive power (W) |
Definition at line 145 of file interference-helper.cc.
References Add().
Referenced by ns3::SpectrumWifiPhy::StartRx().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Add NiChange to the list at the appropriate position and return the iterator of the new event.
| moment | |
| change |
Definition at line 811 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:Append the given Event.
| event |
Definition at line 203 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:
|
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 | |
| txVector |
Definition at line 260 of file interference-helper.cc.
References ns3::WifiTxVector::GetMode(), ns3::WifiMode::GetModulationClass(), ns3::WifiTxVector::GetNss(), ns3::WifiTxVector::GetNTx(), ns3::WifiMode::GetPhyRate(), ns3::Time::GetSeconds(), ns3::Time::IsZero(), m_errorRateModel, m_numRxAntennas, NS_LOG_DEBUG, ns3::WIFI_MOD_CLASS_HE, ns3::WIFI_MOD_CLASS_HT, and ns3::WIFI_MOD_CLASS_VHT.
Referenced by CalculatePlcpHeaderPer(), and CalculatePlcpPayloadPer().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Calculate noise and interference power in W.
| event | |
| ni |
Definition at line 242 of file interference-helper.cc.
References m_firstPower, and m_niChanges.
Referenced by CalculatePlcpHeaderSnrPer(), and CalculatePlcpPayloadSnrPer().
Here is the caller graph for this function:
|
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 330 of file interference-helper.cc.
References CalculateChunkSuccessRate(), CalculateSnr(), ns3::WifiTxVector::GetChannelWidth(), ns3::WifiPhy::GetHePlcpHeaderMode(), ns3::WifiPhy::GetHtPlcpHeaderMode(), ns3::WifiPhy::GetPlcpHeaderDuration(), ns3::WifiPhy::GetPlcpHeaderMode(), ns3::WifiPhy::GetPlcpHtSigHeaderDuration(), ns3::WifiPhy::GetPlcpPreambleDuration(), ns3::WifiPhy::GetPlcpSigA1Duration(), ns3::WifiPhy::GetPlcpSigA2Duration(), ns3::WifiPhy::GetPlcpSigBDuration(), ns3::WifiPhy::GetPlcpTrainingSymbolDuration(), ns3::WifiTxVector::GetPreambleType(), ns3::WifiPhy::GetVhtPlcpHeaderMode(), m_firstPower, NS_ASSERT, NS_LOG_DEBUG, NS_LOG_FUNCTION, ns3::WIFI_PREAMBLE_HE_SU, ns3::WIFI_PREAMBLE_HT_GF, ns3::WIFI_PREAMBLE_HT_MF, ns3::WIFI_PREAMBLE_LONG, ns3::WIFI_PREAMBLE_SHORT, and ns3::WIFI_PREAMBLE_VHT.
Referenced by CalculatePlcpHeaderSnrPer().
Here is the call graph for this function:
Here is the caller graph for this function:| struct InterferenceHelper::SnrPer ns3::InterferenceHelper::CalculatePlcpHeaderSnrPer | ( | Ptr< InterferenceHelper::Event > | event | ) | const |
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 765 of file interference-helper.cc.
References CalculateNoiseInterferenceW(), CalculatePlcpHeaderPer(), CalculateSnr(), ns3::InterferenceHelper::SnrPer::per, and ns3::InterferenceHelper::SnrPer::snr.
Referenced by ns3::WifiPhy::StartReceivePacket().
Here is the call graph for this function:
Here is the caller graph for this function:
|
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 282 of file interference-helper.cc.
References CalculateChunkSuccessRate(), CalculateSnr(), ns3::WifiTxVector::GetChannelWidth(), ns3::WifiPhy::GetPlcpHeaderDuration(), ns3::WifiPhy::GetPlcpHtSigHeaderDuration(), ns3::WifiPhy::GetPlcpPreambleDuration(), ns3::WifiPhy::GetPlcpSigA1Duration(), ns3::WifiPhy::GetPlcpSigA2Duration(), ns3::WifiPhy::GetPlcpSigBDuration(), ns3::WifiPhy::GetPlcpTrainingSymbolDuration(), ns3::WifiTxVector::GetPreambleType(), m_firstPower, 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 | ) | const |
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 745 of file interference-helper.cc.
References CalculateNoiseInterferenceW(), CalculatePlcpPayloadPer(), CalculateSnr(), ns3::InterferenceHelper::SnrPer::per, and ns3::InterferenceHelper::SnrPer::snr.
Referenced by ns3::WifiPhy::EndReceive().
Here is the call graph for this function:
Here is the caller graph for this function:
|
private |
Calculate SNR (linear ratio) from the given signal power and noise+interference power.
(Mode is not currently used)
| signal | |
| noiseInterference | |
| channelWidth |
Definition at line 227 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 | ) |
Erase all events.
Definition at line 785 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:| Time ns3::InterferenceHelper::GetEnergyDuration | ( | double | energyW | ) | const |
| energyW | the minimum energy (W) requested |
Definition at line 185 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:| 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::WifiPhy::CalculateSnr(), and ns3::WifiPhy::GetErrorRateModel().
Here is the caller graph for this function:
|
private |
Returns an iterator to the first nichange that is later than moment.
| moment | time to check from |
Definition at line 795 of file interference-helper.cc.
References m_niChanges.
Referenced by AddNiChangeEvent(), AppendEvent(), and GetPreviousPosition().
Here is the caller graph for this function:| 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::WifiPhy::GetRxNoiseFigure().
Here is the caller graph for this function:
|
private |
Returns an iterator to the first nichange that is later than moment.
| moment | time to check from |
| moment | time to check from |
Definition at line 801 of file interference-helper.cc.
References GetNextPosition().
Referenced by AppendEvent(), and GetEnergyDuration().
Here is the call graph for this function:
Here is the caller graph for this function:| void ns3::InterferenceHelper::NotifyRxEnd | ( | ) |
Notify that RX has ended.
Definition at line 824 of file interference-helper.cc.
References m_firstPower, m_niChanges, m_rxing, ns3::Simulator::Now(), and NS_LOG_FUNCTION.
Referenced by ns3::WifiPhy::AbortCurrentReception(), ns3::WifiPhy::EndReceive(), and ns3::WifiPhy::SendPacket().
Here is the call graph for this function:
Here is the caller graph for this function:| void ns3::InterferenceHelper::NotifyRxStart | ( | void | ) |
Notify that RX has started.
Definition at line 817 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:| void ns3::InterferenceHelper::SetErrorRateModel | ( | const 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::WifiPhy::SetErrorRateModel().
Here is the caller graph for this function:| 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::WifiPhy::SetRxNoiseFigure().
Here is the caller graph for this function:| void ns3::InterferenceHelper::SetNumberOfReceiveAntennas | ( | uint8_t | rx | ) |
Set the number of RX antennas in the receiver corresponding to this interference helper.
| rx | the number of RX antennas |
Definition at line 179 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:
|
private |
error rate model
Definition at line 310 of file interference-helper.h.
Referenced by CalculateChunkSuccessRate(), GetErrorRateModel(), SetErrorRateModel(), and ~InterferenceHelper().
|
private |
first power
Definition at line 314 of file interference-helper.h.
Referenced by AppendEvent(), CalculateNoiseInterferenceW(), CalculatePlcpHeaderPer(), CalculatePlcpPayloadPer(), EraseEvents(), and NotifyRxEnd().
|
private |
Experimental: needed for energy duration calculation.
Definition at line 313 of file interference-helper.h.
Referenced by AddNiChangeEvent(), AppendEvent(), CalculateNoiseInterferenceW(), EraseEvents(), GetEnergyDuration(), GetNextPosition(), and NotifyRxEnd().
|
private |
noise figure (linear)
Definition at line 309 of file interference-helper.h.
Referenced by CalculateSnr(), GetNoiseFigure(), and SetNoiseFigure().
|
private |
the number of RX antennas in the corresponding receiver
Definition at line 311 of file interference-helper.h.
Referenced by CalculateChunkSuccessRate(), and SetNumberOfReceiveAntennas().
|
private |
flag whether it is in receiving state
Definition at line 315 of file interference-helper.h.
Referenced by AppendEvent(), EraseEvents(), NotifyRxEnd(), and NotifyRxStart().