A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
interference-helper.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2005,2006 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
7 */
8
9#ifndef INTERFERENCE_HELPER_H
10#define INTERFERENCE_HELPER_H
11
12#include "wifi-phy-common.h"
13#include "wifi-ppdu.h"
14#include "wifi-tx-vector.h"
15
16#include "ns3/object.h"
17#include "ns3/wifi-export.h"
18
19#include <algorithm>
20#include <cstddef>
21#include <map>
22#include <utility>
23#include <vector>
24
25namespace ns3
26{
27
28class WifiPpdu;
29class WifiPsdu;
30class ErrorRateModel;
31
32/**
33 * @ingroup wifi
34 * @brief handles interference calculations
35 * @brief signal event for a PPDU.
36 */
37class WIFI_EXPORT Event : public SimpleRefCount<Event>
38{
39 public:
40 /**
41 * Create an Event with the given parameters. Note that <i>rxPower</i> will
42 * be moved into this object.
43 *
44 * @param ppdu the PPDU
45 * @param duration duration of the PPDU
46 * @param rxPower the received power per band (W)
47 */
49
50 /**
51 * Return the PPDU.
52 *
53 * @return the PPDU
54 */
56 /**
57 * Return the start time of the signal.
58 *
59 * @return the start time of the signal
60 */
61 const Time& GetStartTime() const;
62 /**
63 * Return the end time of the signal.
64 *
65 * @return the end time of the signal
66 */
67 const Time& GetEndTime() const;
68 /**
69 * Return the duration of the signal.
70 *
71 * @return the duration of the signal
72 */
73 Time GetDuration() const;
74 /**
75 * Return the total received power.
76 *
77 * @return the total received power
78 */
79 Watt_u GetRxPower() const;
80 /**
81 * Return the received power for a given band.
82 *
83 * @param band the band for which the power should be returned
84 * @return the received power for a given band
85 */
86 Watt_u GetRxPower(const WifiSpectrumBandInfo& band) const;
87 /**
88 * Return the received power (W) for all bands.
89 *
90 * @return the received power (W) for all bands.
91 */
93 /**
94 * Update the received power (W) for all bands, i.e. add up the received power
95 * to the current received power, for each band.
96 *
97 * @param rxPower the received power (W) for all bands.
98 */
99 void UpdateRxPowerW(const RxPowerWattPerChannelBand& rxPower);
100 /**
101 * Update the PPDU that initially generated the event.
102 * This is needed to have the PPDU holding the correct TXVECTOR
103 * upon reception of multiple signals carrying the same content
104 * but over different channel width (typically non-HT duplicates).
105 *
106 * @param ppdu the new PPDU to use for this event.
107 */
109
110 private:
112 Time m_startTime; //!< start time
113 Time m_endTime; //!< end time
114 RxPowerWattPerChannelBand m_rxPowerW; //!< received power in watts per band
115};
116
117/**
118 * @brief Stream insertion operator.
119 *
120 * @param os the stream
121 * @param event the event
122 * @returns a reference to the stream
123 */
124WIFI_EXPORT std::ostream& operator<<(std::ostream& os, const Event& event);
125
126/**
127 * @ingroup wifi
128 * @brief handles interference calculations
129 */
130class WIFI_EXPORT InterferenceHelper : public Object
131{
132 public:
134 ~InterferenceHelper() override;
135
136 /**
137 * @brief Get the type ID.
138 * @return the object TypeId
139 */
140 static TypeId GetTypeId();
141
142 /**
143 * Add a frequency band.
144 *
145 * @param band the band to be added
146 */
147 void AddBand(const WifiSpectrumBandInfo& band);
148
149 /**
150 * Remove a frequency band.
151 *
152 * @param band the band to be removed
153 */
154 void RemoveBand(const WifiSpectrumBandInfo& band);
155
156 /**
157 * Check whether bands are already tracked by this interference helper.
158 *
159 * @return true if bands are tracked by this interference helper, false otherwise
160 */
161 bool HasBands() const;
162
163 /**
164 * Update the frequency bands that belongs to a given frequency range when the spectrum model is
165 * changed.
166 *
167 * @param bands the bands to be added in the new spectrum model
168 * @param freqRange the frequency range the bands belong to
169 */
170 void UpdateBands(const std::vector<WifiSpectrumBandInfo>& bands,
171 const FrequencyRange& freqRange);
172
173 /**
174 * Set the noise figure.
175 *
176 * @param value noise figure in linear scale
177 */
178 void SetNoiseFigure(double value);
179 /**
180 * Set the error rate model for this interference helper.
181 *
182 * @param rate Error rate model
183 */
184 void SetErrorRateModel(const Ptr<ErrorRateModel> rate);
185
186 /**
187 * Return the error rate model.
188 *
189 * @return Error rate model
190 */
192 /**
193 * Set the number of RX antennas in the receiver corresponding to this
194 * interference helper.
195 *
196 * @param rx the number of RX antennas
197 */
198 void SetNumberOfReceiveAntennas(uint8_t rx);
199
200 /**
201 * @param energy the minimum energy requested
202 * @param band identify the requested band
203 *
204 * @returns the expected amount of time the observed
205 * energy on the medium for a given band will
206 * be higher than the requested threshold.
207 */
209
210 /**
211 * Add the PPDU-related signal to interference helper.
212 *
213 * @param ppdu the PPDU
214 * @param duration the PPDU duration
215 * @param rxPower received power per band (W)
216 * @param freqRange the frequency range in which the received signal is detected
217 * @param isStartHePortionRxing flag whether the event corresponds to the start of the HE
218 * portion reception (only used for MU)
219 *
220 * @return Event
221 */
223 Time duration,
225 const FrequencyRange& freqRange,
226 bool isStartHePortionRxing = false);
227
228 /**
229 * Add a non-Wifi signal to interference helper.
230 * @param duration the duration of the signal
231 * @param rxPower received power per band (W)
232 * @param freqRange the frequency range in which the received signal is detected
233 */
234 void AddForeignSignal(Time duration,
236 const FrequencyRange& freqRange);
237 /**
238 * Calculate the SNIR at the start of the payload and accumulate
239 * all SNIR changes in the SNIR vector for each MPDU of an A-MPDU.
240 * This workaround is required in order to provide one PER per MPDU, for
241 * reception success/failure evaluation, while hiding aggregation details from
242 * this class.
243 *
244 * @param event the event corresponding to the first time the corresponding PPDU arrives
245 * @param channelWidth the channel width used to transmit the PSDU
246 * @param band identify the band used by the PSDU
247 * @param staId the station ID of the PSDU (only used for MU)
248 * @param relativeMpduStartStop the time window (pair of start and end times) of PHY payload to
249 * focus on
250 *
251 * @return struct of SNR and PER (with PER being evaluated over the provided time window)
252 */
254 MHz_u channelWidth,
255 const WifiSpectrumBandInfo& band,
256 uint16_t staId,
257 std::pair<Time, Time> relativeMpduStartStop) const;
258 /**
259 * Calculate the SNIR for the event (starting from now until the event end).
260 *
261 * @param event the event corresponding to the first time the corresponding PPDU arrives
262 * @param channelWidth the channel width
263 * @param nss the number of spatial streams
264 * @param band identify the band used by the PSDU
265 *
266 * @return the SNR for the PPDU in linear scale
267 */
268 double CalculateSnr(Ptr<Event> event,
269 MHz_u channelWidth,
270 uint8_t nss,
271 const WifiSpectrumBandInfo& band) const;
272 /**
273 * Calculate the SNIR at the start of the PHY header and accumulate
274 * all SNIR changes in the SNIR vector.
275 *
276 * @param event the event corresponding to the first time the corresponding PPDU arrives
277 * @param channelWidth the channel width for header measurement
278 * @param band identify the band used by the PSDU
279 * @param header the PHY header to consider
280 *
281 * @return struct of SNR and PER
282 */
284 MHz_u channelWidth,
285 const WifiSpectrumBandInfo& band,
286 WifiPpduField header) const;
287
288 /**
289 * Notify that RX has started.
290 * @param freqRange the frequency range in which the received signal event is detected
291 */
292 void NotifyRxStart(const FrequencyRange& freqRange);
293 /**
294 * Notify that RX has ended.
295 *
296 * @param endTime the end time of the signal
297 * @param freqRange the frequency range in which the received signal event was detected
298 */
299 void NotifyRxEnd(Time endTime, const FrequencyRange& freqRange);
300
301 /**
302 * Update event to scale its received power (W) per band.
303 *
304 * @param event the event to be updated
305 * @param rxPower the received power (W) per band to be added to the current event
306 */
307 void UpdateEvent(Ptr<Event> event, const RxPowerWattPerChannelBand& rxPower);
308
309 protected:
310 void DoDispose() override;
311
312 /**
313 * Calculate SNR (linear ratio) from the given signal power and noise+interference power.
314 *
315 * @param signal signal power
316 * @param noiseInterference noise and interference power
317 * @param channelWidth signal width
318 * @param nss the number of spatial streams
319 *
320 * @return SNR in linear scale
321 */
322 double CalculateSnr(Watt_u signal,
323 Watt_u noiseInterference,
324 MHz_u channelWidth,
325 uint8_t nss) const;
326 /**
327 * Calculate the success rate of the chunk given the SINR, duration, and TXVECTOR.
328 * The duration and TXVECTOR are used to calculate how many bits are present in the chunk.
329 *
330 * @param snir the SINR
331 * @param duration the duration of the chunk
332 * @param mode the WifiMode
333 * @param txVector the TXVECTOR
334 * @param field the PPDU field to which the chunk belongs to
335 *
336 * @return the success rate
337 */
338 double CalculateChunkSuccessRate(double snir,
339 Time duration,
340 WifiMode mode,
341 const WifiTxVector& txVector,
342 WifiPpduField field) const;
343 /**
344 * Calculate the success rate of the payload chunk given the SINR, duration, and TXVECTOR.
345 * The duration and TXVECTOR are used to calculate how many bits are present in the payload
346 * chunk.
347 *
348 * @param snir the SINR
349 * @param duration the duration of the chunk
350 * @param txVector the TXVECTOR
351 * @param staId the station ID of the PSDU (only used for MU)
352 *
353 * @return the success rate
354 */
355 double CalculatePayloadChunkSuccessRate(double snir,
356 Time duration,
357 const WifiTxVector& txVector,
358 uint16_t staId = SU_STA_ID) const;
359
360 protected:
361 std::map<FrequencyRange, bool>
362 m_rxing; //!< flag whether it is in receiving state for a given FrequencyRange
363
364 /**
365 * Noise and Interference (thus Ni) event.
366 */
367 class WIFI_EXPORT NiChange
368 {
369 public:
370 /**
371 * Create a NiChange at the given time and the amount of NI change.
372 *
373 * @param power the power
374 * @param event causes this NI change
375 */
376 NiChange(Watt_u power, Ptr<Event> event);
377
378 /**
379 * Return the power
380 *
381 * @return the power
382 */
383 Watt_u GetPower() const;
384 /**
385 * Add a given amount of power.
386 *
387 * @param power the power to be added to the existing value
388 */
389 void AddPower(Watt_u power);
390 /**
391 * Return the event causes the corresponding NI change
392 *
393 * @return the event
394 */
395 Ptr<Event> GetEvent() const;
396
397 private:
398 Watt_u m_power; ///< power
399 Ptr<Event> m_event; ///< event
400 };
401
402 /**
403 * Sorted-by-time list of NI changes for a single band.
404 *
405 * Entries are kept in non-decreasing time order and duplicate times are
406 * allowed. The backing std::vector amortises allocations across growth;
407 * insert/erase shift the tail, which is cheap because the steady-state
408 * size is small (a handful of in-flight events per band).
409 */
411 {
412 public:
413 using value_type = std::pair<Time, NiChange>; //!< (time, NI change) entry
414 using iterator = std::vector<value_type>::iterator; //!< iterator type
415 using const_iterator = std::vector<value_type>::const_iterator; //!< const iterator type
416 using size_type = std::size_t; //!< size type
417
418 /// @return an iterator to the first entry
420 {
421 return m_data.begin();
422 }
423
424 /// @return an iterator one past the last entry
426 {
427 return m_data.end();
428 }
429
430 /// @return a const iterator to the first entry
432 {
433 return m_data.begin();
434 }
435
436 /// @return a const iterator one past the last entry
438 {
439 return m_data.end();
440 }
441
442 /// @return a const iterator to the first entry
444 {
445 return m_data.cbegin();
446 }
447
448 /// @return a const iterator one past the last entry
450 {
451 return m_data.cend();
452 }
453
454 /// @return the number of entries
456 {
457 return m_data.size();
458 }
459
460 /**
461 * Access the i-th entry.
462 * @param i the index of the entry
463 * @return reference to the i-th entry
464 */
466 {
467 return m_data[i];
468 }
469
470 /**
471 * Bounds-checked access the i-th entry.
472 * @param i the index of the entry
473 * @return reference to the i-th entry
474 */
476 {
477 return m_data.at(i);
478 }
479
480 /**
481 * Locate the first entry with time strictly greater than @p t.
482 * @param t the time to search for
483 * @return iterator to the first entry with time strictly greater than @p t
484 */
486 {
487 return std::upper_bound(m_data.begin(), m_data.end(), t, TimeLess{});
488 }
489
490 /**
491 * Locate the first entry with time strictly greater than @p t.
492 * @param t the time to search for
493 * @return const iterator to the first entry with time strictly greater than @p t
494 */
496 {
497 return std::upper_bound(m_data.cbegin(), m_data.cend(), t, TimeLess{});
498 }
499
500 /**
501 * Locate the first entry with time greater than or equal to @p t.
502 * @param t the time to search for
503 * @return iterator to the first entry with time greater than or equal to @p t
504 */
506 {
507 return std::lower_bound(m_data.begin(), m_data.end(), t, TimeLess{});
508 }
509
510 /**
511 * Locate the first entry with time greater than or equal to @p t.
512 * @param t the time to search for
513 * @return const iterator to the first entry with time greater than or equal to @p t
514 */
516 {
517 return std::lower_bound(m_data.cbegin(), m_data.cend(), t, TimeLess{});
518 }
519
520 /**
521 * Insert at a caller-provided position (typically the result of
522 * upper_bound(t)). May invalidate other iterators if the vector reallocates.
523 *
524 * @param hint the position to insert at
525 * @param value the entry to insert
526 * @return iterator to the inserted entry
527 */
529 {
530 return m_data.insert(hint, std::move(value));
531 }
532
533 /**
534 * Sorted insert: the position is located via upper_bound, so entries
535 * with equal times keep their insertion order.
536 *
537 * @param v the entry to insert
538 * @return iterator to the inserted entry
539 */
541 {
542 return m_data.insert(upper_bound(v.first), v);
543 }
544
545 /**
546 * Construct a value_type from @p args and insert it at its sorted
547 * position.
548 *
549 * @tparam Args types of the value_type constructor arguments
550 * @param args the value_type constructor arguments
551 * @return iterator to the inserted entry
552 */
553 template <typename... Args>
554 iterator emplace(Args&&... args)
555 {
556 value_type v(std::forward<Args>(args)...);
557 return m_data.insert(upper_bound(v.first), std::move(v));
558 }
559
560 /**
561 * Erase the entries in the range [first, last).
562 *
563 * @param first the first entry to erase
564 * @param last one past the last entry to erase
565 * @return iterator to the entry following the last erased one
566 */
568 {
569 return m_data.erase(first, last);
570 }
571
572 private:
573 /// Comparator for heterogeneous lookup of entries by Time
574 struct TimeLess
575 {
576 /**
577 * Compare an entry against a time.
578 * @param a the entry
579 * @param b the time
580 * @return true if the entry's time is lower than @p b
581 */
582 bool operator()(const value_type& a, const Time& b) const
583 {
584 return a.first < b;
585 }
586
587 /**
588 * Compare a time against an entry.
589 * @param a the time
590 * @param b the entry
591 * @return true if @p a is lower than the entry's time
592 */
593 bool operator()(const Time& a, const value_type& b) const
594 {
595 return a < b.first;
596 }
597 };
598
599 std::vector<value_type> m_data; //!< storage, kept in non-decreasing time order
600 };
601
602 /**
603 * Per-band interference state: the NI changes timeline together with the noise+interference
604 * power captured at the start of the last reception (used by the frame-capture logic).
605 */
607 {
608 NiChanges niChanges; //!< NI changes timeline for this band
609 Watt_u firstPower{0.0}; //!< noise+interference power at the start of the last RX
610 };
611
612 /**
613 * Map of per-band state, keyed by band info.
614 */
615 using BandStateMap = std::map<WifiSpectrumBandInfo, BandState>;
616
617 BandStateMap m_bandStates; //!< Per-band interference state
618
619 private:
620 /**
621 * Check whether a given band is tracked by this interference helper.
622 *
623 * @param band the band to be checked
624 * @return true if the band is already tracked by this interference helper, false otherwise
625 */
626 bool HasBand(const WifiSpectrumBandInfo& band) const;
627
628 /**
629 * Check whether a given band belongs to a given frequency range.
630 *
631 * @param band the band to be checked
632 * @param freqRange the frequency range to check whether the band belong to
633 * @return true if the band belongs to the frequency range, false otherwise
634 */
636 const FrequencyRange& freqRange) const;
637
638 /**
639 * Append the given Event.
640 *
641 * @param event the event to be appended
642 * @param freqRange the frequency range in which the received signal event is detected
643 * @param isStartHePortionRxing flag whether event corresponds to the start of the HE portion
644 * reception (only used for MU)
645 */
646 void AppendEvent(Ptr<Event> event, const FrequencyRange& freqRange, bool isStartHePortionRxing);
647
648 /**
649 * Calculate noise and interference power.
650 *
651 * @param event the event
652 * @param ni the NiChanges container of noise-plus-interference power change events
653 * @param band the band
654 *
655 * @return noise and interference power
656 */
658 NiChanges& ni,
659 const WifiSpectrumBandInfo& band) const;
660
661 /**
662 * Calculate power of all other events preceding a given event that belong to the same MU-MIMO
663 * transmission.
664 *
665 * @param event the event
666 * @param band the band
667 *
668 * @return the power of all other events preceding the event that belong to the same MU-MIMO
669 * transmission
670 */
672
673 /**
674 * Calculate the error rate of the given PHY payload only in the provided time
675 * window (thus enabling per MPDU PER information). The PHY payload can be divided into
676 * multiple chunks (e.g. due to interference from other transmissions).
677 *
678 * @param event the event
679 * @param channelWidth the channel width used to transmit the PSDU
680 * @param ni the NiChanges container of noise-plus-interference power change events
681 * @param band identify the band used by the PSDU
682 * @param staId the station ID of the PSDU (only used for MU)
683 * @param window time window (pair of start and end times) of PHY payload to focus on
684 *
685 * @return the error rate of the payload
686 */
688 MHz_u channelWidth,
689 const NiChanges& ni,
690 const WifiSpectrumBandInfo& band,
691 uint16_t staId,
692 std::pair<Time, Time> window) const;
693 /**
694 * Calculate the error rate of the PHY header. The PHY header
695 * can be divided into multiple chunks (e.g. due to interference from other transmissions).
696 *
697 * @param event the event
698 * @param ni the NiChanges container of noise-plus-interference power change events
699 * @param channelWidth the channel width for header measurement
700 * @param band the band
701 * @param header the PHY header to consider
702 *
703 * @return the error rate of the HT PHY header
704 */
706 const NiChanges& ni,
707 MHz_u channelWidth,
708 const WifiSpectrumBandInfo& band,
709 WifiPpduField header) const;
710 /**
711 * Calculate the success rate of the PHY header sections for the provided event.
712 *
713 * @param event the event
714 * @param ni the NiChanges container of noise-plus-interference power change events
715 * @param channelWidth the channel width for header measurement
716 * @param band the band
717 * @param phyHeaderSections the map of PHY header sections (@see PhyHeaderSections)
718 *
719 * @return the success rate of the PHY header sections
720 */
722 const NiChanges& ni,
723 MHz_u channelWidth,
724 const WifiSpectrumBandInfo& band,
725 PhyHeaderSections phyHeaderSections) const;
726
727 double m_noiseFigure; //!< noise figure (linear)
729 uint8_t m_numRxAntennas; //!< the number of RX antennas in the corresponding receiver
730
731 /**
732 * Returns an iterator to the first NiChange that is later than moment
733 *
734 * @param moment time to check from
735 * @param bandIt iterator of the band to check
736 * @returns an iterator to the list of NiChanges
737 */
738 NiChanges::iterator GetNextPosition(const Time& moment, BandStateMap::iterator bandIt) const;
739 /**
740 * Returns an iterator to the last NiChange that is before than moment
741 *
742 * @param moment time to check from
743 * @param bandIt iterator of the band to check
744 * @returns an iterator to the list of NiChanges
745 */
747 BandStateMap::iterator bandIt) const;
748
749 /**
750 * Add NiChange to the list at the appropriate position and
751 * return the iterator of the new event.
752 *
753 * @param moment time to check from
754 * @param change the NiChange to add
755 * @param bandIt iterator of the band to check
756 * @returns the iterator of the new event
757 */
759 NiChange change,
760 BandStateMap::iterator bandIt);
761
762 /**
763 * Return whether another event is a MU-MIMO event that belongs to the same transmission and to
764 * the same RU.
765 *
766 * @param currentEvent the current event that is being inspected
767 * @param otherEvent the other event to compare against
768 *
769 * @return whether both events belong to the same transmission and to the same RU
770 */
771 bool IsSameMuMimoTransmission(Ptr<const Event> currentEvent, Ptr<const Event> otherEvent) const;
772};
773
774} // namespace ns3
775
776#endif /* INTERFERENCE_HELPER_H */
uint32_t v
the interface for Wifi's error models
handles interference calculations
Time m_endTime
end time
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.
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
iterator emplace(Args &&... args)
Construct a value_type from args and insert it at its sorted position.
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.
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...
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.
Definition object.cc:93
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
Received power (W) per spectrum band.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
a unique identifier for an interface.
Definition type-id.h:50
represent a single transmission mode
Definition wifi-mode.h:39
WifiPpdu stores a preamble, a modulation class, PHY headers and a PSDU.
Definition wifi-ppdu.h:48
WifiPsdu stores an MPDU, S-MPDU or A-MPDU, by keeping header(s) and payload(s) separate for each cons...
Definition wifi-psdu.h:34
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).
Definition first.py:1
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition angles.cc:148
std::map< WifiPpduField, PhyHeaderChunkInfo > PhyHeaderSections
A map of PhyHeaderChunkInfo elements per PPDU field.
double MHz_u
MHz weak type.
Definition wifi-units.h:31
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU).
double Watt_u
Watt weak type.
Definition wifi-units.h:25
Struct defining a frequency range between minFrequency (MHz) and maxFrequency (MHz).
Definition wifi-types.h:94
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.