31 #include "ns3/packet.h"
32 #include "ns3/simulator.h"
34 #include "ns3/assert.h"
46 return (os <<
"DROP");
48 return (os <<
"ABORT");
50 return (os <<
"IGNORE");
53 return (os <<
"unknown");
61 return os <<
"success";
112 NS_ABORT_MSG (
"This method should be used only for HtPhy and child classes. Use GetMode instead.");
119 NS_ABORT_MSG (
"This method should be used only for HtPhy and child classes. Use IsModeSupported instead.");
129 std::list<WifiMode>::const_iterator
135 std::list<WifiMode>::const_iterator
144 NS_FATAL_ERROR (
"PPDU field is not a SIG field (no sense in retrieving the signaled mode) or is unsupported: " << field);
152 const auto itPpdu = ppduFormats.find (preamble);
153 if (itPpdu != ppduFormats.end ())
155 const auto itField = std::find (itPpdu->second.begin (), itPpdu->second.end (), currentField);
156 if (itField != itPpdu->second.end ())
158 const auto itNextField = std::next (itField, 1);
159 if (itNextField != itPpdu->second.end ())
161 return *(itNextField);
163 NS_FATAL_ERROR (
"No field after " << currentField <<
" for " << preamble <<
" for the provided PPDU formats");
167 NS_FATAL_ERROR (
"Unsupported PPDU field " << currentField <<
" for " << preamble <<
" for the provided PPDU formats");
172 NS_FATAL_ERROR (
"Unsupported preamble " << preamble <<
" for the provided PPDU formats");
207 return ppdu->GetPsdu ();
220 map[field] = std::make_pair (std::make_pair (
start,
start + duration),
233 NS_FATAL_ERROR (
"This method is unsupported for the base PhyEntity class. Use the overloaded version in the amendment-specific subclasses instead!");
234 return Create<WifiPpdu> (psdus.begin ()->second, txVector);
245 auto it = sections.find (field);
247 const auto & startStopTimes = it->second.first;
248 return startStopTimes.first;
274 NS_ABORT_MSG_IF (!supported,
"Unknown field " << field <<
" for this PHY entity");
277 m_state->SwitchMaybeToCcaBusy (duration);
339 auto itFormat = ppduFormats.find (event->GetPpdu ()->GetPreamble ());
340 if (itFormat != ppduFormats.end ())
342 auto itField = std::find (itFormat->second.begin (), itFormat->second.end (), field);
343 if (itField != itFormat->second.end ())
368 auto it = std::max_element (rxPowersW.begin (), rxPowersW.end (),
369 [] (
const std::pair<WifiSpectrumBand, double> &p1,
const std::pair<WifiSpectrumBand, double> &p2) {
370 return p1.second < p2.second;
375 if (event ==
nullptr)
393 if (ppdu->IsTruncatedTx ())
395 NS_LOG_DEBUG (
"Packet reception stopped because transmitter has been switched off");
407 NS_LOG_DEBUG (
"Drop packet because of channel switching");
460 NS_LOG_DEBUG (
"Drop packet because already decoding preamble");
486 NS_LOG_FUNCTION (
this << ppdu << reason << endRx << measurementChannelWidth);
514 if (rxDuration >
m_state->GetDelayUntilIdle ())
536 m_state->SwitchToRx (payloadDuration);
550 m_statusPerMpduMap.insert ({std::make_pair (ppdu->GetUid (), staId), std::vector<bool> ()});
567 Time remainingAmpduDuration = psduDuration;
570 uint32_t totalAmpduSize = 0;
571 double totalAmpduNumSymbols = 0.0;
572 auto mpdu = psdu->
begin ();
573 for (
size_t i = 0; i < nMpdus && mpdu != psdu->
end (); ++mpdu)
578 totalAmpduNumSymbols, staId);
580 remainingAmpduDuration -= mpduDuration;
581 if (i == (nMpdus - 1) && !remainingAmpduDuration.
IsZero ())
585 mpduDuration += remainingAmpduDuration;
589 endOfMpduDuration += mpduDuration;
591 " (relativeStart=" << relativeStart.
As (
Time::NS) <<
", mpduDuration=" << mpduDuration.
As (
Time::NS) <<
592 ", remainingAmdpuDuration=" << remainingAmpduDuration.
As (
Time::NS) <<
")");
597 relativeStart += mpduDuration;
605 NS_LOG_FUNCTION (
this << *event << mpduIndex << relativeStart << mpduDuration);
610 std::pair<bool, SignalNoiseDbm> rxInfo =
GetReceptionStatus (psdu, event, staId, relativeStart, mpduDuration);
612 ", correct reception: " << rxInfo.first <<
", Signal/Noise: " << rxInfo.second.signal <<
"/" << rxInfo.second.noise <<
"dBm");
614 auto signalNoiseIt =
m_signalNoiseMap.find (std::make_pair (ppdu->GetUid (), staId));
616 signalNoiseIt->second = rxInfo.second;
619 rxSignalInfo.
snr = rxInfo.second.signal / rxInfo.second.noise;
620 rxSignalInfo.
rssi = rxInfo.second.signal;
622 auto statusPerMpduIt =
m_statusPerMpduMap.find (std::make_pair (ppdu->GetUid (), staId));
624 statusPerMpduIt->second.push_back (rxInfo.first);
629 m_state->ContinueRxNextMpdu (
Copy (psdu), rxSignalInfo, txVector);
643 double snr =
m_wifiPhy->
m_interference->CalculateSnr (event, channelWidthAndBand.first, txVector.
GetNss (staId), channelWidthAndBand.second);
648 auto signalNoiseIt =
m_signalNoiseMap.find (std::make_pair (ppdu->GetUid (), staId));
650 auto statusPerMpduIt =
m_statusPerMpduMap.find (std::make_pair (ppdu->GetUid (), staId));
653 if (std::count (statusPerMpduIt->second.begin (), statusPerMpduIt->second.end (),
true))
658 rxSignalInfo.
snr = snr;
659 rxSignalInfo.
rssi = signalNoiseIt->second.signal;
660 m_state->SwitchFromRxEndOk (
Copy (psdu), rxSignalInfo, txVector, staId, statusPerMpduIt->second);
684 std::pair<bool, SignalNoiseDbm>
686 Time relativeMpduStart,
Time mpduDuration)
688 NS_LOG_FUNCTION (
this << *psdu << *event << staId << relativeMpduStart << mpduDuration);
691 std::make_pair (relativeMpduStart, relativeMpduStart + mpduDuration));
693 WifiMode mode =
event->GetTxVector ().GetMode (staId);
696 ", relativeStart = " << relativeMpduStart.
As (
Time::NS) <<
", duration = " << mpduDuration.
As (
Time::NS));
703 signalNoise.
signal =
WToDbm (event->GetRxPowerW (channelWidthAndBand.second));
704 signalNoise.
noise =
WToDbm (event->GetRxPowerW (channelWidthAndBand.second) / snrPer.
snr);
709 return std::make_pair (
true, signalNoise);
714 return std::make_pair (
false, signalNoise);
718 std::pair<uint16_t, WifiSpectrumBand>
725 const std::map <std::pair<uint64_t, WifiPreamble>,
Ptr<Event> > &
745 auto uidPreamblePair = std::make_pair (ppdu->GetUid (), ppdu->GetPreamble ());
807 double maxRxPowerW = -1;
812 double rxPowerW = preambleEvent.second->GetRxPowerW (measurementBand);
813 if (rxPowerW > maxRxPowerW)
815 maxRxPowerW = rxPowerW;
816 maxEvent = preambleEvent.second;
821 if (maxEvent != event)
823 NS_LOG_DEBUG (
"Receiver got a stronger packet with UID " << maxEvent->GetPpdu ()->GetUid () <<
" during preamble detection: drop packet with UID " << event->GetPpdu ()->GetUid ());
845 it.second->CancelRunningEndPreambleDetectionEvents (
true);
852 NS_LOG_DEBUG (
"Drop packet with UID " << it->first.first <<
" and preamble " << it->first.second <<
" arrived at time " << it->second->GetStartTime ());
881 m_state->SwitchMaybeToCcaBusy (durationTillEnd);
886 NS_LOG_DEBUG (
"Drop packet because PHY preamble detection failed");
904 WifiMode txMode = ppdu->GetTxVector ().GetMode ();
907 NS_LOG_DEBUG (
"Drop packet because it was sent using an unsupported mode (" << txMode <<
")");
919 endPreambleDetectionEvent.Cancel ();
924 endRxPayloadEvent.Cancel ();
929 endMpduEvent.Cancel ();
946 if (endPreambleDetectionEvent.IsRunning ())
948 endPreambleDetectionEvent.Cancel ();
973 endMpduEvent.Cancel ();
1051 Transmit (ppdu->GetTxDuration (), ppdu,
"transmission");
1059 NS_LOG_DEBUG (
"Start " << type <<
": signal power before antenna gain=" <<
WToDbm (txPowerWatts) <<
"dBm");
1062 txParams->duration = txDuration;
1063 txParams->psd = txPowerSpectrum;
1064 txParams->ppdu = ppdu;
1068 auto spectrumWifiPhy = DynamicCast<SpectrumWifiPhy> (
m_wifiPhy);
1070 spectrumWifiPhy->Transmit (txParams);
1079 std::tuple<double, double, double>
1089 const auto & it = psduMap.begin ();
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
void NotifyPayloadBegin(const WifiTxVector &txVector, const Time &payloadDuration)
Fire the trace indicating that the PHY is starting to receive the payload of a PPDU.
const std::map< std::pair< uint64_t, WifiPreamble >, Ptr< Event > > & GetCurrentPreambleEvents(void) const
Get the map of current preamble events (stored in WifiPhy).
virtual PhyFieldRxStatus DoEndReceivePreamble(Ptr< Event > event)
End receiving the preamble, perform amendment-specific actions, and provide the status of the recepti...
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper of the WifiPhy (to make it reachable for child classes)
void EndPreambleDetectionPeriod(Ptr< Event > event)
End the preamble detection period.
virtual Ptr< WifiPpdu > BuildPpdu(const WifiConstPsduMap &psdus, const WifiTxVector &txVector, Time ppduDuration)
Build amendment-specific PPDU.
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...
virtual uint64_t ObtainNextUid(const WifiTxVector &txVector)
Obtain the next UID for the PPDU to transmit.
virtual void CancelAllEvents(void)
Cancel and clear all running events.
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.
virtual Ptr< SpectrumValue > GetTxPowerSpectralDensity(double txPowerW, Ptr< const WifiPpdu > ppdu) const =0
virtual void StartReceivePreamble(Ptr< WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW, Time rxDuration)
Start receiving the PHY preamble of a PPDU (i.e.
std::map< UidStaIdPair, SignalNoiseDbm > m_signalNoiseMap
Map of the latest signal power and noise power in dBm (noise power includes the noise figure)
Ptr< WifiPhy > m_wifiPhy
Pointer to the owning WifiPhy.
std::vector< EventId > m_endOfMpduEvents
the end of MPDU events (only used for A-MPDUs)
bool NoEndPreambleDetectionEvents(void) const
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).
std::list< WifiMode >::const_iterator end(void) const
Return a const iterator to past-the-last WifiMode.
virtual ~PhyEntity()
Destructor for PHY entity.
double GetRandomValue(void) const
Obtain a random value from the WifiPhy's generator.
virtual bool DoStartReceiveField(WifiPpduField field, Ptr< Event > event)
Start receiving a given field, perform amendment-specific actions, and signify if it is supported.
void SetOwner(Ptr< WifiPhy > wifiPhy)
Set the WifiPhy owning this PHY entity.
virtual bool HandlesMcsModes(void) const
Check if the WifiModes handled by this PHY are MCSs.
std::list< WifiMode >::const_iterator begin(void) const
Return a const iterator to the first WifiMode.
std::tuple< double, double, double > GetTxMaskRejectionParams(void) const
virtual void DoAbortCurrentReception(WifiPhyRxfailureReason reason)
Perform amendment-specific actions before aborting the current reception.
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Abort the current reception.
void EndReceivePayload(Ptr< Event > event)
The last symbol of the PPDU has arrived.
static uint64_t m_globalPpduUid
Global counter of the PPDU UID.
PhyHeaderSections GetPhyHeaderSections(const WifiTxVector &txVector, Time ppduStart) const
Return a map of PHY header chunk information per PPDU field.
virtual bool IsMcsSupported(uint8_t index) const
Check if the WifiMode corresponding to the given MCS index is supported.
void StartReceivePayload(Ptr< Event > event)
Start receiving the PSDU (i.e.
std::vector< EventId > m_endRxPayloadEvents
the end of receive events (only one unless UL MU reception)
virtual void DoResetReceive(Ptr< Event > event)
Perform amendment-specific actions before resetting PHY at the end of the PPDU under reception after ...
void EndReceiveField(WifiPpduField field, Ptr< Event > event)
End receiving a given field.
virtual Ptr< Event > DoGetEvent(Ptr< const WifiPpdu > ppdu, RxPowerWattPerChannelBand &rxPowersW)
Get the event corresponding to the incoming PPDU.
virtual WifiMode GetSigMode(WifiPpduField field, const WifiTxVector &txVector) const
Get the WifiMode for the SIG field specified by the PPDU field.
WifiPpduField GetNextField(WifiPpduField currentField, WifiPreamble preamble) const
Return the field following the provided one.
std::map< WifiPpduField, PhyHeaderChunkInfo > PhyHeaderSections
A map of PhyHeaderChunkInfo elements per PPDU field.
double GetRxPowerWForPpdu(Ptr< Event > event) const
Obtain the received power (W) for a given band.
virtual void DoStartReceivePayload(Ptr< Event > event)
Start receiving the PSDU (i.e.
Time CalculatePhyPreambleAndHeaderDuration(const WifiTxVector &txVector) const
void NotifyInterferenceRxEndAndClear(bool reset)
Notify WifiPhy's InterferenceHelper of the end of the reception, clear maps and end of MPDU event,...
void StartPreambleDetectionPeriod(Ptr< Event > event)
Start the preamble detection period.
Time GetDurationUpToField(WifiPpduField field, const WifiTxVector &txVector) const
Get the duration of the PPDU up to (but excluding) the given field.
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...
virtual uint16_t GetRxChannelWidth(const WifiTxVector &txVector) const
Return the channel width used in the reception spectrum model.
void CancelRunningEndPreambleDetectionEvents(bool clear=false)
Cancel and eventually clear all end preamble detection events.
Time GetRemainingDurationAfterField(Ptr< const WifiPpdu > ppdu, WifiPpduField field) const
Get the remaining duration of the PPDU after the end of the given field.
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 void StartTx(Ptr< WifiPpdu > ppdu)
This function is called by SpectrumWifiPhy to send the PPDU while performing amendment-specific actio...
virtual Time CalculateTxDuration(WifiConstPsduMap psduMap, const WifiTxVector &txVector, WifiPhyBand band) const
void StartReceiveField(WifiPpduField field, Ptr< Event > event)
Start receiving a given field.
void Transmit(Time txDuration, Ptr< WifiPpdu > ppdu, std::string type)
This function prepares most of the WifiSpectrumSignalParameters parameters and invokes SpectrumWifiPh...
uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const
virtual bool IsModeSupported(WifiMode mode) const
Check if the WifiMode is supported.
void ResetReceive(Ptr< Event > event)
Reset PHY at the end of the PPDU under reception after it has failed the PHY header.
std::list< WifiMode > m_modeList
the list of supported modes
std::vector< EventId > m_endPreambleDetectionEvents
the end of preamble detection events
virtual Ptr< const WifiPsdu > GetAddressedPsduInPpdu(Ptr< const WifiPpdu > ppdu) const
Get the PSDU addressed to that PHY in a PPDU (useful for MU PPDU).
SnrPer GetPhyHeaderSnrPer(WifiPpduField field, Ptr< Event > event) const
Obtain the SNR and PER of the PPDU field from the WifiPhy's InterferenceHelper class.
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 ...
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...
Ptr< const Event > GetCurrentEvent(void) const
Get the pointer to the current event (stored in WifiPhy).
virtual WifiMode GetMcs(uint8_t index) const
Get the WifiMode corresponding to the given MCS index.
void AddPreambleEvent(Ptr< Event > event)
Add an entry to the map of current preamble events (stored in WifiPhy).
virtual void DoEndReceivePayload(Ptr< const WifiPpdu > ppdu)
Perform amendment-specific actions at the end of the reception of the payload.
uint16_t GetCenterFrequencyForChannelWidth(const WifiTxVector &txVector) const
Get the center frequency of the channel corresponding the current TxVector rather than that of the su...
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.
virtual bool IsConfigSupported(Ptr< const WifiPpdu > ppdu) const
Checks if the signaled configuration (excluding bandwidth) is supported by the PHY.
virtual uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
PhyRxFailureAction
Action to perform in case of RX failure.
@ DROP
drop PPDU and set CCA_BUSY
@ IGNORE
ignore the reception
@ ABORT
abort reception of PPDU
void UpdateInterferenceEvent(Ptr< Event > event, const RxPowerWattPerChannelBand &rxPower)
Update an event in WifiPhy's InterferenceHelper class.
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.
virtual const PpduFormats & GetPpduFormats(void) const =0
Return the PPDU formats of the PHY.
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.
virtual PhyFieldRxStatus DoEndReceiveField(WifiPpduField field, Ptr< Event > event)
End receiving a given field, perform amendment-specific actions, and provide the status of the recept...
virtual uint8_t GetNumModes(void) const
void ScheduleEndOfMpdus(Ptr< Event > event)
Schedule end of MPDUs events.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
static Time Now(void)
Return the current simulation virtual time.
SpectrumModelUid_t GetUid() const
Ptr< const SpectrumModel > GetSpectrumModel() const
Simulation virtual time values and global simulation resolution.
bool IsZero(void) const
Exactly equivalent to t == 0.
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
represent a single transmission mode
uint64_t GetDataRate(uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const
Ptr< WifiPhyStateHelper > m_state
Pointer to WifiPhyStateHelper.
Ptr< UniformRandomVariable > m_random
Provides uniform random variables.
uint8_t GetChannelNumber(void) const
Return current channel number.
static Time GetPayloadDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, MpduType mpdutype=NORMAL_MPDU, uint16_t staId=SU_STA_ID)
const WifiPhyOperatingChannel & GetOperatingChannel(void) const
Get a const reference to the operating channel.
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...
bool IsStateRx(void) const
WifiPhyBand GetPhyBand(void) const
Get the configured Wi-Fi band.
EventId m_endPhyRxEvent
the end of PHY receive event
void NotifyRxDrop(Ptr< const WifiPsdu > psdu, WifiPhyRxfailureReason reason)
Public method used to fire a PhyRxDrop trace.
void AbortCurrentReception(WifiPhyRxfailureReason reason)
Due to newly arrived signal, the current reception cannot be continued and has to be aborted.
Ptr< FrameCaptureModel > m_frameCaptureModel
Frame capture model.
void NotifyRxBegin(Ptr< const WifiPsdu > psdu, const RxPowerWattPerChannelBand &rxPowersW)
Public method used to fire a PhyRxBegin trace.
uint16_t GetMeasurementChannelWidth(const Ptr< const WifiPpdu > ppdu) const
Return the channel width used to measure the RSSI.
void ResetReceive(Ptr< Event > event)
Reset PHY at the end of the packet under reception after it has failed the PHY header.
virtual uint16_t GetGuardBandwidth(uint16_t currentChannelWidth) const =0
static Time CalculateTxDuration(uint32_t size, const WifiTxVector &txVector, WifiPhyBand band, uint16_t staId=SU_STA_ID)
void Reset(void)
Reset data upon end of TX or RX.
std::map< WifiModulationClass, Ptr< PhyEntity > > m_phyEntities
This map holds the supported PHY entities.
Ptr< ErrorModel > m_postReceptionErrorModel
Error model for receive packet events.
Ptr< Event > m_currentEvent
Hold the current event.
virtual std::tuple< double, double, double > GetTxMaskRejectionParams(void) const =0
uint64_t m_previouslyRxPpduUid
UID of the previously received PPDU, reset to UINT64_MAX upon transmission.
Ptr< PreambleDetectionModel > m_preambleDetectionModel
Preamble detection model.
void SwitchMaybeToCcaBusy(uint16_t channelWidth)
Check if PHY state should move to CCA busy state based on current state of interference tracker.
void NotifyRxEnd(Ptr< const WifiPsdu > psdu)
Public method used to fire a PhyRxEnd trace.
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...
double GetTxGain(void) const
Return the transmission gain (dB).
Ptr< InterferenceHelper > m_interference
Pointer to a helper responsible for interference computations.
double GetTxPowerForTransmission(Ptr< const WifiPpdu > ppdu) const
Compute the transmit power for the next transmission.
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.
TracedCallback< WifiTxVector, Time > m_phyRxPayloadBeginTrace
The trace source fired when the reception of the PHY payload (PSDU) begins.
static Time GetPreambleDetectionDuration(void)
Time m_timeLastPreambleDetected
Record the time the last preamble was detected.
Time GetLastRxEndTime(void) const
Return the end time of the last received packet.
uint16_t GetChannelWidth(void) const
uint16_t GetFrequency(void) const
uint16_t GetPrimaryChannelCenterFrequency(uint16_t primaryChannelWidth) const
Get the center frequency of the primary channel of the given width.
uint32_t GetSize(void) const
Return the size of the PSDU in bytes.
std::vector< Ptr< WifiMacQueueItem > >::const_iterator begin(void) const
Return a const iterator to the first MPDU.
std::size_t GetNMpdus(void) const
Return the number of MPDUs constituting the PSDU.
std::vector< Ptr< WifiMacQueueItem > >::const_iterator end(void) const
Return a const iterator to past-the-last MPDU.
std::size_t GetAmpduSubframeSize(std::size_t i) const
Return the size of the i-th A-MPDU subframe.
bool IsSingle(void) const
Return true if the PSDU is an S-MPDU.
Ptr< const Packet > GetPacket(void) const
Get the PSDU as a single packet.
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
WifiPreamble GetPreambleType(void) const
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.
uint16_t GetChannelWidth(void) const
uint16_t GetGuardInterval(void) const
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#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.
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Time NanoSeconds(uint64_t value)
Construct a Time in the indicated unit.
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.
WifiPpduField
The type of PPDU field (grouped for convenience)
MpduType
The type of an MPDU.
@ PREAMBLE_DETECT_FAILURE
@ FRAME_CAPTURE_PACKET_SWITCH
@ PREAMBLE_DETECTION_PACKET_SWITCH
@ WIFI_PPDU_FIELD_SIG_B
SIG-B 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.
std::unordered_map< uint16_t, Ptr< const WifiPsdu > > WifiConstPsduMap
Map of const PSDUs indexed by STA-ID.
double WToDbm(double w)
Convert from Watts to dBm.
double Integral(const SpectrumValue &arg)
double DbmToW(double dBm)
Convert from dBm to Watts.
std::map< WifiSpectrumBand, double > RxPowerWattPerChannelBand
A map of the received power (Watts) for each band.
std::ostream & operator<<(std::ostream &os, const Angles &a)
Ptr< T > Copy(Ptr< T > object)
Return a deep copy of a Ptr.
Status of the reception of the PPDU field.
WifiPhyRxfailureReason reason
failure reason
PhyRxFailureAction actionIfFailure
action to perform in case of failure
bool isSuccess
outcome (true if success) of the reception
A struct for both SNR and PER.
double snr
SNR in linear scale.
RxSignalInfo structure containing info on the received signal.
double snr
SNR in linear scale.
SignalNoiseDbm structure.
double noise
noise power in dBm
double signal
signal strength in dBm
@ CCA_BUSY
The PHY layer has sense the medium busy through the CCA mechanism.
@ SWITCHING
The PHY layer is switching to other channel.
@ RX
The PHY layer is receiving a packet.
@ TX
The PHY layer is sending a packet.
@ OFF
The PHY layer is switched off.
@ SLEEP
The PHY layer is sleeping.
@ IDLE
The PHY layer is IDLE.