9#ifndef INTERFERENCE_HELPER_H
10#define INTERFERENCE_HELPER_H
16#include "ns3/object.h"
17#include "ns3/wifi-export.h"
124WIFI_EXPORT std::ostream&
operator<<(std::ostream& os,
const Event& event);
170 void UpdateBands(
const std::vector<WifiSpectrumBandInfo>& bands,
226 bool isStartHePortionRxing =
false);
257 std::pair<Time, Time> relativeMpduStartStop)
const;
361 std::map<FrequencyRange, bool>
414 using iterator = std::vector<value_type>::iterator;
530 return m_data.insert(hint, std::move(value));
553 template <
typename... Args>
692 std::pair<Time, Time> window)
const;
747 BandStateMap::iterator bandIt)
const;
760 BandStateMap::iterator bandIt);
the interface for Wifi's error models
handles interference calculations
Watt_u GetRxPower() const
Return the total received power.
Time m_startTime
start time
Event(Ptr< const WifiPpdu > ppdu, Time duration, RxPowerWattPerChannelBand &&rxPower)
Create an Event with the given parameters.
Ptr< const WifiPpdu > GetPpdu() const
Return the PPDU.
Ptr< const WifiPpdu > m_ppdu
PPDU.
void UpdateRxPowerW(const RxPowerWattPerChannelBand &rxPower)
Update the received power (W) for all bands, i.e.
const Time & GetEndTime() const
Return the end time of the signal.
Time GetDuration() const
Return the duration of the signal.
const RxPowerWattPerChannelBand & GetRxPowerPerBand() const
Return the received power (W) for all bands.
const Time & GetStartTime() const
Return the start time of the signal.
RxPowerWattPerChannelBand m_rxPowerW
received power in watts per band
void UpdatePpdu(Ptr< const WifiPpdu > ppdu)
Update the PPDU that initially generated the event.
Noise and Interference (thus Ni) event.
Ptr< Event > m_event
event
void AddPower(Watt_u power)
Add a given amount of power.
NiChange(Watt_u power, Ptr< Event > event)
Create a NiChange at the given time and the amount of NI change.
Watt_u GetPower() const
Return the power.
Ptr< Event > GetEvent() const
Return the event causes the corresponding NI change.
Sorted-by-time list of NI changes for a single band.
std::pair< Time, NiChange > value_type
(time, NI change) entry
const_iterator begin() const
iterator emplace(Args &&... args)
Construct a value_type from args and insert it at its sorted position.
std::size_t size_type
size type
const_iterator cend() const
std::vector< value_type > m_data
storage, kept in non-decreasing time order
value_type & at(size_type i)
Bounds-checked access the i-th entry.
const_iterator end() const
std::vector< value_type >::const_iterator const_iterator
const iterator type
iterator upper_bound(const Time &t)
Locate the first entry with time strictly greater than t.
value_type & operator[](size_type i)
Access the i-th entry.
std::vector< value_type >::iterator iterator
iterator type
iterator erase(const_iterator first, const_iterator last)
Erase the entries in the range [first, last).
iterator insert(const value_type &v)
Sorted insert: the position is located via upper_bound, so entries with equal times keep their insert...
const_iterator cbegin() const
iterator insert(const_iterator hint, value_type value)
Insert at a caller-provided position (typically the result of upper_bound(t)).
const_iterator lower_bound(const Time &t) const
Locate the first entry with time greater than or equal to t.
const_iterator upper_bound(const Time &t) const
Locate the first entry with time strictly greater than t.
iterator lower_bound(const Time &t)
Locate the first entry with time greater than or equal to t.
void SetNoiseFigure(double value)
Set the noise figure.
BandStateMap m_bandStates
Per-band interference state.
Ptr< Event > Add(Ptr< const WifiPpdu > ppdu, Time duration, RxPowerWattPerChannelBand &rxPower, const FrequencyRange &freqRange, bool isStartHePortionRxing=false)
Add the PPDU-related signal to interference helper.
double m_noiseFigure
noise figure (linear)
std::map< FrequencyRange, bool > m_rxing
flag whether it is in receiving state for a given FrequencyRange
Ptr< ErrorRateModel > GetErrorRateModel() const
Return the error rate model.
void NotifyRxStart(const FrequencyRange &freqRange)
Notify that RX has started.
uint8_t m_numRxAntennas
the number of RX antennas in the corresponding receiver
bool IsBandInFrequencyRange(const WifiSpectrumBandInfo &band, const FrequencyRange &freqRange) const
Check whether a given band belongs to a given frequency range.
void DoDispose() override
Destructor implementation.
double CalculatePhyHeaderPer(Ptr< const Event > event, const NiChanges &ni, MHz_u channelWidth, const WifiSpectrumBandInfo &band, WifiPpduField header) const
Calculate the error rate of the PHY header.
Time GetEnergyDuration(Watt_u energy, const WifiSpectrumBandInfo &band)
void UpdateBands(const std::vector< WifiSpectrumBandInfo > &bands, const FrequencyRange &freqRange)
Update the frequency bands that belongs to a given frequency range when the spectrum model is changed...
void SetErrorRateModel(const Ptr< ErrorRateModel > rate)
Set the error rate model for this interference helper.
bool HasBands() const
Check whether bands are already tracked by this interference helper.
void AddForeignSignal(Time duration, RxPowerWattPerChannelBand &rxPower, const FrequencyRange &freqRange)
Add a non-Wifi signal to interference helper.
double CalculatePhyHeaderSectionPsr(Ptr< const Event > event, const NiChanges &ni, MHz_u channelWidth, const WifiSpectrumBandInfo &band, PhyHeaderSections phyHeaderSections) const
Calculate the success rate of the PHY header sections for the provided event.
double CalculatePayloadChunkSuccessRate(double snir, Time duration, const WifiTxVector &txVector, uint16_t staId=SU_STA_ID) const
Calculate the success rate of the payload chunk given the SINR, duration, and TXVECTOR.
Ptr< ErrorRateModel > m_errorRateModel
error rate model
Watt_u CalculateNoiseInterferenceW(Ptr< Event > event, NiChanges &ni, const WifiSpectrumBandInfo &band) const
Calculate noise and interference power.
SnrPer CalculatePhyHeaderSnrPer(Ptr< Event > event, MHz_u channelWidth, const WifiSpectrumBandInfo &band, WifiPpduField header) const
Calculate the SNIR at the start of the PHY header and accumulate all SNIR changes in the SNIR vector.
bool IsSameMuMimoTransmission(Ptr< const Event > currentEvent, Ptr< const Event > otherEvent) const
Return whether another event is a MU-MIMO event that belongs to the same transmission and to the same...
double CalculateChunkSuccessRate(double snir, Time duration, WifiMode mode, const WifiTxVector &txVector, WifiPpduField field) const
Calculate the success rate of the chunk given the SINR, duration, and TXVECTOR.
bool HasBand(const WifiSpectrumBandInfo &band) const
Check whether a given band is tracked by this interference helper.
void AddBand(const WifiSpectrumBandInfo &band)
Add a frequency band.
Watt_u CalculateMuMimoPowerW(Ptr< const Event > event, const WifiSpectrumBandInfo &band) const
Calculate power of all other events preceding a given event that belong to the same MU-MIMO transmiss...
void AppendEvent(Ptr< Event > event, const FrequencyRange &freqRange, bool isStartHePortionRxing)
Append the given Event.
static TypeId GetTypeId()
Get the type ID.
void UpdateEvent(Ptr< Event > event, const RxPowerWattPerChannelBand &rxPower)
Update event to scale its received power (W) per band.
void RemoveBand(const WifiSpectrumBandInfo &band)
Remove a frequency band.
void NotifyRxEnd(Time endTime, const FrequencyRange &freqRange)
Notify that RX has ended.
double CalculatePayloadPer(Ptr< const Event > event, MHz_u channelWidth, const NiChanges &ni, const WifiSpectrumBandInfo &band, uint16_t staId, std::pair< Time, Time > window) const
Calculate the error rate of the given PHY payload only in the provided time window (thus enabling per...
void SetNumberOfReceiveAntennas(uint8_t rx)
Set the number of RX antennas in the receiver corresponding to this interference helper.
NiChanges::iterator GetPreviousPosition(const Time &moment, BandStateMap::iterator bandIt) const
Returns an iterator to the last NiChange that is before than moment.
SnrPer CalculatePayloadSnrPer(Ptr< Event > event, MHz_u channelWidth, const WifiSpectrumBandInfo &band, uint16_t staId, 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...
NiChanges::iterator GetNextPosition(const Time &moment, BandStateMap::iterator bandIt) const
Returns an iterator to the first NiChange that is later than moment.
std::map< WifiSpectrumBandInfo, BandState > BandStateMap
Map of per-band state, keyed by band info.
NiChanges::iterator AddNiChangeEvent(const Time &moment, NiChange change, BandStateMap::iterator bandIt)
Add NiChange to the list at the appropriate position and return the iterator of the new event.
double CalculateSnr(Ptr< Event > event, MHz_u channelWidth, uint8_t nss, const WifiSpectrumBandInfo &band) const
Calculate the SNIR for the event (starting from now until the event end).
Object()
Caller graph was not generated because of its size.
Smart pointer class similar to boost::intrusive_ptr.
Received power (W) per spectrum band.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
represent a single transmission mode
WifiPpdu stores a preamble, a modulation class, PHY headers and a PSDU.
WifiPsdu stores an MPDU, S-MPDU or A-MPDU, by keeping header(s) and payload(s) separate for each cons...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiPpduField
The type of PPDU field (grouped for convenience).
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
std::map< WifiPpduField, PhyHeaderChunkInfo > PhyHeaderSections
A map of PhyHeaderChunkInfo elements per PPDU field.
double MHz_u
MHz weak type.
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU).
double Watt_u
Watt weak type.
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).
Per-band interference state: the NI changes timeline together with the noise+interference power captu...
Watt_u firstPower
noise+interference power at the start of the last RX
NiChanges niChanges
NI changes timeline for this band.
Comparator for heterogeneous lookup of entries by Time.
bool operator()(const value_type &a, const Time &b) const
Compare an entry against a time.
bool operator()(const Time &a, const value_type &b) const
Compare a time against an entry.
A struct for both SNR and PER.
WifiSpectrumBandInfo structure containing info about a spectrum band.
Declaration of the following enums:
Declaration of ns3::WifiPpdu class and ns3::WifiConstPsduMap.