| 
	      
		 A Discrete-Event Network Simulator 
		
	       | 
	      
	      
		API
	       | 
	    
	  
	
	
       
 
Go to the documentation of this file.
   30 #include "ns3/packet.h" 
   31 #include "ns3/simulator.h" 
   33 #include "ns3/assert.h" 
   45         return (os << 
"DROP");
 
   47         return (os << 
"ABORT");
 
   49         return (os << 
"IGNORE");
 
   52         return (os << 
"unknown");
 
   60       return os << 
"success";
 
  111   NS_ABORT_MSG (
"This method should be used only for HtPhy and child classes. Use GetMode instead.");
 
  118   NS_ABORT_MSG (
"This method should be used only for HtPhy and child classes. Use IsModeSupported instead.");
 
  128 std::list<WifiMode>::const_iterator
 
  134 std::list<WifiMode>::const_iterator
 
  143   NS_FATAL_ERROR (
"PPDU field is not a SIG field (no sense in retrieving the signaled mode) or is unsupported: " << field);
 
  151   const auto itPpdu = ppduFormats.find (preamble);
 
  152   if (itPpdu != ppduFormats.end ())
 
  154       const auto itField = std::find (itPpdu->second.begin (), itPpdu->second.end (), currentField);
 
  155       if (itField != itPpdu->second.end ())
 
  157           const auto itNextField = std::next (itField, 1);
 
  158           if (itNextField != itPpdu->second.end ())
 
  160               return *(itNextField);
 
  162           NS_FATAL_ERROR (
"No field after " << currentField << 
" for " << preamble << 
" for the provided PPDU formats");
 
  166           NS_FATAL_ERROR (
"Unsupported PPDU field " << currentField << 
" for " << preamble << 
" for the provided PPDU formats");
 
  171       NS_FATAL_ERROR (
"Unsupported preamble " << preamble << 
" for the provided PPDU formats");
 
  205   return ppdu->GetPsdu ();
 
  218       map[field] = std::make_pair (std::make_pair (
start, 
start + duration),
 
  231   NS_FATAL_ERROR (
"This method is unsupported for the base PhyEntity class. Use the overloaded version in the amendment-specific subclasses instead!");
 
  232   return Create<WifiPpdu> (psdus.begin ()->second, txVector); 
 
  243   auto it = sections.find (field);
 
  245   const auto & startStopTimes = it->second.first;
 
  246   return startStopTimes.first; 
 
  272   NS_ABORT_MSG_IF (!supported, 
"Unknown field " << field << 
" for this PHY entity"); 
 
  275   m_state->SwitchMaybeToCcaBusy (duration); 
 
  337   auto itFormat = ppduFormats.find (event->GetPpdu ()->GetPreamble ());
 
  338   if (itFormat != ppduFormats.end ())
 
  340       auto itField = std::find (itFormat->second.begin (), itFormat->second.end (), field);
 
  341       if (itField != itFormat->second.end ())
 
  366   auto it = std::max_element (rxPowersW.begin (), rxPowersW.end (),
 
  367                               [] (
const std::pair<WifiSpectrumBand, double> &p1, 
const std::pair<WifiSpectrumBand, double> &p2) {
 
  368                                 return p1.second < p2.second;
 
  371   Time rxDuration = ppdu->GetTxDuration (); 
 
  374   if (event == 
nullptr)
 
  391   if (ppdu->IsTruncatedTx ())
 
  393       NS_LOG_DEBUG (
"Packet reception stopped because transmitter has been switched off");
 
  404         NS_LOG_DEBUG (
"Drop packet because of channel switching");
 
  457                 NS_LOG_DEBUG (
"Drop packet because already decoding preamble");
 
  483   NS_LOG_FUNCTION (
this << ppdu << reason << endRx << measurementChannelWidth);
 
  511   if (rxDuration > 
m_state->GetDelayUntilIdle ())
 
  533   m_state->SwitchToRx (payloadDuration);
 
  547   m_statusPerMpduMap.insert ({std::make_pair (ppdu->GetUid (), staId), std::vector<bool> ()});
 
  564   Time remainingAmpduDuration = psduDuration;
 
  567   uint32_t totalAmpduSize = 0;
 
  568   double totalAmpduNumSymbols = 0.0;
 
  569   auto mpdu = psdu->
begin ();
 
  570   for (
size_t i = 0; i < nMpdus && mpdu != psdu->
end (); ++mpdu)
 
  575                                                          totalAmpduNumSymbols, staId);
 
  577       remainingAmpduDuration -= mpduDuration;
 
  578       if (i == (nMpdus - 1) && !remainingAmpduDuration.
IsZero ()) 
 
  582               mpduDuration += remainingAmpduDuration; 
 
  586       endOfMpduDuration += mpduDuration;
 
  588                    " (relativeStart=" << relativeStart.
As (
Time::NS) << 
", mpduDuration=" << mpduDuration.
As (
Time::NS) <<
 
  589                    ", remainingAmdpuDuration=" << remainingAmpduDuration.
As (
Time::NS) << 
")");
 
  594       relativeStart += mpduDuration;
 
  602   NS_LOG_FUNCTION (
this << *event << mpduIndex << relativeStart << mpduDuration);
 
  607   std::pair<bool, SignalNoiseDbm> rxInfo = 
GetReceptionStatus (psdu, event, staId, relativeStart, mpduDuration);
 
  609                 ", correct reception: " << rxInfo.first << 
", Signal/Noise: " << rxInfo.second.signal << 
"/" << rxInfo.second.noise << 
"dBm");
 
  611   auto signalNoiseIt = 
m_signalNoiseMap.find (std::make_pair (ppdu->GetUid (), staId));
 
  613   signalNoiseIt->second = rxInfo.second;
 
  616   rxSignalInfo.
snr = rxInfo.second.signal / rxInfo.second.noise;
 
  617   rxSignalInfo.
rssi = rxInfo.second.signal;
 
  619   auto statusPerMpduIt = 
m_statusPerMpduMap.find (std::make_pair (ppdu->GetUid (), staId));
 
  621   statusPerMpduIt->second.push_back (rxInfo.first);
 
  626       m_state->ContinueRxNextMpdu (
Copy (psdu), rxSignalInfo, txVector);
 
  645   auto signalNoiseIt = 
m_signalNoiseMap.find (std::make_pair (ppdu->GetUid (), staId));
 
  647   auto statusPerMpduIt = 
m_statusPerMpduMap.find (std::make_pair (ppdu->GetUid (), staId));
 
  650   if (std::count (statusPerMpduIt->second.begin (), statusPerMpduIt->second.end (), 
true))
 
  655       rxSignalInfo.
snr = snr;
 
  656       rxSignalInfo.
rssi = signalNoiseIt->second.signal; 
 
  657       m_state->SwitchFromRxEndOk (
Copy (psdu), rxSignalInfo, txVector, staId, statusPerMpduIt->second);
 
  681 std::pair<bool, SignalNoiseDbm>
 
  683                                Time relativeMpduStart, 
Time mpduDuration)
 
  685   NS_LOG_FUNCTION (
this << *psdu << *event << staId << relativeMpduStart << mpduDuration);
 
  688                                                                     std::make_pair (relativeMpduStart, relativeMpduStart + mpduDuration));
 
  690   WifiMode mode = 
event->GetTxVector ().GetMode (staId);
 
  693                 ", relativeStart = " << relativeMpduStart.
As (
Time::NS) << 
", duration = " << mpduDuration.
As (
Time::NS));
 
  700   signalNoise.
signal = 
WToDbm (event->GetRxPowerW (channelWidthAndBand.second));
 
  701   signalNoise.
noise = 
WToDbm (event->GetRxPowerW (channelWidthAndBand.second) / snrPer.
snr);
 
  706       return std::make_pair (
true, signalNoise);
 
  711       return std::make_pair (
false, signalNoise);
 
  715 std::pair<uint16_t, WifiSpectrumBand>
 
  722 const std::map <std::pair<uint64_t, WifiPreamble>, 
Ptr<Event> > &
 
  742   auto uidPreamblePair = std::make_pair (ppdu->GetUid (), ppdu->GetPreamble ());
 
  804   double maxRxPowerW = -1; 
 
  809       double rxPowerW = preambleEvent.second->GetRxPowerW (measurementBand);
 
  810       if (rxPowerW > maxRxPowerW)
 
  812           maxRxPowerW = rxPowerW;
 
  813           maxEvent = preambleEvent.second;
 
  818   if (maxEvent != event)
 
  820       NS_LOG_DEBUG (
"Receiver got a stronger packet with UID " << maxEvent->GetPpdu ()->GetUid () << 
" during preamble detection: drop packet with UID " << event->GetPpdu ()->GetUid ());
 
  842           it.second->CancelRunningEndPreambleDetectionEvents (
true);
 
  849               NS_LOG_DEBUG (
"Drop packet with UID " << it->first.first << 
" and preamble " << it->first.second << 
" arrived at time " << it->second->GetStartTime ());
 
  878       m_state->SwitchMaybeToCcaBusy (durationTillEnd); 
 
  883       NS_LOG_DEBUG (
"Drop packet because PHY preamble detection failed");
 
  901   WifiMode txMode = ppdu->GetTxVector ().GetMode ();
 
  904       NS_LOG_DEBUG (
"Drop packet because it was sent using an unsupported mode (" << txMode << 
")");
 
  916       endPreambleDetectionEvent.Cancel ();
 
  921       endRxPayloadEvent.Cancel ();
 
  938       if (endPreambleDetectionEvent.IsRunning ())
 
  940           endPreambleDetectionEvent.Cancel ();
 
  965           endMpduEvent.Cancel ();
 
 1037   Transmit (ppdu->GetTxDuration (), ppdu, 
"transmission");
 
 1045   NS_LOG_DEBUG (
"Start " << type << 
": signal power before antenna gain=" << 
WToDbm (txPowerWatts) << 
"dBm");
 
 1048   txParams->duration = txDuration;
 
 1049   txParams->psd = txPowerSpectrum;
 
 1050   txParams->ppdu = ppdu;
 
 1053   auto spectrumWifiPhy = DynamicCast<SpectrumWifiPhy> (
m_wifiPhy);
 
 1055   spectrumWifiPhy->Transmit (txParams);
 
 1064 std::tuple<double, double, double>
 
 1074   const auto & it = psduMap.begin ();
 
  
 
void NotifyRxStart()
Notify that RX has started.
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
 
double noise
noise power in dBm
 
double Integral(const SpectrumValue &arg)
 
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
 
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
 
static Time GetPreambleDetectionDuration(void)
 
virtual uint16_t GetRxChannelWidth(const WifiTxVector &txVector) const
Return the channel width used in the reception spectrum model.
 
PhyHeaderSections GetPhyHeaderSections(const WifiTxVector &txVector, Time ppduStart) const
Return a map of PHY header chunk information per PPDU field.
 
void StartPreambleDetectionPeriod(Ptr< Event > event)
Start the preamble detection period.
 
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
 
Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector) const
 
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 ...
 
virtual void DoEndReceivePayload(Ptr< const WifiPpdu > ppdu)
Perform amendment-specific actions at the end of the reception of the payload.
 
virtual PhyFieldRxStatus DoEndReceivePreamble(Ptr< Event > event)
End receiving the preamble, perform amendment-specific actions, and provide the status of the recepti...
 
std::list< WifiMode > m_modeList
the list of supported modes
 
void EndReceiveField(WifiPpduField field, Ptr< Event > event)
End receiving a given field.
 
virtual void DoResetReceive(Ptr< Event > event)
Perform amendment-specific actions before resetting PHY at the end of the PPDU under reception after ...
 
std::map< UidStaIdPair, SignalNoiseDbm > m_signalNoiseMap
Map of the latest signal power and noise power in dBm (noise power includes the noise figure)
 
uint16_t GetCenterFrequencyForChannelWidth(const WifiTxVector &txVector) const
Get the center frequency of the channel corresponding the current TxVector rather than that of the su...
 
static Time Now(void)
Return the current simulation virtual time.
 
void EndPreambleDetectionPeriod(Ptr< Event > event)
End the preamble detection period.
 
Every class exported by the ns3 library is enclosed in the ns3 namespace.
 
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...
 
bool IsStateRx(void) const
 
@ RX
The PHY layer is receiving a packet.
 
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.
 
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const
 
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
 
void SetOwner(Ptr< WifiPhy > wifiPhy)
Set the WifiPhy owning this PHY entity.
 
double snr
SNR in linear scale.
 
void EndReceivePayload(Ptr< Event > event)
The last symbol of the PPDU has arrived.
 
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.
 
std::list< WifiMode >::const_iterator begin(void) const
Return a const iterator to the first WifiMode.
 
virtual Time CalculateTxDuration(WifiConstPsduMap psduMap, const WifiTxVector &txVector, WifiPhyBand band) const
 
std::vector< Ptr< WifiMacQueueItem > >::const_iterator end(void) const
Return a const iterator to past-the-last MPDU.
 
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
 
@ IDLE
The PHY layer is IDLE.
 
void ScheduleEndOfMpdus(Ptr< Event > event)
Schedule end of MPDUs events.
 
virtual std::tuple< double, double, double > GetTxMaskRejectionParams(void) const =0
 
virtual bool IsModeSupported(WifiMode mode) const
Check if the WifiMode is supported.
 
PhyRxFailureAction actionIfFailure
action to perform in case of failure
 
double GetTxGain(void) const
Return the transmission gain (dB).
 
void ResetReceive(Ptr< Event > event)
Reset PHY at the end of the packet under reception after it has failed the PHY header.
 
uint8_t GetChannelNumber(void) const
Return current channel number.
 
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.
 
uint16_t GetFrequency(void) const
 
@ OFF
The PHY layer is switched off.
 
double WToDbm(double w)
Convert from Watts to dBm.
 
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.
 
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.
 
double GetRxPowerWForPpdu(Ptr< Event > event) const
Obtain the received power (W) for a given band.
 
Ptr< const SpectrumModel > GetSpectrumModel() const
 
@ ABORT
abort reception of PPDU
 
virtual Ptr< Event > DoGetEvent(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW)
Get the event corresponding to the incoming PPDU.
 
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
 
void CancelRunningEndPreambleDetectionEvents(bool clear=false)
Cancel and eventually clear all end preamble detection events.
 
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
 
@ WIFI_PPDU_FIELD_PREAMBLE
SYNC + SFD fields for DSSS or ERP, shortSYNC + shortSFD fields for HR/DSSS or ERP,...
 
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
 
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
 
virtual void StartTx(Ptr< WifiPpdu > ppdu)
This function is called by SpectrumWifiPhy to send the PPDU while performing amendment-specific actio...
 
void AddPreambleEvent(Ptr< Event > event)
Add an entry to the map of current preamble events (stored in WifiPhy).
 
void Transmit(Time txDuration, Ptr< WifiPpdu > ppdu, std::string type)
This function prepares most of the WifiSpectrumSignalParameters parameters and invokes SpectrumWifiPh...
 
@ CCA_BUSY
The PHY layer has sense the medium busy through the CCA mechanism.
 
std::size_t GetAmpduSubframeSize(std::size_t i) const
Return the size of the i-th A-MPDU subframe.
 
@ FIRST_MPDU_IN_AGGREGATE
The MPDU is the first aggregate in an A-MPDU with multiple MPDUs, but is not the last aggregate.
 
@ PREAMBLE_DETECT_FAILURE
 
static Time GetPayloadDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, MpduType mpdutype=NORMAL_MPDU, uint16_t staId=SU_STA_ID)
 
SignalNoiseDbm structure.
 
std::map< WifiPpduField, PhyHeaderChunkInfo > PhyHeaderSections
A map of PhyHeaderChunkInfo elements per PPDU field.
 
virtual Ptr< SpectrumValue > GetTxPowerSpectralDensity(double txPowerW, Ptr< const WifiPpdu > ppdu) const =0
 
@ FRAME_CAPTURE_PACKET_SWITCH
 
virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const =0
 
InterferenceHelper m_interference
the class handling interference computations
 
std::list< WifiMode >::const_iterator end(void) const
Return a const iterator to past-the-last WifiMode.
 
@ PREAMBLE_DETECTION_PACKET_SWITCH
 
virtual uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
 
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
 
@ NORMAL_MPDU
The MPDU is not part of an A-MPDU.
 
virtual bool IsMcsSupported(uint8_t index) const
Check if the WifiMode corresponding to the given MCS index is supported.
 
@ MIDDLE_MPDU_IN_AGGREGATE
The MPDU is part of an A-MPDU with multiple MPDUs, but is neither the first nor the last aggregate.
 
@ IGNORE
ignore the reception
 
const std::map< std::pair< uint64_t, WifiPreamble >, Ptr< Event > > & GetCurrentPreambleEvents(void) const
Get the map of current preamble events (stored in WifiPhy).
 
void StartReceivePayload(Ptr< Event > event)
Start receiving the PSDU (i.e.
 
WifiPhyRxfailureReason
Enumeration of the possible reception failure reasons.
 
Ptr< const Event > GetCurrentEvent(void) const
Get the pointer to the current event (stored in WifiPhy).
 
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
 
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
 
represent a single transmission mode
 
WifiPhyRxfailureReason reason
failure reason
 
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
 
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
 
Status of the reception of the PPDU field.
 
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
 
bool IsZero(void) const
Exactly equivalent to t == 0.
 
void StartReceiveField(WifiPpduField field, Ptr< Event > event)
Start receiving a given field.
 
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.
 
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
 
Time GetLastRxEndTime(void) const
Return the end time of the last received packet.
 
void DropPreambleEvent(Ptr< const WifiPpdu > ppdu, WifiPhyRxfailureReason reason, Time endRx, uint16_t measurementChannelWidth)
Drop the PPDU and the corresponding preamble detection event, but keep CCA busy state after the compl...
 
virtual void DoAbortCurrentReception(WifiPhyRxfailureReason reason)
Perform amendment-specific actions before aborting the current reception.
 
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).
 
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
 
std::vector< EventId > m_endOfMpduEvents
the end of MPDU events (only used for A-MPDUs)
 
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
 
WifiPpduField GetNextField(WifiPpduField currentField, WifiPreamble preamble) const
Return the field following the provided one.
 
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
 
virtual bool DoStartReceiveField(WifiPpduField field, Ptr< Event > event)
Start receiving a given field, perform amendment-specific actions, and signify if it is supported.
 
Ptr< T > Copy(Ptr< T > object)
Return a deep copy of a Ptr.
 
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
 
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
 
WifiPreamble GetPreambleType(void) const
 
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
 
void Reset(void)
Reset data upon end of TX or RX.
 
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
 
Simulation virtual time values and global simulation resolution.
 
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
 
Time GetDurationUpToField(WifiPpduField field, const WifiTxVector &txVector) const
Get the duration of the PPDU up to (but excluding) the given field.
 
virtual PhyFieldRxStatus DoEndReceiveField(WifiPpduField field, Ptr< Event > event)
End receiving a given field, perform amendment-specific actions, and provide the status of the recept...
 
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
 
uint16_t GetChannelWidth(void) const
 
WifiPpduField
The type of PPDU field (grouped for convenience)
 
bool isSuccess
outcome (true if success) of the reception
 
@ SLEEP
The PHY layer is sleeping.
 
double RatioToDb(double ratio)
Convert from ratio to dB.
 
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
 
bool NoEndPreambleDetectionEvents(void) const
 
void UpdateEvent(Ptr< Event > event, const RxPowerWattPerChannelBand &rxPower)
Update event to scale its received power (W) per band.
 
double GetRandomValue(void) const
Obtain a random value from the WifiPhy's generator.
 
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
 
virtual Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration)
Build amendment-specific PPDU.
 
SnrPer GetPhyHeaderSnrPer(WifiPpduField field, Ptr< Event > event) const
Obtain the SNR and PER of the PPDU field from the WifiPhy's InterferenceHelper class.
 
uint16_t GetGuardInterval(void) const
 
Ptr< Event > m_currentEvent
Hold the current event.
 
void SwitchMaybeToCcaBusy(uint16_t channelWidth)
Check if PHY state should move to CCA busy state based on current state of interference tracker.
 
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper of the WifiPhy (to make it reachable for child classes)
 
uint8_t GetNss(uint16_t staId=SU_STA_ID) const
If this TX vector is associated with an SU PPDU, return the number of spatial streams.
 
virtual bool HandlesMcsModes(void) const
Check if the WifiModes handled by this PHY are MCSs.
 
double snr
SNR in linear scale.
 
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
 
double CalculateSnr(Ptr< Event > event, uint16_t channelWidth, uint8_t nss, WifiSpectrumBand band) const
Calculate the SNIR for the event (starting from now until the event end).
 
double DbmToW(double dBm)
Convert from dBm to Watts.
 
@ SWITCHING
The PHY layer is switching to other channel.
 
virtual void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
 
Ptr< const Packet > GetPacket(void) const
Get the PSDU as a single packet.
 
uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
 
WifiSpectrumBand GetPrimaryBand(uint16_t bandWidth)
If the operating channel width is a multiple of 20 MHz, return the start band index and the stop band...
 
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Abort the current reception.
 
RxSignalInfo structure containing info on the received signal.
 
virtual uint8_t GetNumModes(void) const
 
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...
 
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
 
void NotifyInterferenceRxEndAndClear(bool reset)
Notify WifiPhy's InterferenceHelper of the end of the reception, clear maps and end of MPDU event,...
 
Time GetRemainingDurationAfterField(Ptr< const WifiPpdu > ppdu, WifiPpduField field) const
Get the remaining duration of the PPDU after the end of the given field.
 
virtual WifiMode GetMcs(uint8_t index) const
Get the WifiMode corresponding to the given MCS index.
 
struct PhyEntity::SnrPer CalculatePhyHeaderSnrPer(Ptr< Event > event, uint16_t channelWidth, WifiSpectrumBand band, WifiPpduField header) const
Calculate the SNIR at the start of the PHY header and accumulate all SNIR changes in the SNIR vector.
 
virtual void CancelAllEvents(void)
Cancel and clear all running events.
 
Ptr< Event > Add(Ptr< const WifiPpdu > ppdu, const WifiTxVector &txVector, Time duration, RxPowerWattPerChannelBand &rxPower, bool isStartOfdmaRxing=false)
Add the PPDU-related signal to interference helper.
 
uint16_t GetChannelWidth(void) const
 
virtual Ptr< const WifiPsdu > GetAddressedPsduInPpdu(Ptr< const WifiPpdu > ppdu) const
Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
 
SpectrumModelUid_t GetUid() const
 
void ResetReceive(Ptr< Event > event)
Reset PHY at the end of the PPDU under reception after it has failed the PHY header.
 
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...
 
std::vector< EventId > m_endPreambleDetectionEvents
the end of preamble detection events
 
@ WIFI_PPDU_FIELD_DATA
data field
 
virtual void DoStartReceivePayload(Ptr< Event > event)
Start receiving the PSDU (i.e.
 
A struct for both SNR and PER.
 
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
 
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
 
@ LAST_MPDU_IN_AGGREGATE
The MPDU is the last aggregate in an A-MPDU with multiple MPDUs.
 
WifiPhyBand
Identifies the PHY band.
 
double signal
signal strength in dBm
 
EventId m_endPhyRxEvent
the end of PHY receive event
 
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
 
std::vector< Ptr< WifiMacQueueItem > >::const_iterator begin(void) const
Return a const iterator to the first MPDU.
 
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
 
virtual WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const
Get the WifiMode for the SIG field specified by the PPDU field.
 
std::vector< EventId > m_endRxPayloadEvents
the end of receive events (only one unless UL MU reception)
 
virtual bool IsConfigSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the signaled configuration (excluding bandwidth) is supported by the PHY.
 
std::ostream & operator<<(std::ostream &os, const Angles &a)
 
std::tuple< double, double, double > GetTxMaskRejectionParams(void) const
 
@ TX
The PHY layer is sending a packet.
 
PhyRxFailureAction
Action to perform in case of RX failure.
 
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
 
virtual const PpduFormats & GetPpduFormats(void) const =0
Return the PPDU formats of the PHY.
 
bool IsSingle(void) const
Return true if the PSDU is an S-MPDU.
 
static uint64_t m_globalPpduUid
Global counter of the PPDU UID.
 
@ WIFI_PPDU_FIELD_SIG_B
SIG-B field.
 
void UpdateInterferenceEvent(Ptr< Event > event, const RxPowerWattPerChannelBand &rxPower)
Update an event in WifiPhy's InterferenceHelper class.
 
struct PhyEntity::SnrPer CalculatePayloadSnrPer(Ptr< Event > event, uint16_t channelWidth, WifiSpectrumBand 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...
 
uint16_t GetPrimaryChannelCenterFrequency(uint16_t primaryChannelWidth) const
Get the center frequency of the primary channel of the given width.
 
@ SINGLE_MPDU
The MPDU is a single MPDU.
 
@ DROP
drop PPDU and set CCA_BUSY
 
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
 
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
 
virtual ~PhyEntity()
Destructor for PHY entity.
 
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
 
MpduType
The type of an MPDU.
 
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
 
void NotifyRxEnd(Time endTime)
Notify that RX has ended.