A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
phy-entity.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Orange Labs
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Authors: Rediet <getachew.redieteab@orange.com>
18 * Sébastien Deronne <sebastien.deronne@gmail.com> (for logic ported from wifi-phy and
19 * spectrum-wifi-phy) Mathieu Lacage <mathieu.lacage@sophia.inria.fr> (for logic ported from
20 * wifi-phy)
21 */
22
23#include "phy-entity.h"
24
25#include "frame-capture-model.h"
26#include "interference-helper.h"
28#include "spectrum-wifi-phy.h"
29#include "wifi-psdu.h"
31#include "wifi-utils.h"
32
33#include "ns3/assert.h"
34#include "ns3/log.h"
35#include "ns3/packet.h"
36#include "ns3/simulator.h"
37
38#include <algorithm>
39
40#undef NS_LOG_APPEND_CONTEXT
41#define NS_LOG_APPEND_CONTEXT WIFI_PHY_NS_LOG_APPEND_CONTEXT(m_wifiPhy)
42
43namespace ns3
44{
45
46NS_LOG_COMPONENT_DEFINE("PhyEntity");
47
48std::ostream&
49operator<<(std::ostream& os, const PhyEntity::PhyRxFailureAction& action)
50{
51 switch (action)
52 {
53 case PhyEntity::DROP:
54 return (os << "DROP");
56 return (os << "ABORT");
58 return (os << "IGNORE");
59 default:
60 NS_FATAL_ERROR("Unknown action");
61 return (os << "unknown");
62 }
63}
64
65std::ostream&
66operator<<(std::ostream& os, const PhyEntity::PhyFieldRxStatus& status)
67{
68 if (status.isSuccess)
69 {
70 return os << "success";
71 }
72 else
73 {
74 return os << "failure (" << status.reason << "/" << status.actionIfFailure << ")";
75 }
76}
77
78/*******************************************************
79 * Abstract base class for PHY entities
80 *******************************************************/
81
83
85{
86 NS_LOG_FUNCTION(this);
87 m_modeList.clear();
89}
90
91void
93{
94 NS_LOG_FUNCTION(this << wifiPhy);
95 m_wifiPhy = wifiPhy;
97}
98
99bool
101{
102 for (const auto& m : m_modeList)
103 {
104 if (m == mode)
105 {
106 return true;
107 }
108 }
109 return false;
110}
111
112uint8_t
114{
115 return m_modeList.size();
116}
117
119PhyEntity::GetMcs(uint8_t /* index */) const
120{
122 "This method should be used only for HtPhy and child classes. Use GetMode instead.");
123 return WifiMode();
124}
125
126bool
127PhyEntity::IsMcsSupported(uint8_t /* index */) const
128{
129 NS_ABORT_MSG("This method should be used only for HtPhy and child classes. Use IsModeSupported "
130 "instead.");
131 return false;
132}
133
134bool
136{
137 return false;
138}
139
140std::list<WifiMode>::const_iterator
142{
143 return m_modeList.begin();
144}
145
146std::list<WifiMode>::const_iterator
148{
149 return m_modeList.end();
150}
151
154{
155 NS_FATAL_ERROR("PPDU field is not a SIG field (no sense in retrieving the signaled mode) or is "
156 "unsupported: "
157 << field);
158 return WifiMode(); // should be overloaded
159}
160
163{
164 auto ppduFormats = GetPpduFormats();
165 const auto itPpdu = ppduFormats.find(preamble);
166 if (itPpdu != ppduFormats.end())
167 {
168 const auto itField = std::find(itPpdu->second.begin(), itPpdu->second.end(), currentField);
169 if (itField != itPpdu->second.end())
170 {
171 const auto itNextField = std::next(itField, 1);
172 if (itNextField != itPpdu->second.end())
173 {
174 return *(itNextField);
175 }
176 NS_FATAL_ERROR("No field after " << currentField << " for " << preamble
177 << " for the provided PPDU formats");
178 }
179 else
180 {
181 NS_FATAL_ERROR("Unsupported PPDU field " << currentField << " for " << preamble
182 << " for the provided PPDU formats");
183 }
184 }
185 else
186 {
187 NS_FATAL_ERROR("Unsupported preamble " << preamble << " for the provided PPDU formats");
188 }
189 return WifiPpduField::WIFI_PPDU_FIELD_PREAMBLE; // Silence compiler warning
190}
191
192Time
194{
195 if (field > WIFI_PPDU_FIELD_EHT_SIG)
196 {
197 NS_FATAL_ERROR("Unsupported PPDU field");
198 }
199 return MicroSeconds(0); // should be overloaded
200}
201
202Time
204{
205 Time duration = MicroSeconds(0);
206 for (uint8_t field = WIFI_PPDU_FIELD_PREAMBLE; field < WIFI_PPDU_FIELD_DATA; ++field)
207 {
208 duration += GetDuration(static_cast<WifiPpduField>(field), txVector);
209 }
210 return duration;
211}
212
215{
216 return WifiConstPsduMap({{SU_STA_ID, psdu}});
217}
218
221{
222 return ppdu->GetPsdu();
223}
224
226PhyEntity::GetPhyHeaderSections(const WifiTxVector& txVector, Time ppduStart) const
227{
229 WifiPpduField field = WIFI_PPDU_FIELD_PREAMBLE; // preamble always present
230 Time start = ppduStart;
231
232 while (field != WIFI_PPDU_FIELD_DATA)
233 {
234 Time duration = GetDuration(field, txVector);
235 map[field] = {{start, start + duration}, GetSigMode(field, txVector)};
236 // Move to next field
237 start += duration;
238 field = GetNextField(field, txVector.GetPreambleType());
239 }
240 return map;
241}
242
244PhyEntity::BuildPpdu(const WifiConstPsduMap& psdus, const WifiTxVector& txVector, Time ppduDuration)
245{
246 NS_LOG_FUNCTION(this << psdus << txVector << ppduDuration);
247 NS_FATAL_ERROR("This method is unsupported for the base PhyEntity class. Use the overloaded "
248 "version in the amendment-specific subclasses instead!");
249 return Create<WifiPpdu>(psdus.begin()->second,
250 txVector,
251 m_wifiPhy->GetOperatingChannel()); // should be overloaded
252}
253
254Time
256{
257 if (field ==
258 WIFI_PPDU_FIELD_DATA) // this field is not in the map returned by GetPhyHeaderSections
259 {
261 }
262 const auto& sections = GetPhyHeaderSections(txVector, NanoSeconds(0));
263 auto it = sections.find(field);
264 NS_ASSERT(it != sections.end());
265 const auto& startStopTimes = it->second.first;
266 return startStopTimes
267 .first; // return the start time of field relatively to the beginning of the PPDU
268}
269
272{
273 uint16_t measurementChannelWidth = GetMeasurementChannelWidth(event->GetPpdu());
274 return m_wifiPhy->m_interference->CalculatePhyHeaderSnrPer(
275 event,
276 measurementChannelWidth,
277 GetPrimaryBand(measurementChannelWidth),
278 field);
279}
280
281void
283{
284 NS_LOG_FUNCTION(this << field << *event);
285 NS_ASSERT(m_wifiPhy); // no sense if no owner WifiPhy instance
288 "Use the StartReceivePreamble method for preamble reception");
289 // Handle special cases of data reception
290 if (field == WIFI_PPDU_FIELD_DATA)
291 {
292 StartReceivePayload(event);
293 return;
294 }
295
296 bool supported = DoStartReceiveField(field, event);
297 NS_ABORT_MSG_IF(!supported,
298 "Unknown field "
299 << field << " for this PHY entity"); // TODO see what to do if not supported
300 Time duration = GetDuration(field, event->GetPpdu()->GetTxVector());
302 Simulator::Schedule(duration, &PhyEntity::EndReceiveField, this, field, event);
304 event->GetPpdu(),
305 duration); // keep in CCA busy state up to reception of Data (will then switch to RX)
306}
307
308void
310{
311 NS_LOG_FUNCTION(this << field << *event);
312 NS_ASSERT(m_wifiPhy); // no sense if no owner WifiPhy instance
314 PhyFieldRxStatus status = DoEndReceiveField(field, event);
315 const auto& txVector = event->GetPpdu()->GetTxVector();
316 if (status.isSuccess) // move to next field if reception succeeded
317 {
318 StartReceiveField(GetNextField(field, txVector.GetPreambleType()), event);
319 }
320 else
321 {
322 Ptr<const WifiPpdu> ppdu = event->GetPpdu();
323 switch (status.actionIfFailure)
324 {
325 case ABORT:
326 // Abort reception, but consider medium as busy
328 if (event->GetEndTime() > (Simulator::Now() + m_state->GetDelayUntilIdle()))
329 {
331 }
332 break;
333 case DROP:
334 // Notify drop, keep in CCA busy, and perform same processing as IGNORE case
335 if (status.reason == FILTERED)
336 {
337 // PHY-RXSTART is immediately followed by PHY-RXEND (Filtered)
339 txVector,
340 NanoSeconds(0)); // this callback (equivalent to PHY-RXSTART primitive) is also
341 // triggered for filtered PPDUs
342 }
345 // no break
346 case IGNORE:
347 // Keep in Rx state and reset at end
348 m_endRxPayloadEvents.push_back(
351 this,
352 event));
353 break;
354 default:
355 NS_FATAL_ERROR("Unknown action in case of failure");
356 }
357 }
358}
359
360Time
362{
363 const auto& txVector = ppdu->GetTxVector();
364 return ppdu->GetTxDuration() -
365 (GetDurationUpToField(field, txVector) + GetDuration(field, txVector));
366}
367
368bool
370{
371 NS_LOG_FUNCTION(this << field << *event);
373 field != WIFI_PPDU_FIELD_DATA); // handled apart for the time being
374 auto ppduFormats = GetPpduFormats();
375 auto itFormat = ppduFormats.find(event->GetPpdu()->GetPreamble());
376 if (itFormat != ppduFormats.end())
377 {
378 auto itField = std::find(itFormat->second.begin(), itFormat->second.end(), field);
379 if (itField != itFormat->second.end())
380 {
381 return true; // supported field so we can start receiving
382 }
383 }
384 return false; // unsupported otherwise
385}
386
389{
390 NS_LOG_FUNCTION(this << field << *event);
391 NS_ASSERT(field != WIFI_PPDU_FIELD_DATA); // handled apart for the time being
392 if (field == WIFI_PPDU_FIELD_PREAMBLE)
393 {
394 return DoEndReceivePreamble(event);
395 }
396 return PhyFieldRxStatus(false); // failed reception by default
397}
398
399void
401 RxPowerWattPerChannelBand& rxPowersW,
402 Time rxDuration)
403{
404 // The total RX power corresponds to the maximum over all the bands
405 auto it =
406 std::max_element(rxPowersW.begin(), rxPowersW.end(), [](const auto& p1, const auto& p2) {
407 return p1.second < p2.second;
408 });
409 NS_LOG_FUNCTION(this << ppdu << it->second);
410
411 auto event = DoGetEvent(ppdu, rxPowersW);
412 if (!event)
413 {
414 // PPDU should be simply considered as interference (once it has been accounted for in
415 // InterferenceHelper)
416 return;
417 }
418
419 Time endRx = Simulator::Now() + rxDuration;
420 if (ppdu->IsTruncatedTx())
421 {
422 NS_LOG_DEBUG("Packet reception stopped because transmitter has been switched off");
423 if (endRx > (Simulator::Now() + m_state->GetDelayUntilIdle()))
424 {
426 }
428 return;
429 }
430
431 switch (m_state->GetState())
432 {
434 NS_LOG_DEBUG("Drop packet because of channel switching");
435 /*
436 * Packets received on the upcoming channel are added to the event list
437 * during the switching state. This way the medium can be correctly sensed
438 * when the device listens to the channel for the first time after the
439 * switching e.g. after channel switching, the channel may be sensed as
440 * busy due to other devices' transmissions started before the end of
441 * the switching.
442 */
444 break;
445 case WifiPhyState::RX:
447 m_wifiPhy->m_frameCaptureModel->IsInCaptureWindow(
449 m_wifiPhy->m_frameCaptureModel->CaptureNewFrame(m_wifiPhy->m_currentEvent, event))
450 {
452 NS_LOG_DEBUG("Switch to new packet");
454 }
455 else
456 {
457 NS_LOG_DEBUG("Drop packet because already in Rx");
458 DropPreambleEvent(ppdu, RXING, endRx);
460 {
461 /*
462 * We are here because the non-legacy PHY header has not been successfully received.
463 * The PHY is kept in RX state for the duration of the PPDU, but EndReceive function
464 * is not called when the reception of the PPDU is finished, which is responsible to
465 * clear m_currentPreambleEvents. As a result, m_currentPreambleEvents should be
466 * cleared here.
467 */
469 }
470 }
471 break;
472 case WifiPhyState::TX:
473 NS_LOG_DEBUG("Drop packet because already in Tx");
474 DropPreambleEvent(ppdu, TXING, endRx);
475 break;
478 {
480 m_wifiPhy->m_frameCaptureModel->IsInCaptureWindow(
482 m_wifiPhy->m_frameCaptureModel->CaptureNewFrame(m_wifiPhy->m_currentEvent, event))
483 {
485 NS_LOG_DEBUG("Switch to new packet");
487 }
488 else
489 {
490 NS_LOG_DEBUG("Drop packet because already decoding preamble");
492 }
493 }
494 else
495 {
497 }
498 break;
502 break;
504 NS_LOG_DEBUG("Drop packet because in sleep mode");
505 DropPreambleEvent(ppdu, SLEEPING, endRx);
506 break;
508 NS_LOG_DEBUG("Drop packet because in switched off");
510 break;
511 default:
512 NS_FATAL_ERROR("Invalid WifiPhy state.");
513 break;
514 }
515}
516
517void
519{
520 NS_LOG_FUNCTION(this << ppdu << reason << endRx);
522 auto it = m_wifiPhy->m_currentPreambleEvents.find({ppdu->GetUid(), ppdu->GetPreamble()});
523 if (it != m_wifiPhy->m_currentPreambleEvents.end())
524 {
526 }
528 (endRx > (Simulator::Now() + m_state->GetDelayUntilIdle())))
529 {
530 // that PPDU will be noise _after_ the end of the current event.
532 }
533}
534
535void
537{
538 NS_LOG_FUNCTION(this << ppdu << rxDuration);
539 auto it = m_wifiPhy->m_currentPreambleEvents.find({ppdu->GetUid(), ppdu->GetPreamble()});
540 if (it != m_wifiPhy->m_currentPreambleEvents.end())
541 {
543 }
545 {
546 m_wifiPhy->Reset();
547 }
548
549 if (rxDuration > m_state->GetDelayUntilIdle())
550 {
551 // this PPDU will be noise _after_ the completion of the current event
553 }
554}
555
556uint16_t
558{
559 return SU_STA_ID;
560}
561
562void
564{
565 NS_LOG_FUNCTION(this << *event);
567
568 Time payloadDuration = DoStartReceivePayload(event);
569 m_state->SwitchToRx(payloadDuration);
570}
571
572Time
574{
575 NS_LOG_FUNCTION(this << *event);
576 Ptr<const WifiPpdu> ppdu = event->GetPpdu();
577 NS_LOG_DEBUG("Receiving PSDU");
578 uint16_t staId = GetStaId(ppdu);
579 m_signalNoiseMap.insert({{ppdu->GetUid(), staId}, SignalNoiseDbm()});
580 m_statusPerMpduMap.insert({{ppdu->GetUid(), staId}, std::vector<bool>()});
581 ScheduleEndOfMpdus(event);
582 const auto& txVector = event->GetPpdu()->GetTxVector();
583 Time payloadDuration = ppdu->GetTxDuration() - CalculatePhyPreambleAndHeaderDuration(txVector);
585 txVector,
586 payloadDuration); // this callback (equivalent to PHY-RXSTART primitive) is triggered only
587 // if headers have been correctly decoded and that the mode within is
588 // supported
589 m_endRxPayloadEvents.push_back(
590 Simulator::Schedule(payloadDuration, &PhyEntity::EndReceivePayload, this, event));
591 return payloadDuration;
592}
593
594void
596{
597 NS_LOG_FUNCTION(this << *event);
598 Ptr<const WifiPpdu> ppdu = event->GetPpdu();
600 const auto& txVector = event->GetPpdu()->GetTxVector();
601 uint16_t staId = GetStaId(ppdu);
602 Time endOfMpduDuration = NanoSeconds(0);
603 Time relativeStart = NanoSeconds(0);
604 Time psduDuration = ppdu->GetTxDuration() - CalculatePhyPreambleAndHeaderDuration(txVector);
605 Time remainingAmpduDuration = psduDuration;
606 size_t nMpdus = psdu->GetNMpdus();
607 MpduType mpduType =
608 (nMpdus > 1) ? FIRST_MPDU_IN_AGGREGATE : (psdu->IsSingle() ? SINGLE_MPDU : NORMAL_MPDU);
609 uint32_t totalAmpduSize = 0;
610 double totalAmpduNumSymbols = 0.0;
611 auto mpdu = psdu->begin();
612 for (size_t i = 0; i < nMpdus && mpdu != psdu->end(); ++mpdu)
613 {
614 uint32_t size = (mpduType == NORMAL_MPDU) ? psdu->GetSize() : psdu->GetAmpduSubframeSize(i);
615 Time mpduDuration = m_wifiPhy->GetPayloadDuration(size,
616 txVector,
618 mpduType,
619 true,
620 totalAmpduSize,
621 totalAmpduNumSymbols,
622 staId);
623
624 remainingAmpduDuration -= mpduDuration;
625 if (i == (nMpdus - 1) && !remainingAmpduDuration.IsZero()) // no more MPDUs coming
626 {
627 if (remainingAmpduDuration <
628 NanoSeconds(txVector.GetGuardInterval())) // enables to ignore padding
629 {
630 mpduDuration += remainingAmpduDuration; // apply a correction just in case rounding
631 // had induced slight shift
632 }
633 }
634
635 endOfMpduDuration += mpduDuration;
636 NS_LOG_INFO("Schedule end of MPDU #"
637 << i << " in " << endOfMpduDuration.As(Time::NS) << " (relativeStart="
638 << relativeStart.As(Time::NS) << ", mpduDuration=" << mpduDuration.As(Time::NS)
639 << ", remainingAmdpuDuration=" << remainingAmpduDuration.As(Time::NS) << ")");
640 m_endOfMpduEvents.push_back(Simulator::Schedule(endOfMpduDuration,
642 this,
643 event,
644 Create<WifiPsdu>(*mpdu, false),
645 i,
646 relativeStart,
647 mpduDuration));
648
649 // Prepare next iteration
650 ++i;
651 relativeStart += mpduDuration;
652 mpduType = (i == (nMpdus - 1)) ? LAST_MPDU_IN_AGGREGATE : MIDDLE_MPDU_IN_AGGREGATE;
653 }
654}
655
656void
659 size_t mpduIndex,
660 Time relativeStart,
661 Time mpduDuration)
662{
663 NS_LOG_FUNCTION(this << *event << mpduIndex << relativeStart << mpduDuration);
664 const auto ppdu = event->GetPpdu();
665 const auto& txVector = ppdu->GetTxVector();
666 uint16_t staId = GetStaId(ppdu);
667
668 std::pair<bool, SignalNoiseDbm> rxInfo =
669 GetReceptionStatus(psdu, event, staId, relativeStart, mpduDuration);
670 NS_LOG_DEBUG("Extracted MPDU #" << mpduIndex << ": duration: " << mpduDuration.As(Time::NS)
671 << ", correct reception: " << rxInfo.first << ", Signal/Noise: "
672 << rxInfo.second.signal << "/" << rxInfo.second.noise << "dBm");
673
674 auto signalNoiseIt = m_signalNoiseMap.find({ppdu->GetUid(), staId});
675 NS_ASSERT(signalNoiseIt != m_signalNoiseMap.end());
676 signalNoiseIt->second = rxInfo.second;
677
678 RxSignalInfo rxSignalInfo;
679 rxSignalInfo.snr = rxInfo.second.signal / rxInfo.second.noise;
680 rxSignalInfo.rssi = rxInfo.second.signal;
681
682 auto statusPerMpduIt = m_statusPerMpduMap.find({ppdu->GetUid(), staId});
683 NS_ASSERT(statusPerMpduIt != m_statusPerMpduMap.end());
684 statusPerMpduIt->second.push_back(rxInfo.first);
685
686 if (rxInfo.first && GetAddressedPsduInPpdu(ppdu)->GetNMpdus() > 1)
687 {
688 // only done for correct MPDU that is part of an A-MPDU
689 m_state->NotifyRxMpdu(psdu, rxSignalInfo, txVector);
690 }
691}
692
693void
695{
696 const auto ppdu = event->GetPpdu();
697 const auto& txVector = ppdu->GetTxVector();
699 this << *event << ppdu->GetTxDuration() - CalculatePhyPreambleAndHeaderDuration(txVector));
700 NS_ASSERT(event->GetEndTime() == Simulator::Now());
701 const auto staId = GetStaId(ppdu);
702 const auto channelWidthAndBand = GetChannelWidthAndBand(txVector, staId);
703 double snr = m_wifiPhy->m_interference->CalculateSnr(event,
704 channelWidthAndBand.first,
705 txVector.GetNss(staId),
706 channelWidthAndBand.second);
707
709 m_wifiPhy->NotifyRxEnd(psdu);
710
711 auto signalNoiseIt = m_signalNoiseMap.find({ppdu->GetUid(), staId});
712 NS_ASSERT(signalNoiseIt != m_signalNoiseMap.end());
713 auto statusPerMpduIt = m_statusPerMpduMap.find({ppdu->GetUid(), staId});
714 NS_ASSERT(statusPerMpduIt != m_statusPerMpduMap.end());
715 // store per-MPDU status, which is cleared by the call to DoEndReceivePayload below
716 auto statusPerMpdu = statusPerMpduIt->second;
717
718 RxSignalInfo rxSignalInfo;
719 bool success;
720
721 if (std::count(statusPerMpdu.cbegin(), statusPerMpdu.cend(), true))
722 {
723 // At least one MPDU has been successfully received
726 txVector,
727 signalNoiseIt->second,
728 statusPerMpdu,
729 staId);
730 rxSignalInfo.snr = snr;
731 rxSignalInfo.rssi = signalNoiseIt->second.signal; // same information for all MPDUs
732 RxPayloadSucceeded(psdu, rxSignalInfo, txVector, staId, statusPerMpdu);
734 ppdu->GetUid(); // store UID only if reception is successful (because otherwise trigger
735 // won't be read by MAC layer)
736 success = true;
737 }
738 else
739 {
740 RxPayloadFailed(psdu, snr, txVector);
741 success = false;
742 }
743
746
747 // notify the MAC through the PHY state helper as the last action. Indeed, the notification
748 // of the RX end may lead the MAC to request a PHY state change (e.g., channel switch, sleep).
749 // Hence, all actions the PHY has to perform when RX ends should be completed before
750 // notifying the MAC.
751 success ? m_state->NotifyRxPsduSucceeded(psdu, rxSignalInfo, txVector, staId, statusPerMpdu)
752 : m_state->NotifyRxPsduFailed(psdu, snr);
753}
754
755void
757 RxSignalInfo rxSignalInfo,
758 const WifiTxVector& txVector,
759 uint16_t staId,
760 const std::vector<bool>& statusPerMpdu)
761{
762 NS_LOG_FUNCTION(this << *psdu << txVector);
763 m_state->SwitchFromRxEndOk();
764}
765
766void
768{
769 NS_LOG_FUNCTION(this << *psdu << txVector << snr);
770 m_state->SwitchFromRxEndError();
771}
772
773void
775{
776 NS_LOG_FUNCTION(this << ppdu);
778 NotifyInterferenceRxEndAndClear(false); // don't reset WifiPhy
779
780 m_wifiPhy->m_currentEvent = nullptr;
782 m_endRxPayloadEvents.clear();
783}
784
785std::pair<bool, SignalNoiseDbm>
787 Ptr<Event> event,
788 uint16_t staId,
789 Time relativeMpduStart,
790 Time mpduDuration)
791{
792 NS_LOG_FUNCTION(this << *psdu << *event << staId << relativeMpduStart << mpduDuration);
793 const auto channelWidthAndBand = GetChannelWidthAndBand(event->GetPpdu()->GetTxVector(), staId);
794 SnrPer snrPer = m_wifiPhy->m_interference->CalculatePayloadSnrPer(
795 event,
796 channelWidthAndBand.first,
797 channelWidthAndBand.second,
798 staId,
799 {relativeMpduStart, relativeMpduStart + mpduDuration});
800
801 WifiMode mode = event->GetPpdu()->GetTxVector().GetMode(staId);
802 NS_LOG_DEBUG("rate=" << (mode.GetDataRate(event->GetPpdu()->GetTxVector(), staId))
803 << ", SNR(dB)=" << RatioToDb(snrPer.snr) << ", PER=" << snrPer.per
804 << ", size=" << psdu->GetSize()
805 << ", relativeStart = " << relativeMpduStart.As(Time::NS)
806 << ", duration = " << mpduDuration.As(Time::NS));
807
808 // There are two error checks: PER and receive error model check.
809 // PER check models is typical for Wi-Fi and is based on signal modulation;
810 // Receive error model is optional, if we have an error model and
811 // it indicates that the packet is corrupt, drop the packet.
812 SignalNoiseDbm signalNoise;
813 signalNoise.signal = WToDbm(event->GetRxPowerW(channelWidthAndBand.second));
814 signalNoise.noise = WToDbm(event->GetRxPowerW(channelWidthAndBand.second) / snrPer.snr);
815 if (GetRandomValue() > snrPer.per &&
817 m_wifiPhy->m_postReceptionErrorModel->IsCorrupt(psdu->GetPacket()->Copy())))
818 {
819 NS_LOG_DEBUG("Reception succeeded: " << psdu);
820 return {true, signalNoise};
821 }
822 else
823 {
824 NS_LOG_DEBUG("Reception failed: " << psdu);
825 return {false, signalNoise};
826 }
827}
828
829std::pair<uint16_t, WifiSpectrumBandInfo>
830PhyEntity::GetChannelWidthAndBand(const WifiTxVector& txVector, uint16_t /* staId */) const
831{
832 uint16_t channelWidth = GetRxChannelWidth(txVector);
833 return {channelWidth, GetPrimaryBand(channelWidth)};
834}
835
836const std::map<std::pair<uint64_t, WifiPreamble>, Ptr<Event>>&
838{
840}
841
842void
844{
845 NS_LOG_FUNCTION(this << *event);
846 Ptr<const WifiPpdu> ppdu = event->GetPpdu();
847 m_wifiPhy->m_currentPreambleEvents.insert({{ppdu->GetUid(), ppdu->GetPreamble()}, event});
848}
849
852{
853 // We store all incoming preamble events, and a decision is made at the end of the preamble
854 // detection window.
855 const auto& currentPreambleEvents = GetCurrentPreambleEvents();
856 const auto it = currentPreambleEvents.find({ppdu->GetUid(), ppdu->GetPreamble()});
857 if (it != currentPreambleEvents.cend())
858 {
859 // received another signal with the same content
860 NS_LOG_DEBUG("Received another PPDU for UID " << ppdu->GetUid());
861 const auto foundEvent = it->second;
862 HandleRxPpduWithSameContent(foundEvent, ppdu, rxPowersW);
863 return nullptr;
864 }
865
866 auto event = CreateInterferenceEvent(ppdu, ppdu->GetTxDuration(), rxPowersW);
867 AddPreambleEvent(event);
868 return event;
869}
870
873 Time duration,
875 bool isStartHePortionRxing /* = false */)
876{
877 return m_wifiPhy->m_interference->Add(ppdu, duration, rxPower, isStartHePortionRxing);
878}
879
880void
884{
885 if (const auto maxDelay =
886 m_wifiPhy->GetPhyEntityForPpdu(ppdu)->GetMaxDelayPpduSameUid(ppdu->GetTxVector());
887 Simulator::Now() - event->GetStartTime() > maxDelay)
888 {
889 // This PPDU arrived too late to be decoded properly. The PPDU is dropped and added as
890 // interference
891 event = CreateInterferenceEvent(ppdu, ppdu->GetTxDuration(), rxPower);
892 NS_LOG_DEBUG("Drop PPDU that arrived too late");
894 return;
895 }
896
897 // Update received power and TXVECTOR of the event associated to that transmission upon
898 // reception of a signal adding up constructively (in case of a UL MU PPDU or non-HT duplicate
899 // PPDU)
900 m_wifiPhy->m_interference->UpdateEvent(event, rxPower);
901 const auto& txVector = ppdu->GetTxVector();
902 const auto& eventTxVector = event->GetPpdu()->GetTxVector();
903 auto updatedTxVector{eventTxVector};
904 updatedTxVector.SetChannelWidth(
905 std::max(eventTxVector.GetChannelWidth(), txVector.GetChannelWidth()));
906 if (updatedTxVector.GetChannelWidth() != eventTxVector.GetChannelWidth())
907 {
908 event->UpdatePpdu(ppdu);
909 }
910}
911
912void
914{
916 m_signalNoiseMap.clear();
917 m_statusPerMpduMap.clear();
918 for (const auto& endOfMpduEvent : m_endOfMpduEvents)
919 {
920 NS_ASSERT(endOfMpduEvent.IsExpired());
921 }
922 m_endOfMpduEvents.clear();
923 if (reset)
924 {
925 m_wifiPhy->Reset();
926 }
927}
928
931{
932 NS_LOG_FUNCTION(this << *event);
934 1); // Synched on one after detection period
935 return PhyFieldRxStatus(true); // always consider that preamble has been correctly received if
936 // preamble detection was OK
937}
938
939void
941{
942 NS_LOG_FUNCTION(this << *event);
943 NS_LOG_DEBUG("Sync to signal (power=" << WToDbm(GetRxPowerWForPpdu(event)) << "dBm)");
945 ->NotifyRxStart(); // We need to notify it now so that it starts recording events
949 this,
950 event));
951}
952
953void
955{
956 NS_LOG_FUNCTION(this << *event);
958 NS_ASSERT(m_wifiPhy->m_endPhyRxEvent.IsExpired()); // since end of preamble reception is
959 // scheduled by this method upon success
960
961 // calculate PER on the measurement channel for PHY headers
962 uint16_t measurementChannelWidth = GetMeasurementChannelWidth(event->GetPpdu());
963 auto measurementBand = GetPrimaryBand(measurementChannelWidth);
964 double maxRxPowerW = -1; // in case current event may not be sent on measurement channel
965 // (rxPowerW would be equal to 0)
966 Ptr<Event> maxEvent;
968 for (auto preambleEvent : m_wifiPhy->m_currentPreambleEvents)
969 {
970 double rxPowerW = preambleEvent.second->GetRxPowerW(measurementBand);
971 if (rxPowerW > maxRxPowerW)
972 {
973 maxRxPowerW = rxPowerW;
974 maxEvent = preambleEvent.second;
975 }
976 }
977
978 NS_ASSERT(maxEvent);
979 if (maxEvent != event)
980 {
981 NS_LOG_DEBUG("Receiver got a stronger packet with UID "
982 << maxEvent->GetPpdu()->GetUid()
983 << " during preamble detection: drop packet with UID "
984 << event->GetPpdu()->GetUid());
986 auto it = m_wifiPhy->m_currentPreambleEvents.find(
987 {event->GetPpdu()->GetUid(), event->GetPpdu()->GetPreamble()});
989 // This is needed to cleanup the m_firstPowerPerBand so that the first power corresponds to
990 // the power at the start of the PPDU
991 m_wifiPhy->m_interference->NotifyRxEnd(maxEvent->GetStartTime(),
993 // Make sure InterferenceHelper keeps recording events
994 m_wifiPhy->m_interference->NotifyRxStart();
995 return;
996 }
997
998 m_wifiPhy->m_currentEvent = event;
999
1000 double snr = m_wifiPhy->m_interference->CalculateSnr(m_wifiPhy->m_currentEvent,
1001 measurementChannelWidth,
1002 1,
1003 measurementBand);
1004 NS_LOG_DEBUG("SNR(dB)=" << RatioToDb(snr) << " at end of preamble detection period");
1005
1006 if ((!m_wifiPhy->m_preambleDetectionModel && maxRxPowerW > 0.0) ||
1008 m_wifiPhy->m_preambleDetectionModel->IsPreambleDetected(
1009 m_wifiPhy->m_currentEvent->GetRxPowerW(measurementBand),
1010 snr,
1011 measurementChannelWidth)))
1012 {
1013 // A bit convoluted but it enables to sync all PHYs
1014 for (auto& it : m_wifiPhy->m_phyEntities)
1015 {
1016 it.second->CancelRunningEndPreambleDetectionEvents();
1017 }
1018
1019 for (auto it = m_wifiPhy->m_currentPreambleEvents.begin();
1020 it != m_wifiPhy->m_currentPreambleEvents.end();)
1021 {
1022 if (it->second != m_wifiPhy->m_currentEvent)
1023 {
1024 NS_LOG_DEBUG("Drop packet with UID " << it->first.first << " and preamble "
1025 << it->first.second << " arrived at time "
1026 << it->second->GetStartTime());
1028 if (m_wifiPhy->m_currentEvent->GetPpdu()->GetUid() > it->first.first)
1029 {
1031 // This is needed to cleanup the m_firstPowerPerBand so that the first power
1032 // corresponds to the power at the start of the PPDU
1033 m_wifiPhy->m_interference->NotifyRxEnd(
1034 m_wifiPhy->m_currentEvent->GetStartTime(),
1036 }
1037 else
1038 {
1039 reason = BUSY_DECODING_PREAMBLE;
1040 }
1041 m_wifiPhy->NotifyRxDrop(GetAddressedPsduInPpdu(it->second->GetPpdu()), reason);
1042 it = m_wifiPhy->m_currentPreambleEvents.erase(it);
1043 }
1044 else
1045 {
1046 ++it;
1047 }
1048 }
1049
1050 // Make sure InterferenceHelper keeps recording events
1051 m_wifiPhy->m_interference->NotifyRxStart();
1052
1054 m_wifiPhy->m_currentEvent->GetRxPowerWPerBand());
1056
1057 // Continue receiving preamble
1058 Time durationTillEnd =
1059 GetDuration(WIFI_PPDU_FIELD_PREAMBLE, event->GetPpdu()->GetTxVector()) -
1061 m_wifiPhy->NotifyCcaBusy(event->GetPpdu(),
1062 durationTillEnd); // will be prolonged by next field
1065 this,
1067 event);
1068 }
1069 else
1070 {
1071 NS_LOG_DEBUG("Drop packet because PHY preamble detection failed");
1072 // Like CCA-SD, CCA-ED is governed by the 4 us CCA window to flag CCA-BUSY
1073 // for any received signal greater than the CCA-ED threshold.
1076 m_wifiPhy->m_currentEvent->GetEndTime());
1078 {
1079 // Do not erase events if there are still pending preamble events to be processed
1080 m_wifiPhy->m_interference->NotifyRxEnd(Simulator::Now(),
1082 }
1083 m_wifiPhy->m_currentEvent = nullptr;
1084 // Cancel preamble reception
1086 }
1087}
1088
1089bool
1091{
1092 WifiMode txMode = ppdu->GetTxVector().GetMode();
1093 if (!IsModeSupported(txMode))
1094 {
1095 NS_LOG_DEBUG("Drop packet because it was sent using an unsupported mode (" << txMode
1096 << ")");
1097 return false;
1098 }
1099 return true;
1100}
1101
1102void
1104{
1105 NS_LOG_FUNCTION(this);
1107 for (auto& endRxPayloadEvent : m_endRxPayloadEvents)
1108 {
1109 endRxPayloadEvent.Cancel();
1110 }
1111 m_endRxPayloadEvents.clear();
1112 for (auto& endMpduEvent : m_endOfMpduEvents)
1113 {
1114 endMpduEvent.Cancel();
1115 }
1116 m_endOfMpduEvents.clear();
1117}
1118
1119bool
1121{
1122 return m_endPreambleDetectionEvents.empty();
1123}
1124
1125void
1127{
1128 NS_LOG_FUNCTION(this);
1129 for (auto& endPreambleDetectionEvent : m_endPreambleDetectionEvents)
1130 {
1131 endPreambleDetectionEvent.Cancel();
1132 }
1134}
1135
1136void
1138{
1139 NS_LOG_FUNCTION(this << reason);
1142}
1143
1144void
1146{
1147 NS_LOG_FUNCTION(this << reason);
1148 if (m_wifiPhy->m_currentEvent) // Otherwise abort has already been called just before
1149 {
1150 for (auto& endMpduEvent : m_endOfMpduEvents)
1151 {
1152 endMpduEvent.Cancel();
1153 }
1154 m_endOfMpduEvents.clear();
1155 }
1156}
1157
1158void
1160{
1161 NS_LOG_FUNCTION(this << *event);
1162 DoResetReceive(event);
1165 NS_ASSERT(m_endRxPayloadEvents.size() == 1 && m_endRxPayloadEvents.front().IsExpired());
1166 m_endRxPayloadEvents.clear();
1167 m_wifiPhy->m_currentEvent = nullptr;
1169 m_wifiPhy->SwitchMaybeToCcaBusy(event->GetPpdu());
1170}
1171
1172void
1174{
1175 NS_LOG_FUNCTION(this << *event);
1176 NS_ASSERT(event->GetEndTime() == Simulator::Now());
1177}
1178
1179double
1181{
1182 return m_wifiPhy->m_random->GetValue();
1183}
1184
1185double
1187{
1188 return event->GetRxPowerW(GetPrimaryBand(GetMeasurementChannelWidth(event->GetPpdu())));
1189}
1190
1193{
1194 return m_wifiPhy->m_currentEvent;
1195}
1196
1198PhyEntity::GetPrimaryBand(uint16_t bandWidth) const
1199{
1200 if (m_wifiPhy->GetChannelWidth() % 20 != 0)
1201 {
1202 return m_wifiPhy->GetBand(bandWidth);
1203 }
1204 return m_wifiPhy->GetBand(bandWidth,
1206}
1207
1209PhyEntity::GetSecondaryBand(uint16_t bandWidth) const
1210{
1212 return m_wifiPhy->GetBand(bandWidth,
1214}
1215
1216uint16_t
1218{
1219 return std::min(m_wifiPhy->GetChannelWidth(), txVector.GetChannelWidth());
1220}
1221
1222double
1224 WifiChannelListType /*channelType*/) const
1225{
1227}
1228
1229Time
1231{
1232 return m_wifiPhy->m_interference->GetEnergyDuration(DbmToW(thresholdDbm), band);
1233}
1234
1235void
1237{
1238 // We are here because we have received the first bit of a packet and we are
1239 // not going to be able to synchronize on it
1240 // In this model, CCA becomes busy when the aggregation of all signals as
1241 // tracked by the InterferenceHelper class is higher than the CcaBusyThreshold
1242 const auto ccaIndication = GetCcaIndication(ppdu);
1243 if (ccaIndication.has_value())
1244 {
1245 NS_LOG_DEBUG("CCA busy for " << ccaIndication.value().second << " during "
1246 << ccaIndication.value().first.As(Time::S));
1247 m_state->SwitchMaybeToCcaBusy(ccaIndication.value().first,
1248 ccaIndication.value().second,
1249 {});
1250 return;
1251 }
1252 if (ppdu)
1253 {
1254 SwitchMaybeToCcaBusy(nullptr);
1255 }
1256}
1257
1260{
1261 const uint16_t channelWidth = GetMeasurementChannelWidth(ppdu);
1262 NS_LOG_FUNCTION(this << channelWidth);
1263 const double ccaThresholdDbm = GetCcaThreshold(ppdu, WIFI_CHANLIST_PRIMARY);
1264 const Time delayUntilCcaEnd =
1265 GetDelayUntilCcaEnd(ccaThresholdDbm, GetPrimaryBand(channelWidth));
1266 if (delayUntilCcaEnd.IsStrictlyPositive())
1267 {
1268 return std::make_pair(delayUntilCcaEnd, WIFI_CHANLIST_PRIMARY);
1269 }
1270 return std::nullopt;
1271}
1272
1273void
1275 Time duration,
1276 WifiChannelListType channelType)
1277{
1278 NS_LOG_FUNCTION(this << duration << channelType);
1279 NS_LOG_DEBUG("CCA busy for " << channelType << " during " << duration.As(Time::S));
1280 m_state->SwitchMaybeToCcaBusy(duration, channelType, {});
1281}
1282
1283uint64_t
1285{
1286 NS_LOG_FUNCTION(this);
1287 return m_globalPpduUid++;
1288}
1289
1290Time
1292{
1293 return Seconds(0);
1294}
1295
1296uint16_t
1298{
1299 NS_LOG_FUNCTION(this << txVector);
1300
1302 txVector.GetChannelWidth());
1303}
1304
1305void
1306PhyEntity::NotifyPayloadBegin(const WifiTxVector& txVector, const Time& payloadDuration)
1307{
1308 m_wifiPhy->m_phyRxPayloadBeginTrace(txVector, payloadDuration);
1309}
1310
1311void
1313{
1314 NS_LOG_FUNCTION(this << ppdu);
1315 auto txPowerDbm = m_wifiPhy->GetTxPowerForTransmission(ppdu) + m_wifiPhy->GetTxGain();
1316 auto txVector = ppdu->GetTxVector();
1317 auto txPowerSpectrum = GetTxPowerSpectralDensity(DbmToW(txPowerDbm), ppdu);
1318 Transmit(ppdu->GetTxDuration(), ppdu, txPowerDbm, txPowerSpectrum, "transmission");
1319}
1320
1321void
1324 double txPowerDbm,
1325 Ptr<SpectrumValue> txPowerSpectrum,
1326 const std::string& type)
1327{
1328 NS_LOG_FUNCTION(this << txDuration << ppdu << txPowerDbm << type);
1329 NS_LOG_DEBUG("Start " << type << ": signal power before antenna gain=" << txPowerDbm << "dBm");
1330 auto txParams = Create<WifiSpectrumSignalParameters>();
1331 txParams->duration = txDuration;
1332 txParams->psd = txPowerSpectrum;
1333 txParams->ppdu = ppdu;
1334 NS_LOG_DEBUG("Starting " << type << " with power " << txPowerDbm << " dBm on channel "
1335 << +m_wifiPhy->GetChannelNumber() << " for "
1336 << txParams->duration.As(Time::MS));
1337 NS_LOG_DEBUG("Starting " << type << " with integrated spectrum power "
1338 << WToDbm(Integral(*txPowerSpectrum)) << " dBm; spectrum model Uid: "
1339 << txPowerSpectrum->GetSpectrumModel()->GetUid());
1340 auto spectrumWifiPhy = DynamicCast<SpectrumWifiPhy>(m_wifiPhy);
1341 NS_ASSERT(spectrumWifiPhy);
1342 spectrumWifiPhy->Transmit(txParams);
1343}
1344
1345uint16_t
1346PhyEntity::GetGuardBandwidth(uint16_t currentChannelWidth) const
1347{
1348 return m_wifiPhy->GetGuardBandwidth(currentChannelWidth);
1349}
1350
1351std::tuple<double, double, double>
1353{
1355}
1356
1357Time
1359 const WifiTxVector& txVector,
1360 WifiPhyBand band) const
1361{
1362 NS_ASSERT(psduMap.size() == 1);
1363 const auto& it = psduMap.begin();
1364 return WifiPhy::CalculateTxDuration(it->second->GetSize(), txVector, band, it->first);
1365}
1366
1367bool
1369{
1370 // The PHY shall not issue a PHY-RXSTART.indication primitive in response to a PPDU that does
1371 // not overlap the primary channel
1372 const auto channelWidth = m_wifiPhy->GetChannelWidth();
1373 const auto primaryWidth =
1374 ((channelWidth % 20 == 0) ? 20
1375 : channelWidth); // if the channel width is a multiple of 20 MHz,
1376 // then we consider the primary20 channel
1377 const auto p20CenterFreq =
1379 const auto p20MinFreq = p20CenterFreq - (primaryWidth / 2);
1380 const auto p20MaxFreq = p20CenterFreq + (primaryWidth / 2);
1381 const auto txCenterFreq = ppdu->GetTxCenterFreq();
1382 const auto txChannelWidth = ppdu->GetTxChannelWidth();
1383 const auto minTxFreq = txCenterFreq - txChannelWidth / 2;
1384 const auto maxTxFreq = txCenterFreq + txChannelWidth / 2;
1385 return p20MinFreq >= minTxFreq && p20MaxFreq <= maxTxFreq;
1386}
1387
1390{
1391 return ppdu;
1392}
1393
1394} // namespace ns3
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:55
bool IsExpired() const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition: event-id.cc:69
void NotifyPayloadBegin(const WifiTxVector &txVector, const Time &payloadDuration)
Fire the trace indicating that the PHY is starting to receive the payload of a PPDU.
Definition: phy-entity.cc:1306
virtual void HandleRxPpduWithSameContent(Ptr< Event > event, Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPower)
Handle reception of a PPDU that carries the same content of another PPDU.
Definition: phy-entity.cc:881
void DropPreambleEvent(Ptr< const WifiPpdu > ppdu, WifiPhyRxfailureReason reason, Time endRx)
Drop the PPDU and the corresponding preamble detection event, but keep CCA busy state after the compl...
Definition: phy-entity.cc:518
std::list< WifiMode >::const_iterator end() const
Return a const iterator to past-the-last WifiMode.
Definition: phy-entity.cc:147
virtual void RxPayloadSucceeded(Ptr< const WifiPsdu > psdu, RxSignalInfo rxSignalInfo, const WifiTxVector &txVector, uint16_t staId, const std::vector< bool > &statusPerMpdu)
Perform amendment-specific actions when the payload is successfully received.
Definition: phy-entity.cc:756
virtual PhyFieldRxStatus DoEndReceivePreamble(Ptr< Event > event)
End receiving the preamble, perform amendment-specific actions, and provide the status of the recepti...
Definition: phy-entity.cc:930
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper of the WifiPhy (to make it reachable for child classes)
Definition: phy-entity.h:982
virtual void RxPayloadFailed(Ptr< const WifiPsdu > psdu, double snr, const WifiTxVector &txVector)
Perform amendment-specific actions when the payload is unsuccessfuly received.
Definition: phy-entity.cc:767
void EndPreambleDetectionPeriod(Ptr< Event > event)
End the preamble detection period.
Definition: phy-entity.cc:954
virtual void NotifyCcaBusy(const Ptr< const WifiPpdu > ppdu, Time duration, WifiChannelListType channelType)
Notify PHY state helper to switch to CCA busy state,.
Definition: phy-entity.cc:1274
virtual Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration)
Build amendment-specific PPDU.
Definition: phy-entity.cc:244
virtual Time GetDuration(WifiPpduField field, const WifiTxVector &txVector) const
Get the duration of the PPDU field (or group of fields) used by this entity for the given transmissio...
Definition: phy-entity.cc:193
std::tuple< double, double, double > GetTxMaskRejectionParams() const
Definition: phy-entity.cc:1352
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
Definition: phy-entity.cc:1284
virtual Time DoStartReceivePayload(Ptr< Event > event)
Start receiving the PSDU (i.e.
Definition: phy-entity.cc:573
Time GetDelayUntilCcaEnd(double thresholdDbm, const WifiSpectrumBandInfo &band)
Return the delay until CCA busy is ended for a given sensitivity threshold (in dBm) and a given band.
Definition: phy-entity.cc:1230
virtual void StartReceivePreamble(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
Definition: phy-entity.cc:400
bool NoEndPreambleDetectionEvents() const
Definition: phy-entity.cc:1120
virtual bool HandlesMcsModes() const
Check if the WifiModes handled by this PHY are MCSs.
Definition: phy-entity.cc:135
const std::map< std::pair< uint64_t, WifiPreamble >, Ptr< Event > > & GetCurrentPreambleEvents() const
Get the map of current preamble events (stored in WifiPhy).
Definition: phy-entity.cc:837
std::map< UidStaIdPair, SignalNoiseDbm > m_signalNoiseMap
Map of the latest signal power and noise power in dBm (noise power includes the noise figure)
Definition: phy-entity.h:1002
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
Definition: phy-entity.h:981
void Transmit(Time txDuration, Ptr< const WifiPpdu > ppdu, double txPowerDbm, Ptr< SpectrumValue > txPowerSpectrum, const std::string &type)
This function prepares most of the WifiSpectrumSignalParameters parameters and invokes SpectrumWifiPh...
Definition: phy-entity.cc:1322
virtual Ptr< SpectrumValue > GetTxPowerSpectralDensity(double txPowerW, Ptr< const WifiPpdu > ppdu) const =0
WifiSpectrumBandInfo GetSecondaryBand(uint16_t bandWidth) const
If the channel bonding is used, return the info corresponding to the secondary channel of the given b...
Definition: phy-entity.cc:1209
std::vector< EventId > m_endOfMpduEvents
the end of MPDU events (only used for A-MPDUs)
Definition: phy-entity.h:988
virtual uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const =0
Return the channel width used to measure the RSSI.
virtual ~PhyEntity()
Destructor for PHY entity.
Definition: phy-entity.cc:84
virtual double GetCcaThreshold(const Ptr< const WifiPpdu > ppdu, WifiChannelListType channelType) const
Return the CCA threshold in dBm for a given channel type.
Definition: phy-entity.cc:1223
virtual const PpduFormats & GetPpduFormats() const =0
Return the PPDU formats of the PHY.
virtual uint8_t GetNumModes() const
Definition: phy-entity.cc:113
virtual bool DoStartReceiveField(WifiPpduField field, Ptr< Event > event)
Start receiving a given field, perform amendment-specific actions, and signify if it is supported.
Definition: phy-entity.cc:369
void SetOwner(Ptr< WifiPhy > wifiPhy)
Set the WifiPhy owning this PHY entity.
Definition: phy-entity.cc:92
std::list< WifiMode >::const_iterator begin() const
Return a const iterator to the first WifiMode.
Definition: phy-entity.cc:141
virtual void CancelAllEvents()
Cancel and clear all running events.
Definition: phy-entity.cc:1103
virtual void DoAbortCurrentReception(WifiPhyRxfailureReason reason)
Perform amendment-specific actions before aborting the current reception.
Definition: phy-entity.cc:1145
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Abort the current reception.
Definition: phy-entity.cc:1137
void EndReceivePayload(Ptr< Event > event)
The last symbol of the PPDU has arrived.
Definition: phy-entity.cc:694
static uint64_t m_globalPpduUid
Global counter of the PPDU UID.
Definition: phy-entity.h:1005
PhyHeaderSections GetPhyHeaderSections(const WifiTxVector &txVector, Time ppduStart) const
Return a map of PHY header chunk information per PPDU field.
Definition: phy-entity.cc:226
virtual bool IsMcsSupported(uint8_t index) const
Check if the WifiMode corresponding to the given MCS index is supported.
Definition: phy-entity.cc:127
void StartReceivePayload(Ptr< Event > event)
Start receiving the PSDU (i.e.
Definition: phy-entity.cc:563
std::vector< EventId > m_endRxPayloadEvents
the end of receive events (only one unless UL MU reception)
Definition: phy-entity.h:991
virtual void DoResetReceive(Ptr< Event > event)
Perform amendment-specific actions before resetting PHY at the end of the PPDU under reception after ...
Definition: phy-entity.cc:1173
void EndReceiveField(WifiPpduField field, Ptr< Event > event)
End receiving a given field.
Definition: phy-entity.cc:309
virtual Ptr< Event > DoGetEvent(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW)
Get the event corresponding to the incoming PPDU.
Definition: phy-entity.cc:851
virtual WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const
Get the WifiMode for the SIG field specified by the PPDU field.
Definition: phy-entity.cc:153
WifiPpduField GetNextField(WifiPpduField currentField, WifiPreamble preamble) const
Return the field following the provided one.
Definition: phy-entity.cc:162
void CancelRunningEndPreambleDetectionEvents()
Cancel all end preamble detection events.
Definition: phy-entity.cc:1126
std::map< WifiPpduField, PhyHeaderChunkInfo > PhyHeaderSections
A map of PhyHeaderChunkInfo elements per PPDU field.
Definition: phy-entity.h:326
double GetRxPowerWForPpdu(Ptr< Event > event) const
Obtain the received power (W) for a given band.
Definition: phy-entity.cc:1186
virtual void SwitchMaybeToCcaBusy(const Ptr< const WifiPpdu > ppdu)
Check if PHY state should move to CCA busy state based on current state of interference tracker.
Definition: phy-entity.cc:1236
Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector) const
Definition: phy-entity.cc:203
void NotifyInterferenceRxEndAndClear(bool reset)
Notify WifiPhy's InterferenceHelper of the end of the reception, clear maps and end of MPDU event,...
Definition: phy-entity.cc:913
void StartPreambleDetectionPeriod(Ptr< Event > event)
Start the preamble detection period.
Definition: phy-entity.cc:940
Time GetDurationUpToField(WifiPpduField field, const WifiTxVector &txVector) const
Get the duration of the PPDU up to (but excluding) the given field.
Definition: phy-entity.cc:255
std::map< UidStaIdPair, std::vector< bool > > m_statusPerMpduMap
Map of the current reception status per MPDU that is filled in as long as MPDUs are being processed b...
Definition: phy-entity.h:999
virtual bool CanStartRx(Ptr< const WifiPpdu > ppdu) const
Determine whether the PHY shall issue a PHY-RXSTART.indication primitive in response to a given PPDU.
Definition: phy-entity.cc:1368
virtual void StartTx(Ptr< const WifiPpdu > ppdu)
This function is called by SpectrumWifiPhy to send the PPDU while performing amendment-specific actio...
Definition: phy-entity.cc:1312
virtual uint16_t GetRxChannelWidth(const WifiTxVector &txVector) const
Return the channel width used in the reception spectrum model.
Definition: phy-entity.cc:1217
Time GetRemainingDurationAfterField(Ptr< const WifiPpdu > ppdu, WifiPpduField field) const
Get the remaining duration of the PPDU after the end of the given field.
Definition: phy-entity.cc:361
virtual uint16_t GetStaId(const Ptr< const WifiPpdu > ppdu) const
Return the STA ID that has been assigned to the station this PHY belongs to.
Definition: phy-entity.cc:557
virtual Time CalculateTxDuration(WifiConstPsduMap psduMap, const WifiTxVector &txVector, WifiPhyBand band) const
Definition: phy-entity.cc:1358
void StartReceiveField(WifiPpduField field, Ptr< Event > event)
Start receiving a given field.
Definition: phy-entity.cc:282
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const
Definition: phy-entity.cc:1346
virtual bool IsModeSupported(WifiMode mode) const
Check if the WifiMode is supported.
Definition: phy-entity.cc:100
void ResetReceive(Ptr< Event > event)
Reset PHY at the end of the PPDU under reception after it has failed the PHY header.
Definition: phy-entity.cc:1159
std::optional< std::pair< Time, WifiChannelListType > > CcaIndication
CCA end time and its corresponding channel list type (can be std::nullopt if IDLE)
Definition: phy-entity.h:969
virtual CcaIndication GetCcaIndication(const Ptr< const WifiPpdu > ppdu)
Get CCA end time and its corresponding channel list type when a new signal has been received by the P...
Definition: phy-entity.cc:1259
std::list< WifiMode > m_modeList
the list of supported modes
Definition: phy-entity.h:985
virtual Time GetMaxDelayPpduSameUid(const WifiTxVector &txVector)
Obtain the maximum time between two PPDUs with the same UID to consider they are identical and their ...
Definition: phy-entity.cc:1291
Ptr< const Event > GetCurrentEvent() const
Get the pointer to the current event (stored in WifiPhy).
Definition: phy-entity.cc:1192
double GetRandomValue() const
Obtain a random value from the WifiPhy's generator.
Definition: phy-entity.cc:1180
std::vector< EventId > m_endPreambleDetectionEvents
the end of preamble detection events
Definition: phy-entity.h:987
virtual Ptr< const WifiPsdu > GetAddressedPsduInPpdu(Ptr< const WifiPpdu > ppdu) const
Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
Definition: phy-entity.cc:220
SnrPer GetPhyHeaderSnrPer(WifiPpduField field, Ptr< Event > event) const
Obtain the SNR and PER of the PPDU field from the WifiPhy's InterferenceHelper class.
Definition: phy-entity.cc:271
void ErasePreambleEvent(Ptr< const WifiPpdu > ppdu, Time rxDuration)
Erase the event corresponding to the PPDU from the list of preamble events, but consider it as noise ...
Definition: phy-entity.cc:536
virtual Ptr< const WifiPpdu > GetRxPpduFromTxPpdu(Ptr< const WifiPpdu > ppdu)
The WifiPpdu from the TX PHY is received by each RX PHY attached to the same channel.
Definition: phy-entity.cc:1389
virtual WifiMode GetMcs(uint8_t index) const
Get the WifiMode corresponding to the given MCS index.
Definition: phy-entity.cc:119
void AddPreambleEvent(Ptr< Event > event)
Add an entry to the map of current preamble events (stored in WifiPhy).
Definition: phy-entity.cc:843
virtual void DoEndReceivePayload(Ptr< const WifiPpdu > ppdu)
Perform amendment-specific actions at the end of the reception of the payload.
Definition: phy-entity.cc:774
uint16_t GetCenterFrequencyForChannelWidth(const WifiTxVector &txVector) const
Get the center frequency of the channel corresponding the current TxVector rather than that of the su...
Definition: phy-entity.cc:1297
virtual WifiConstPsduMap GetWifiConstPsduMap(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector) const
Get a WifiConstPsduMap from a PSDU and the TXVECTOR to use to send the PSDU.
Definition: phy-entity.cc:214
virtual std::pair< uint16_t, WifiSpectrumBandInfo > GetChannelWidthAndBand(const WifiTxVector &txVector, uint16_t staId) const
Get the channel width and band to use (will be overloaded by child classes).
Definition: phy-entity.cc:830
virtual bool IsConfigSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the signaled configuration (excluding bandwidth) is supported by the PHY.
Definition: phy-entity.cc:1090
Ptr< Event > CreateInterferenceEvent(Ptr< const WifiPpdu > ppdu, Time duration, RxPowerWattPerChannelBand &rxPower, bool isStartHePortionRxing=false)
Create an event using WifiPhy's InterferenceHelper class.
Definition: phy-entity.cc:872
PhyRxFailureAction
Action to perform in case of RX failure.
Definition: phy-entity.h:102
@ DROP
drop PPDU and set CCA_BUSY
Definition: phy-entity.h:103
@ IGNORE
ignore the reception
Definition: phy-entity.h:105
@ ABORT
abort reception of PPDU
Definition: phy-entity.h:104
std::pair< bool, SignalNoiseDbm > GetReceptionStatus(Ptr< const WifiPsdu > psdu, Ptr< Event > event, uint16_t staId, Time relativeMpduStart, Time mpduDuration)
Get the reception status for the provided MPDU and notify.
Definition: phy-entity.cc:786
WifiSpectrumBandInfo GetPrimaryBand(uint16_t bandWidth) const
If the operating channel width is a multiple of 20 MHz, return the info corresponding to the primary ...
Definition: phy-entity.cc:1198
void EndOfMpdu(Ptr< Event > event, Ptr< const WifiPsdu > psdu, size_t mpduIndex, Time relativeStart, Time mpduDuration)
The last symbol of an MPDU in an A-MPDU has arrived.
Definition: phy-entity.cc:657
virtual PhyFieldRxStatus DoEndReceiveField(WifiPpduField field, Ptr< Event > event)
End receiving a given field, perform amendment-specific actions, and provide the status of the recept...
Definition: phy-entity.cc:388
void ScheduleEndOfMpdus(Ptr< Event > event)
Schedule end of MPDUs events.
Definition: phy-entity.cc:595
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:571
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:415
bool IsStrictlyPositive() const
Exactly equivalent to t > 0.
Definition: nstime.h:351
@ MS
millisecond
Definition: nstime.h:117
@ S
second
Definition: nstime.h:116
@ NS
nanosecond
Definition: nstime.h:119
bool IsZero() const
Exactly equivalent to t == 0.
Definition: nstime.h:315
double GetValue(double min, double max)
Get the next random value drawn from the distribution.
represent a single transmission mode
Definition: wifi-mode.h:51
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Definition: wifi-mode.cc:122
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Definition: wifi-phy.h:1291
double GetCcaEdThreshold() const
Return the CCA energy detection threshold (dBm).
Definition: wifi-phy.cc:503
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
Definition: wifi-phy.h:1290
void NotifyCcaBusy(const Ptr< const WifiPpdu > ppdu, Time duration)
Notify PHY state helper to switch to CCA busy state,.
Definition: wifi-phy.cc:2130
WifiPhyOperatingChannel m_operatingChannel
Operating channel.
Definition: wifi-phy.h:1522
static Time GetPayloadDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, MpduType mpdutype=NORMAL_MPDU, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1478
uint16_t GetChannelWidth() const
Definition: wifi-phy.cc:1069
std::map< std::pair< uint64_t, WifiPreamble >, Ptr< Event > > m_currentPreambleEvents
store event associated to a PPDU (that has a unique ID and preamble combination) whose preamble is be...
Definition: wifi-phy.h:1303
EventId m_endPhyRxEvent
the end of PHY receive event
Definition: wifi-phy.h:1298
double GetTxGain() const
Return the transmission gain (dB).
Definition: wifi-phy.cc:579
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
Definition: wifi-phy.cc:1626
bool IsStateRx() const
Definition: wifi-phy.cc:2075
uint16_t GetFrequency() const
Definition: wifi-phy.cc:1057
static Time GetPreambleDetectionDuration()
Definition: wifi-phy.cc:1466
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Definition: wifi-phy.cc:2137
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
Definition: wifi-phy.h:1564
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
Definition: wifi-phy.cc:1602
virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const =0
bool IsStateOff() const
Definition: wifi-phy.cc:2099
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
Definition: wifi-phy.cc:1525
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Definition: wifi-phy.h:1326
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Definition: wifi-phy.h:1567
WifiPhyBand GetPhyBand() const
Get the configured Wi-Fi band.
Definition: wifi-phy.cc:1039
Ptr< Event > m_currentEvent
Hold the current event.
Definition: wifi-phy.h:1301
uint8_t GetChannelNumber() const
Return current channel number.
Definition: wifi-phy.cc:1063
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Definition: wifi-phy.h:1306
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
Definition: wifi-phy.h:1565
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
Definition: wifi-phy.cc:1614
bool IsStateSleep() const
Definition: wifi-phy.cc:2093
virtual FrequencyRange GetCurrentFrequencyRange() const =0
Get the frequency range of the current RF interface.
virtual WifiSpectrumBandInfo GetBand(uint16_t bandWidth, uint8_t bandIndex=0)=0
Get the info of a given band.
void SwitchMaybeToCcaBusy(const Ptr< const WifiPpdu > ppdu=nullptr)
Check if PHY state should move to CCA busy state based on current state of interference tracker.
Definition: wifi-phy.cc:2123
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
Definition: wifi-phy.h:1288
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
Definition: wifi-phy.cc:2202
virtual std::tuple< double, double, double > GetTxMaskRejectionParams() const =0
void NotifyMonitorSniffRx(Ptr< const WifiPsdu > psdu, uint16_t channelFreqMhz, WifiTxVector txVector, SignalNoiseDbm signalNoise, std::vector< bool > statusPerMpdu, uint16_t staId=SU_STA_ID)
Public method used to fire a MonitorSniffer trace for a wifi PSDU being received.
Definition: wifi-phy.cc:1638
Ptr< PhyEntity > GetPhyEntityForPpdu(const Ptr< const WifiPpdu > ppdu) const
Get the supported PHY entity to use for a received PPDU.
Definition: wifi-phy.cc:751
void Reset()
Reset data upon end of TX or RX.
Definition: wifi-phy.cc:1872
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
Definition: wifi-phy.h:1453
Time GetLastRxEndTime() const
Return the end time of the last received packet.
Definition: wifi-phy.cc:2117
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Definition: wifi-phy.h:1568
const WifiPhyOperatingChannel & GetOperatingChannel() const
Get a const reference to the operating channel.
Definition: wifi-phy.cc:1051
double GetCcaSensitivityThreshold() const
Return the CCA sensitivity threshold (dBm).
Definition: wifi-phy.cc:516
uint8_t GetPrimaryChannelIndex(uint16_t primaryChannelWidth) const
If the operating channel width is a multiple of 20 MHz, return the index of the primary channel of th...
uint8_t GetSecondaryChannelIndex(uint16_t secondaryChannelWidth) const
If the operating channel width is made of a multiple of 20 MHz, return the index of the secondary cha...
uint16_t GetPrimaryChannelCenterFrequency(uint16_t primaryChannelWidth) const
Get the center frequency of the primary channel of the given width.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiPreamble GetPreambleType() const
uint16_t GetChannelWidth() const
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
Definition: abort.h:49
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1350
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1362
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiPhyBand
Identifies the PHY band.
Definition: wifi-phy-band.h:33
WifiChannelListType
Enumeration of the possible channel-list parameter elements defined in Table 8-5 of IEEE 802....
WifiPpduField
The type of PPDU field (grouped for convenience)
MpduType
The type of an MPDU.
@ PREAMBLE_DETECT_FAILURE
@ TRUNCATED_TX
@ FRAME_CAPTURE_PACKET_SWITCH
@ POWERED_OFF
@ CHANNEL_SWITCHING
@ BUSY_DECODING_PREAMBLE
@ PPDU_TOO_LATE
@ PREAMBLE_DETECTION_PACKET_SWITCH
@ WIFI_CHANLIST_PRIMARY
@ WIFI_PPDU_FIELD_EHT_SIG
EHT-SIG field.
@ WIFI_PPDU_FIELD_PREAMBLE
SYNC + SFD fields for DSSS or ERP, shortSYNC + shortSFD fields for HR/DSSS or ERP,...
@ WIFI_PPDU_FIELD_DATA
data field
@ LAST_MPDU_IN_AGGREGATE
The MPDU is the last aggregate in an A-MPDU with multiple MPDUs.
@ NORMAL_MPDU
The MPDU is not part of an A-MPDU.
@ FIRST_MPDU_IN_AGGREGATE
The MPDU is the first aggregate in an A-MPDU with multiple MPDUs, but is not the last aggregate.
@ SINGLE_MPDU
The MPDU is a single MPDU.
@ MIDDLE_MPDU_IN_AGGREGATE
The MPDU is part of an A-MPDU with multiple MPDUs, but is neither the first nor the last aggregate.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double RatioToDb(double ratio)
Convert from ratio to dB.
Definition: wifi-utils.cc:52
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
@ SWITCHING
The PHY layer is switching to other channel.
@ TX
The PHY layer is sending a packet.
@ OFF
The PHY layer is switched off.
@ IDLE
The PHY layer is IDLE.
@ CCA_BUSY
The PHY layer has sense the medium busy through the CCA mechanism.
@ SLEEP
The PHY layer is sleeping.
@ RX
The PHY layer is receiving a packet.
double WToDbm(double w)
Convert from Watts to dBm.
Definition: wifi-utils.cc:46
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:159
double Integral(const SpectrumValue &arg)
double DbmToW(double dBm)
Convert from dBm to Watts.
Definition: wifi-utils.cc:40
std::map< WifiSpectrumBandInfo, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:77
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Definition: wifi-mode.h:35
Declaration of:
Status of the reception of the PPDU field.
Definition: phy-entity.h:112
WifiPhyRxfailureReason reason
failure reason
Definition: phy-entity.h:114
PhyRxFailureAction actionIfFailure
action to perform in case of failure
Definition: phy-entity.h:115
bool isSuccess
outcome (true if success) of the reception
Definition: phy-entity.h:113
A struct for both SNR and PER.
Definition: phy-entity.h:147
double snr
SNR in linear scale.
Definition: phy-entity.h:148
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:69
double rssi
RSSI in dBm.
Definition: phy-entity.h:71
double snr
SNR in linear scale.
Definition: phy-entity.h:70
SignalNoiseDbm structure.
Definition: phy-entity.h:55
double noise
noise power in dBm
Definition: phy-entity.h:57
double signal
signal strength in dBm
Definition: phy-entity.h:56
WifiSpectrumBandInfo structure containing info about a spectrum band.