28std::vector<ns3::MHz_u>
36 std::vector<ns3::MHz_u> freqs{};
37 const auto width = std::min(channelWidth, channel.GetWidth(0));
38 const auto primarySegmentIndex = channel.GetPrimarySegmentIndex(width);
39 const auto secondarySegmentIndex = channel.GetSecondarySegmentIndex(width);
40 const auto primaryIndex = channel.GetPrimaryChannelIndex(channelWidth);
41 const auto segmentIndices =
42 ((channel.GetNSegments() < 2) || (channelWidth <= channel.GetWidth(primarySegmentIndex)))
43 ? std::vector<uint8_t>{primarySegmentIndex}
44 : std::vector<uint8_t>{primarySegmentIndex, secondarySegmentIndex};
45 for (
auto segmentIndex : segmentIndices)
47 const auto segmentFrequency = channel.GetFrequency(segmentIndex);
48 const auto segmentWidth = channel.GetWidth(segmentIndex);
50 const uint8_t segmentOffset = (primarySegmentIndex * (segmentWidth / channelWidth));
52 segmentFrequency - (segmentWidth / 2.) + (primaryIndex - segmentOffset + 0.5) * width;
53 freqs.push_back(freq);
68 : m_preamble(txVector.GetPreambleType()),
70 m_txCenterFreqs(GetChannelCenterFrequenciesPerSegment(channel, txVector.GetChannelWidth())),
73 m_operatingChannel(channel),
75 m_txPowerLevel(txVector.GetTxPowerLevel()),
76 m_txAntennas(txVector.GetNTx()),
77 m_txChannelWidth(txVector.GetChannelWidth())
87 : m_preamble(txVector.GetPreambleType()),
88 m_modulation(txVector.IsValid() ? txVector.GetMode(psdus.begin()->
first).GetModulationClass()
90 m_txCenterFreqs(GetChannelCenterFrequenciesPerSegment(channel, txVector.GetChannelWidth())),
93 m_operatingChannel(channel),
95 m_txPowerLevel(txVector.GetTxPowerLevel()),
96 m_txAntennas(txVector.GetNTx()),
97 m_txChannelWidth(txVector.GetChannelWidth())
107 psdu.second =
nullptr;
128 NS_FATAL_ERROR(
"This method should not be called for the base WifiPpdu class. Use the "
129 "overloaded version in the amendment-specific PPDU subclasses instead!");
151 return m_psdus.begin()->second;
193 const auto minTxFreq = txCenterFreq - txChannelWidth / 2;
194 const auto maxTxFreq = txCenterFreq + txChannelWidth / 2;
224 if ((minTxFreq < maxFreq) && (maxTxFreq > minFreq))
259 NS_FATAL_ERROR(
"This method should not be called for the base WifiPpdu class. Use the "
260 "overloaded version in the amendment-specific PPDU subclasses instead!");
275 std::ostringstream ss;
276 ss <<
"PSDU=" <<
GetPsdu() <<
" ";
283 NS_FATAL_ERROR(
"This method should not be called for the base WifiPpdu class. Use the "
284 "overloaded version in the amendment-specific PPDU subclasses instead!");
298 for (
const auto& psdu : psdus)
300 os <<
"PSDU for STA_ID=" << psdu.first <<
" (" << *psdu.second <<
") ";
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Class that keeps track of all information about the current PHY operating channel.
void Print(std::ostream &os) const
Print the PPDU contents.
virtual Time GetTxDuration() const
Get the total transmission duration of the PPDU.
bool IsTruncatedTx() const
WifiPreamble GetPreamble() const
Get the preamble of the PPDU.
virtual MHz_u GetTxChannelWidth() const
Get the channel width over which the PPDU will effectively be transmitted.
void ResetTxVector() const
Reset the TXVECTOR.
virtual uint16_t GetStaId() const
Get the ID of the STA that transmitted the PPDU for UL MU, SU_STA_ID otherwise.
WifiPpdu(Ptr< const WifiPsdu > psdu, const WifiTxVector &txVector, const WifiPhyOperatingChannel &channel, uint64_t uid=UINT64_MAX)
Create a PPDU storing a PSDU.
void UpdateTxVector(const WifiTxVector &updatedTxVector) const
Update the TXVECTOR based on some information known at the receiver.
virtual WifiPpduType GetType() const
Return the PPDU type (.
std::optional< WifiTxVector > m_txVector
the TXVECTOR at TX PHY or the reconstructed TXVECTOR at RX PHY (or std::nullopt if TXVECTOR has not b...
WifiModulationClass m_modulation
the modulation used for the transmission of this PPDU
WifiPreamble m_preamble
the PHY preamble
MHz_u m_txChannelWidth
The channel width used for the transmission of this PPDU.
virtual ~WifiPpdu()
Destructor for WifiPpdu.
Ptr< const WifiPsdu > GetPsdu() const
Get the payload of the PPDU.
virtual WifiTxVector DoGetTxVector() const
Get the TXVECTOR used to send the PPDU.
uint64_t m_uid
the unique ID of this PPDU
std::vector< MHz_u > m_txCenterFreqs
the center frequency per segment used for the transmission of this PPDU
void SetTruncatedTx()
Indicate that the PPDU's transmission was aborted due to transmitter switch off.
bool DoesOverlapChannel(MHz_u minFreq, MHz_u maxFreq) const
Check whether the given PPDU overlaps a given channel.
const WifiTxVector & GetTxVector() const
Get the TXVECTOR used to send the PPDU.
uint64_t GetUid() const
Get the UID of the PPDU.
WifiModulationClass GetModulation() const
Get the modulation used for the PPDU.
WifiConstPsduMap m_psdus
the PSDUs contained in this PPDU
virtual std::string PrintPayload() const
Print the payload of the PPDU.
uint8_t m_txAntennas
the number of antennas used to transmit this PPDU
uint8_t m_txPowerLevel
the transmission power level (used only for TX and initializing the returned WifiTxVector)
virtual Ptr< WifiPpdu > Copy() const
Copy this instance.
bool m_truncatedTx
flag indicating whether the frame's transmission was aborted due to transmitter switch off
std::vector< MHz_u > GetTxCenterFreqs() const
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
WifiPreamble
The type of preamble to be used by an IEEE 802.11 transmission.
WifiPpduType
The type of PPDU (SU, DL MU, or UL MU)
WifiModulationClass
This enumeration defines the modulation classes per (Table 10-6 "Modulation classes"; IEEE 802....
@ WIFI_MOD_CLASS_UNKNOWN
Modulation class unknown or unspecified.
std::vector< ns3::MHz_u > GetChannelCenterFrequenciesPerSegment(const ns3::WifiPhyOperatingChannel &channel, ns3::MHz_u channelWidth)
Get the center frequency of each segment covered by the provided channel width.
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::ostream & operator<<(std::ostream &os, const Angles &a)
double MHz_u
MHz weak type.
static constexpr uint16_t SU_STA_ID
STA_ID to identify a single user (SU)
Declaration of ns3::WifiPpdu class and ns3::WifiConstPsduMap.