A Discrete-Event Network Simulator
API
phy-entity.h
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 #ifndef PHY_ENTITY_H
24 #define PHY_ENTITY_H
25 
26 #include "wifi-mpdu-type.h"
27 #include "wifi-phy-band.h"
28 #include "wifi-ppdu.h"
29 #include "wifi-tx-vector.h"
30 
31 #include "ns3/event-id.h"
32 #include "ns3/nstime.h"
33 #include "ns3/simple-ref-count.h"
34 #include "ns3/wifi-spectrum-value-helper.h"
35 
36 #include <list>
37 #include <map>
38 #include <optional>
39 #include <tuple>
40 #include <utility>
41 
51 namespace ns3
52 {
53 
56 {
57  double signal;
58  double noise;
59 };
60 
62 struct MpduInfo
63 {
65  uint32_t mpduRefNumber;
66 };
67 
70 {
71  double snr;
72  double rssi;
73 };
74 
78 typedef std::map<WifiSpectrumBand, double> RxPowerWattPerChannelBand;
79 
80 class WifiPsdu;
81 class WifiPhy;
82 class InterferenceHelper;
83 class Event;
84 class WifiPhyStateHelper;
85 class WifiPsdu;
86 class WifiPpdu;
87 
96 class PhyEntity : public SimpleRefCount<PhyEntity>
97 {
98  public:
103  {
104  DROP = 0,
106  IGNORE
107  };
108 
113  {
114  bool isSuccess{true};
117  DROP};
118 
125  : isSuccess(s)
126  {
127  }
128 
137  : isSuccess(s),
138  reason(r),
139  actionIfFailure(a)
140  {
141  }
142  };
143 
147  struct SnrPer
148  {
149  double snr{0.0};
150  double per{1.0};
151 
156  {
157  }
158 
165  SnrPer(double s, double p)
166  : snr(s),
167  per(p)
168  {
169  }
170  };
171 
175  virtual ~PhyEntity();
176 
182  void SetOwner(Ptr<WifiPhy> wifiPhy);
183 
191  virtual bool IsModeSupported(WifiMode mode) const;
195  virtual uint8_t GetNumModes() const;
196 
205  virtual WifiMode GetMcs(uint8_t index) const;
215  virtual bool IsMcsSupported(uint8_t index) const;
222  virtual bool HandlesMcsModes() const;
223 
232  virtual WifiMode GetSigMode(WifiPpduField field, const WifiTxVector& txVector) const;
233 
239  std::list<WifiMode>::const_iterator begin() const;
245  std::list<WifiMode>::const_iterator end() const;
246 
254  WifiPpduField GetNextField(WifiPpduField currentField, WifiPreamble preamble) const;
255 
265  virtual Time GetDuration(WifiPpduField field, const WifiTxVector& txVector) const;
272 
290  virtual Time GetPayloadDuration(uint32_t size,
291  const WifiTxVector& txVector,
292  WifiPhyBand band,
293  MpduType mpdutype,
294  bool incFlag,
295  uint32_t& totalAmpduSize,
296  double& totalAmpduNumSymbols,
297  uint16_t staId) const = 0;
298 
309  const WifiTxVector& txVector) const;
310 
316  virtual uint32_t GetMaxPsduSize() const = 0;
317 
322  typedef std::pair<std::pair<Time /* start */, Time /* stop */>, WifiMode> PhyHeaderChunkInfo;
327  typedef std::map<WifiPpduField, PhyHeaderChunkInfo> PhyHeaderSections;
339  PhyHeaderSections GetPhyHeaderSections(const WifiTxVector& txVector, Time ppduStart) const;
340 
350  virtual Ptr<WifiPpdu> BuildPpdu(const WifiConstPsduMap& psdus,
351  const WifiTxVector& txVector,
352  Time ppduDuration);
353 
361  Time GetDurationUpToField(WifiPpduField field, const WifiTxVector& txVector) const;
370 
378 
389  virtual void StartReceivePreamble(Ptr<const WifiPpdu> ppdu,
390  RxPowerWattPerChannelBand& rxPowersW,
391  Time rxDuration);
404  void StartReceiveField(WifiPpduField field, Ptr<Event> event);
416  void EndReceiveField(WifiPpduField field, Ptr<Event> event);
417 
423  void EndReceivePayload(Ptr<Event> event);
424 
430  void ResetReceive(Ptr<Event> event);
431 
435  virtual void CancelAllEvents();
439  bool NoEndPreambleDetectionEvents() const;
445  void CancelRunningEndPreambleDetectionEvents(bool clear = false);
446 
454  virtual uint16_t GetStaId(const Ptr<const WifiPpdu> ppdu) const;
455 
465  virtual bool CanStartRx(Ptr<const WifiPpdu> ppdu, uint16_t txChannelWidth) const;
466 
473  virtual void SwitchMaybeToCcaBusy(const Ptr<const WifiPpdu> ppdu);
481  virtual void NotifyCcaBusy(const Ptr<const WifiPpdu> ppdu,
482  Time duration,
483  WifiChannelListType channelType);
491  virtual void StartTx(Ptr<const WifiPpdu> ppdu);
492 
504  void Transmit(Time txDuration,
505  Ptr<const WifiPpdu> ppdu,
506  double txPowerDbm,
507  Ptr<SpectrumValue> txPowerSpectrum,
508  const std::string& type);
509 
517  virtual Time CalculateTxDuration(WifiConstPsduMap psduMap,
518  const WifiTxVector& txVector,
519  WifiPhyBand band) const;
528  virtual double GetCcaThreshold(const Ptr<const WifiPpdu> ppdu,
529  WifiChannelListType channelType) const;
530 
541 
549  virtual uint64_t ObtainNextUid(const WifiTxVector& txVector);
550 
551  protected:
556  typedef std::map<WifiPreamble, std::vector<WifiPpduField>> PpduFormats;
557 
561  typedef std::pair<WifiCodeRate, uint16_t> CodeRateConstellationSizePair;
562 
566  typedef std::map<std::string, CodeRateConstellationSizePair> ModulationLookupTable;
567 
573  virtual const PpduFormats& GetPpduFormats() const = 0;
574 
583  virtual bool DoStartReceiveField(WifiPpduField field, Ptr<Event> event);
593 
629 
635  void StartReceivePayload(Ptr<Event> event);
636 
644  virtual Time DoStartReceivePayload(Ptr<Event> event);
645 
652  virtual void DoResetReceive(Ptr<Event> event);
653 
660  virtual void DoAbortCurrentReception(WifiPhyRxfailureReason reason);
661 
669  virtual bool IsConfigSupported(Ptr<const WifiPpdu> ppdu) const;
670 
680 
688  void ErasePreambleEvent(Ptr<const WifiPpdu> ppdu, Time rxDuration);
689 
702  std::pair<bool, SignalNoiseDbm> GetReceptionStatus(Ptr<const WifiPsdu> psdu,
703  Ptr<Event> event,
704  uint16_t staId,
705  Time relativeMpduStart,
706  Time mpduDuration);
716  void EndOfMpdu(Ptr<Event> event,
717  Ptr<const WifiPsdu> psdu,
718  size_t mpduIndex,
719  Time relativeStart,
720  Time mpduDuration);
721 
727  void ScheduleEndOfMpdus(Ptr<Event> event);
728 
738  virtual void RxPayloadSucceeded(Ptr<const WifiPsdu> psdu,
739  RxSignalInfo rxSignalInfo,
740  const WifiTxVector& txVector,
741  uint16_t staId,
742  const std::vector<bool>& statusPerMpdu);
750  virtual void RxPayloadFailed(Ptr<const WifiPsdu> psdu,
751  double snr,
752  const WifiTxVector& txVector);
753 
760  virtual void DoEndReceivePayload(Ptr<const WifiPpdu> ppdu);
761 
769  virtual std::pair<uint16_t, WifiSpectrumBand> GetChannelWidthAndBand(
770  const WifiTxVector& txVector,
771  uint16_t staId) const;
772 
779 
786  double GetRandomValue() const;
803  double GetRxPowerWForPpdu(Ptr<Event> event) const;
817  const std::map<std::pair<uint64_t, WifiPreamble>, Ptr<Event>>& GetCurrentPreambleEvents() const;
824  void AddPreambleEvent(Ptr<Event> event);
825 
833  const WifiTxVector& txVector,
834  Time duration,
835  RxPowerWattPerChannelBand& rxPower,
836  bool isStartOfdmaRxing = false);
850  void NotifyInterferenceRxEndAndClear(bool reset);
851 
861  Ptr<const WifiPpdu> ppdu) const = 0;
862 
871  uint16_t GetCenterFrequencyForChannelWidth(const WifiTxVector& txVector) const;
872 
879  void NotifyPayloadBegin(const WifiTxVector& txVector, const Time& payloadDuration);
880 
892  WifiSpectrumBand GetPrimaryBand(uint16_t bandWidth) const;
902  WifiSpectrumBand GetSecondaryBand(uint16_t bandWidth) const;
903 
910  virtual uint16_t GetMeasurementChannelWidth(const Ptr<const WifiPpdu> ppdu) const = 0;
911 
918  virtual uint16_t GetRxChannelWidth(const WifiTxVector& txVector) const;
919 
928  Time GetDelayUntilCcaEnd(double thresholdDbm, WifiSpectrumBand band);
929 
937  uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const;
946  std::tuple<double, double, double> GetTxMaskRejectionParams() const;
947 
949  std::optional<std::pair<Time, WifiChannelListType>>;
952 
962 
966 
967  std::list<WifiMode> m_modeList;
968 
969  std::vector<EventId> m_endPreambleDetectionEvents;
970  std::vector<EventId> m_endOfMpduEvents;
971 
972  std::vector<EventId>
974 
978  typedef std::pair<uint64_t /* UID */, uint16_t /* STA-ID */> UidStaIdPair;
979 
980  std::map<UidStaIdPair, std::vector<bool>>
983  std::map<UidStaIdPair, SignalNoiseDbm>
986 
987  static uint64_t m_globalPpduUid;
988 }; // class PhyEntity
989 
997 std::ostream& operator<<(std::ostream& os, const PhyEntity::PhyRxFailureAction& action);
1005 std::ostream& operator<<(std::ostream& os, const PhyEntity::PhyFieldRxStatus& status);
1006 
1007 } // namespace ns3
1008 
1009 #endif /* PHY_ENTITY_H */
handles interference calculations
handles interference calculations
Abstract class for PHY entities.
Definition: phy-entity.h:97
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:1276
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:527
std::list< WifiMode >::const_iterator end() const
Return a const iterator to past-the-last WifiMode.
Definition: phy-entity.cc:144
virtual const PpduFormats & GetPpduFormats() const =0
Return the PPDU formats of the PHY.
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:754
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:900
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper of the WifiPhy (to make it reachable for child classes)
Definition: phy-entity.h:964
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:766
void EndPreambleDetectionPeriod(Ptr< Event > event)
End the preamble detection period.
Definition: phy-entity.cc:924
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:1250
virtual Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration)
Build amendment-specific PPDU.
Definition: phy-entity.cc:242
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:190
std::tuple< double, double, double > GetTxMaskRejectionParams() const
Definition: phy-entity.cc:1324
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
Definition: phy-entity.cc:1260
virtual Time DoStartReceivePayload(Ptr< Event > event)
Start receiving the PSDU (i.e.
Definition: phy-entity.cc:584
virtual bool CanStartRx(Ptr< const WifiPpdu > ppdu, uint16_t txChannelWidth) const
Determine whether the PHY shall issue a PHY-RXSTART.indication primitive in response to a given PPDU.
Definition: phy-entity.cc:1340
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:399
virtual Time GetPayloadDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, MpduType mpdutype, bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols, uint16_t staId) const =0
Ptr< Event > CreateInterferenceEvent(Ptr< const WifiPpdu > ppdu, const WifiTxVector &txVector, Time duration, RxPowerWattPerChannelBand &rxPower, bool isStartOfdmaRxing=false)
Create an event using WifiPhy's InterferenceHelper class.
Definition: phy-entity.cc:867
bool NoEndPreambleDetectionEvents() const
Definition: phy-entity.cc:1090
virtual Ptr< SpectrumValue > GetTxPowerSpectralDensity(double txPowerW, Ptr< const WifiPpdu > ppdu) const =0
virtual bool HandlesMcsModes() const
Check if the WifiModes handled by this PHY are MCSs.
Definition: phy-entity.cc:132
std::pair< WifiCodeRate, uint16_t > CodeRateConstellationSizePair
A pair to hold modulation information: code rate and constellation size.
Definition: phy-entity.h:561
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:984
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
Definition: phy-entity.h:963
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:1292
WifiSpectrumBand GetSecondaryBand(uint16_t bandWidth) const
If the channel bonding is used, return the start band index and the stop band index for the secondary...
Definition: phy-entity.cc:1185
std::map< std::string, CodeRateConstellationSizePair > ModulationLookupTable
A modulation lookup table using unique name of modulation as key.
Definition: phy-entity.h:566
std::pair< std::pair< Time, Time >, WifiMode > PhyHeaderChunkInfo
A pair containing information on the PHY header chunk, namely the start and stop times of the chunk a...
Definition: phy-entity.h:322
std::vector< EventId > m_endOfMpduEvents
the end of MPDU events (only used for A-MPDUs)
Definition: phy-entity.h:970
virtual uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const =0
Return the channel width used to measure the RSSI.
virtual std::pair< uint16_t, WifiSpectrumBand > 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 ~PhyEntity()
Destructor for PHY entity.
Definition: phy-entity.cc:81
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:1199
virtual uint8_t GetNumModes() const
Definition: phy-entity.cc:110
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:368
void SetOwner(Ptr< WifiPhy > wifiPhy)
Set the WifiPhy owning this PHY entity.
Definition: phy-entity.cc:89
std::list< WifiMode >::const_iterator begin() const
Return a const iterator to the first WifiMode.
Definition: phy-entity.cc:138
virtual void CancelAllEvents()
Cancel and clear all running events.
Definition: phy-entity.cc:1069
virtual uint32_t GetMaxPsduSize() const =0
Get the maximum PSDU size in bytes.
virtual void DoAbortCurrentReception(WifiPhyRxfailureReason reason)
Perform amendment-specific actions before aborting the current reception.
Definition: phy-entity.cc:1121
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Abort the current reception.
Definition: phy-entity.cc:1113
void EndReceivePayload(Ptr< Event > event)
The last symbol of the PPDU has arrived.
Definition: phy-entity.cc:705
std::map< WifiPreamble, std::vector< WifiPpduField > > PpduFormats
A map of PPDU field elements per preamble type.
Definition: phy-entity.h:556
static uint64_t m_globalPpduUid
Global counter of the PPDU UID.
Definition: phy-entity.h:987
PhyHeaderSections GetPhyHeaderSections(const WifiTxVector &txVector, Time ppduStart) const
Return a map of PHY header chunk information per PPDU field.
Definition: phy-entity.cc:223
virtual bool IsMcsSupported(uint8_t index) const
Check if the WifiMode corresponding to the given MCS index is supported.
Definition: phy-entity.cc:124
void StartReceivePayload(Ptr< Event > event)
Start receiving the PSDU (i.e.
Definition: phy-entity.cc:574
std::vector< EventId > m_endRxPayloadEvents
the end of receive events (only one unless UL MU reception)
Definition: phy-entity.h:973
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:1149
void EndReceiveField(WifiPpduField field, Ptr< Event > event)
End receiving a given field.
Definition: phy-entity.cc:308
virtual Ptr< Event > DoGetEvent(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW)
Get the event corresponding to the incoming PPDU.
Definition: phy-entity.cc:852
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:150
WifiPpduField GetNextField(WifiPpduField currentField, WifiPreamble preamble) const
Return the field following the provided one.
Definition: phy-entity.cc:159
std::map< WifiPpduField, PhyHeaderChunkInfo > PhyHeaderSections
A map of PhyHeaderChunkInfo elements per PPDU field.
Definition: phy-entity.h:327
double GetRxPowerWForPpdu(Ptr< Event > event) const
Obtain the received power (W) for a given band.
Definition: phy-entity.cc:1162
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:1212
Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector) const
Definition: phy-entity.cc:200
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:883
void StartPreambleDetectionPeriod(Ptr< Event > event)
Start the preamble detection period.
Definition: phy-entity.cc:910
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:254
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:981
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:1282
virtual uint16_t GetRxChannelWidth(const WifiTxVector &txVector) const
Return the channel width used in the reception spectrum model.
Definition: phy-entity.cc:1193
Time GetDelayUntilCcaEnd(double thresholdDbm, WifiSpectrumBand band)
Return the delay until CCA busy is ended for a given sensitivity threshold (in dBm) and a given band.
Definition: phy-entity.cc:1206
void CancelRunningEndPreambleDetectionEvents(bool clear=false)
Cancel and eventually clear all end preamble detection events.
Definition: phy-entity.cc:1096
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:360
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:568
virtual Time CalculateTxDuration(WifiConstPsduMap psduMap, const WifiTxVector &txVector, WifiPhyBand band) const
Definition: phy-entity.cc:1330
void StartReceiveField(WifiPpduField field, Ptr< Event > event)
Start receiving a given field.
Definition: phy-entity.cc:281
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const
Definition: phy-entity.cc:1318
virtual bool IsModeSupported(WifiMode mode) const
Check if the WifiMode is supported.
Definition: phy-entity.cc:97
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:1135
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:951
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:1235
std::list< WifiMode > m_modeList
the list of supported modes
Definition: phy-entity.h:967
std::pair< uint64_t, uint16_t > UidStaIdPair
A pair of a UID and STA_ID.
Definition: phy-entity.h:978
Ptr< const Event > GetCurrentEvent() const
Get the pointer to the current event (stored in WifiPhy).
Definition: phy-entity.cc:1168
double GetRandomValue() const
Obtain a random value from the WifiPhy's generator.
Definition: phy-entity.cc:1156
std::vector< EventId > m_endPreambleDetectionEvents
the end of preamble detection events
Definition: phy-entity.h:969
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:217
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:270
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:546
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:1364
virtual WifiMode GetMcs(uint8_t index) const
Get the WifiMode corresponding to the given MCS index.
Definition: phy-entity.cc:116
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:1267
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:211
virtual bool IsConfigSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the signaled configuration (excluding bandwidth) is supported by the PHY.
Definition: phy-entity.cc:1056
WifiSpectrumBand GetPrimaryBand(uint16_t bandWidth) const
If the operating channel width is a multiple of 20 MHz, return the start band index and the stop band...
Definition: phy-entity.cc:1174
PhyRxFailureAction
Action to perform in case of RX failure.
Definition: phy-entity.h:103
@ DROP
drop PPDU and set CCA_BUSY
Definition: phy-entity.h:104
@ IGNORE
ignore the reception
Definition: phy-entity.h:106
@ ABORT
abort reception of PPDU
Definition: phy-entity.h:105
void UpdateInterferenceEvent(Ptr< Event > event, const RxPowerWattPerChannelBand &rxPower)
Update an event in WifiPhy's InterferenceHelper class.
Definition: phy-entity.cc:877
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
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:668
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:387
void ScheduleEndOfMpdus(Ptr< Event > event)
Schedule end of MPDUs events.
Definition: phy-entity.cc:606
A template-based reference counting class.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
represent a single transmission mode
Definition: wifi-mode.h:50
802.11 PHY layer model
Definition: wifi-phy.h:53
This objects implements the PHY state machine of the Wifi device.
WifiPpdu stores a preamble, a modulation class, PHY headers and a PSDU.
Definition: wifi-ppdu.h:56
WifiPsdu stores an MPDU, S-MPDU or A-MPDU, by keeping header(s) and payload(s) separate for each cons...
Definition: wifi-psdu.h:43
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
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.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
std::pair< uint32_t, uint32_t > WifiSpectrumBand
typedef for a pair of start and stop sub-band indexes
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
Definition: phy-entity.h:78
std::ostream & operator<<(std::ostream &os, const Angles &a)
Definition: angles.cc:129
MpduInfo structure.
Definition: phy-entity.h:63
MpduType type
type of MPDU
Definition: phy-entity.h:64
uint32_t mpduRefNumber
MPDU ref number.
Definition: phy-entity.h:65
Status of the reception of the PPDU field.
Definition: phy-entity.h:113
WifiPhyRxfailureReason reason
failure reason
Definition: phy-entity.h:115
PhyRxFailureAction actionIfFailure
action to perform in case of failure
Definition: phy-entity.h:116
PhyFieldRxStatus(bool s, WifiPhyRxfailureReason r, PhyRxFailureAction a)
Constructor.
Definition: phy-entity.h:136
PhyFieldRxStatus(bool s)
Constructor setting outcome of reception.
Definition: phy-entity.h:124
bool isSuccess
outcome (true if success) of the reception
Definition: phy-entity.h:114
A struct for both SNR and PER.
Definition: phy-entity.h:148
SnrPer(double s, double p)
Constructor for SnrPer.
Definition: phy-entity.h:165
double snr
SNR in linear scale.
Definition: phy-entity.h:149
SnrPer()
Default constructor.
Definition: phy-entity.h:155
RxSignalInfo structure containing info on the received signal.
Definition: phy-entity.h:70
double rssi
RSSI in dBm.
Definition: phy-entity.h:72
double snr
SNR in linear scale.
Definition: phy-entity.h:71
SignalNoiseDbm structure.
Definition: phy-entity.h:56
double noise
noise power in dBm
Definition: phy-entity.h:58
double signal
signal strength in dBm
Definition: phy-entity.h:57
Declaration of ns3::WifiPpdu class and ns3::WifiConstPsduMap.