wifi: Pass WifiTxVector by const reference where possible

Continuing Stefano's effort in FEM hierarchy
This commit is contained in:
Rediet
2021-02-15 11:46:27 +01:00
parent 0a0d305330
commit c13d30f290
42 changed files with 213 additions and 214 deletions

View File

@@ -36,7 +36,7 @@ TypeId ErrorRateModel::GetTypeId (void)
}
double
ErrorRateModel::CalculateSnr (WifiTxVector txVector, double ber) const
ErrorRateModel::CalculateSnr (const WifiTxVector& txVector, double ber) const
{
//This is a very simple binary search.
double low, high, precision;
@@ -60,7 +60,7 @@ ErrorRateModel::CalculateSnr (WifiTxVector txVector, double ber) const
}
double
ErrorRateModel::GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const
ErrorRateModel::GetChunkSuccessRate (WifiMode mode, const WifiTxVector& txVector, double snr, uint64_t nbits) const
{
if (mode.GetModulationClass () == WIFI_MOD_CLASS_DSSS || mode.GetModulationClass () == WIFI_MOD_CLASS_HR_DSSS)
{

View File

@@ -48,7 +48,7 @@ public:
*
* \return the SNR which corresponds to the requested BER
*/
double CalculateSnr (WifiTxVector txVector, double ber) const;
double CalculateSnr (const WifiTxVector& txVector, double ber) const;
/**
* This method returns the probability that the given 'chunk' of the
@@ -75,7 +75,7 @@ public:
*
* \return probability of successfully receiving the chunk
*/
double GetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const;
double GetChunkSuccessRate (WifiMode mode, const WifiTxVector& txVector, double snr, uint64_t nbits) const;
private:
@@ -89,7 +89,7 @@ private:
*
* \return probability of successfully receiving the chunk
*/
virtual double DoGetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const = 0;
virtual double DoGetChunkSuccessRate (WifiMode mode, const WifiTxVector& txVector, double snr, uint64_t nbits) const = 0;
};
} //namespace ns3

View File

@@ -102,7 +102,7 @@ HePhy::BuildModeList (void)
}
WifiMode
HePhy::GetSigMode (WifiPpduField field, WifiTxVector txVector) const
HePhy::GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const
{
switch (field)
{
@@ -129,7 +129,7 @@ HePhy::GetSigAMode (void) const
}
WifiMode
HePhy::GetSigBMode (WifiTxVector txVector) const
HePhy::GetSigBMode (const WifiTxVector& txVector) const
{
NS_ABORT_MSG_IF (txVector.GetPreambleType () != WIFI_PREAMBLE_HE_MU, "HE-SIG-B only available for HE MU");
/**
@@ -174,7 +174,7 @@ HePhy::GetLSigDuration (WifiPreamble /* preamble */) const
}
Time
HePhy::GetTrainingDuration (WifiTxVector txVector,
HePhy::GetTrainingDuration (const WifiTxVector& txVector,
uint8_t nDataLtf, uint8_t nExtensionLtf /* = 0 */) const
{
Time ltfDuration = MicroSeconds (8); //TODO extract from TxVector when available
@@ -191,7 +191,7 @@ HePhy::GetSigADuration (WifiPreamble preamble) const
}
Time
HePhy::GetSigBDuration (WifiTxVector txVector) const
HePhy::GetSigBDuration (const WifiTxVector& txVector) const
{
if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_MU) //See section 27.3.10.8 of IEEE 802.11ax draft 4.0.
{
@@ -261,7 +261,7 @@ HePhy::ConvertHeTbPpduDurationToLSigLength (Time ppduDuration, WifiPhyBand band)
}
Time
HePhy::ConvertLSigLengthToHeTbPpduDuration (uint16_t length, WifiTxVector txVector, WifiPhyBand band)
HePhy::ConvertLSigLengthToHeTbPpduDuration (uint16_t length, const WifiTxVector& txVector, WifiPhyBand band)
{
NS_ABORT_IF (txVector.GetPreambleType () != WIFI_PREAMBLE_HE_TB);
Time tSymbol = NanoSeconds (12800 + txVector.GetGuardInterval ());
@@ -280,7 +280,7 @@ HePhy::ConvertLSigLengthToHeTbPpduDuration (uint16_t length, WifiTxVector txVect
}
Time
HePhy::CalculateNonOfdmaDurationForHeTb (WifiTxVector txVector) const
HePhy::CalculateNonOfdmaDurationForHeTb (const WifiTxVector& txVector) const
{
NS_ABORT_IF (txVector.GetPreambleType () != WIFI_PREAMBLE_HE_TB);
Time duration = GetDuration (WIFI_PPDU_FIELD_PREAMBLE, txVector)
@@ -290,13 +290,13 @@ HePhy::CalculateNonOfdmaDurationForHeTb (WifiTxVector txVector) const
}
uint8_t
HePhy::GetNumberBccEncoders (WifiTxVector /* txVector */) const
HePhy::GetNumberBccEncoders (const WifiTxVector& /* txVector */) const
{
return 1; //only 1 BCC encoder for HE since higher rates are obtained using LDPC
}
Time
HePhy::GetSymbolDuration (WifiTxVector txVector) const
HePhy::GetSymbolDuration (const WifiTxVector& txVector) const
{
uint16_t gi = txVector.GetGuardInterval ();
NS_ASSERT (gi == 800 || gi == 1600 || gi == 3200);
@@ -304,7 +304,7 @@ HePhy::GetSymbolDuration (WifiTxVector txVector) const
}
Ptr<WifiPpdu>
HePhy::BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration)
HePhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration)
{
NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration);
HePpdu::TxPsdFlag flag = (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB) ?
@@ -319,7 +319,7 @@ HePhy::StartReceivePreamble (Ptr<WifiPpdu> ppdu, RxPowerWattPerChannelBand rxPow
Time rxDuration)
{
NS_LOG_FUNCTION (this << ppdu << rxDuration);
WifiTxVector txVector = ppdu->GetTxVector ();
const WifiTxVector& txVector = ppdu->GetTxVector ();
auto hePpdu = DynamicCast<HePpdu> (ppdu);
NS_ASSERT (hePpdu);
HePpdu::TxPsdFlag psdFlag = hePpdu->GetTxPsdFlag ();
@@ -409,7 +409,7 @@ HePhy::DoGetEvent (Ptr<const WifiPpdu> ppdu, RxPowerWattPerChannelBand rxPowersW
if (ppdu->GetType () == WIFI_PPDU_TYPE_UL_MU)
{
auto uidPreamblePair = std::make_pair (ppdu->GetUid (), ppdu->GetPreamble ());
WifiTxVector txVector = ppdu->GetTxVector ();
const WifiTxVector& txVector = ppdu->GetTxVector ();
Time rxDuration = CalculateNonOfdmaDurationForHeTb (txVector); //the OFDMA part of the transmission will be added later on
const auto & currentPreambleEvents = GetCurrentPreambleEvents ();
auto it = currentPreambleEvents.find (uidPreamblePair);
@@ -583,7 +583,7 @@ HePhy::ProcessSigB (Ptr<Event> event, PhyFieldRxStatus status)
bool
HePhy::IsConfigSupported (Ptr<const WifiPpdu> ppdu) const
{
WifiTxVector txVector = ppdu->GetTxVector ();
const WifiTxVector& txVector = ppdu->GetTxVector ();
uint16_t staId = GetStaId (ppdu);
WifiMode txMode = txVector.GetMode (staId);
uint8_t nss = txVector.GetNssMax ();
@@ -616,7 +616,7 @@ void
HePhy::DoStartReceivePayload (Ptr<Event> event)
{
NS_LOG_FUNCTION (this << *event);
WifiTxVector txVector = event->GetTxVector ();
const WifiTxVector& txVector = event->GetTxVector ();
Ptr<const WifiPpdu> ppdu = event->GetPpdu ();
if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB)
{
@@ -719,7 +719,7 @@ HePhy::StartReceiveOfdmaPayload (Ptr<Event> event)
}
std::pair<uint16_t, WifiSpectrumBand>
HePhy::GetChannelWidthAndBand (WifiTxVector txVector, uint16_t staId) const
HePhy::GetChannelWidthAndBand (const WifiTxVector& txVector, uint16_t staId) const
{
if (txVector.IsMu ())
{
@@ -733,7 +733,7 @@ HePhy::GetChannelWidthAndBand (WifiTxVector txVector, uint16_t staId) const
}
WifiSpectrumBand
HePhy::GetRuBand (WifiTxVector txVector, uint16_t staId) const
HePhy::GetRuBand (const WifiTxVector& txVector, uint16_t staId) const
{
NS_ASSERT (txVector.IsMu ());
WifiSpectrumBand band;
@@ -747,7 +747,7 @@ HePhy::GetRuBand (WifiTxVector txVector, uint16_t staId) const
}
WifiSpectrumBand
HePhy::GetNonOfdmaBand (WifiTxVector txVector, uint16_t staId) const
HePhy::GetNonOfdmaBand (const WifiTxVector& txVector, uint16_t staId) const
{
NS_ASSERT (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB);
uint16_t channelWidth = txVector.GetChannelWidth ();
@@ -811,7 +811,7 @@ HePhy::ObtainNextUid (const WifiTxVector& txVector)
Ptr<SpectrumValue>
HePhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const
{
WifiTxVector txVector = ppdu->GetTxVector ();
const WifiTxVector& txVector = ppdu->GetTxVector ();
uint16_t centerFrequency = GetCenterFrequencyForChannelWidth (txVector);
uint16_t channelWidth = txVector.GetChannelWidth ();
NS_LOG_FUNCTION (this << centerFrequency << channelWidth << txPowerW);
@@ -842,7 +842,7 @@ HePhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) con
}
uint16_t
HePhy::GetCenterFrequencyForNonOfdmaPart (WifiTxVector txVector, uint16_t staId) const
HePhy::GetCenterFrequencyForNonOfdmaPart (const WifiTxVector& txVector, uint16_t staId) const
{
NS_LOG_FUNCTION (this << txVector << staId);
NS_ASSERT (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB);
@@ -889,7 +889,7 @@ HePhy::StartTx (Ptr<WifiPpdu> ppdu)
uint16_t
HePhy::GetTransmissionChannelWidth (Ptr<const WifiPpdu> ppdu) const
{
WifiTxVector txVector = ppdu->GetTxVector ();
const WifiTxVector& txVector = ppdu->GetTxVector ();
if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB && ppdu->GetStaId () != SU_STA_ID)
{
auto hePpdu = DynamicCast<const HePpdu> (ppdu);
@@ -908,7 +908,7 @@ HePhy::GetTransmissionChannelWidth (Ptr<const WifiPpdu> ppdu) const
}
Time
HePhy::CalculateTxDuration (WifiConstPsduMap psduMap, WifiTxVector txVector, WifiPhyBand band) const
HePhy::CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band) const
{
if (txVector.GetPreambleType () == WIFI_PREAMBLE_HE_TB)
{
@@ -1045,7 +1045,7 @@ HePhy::GetPhyRate (uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInterv
}
uint64_t
HePhy::GetDataRateFromTxVector (WifiTxVector txVector, uint16_t staId /* = SU_STA_ID */)
HePhy::GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t staId /* = SU_STA_ID */)
{
uint16_t bw = txVector.GetChannelWidth ();
if (txVector.IsMu ())

View File

@@ -80,16 +80,16 @@ public:
virtual ~HePhy ();
// Inherited
WifiMode GetSigMode (WifiPpduField field, WifiTxVector txVector) const override;
WifiMode GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const override;
WifiMode GetSigAMode (void) const override;
WifiMode GetSigBMode (WifiTxVector txVector) const override;
WifiMode GetSigBMode (const WifiTxVector& txVector) const override;
virtual const PpduFormats & GetPpduFormats (void) const override;
Time GetLSigDuration (WifiPreamble preamble) const override;
virtual Time GetTrainingDuration (WifiTxVector txVector,
virtual Time GetTrainingDuration (const WifiTxVector& txVector,
uint8_t nDataLtf, uint8_t nExtensionLtf = 0) const override;
Time GetSigADuration (WifiPreamble preamble) const override;
Time GetSigBDuration (WifiTxVector txVector) const override;
virtual Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration) override;
Time GetSigBDuration (const WifiTxVector& txVector) const override;
virtual Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration) override;
Ptr<const WifiPsdu> GetAddressedPsduInPpdu (Ptr<const WifiPpdu> ppdu) const override;
void StartReceivePreamble (Ptr<WifiPpdu> ppdu, RxPowerWattPerChannelBand rxPowersW,
Time rxDuration) override;
@@ -98,7 +98,7 @@ public:
uint16_t GetMeasurementChannelWidth (const Ptr<const WifiPpdu> ppdu) const override;
void StartTx (Ptr<WifiPpdu> ppdu) override;
uint16_t GetTransmissionChannelWidth (Ptr<const WifiPpdu> ppdu) const override;
Time CalculateTxDuration (WifiConstPsduMap psduMap, WifiTxVector txVector, WifiPhyBand band) const override;
Time CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band) const override;
/**
* \return the BSS color of this PHY.
@@ -119,13 +119,13 @@ public:
*
* \return the duration of the HE TB PPDU corresponding to that L-SIG length value.
*/
static Time ConvertLSigLengthToHeTbPpduDuration (uint16_t length, WifiTxVector txVector, WifiPhyBand band);
static Time ConvertLSigLengthToHeTbPpduDuration (uint16_t length, const WifiTxVector& txVector, WifiPhyBand band);
/**
* \param txVector the transmission parameters used for the HE TB PPDU
*
* \return the duration of the non-OFDMA portion of the HE TB PPDU.
*/
Time CalculateNonOfdmaDurationForHeTb (WifiTxVector txVector) const;
Time CalculateNonOfdmaDurationForHeTb (const WifiTxVector& txVector) const;
/**
* Get the RU band used to transmit a PSDU to a given STA in a HE MU PPDU
@@ -135,7 +135,7 @@ public:
*
* \return the RU band used to transmit a PSDU to a given STA in a HE MU PPDU
*/
WifiSpectrumBand GetRuBand (WifiTxVector txVector, uint16_t staId) const;
WifiSpectrumBand GetRuBand (const WifiTxVector& txVector, uint16_t staId) const;
/**
* Get the band used to transmit the non-OFDMA part of an HE TB PPDU.
*
@@ -144,7 +144,7 @@ public:
*
* \return the spectrum band used to transmit the non-OFDMA part of an HE TB PPDU
*/
WifiSpectrumBand GetNonOfdmaBand (WifiTxVector txVector, uint16_t staId) const;
WifiSpectrumBand GetNonOfdmaBand (const WifiTxVector& txVector, uint16_t staId) const;
/**
* \return the UID of the HE TB PPDU being received
@@ -160,7 +160,7 @@ public:
* \param staId the STA-ID of the station taking part of the UL MU
* \return the center frequency in MHz corresponding to the non-OFDMA part of the HE TB PPDU
*/
uint16_t GetCenterFrequencyForNonOfdmaPart (WifiTxVector txVector, uint16_t staId) const;
uint16_t GetCenterFrequencyForNonOfdmaPart (const WifiTxVector& txVector, uint16_t staId) const;
/**
* Set a callback for a end of HE-SIG-A.
@@ -304,7 +304,7 @@ public:
* \param staId the station ID for MU (unused if SU)
* \return the data bit rate in bps.
*/
static uint64_t GetDataRateFromTxVector (WifiTxVector txVector, uint16_t staId = SU_STA_ID);
static uint64_t GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t staId = SU_STA_ID);
/**
* Return the data rate corresponding to
* the supplied HE MCS index, channel width,
@@ -345,7 +345,7 @@ protected:
Ptr<Event> DoGetEvent (Ptr<const WifiPpdu> ppdu, RxPowerWattPerChannelBand rxPowersW) override;
virtual bool IsConfigSupported (Ptr<const WifiPpdu> ppdu) const override;
virtual void DoStartReceivePayload (Ptr<Event> event) override;
std::pair<uint16_t, WifiSpectrumBand> GetChannelWidthAndBand (WifiTxVector txVector, uint16_t staId) const override;
std::pair<uint16_t, WifiSpectrumBand> GetChannelWidthAndBand (const WifiTxVector& txVector, uint16_t staId) const override;
void DoEndReceivePayload (Ptr<const WifiPpdu> ppdu) override;
void DoResetReceive (Ptr<Event> event) override;
void DoAbortCurrentReception (WifiPhyRxfailureReason reason) override;
@@ -389,8 +389,8 @@ protected:
private:
// Inherited
virtual void BuildModeList (void) override;
uint8_t GetNumberBccEncoders (WifiTxVector txVector) const override;
virtual Time GetSymbolDuration (WifiTxVector txVector) const override;
uint8_t GetNumberBccEncoders (const WifiTxVector& txVector) const override;
virtual Time GetSymbolDuration (const WifiTxVector& txVector) const override;
/**
* Create and return the HE MCS corresponding to

View File

@@ -47,7 +47,7 @@ std::ostream& operator<< (std::ostream& os, const HePpdu::TxPsdFlag &flag)
}
}
HePpdu::HePpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration,
HePpdu::HePpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration,
WifiPhyBand band, uint64_t uid, TxPsdFlag flag)
: OfdmPpdu (psdus.begin ()->second, txVector, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu
{
@@ -66,7 +66,7 @@ HePpdu::HePpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppdu
SetTxPsdFlag (flag);
}
HePpdu::HePpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, Time ppduDuration,
HePpdu::HePpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, Time ppduDuration,
WifiPhyBand band, uint64_t uid)
: OfdmPpdu (psdu, txVector, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu
{
@@ -81,7 +81,7 @@ HePpdu::~HePpdu ()
}
void
HePpdu::SetPhyHeaders (WifiTxVector txVector, Time ppduDuration)
HePpdu::SetPhyHeaders (const WifiTxVector& txVector, Time ppduDuration)
{
NS_LOG_FUNCTION (this << txVector << ppduDuration);
uint8_t sigExtension = 0;
@@ -140,7 +140,7 @@ Time
HePpdu::GetTxDuration (void) const
{
Time ppduDuration = Seconds (0);
WifiTxVector txVector = GetTxVector ();
const WifiTxVector& txVector = GetTxVector ();
Time tSymbol = NanoSeconds (12800 + txVector.GetGuardInterval ());
Time preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration (txVector);
uint8_t sigExtension = 0;

View File

@@ -172,7 +172,7 @@ public:
* \param band the WifiPhyBand used for the transmission of this PPDU
* \param uid the unique ID of this PPDU
*/
HePpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, Time ppduDuration,
HePpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, Time ppduDuration,
WifiPhyBand band, uint64_t uid);
/**
* Create an MU HE PPDU, storing a map of PSDUs.
@@ -186,7 +186,7 @@ public:
* \param uid the unique ID of this PPDU or of the triggering PPDU if this is an HE TB PPDU
* \param flag the flag indicating the type of Tx PSD to build
*/
HePpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration,
HePpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration,
WifiPhyBand band, uint64_t uid, TxPsdFlag flag);
/**
* Destructor for HePpdu.
@@ -254,7 +254,7 @@ private:
* \param txVector the TXVECTOR that was used for this PPDU
* \param ppduDuration the transmission duration of this PPDU
*/
void SetPhyHeaders (WifiTxVector txVector, Time ppduDuration);
void SetPhyHeaders (const WifiTxVector& txVector, Time ppduDuration);
HeSigHeader m_heSig; //!< the HE-SIG PHY header
TxPsdFlag m_txPsdFlag; //!< the transmit power spectral density flag

View File

@@ -127,7 +127,7 @@ HtPhy::GetPpduFormats (void) const
}
WifiMode
HtPhy::GetSigMode (WifiPpduField field, WifiTxVector txVector) const
HtPhy::GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const
{
switch (field)
{
@@ -196,7 +196,7 @@ HtPhy::SetMaxSupportedNss (uint8_t maxNss)
}
Time
HtPhy::GetDuration (WifiPpduField field, WifiTxVector txVector) const
HtPhy::GetDuration (WifiPpduField field, const WifiTxVector& txVector) const
{
switch (field)
{
@@ -242,7 +242,7 @@ HtPhy::GetLSigDuration (WifiPreamble preamble) const
}
Time
HtPhy::GetTrainingDuration (WifiTxVector txVector,
HtPhy::GetTrainingDuration (const WifiTxVector& txVector,
uint8_t nDataLtf, uint8_t nExtensionLtf /* = 0 */) const
{
NS_ABORT_MSG_IF (nDataLtf == 0 || nDataLtf > 4 || nExtensionLtf > 4 || (nDataLtf + nExtensionLtf) > 5,
@@ -258,7 +258,7 @@ HtPhy::GetHtSigDuration (void) const
}
Time
HtPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand band, MpduType mpdutype,
HtPhy::GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype,
bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols,
uint16_t staId) const
{
@@ -332,7 +332,7 @@ HtPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand ban
}
uint8_t
HtPhy::GetNumberBccEncoders (WifiTxVector txVector) const
HtPhy::GetNumberBccEncoders (const WifiTxVector& txVector) const
{
/**
* Add an encoder when crossing maxRatePerCoder frontier.
@@ -346,7 +346,7 @@ HtPhy::GetNumberBccEncoders (WifiTxVector txVector) const
}
Time
HtPhy::GetSymbolDuration (WifiTxVector txVector) const
HtPhy::GetSymbolDuration (const WifiTxVector& txVector) const
{
uint16_t gi = txVector.GetGuardInterval ();
NS_ASSERT (gi == 400 || gi == 800);
@@ -354,7 +354,7 @@ HtPhy::GetSymbolDuration (WifiTxVector txVector) const
}
Ptr<WifiPpdu>
HtPhy::BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration)
HtPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration)
{
NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration);
return Create<HtPpdu> (psdus.begin ()->second, txVector, ppduDuration, m_wifiPhy->GetPhyBand (),
@@ -416,7 +416,7 @@ HtPhy::IsAllConfigSupported (WifiPpduField field, Ptr<const WifiPpdu> ppdu) cons
bool
HtPhy::IsConfigSupported (Ptr<const WifiPpdu> ppdu) const
{
WifiTxVector txVector = ppdu->GetTxVector ();
const WifiTxVector& txVector = ppdu->GetTxVector ();
if (txVector.GetNss () > m_wifiPhy->GetMaxSupportedRxSpatialStreams ())
{
NS_LOG_DEBUG ("Packet reception could not be started because not enough RX antennas");
@@ -433,7 +433,7 @@ HtPhy::IsConfigSupported (Ptr<const WifiPpdu> ppdu) const
Ptr<SpectrumValue>
HtPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const
{
WifiTxVector txVector = ppdu->GetTxVector ();
const WifiTxVector& txVector = ppdu->GetTxVector ();
uint16_t centerFrequency = GetCenterFrequencyForChannelWidth (txVector);
uint16_t channelWidth = txVector.GetChannelWidth ();
NS_LOG_FUNCTION (this << centerFrequency << channelWidth << txPowerW);
@@ -641,7 +641,7 @@ HtPhy::GetCodeRatio (WifiCodeRate codeRate)
}
uint64_t
HtPhy::GetDataRateFromTxVector (WifiTxVector txVector, uint16_t /* staId */)
HtPhy::GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t /* staId */)
{
return GetDataRate (txVector.GetMode ().GetMcsValue (),
txVector.GetChannelWidth (),

View File

@@ -67,13 +67,13 @@ public:
WifiMode GetMcs (uint8_t index) const override;
bool IsMcsSupported (uint8_t index) const override;
bool HandlesMcsModes (void) const override;
virtual WifiMode GetSigMode (WifiPpduField field, WifiTxVector txVector) const override;
virtual WifiMode GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const override;
virtual const PpduFormats & GetPpduFormats (void) const override;
virtual Time GetDuration (WifiPpduField field, WifiTxVector txVector) const override;
Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand band, MpduType mpdutype,
virtual Time GetDuration (WifiPpduField field, const WifiTxVector& txVector) const override;
Time GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype,
bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols,
uint16_t staId) const override;
virtual Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration) override;
virtual Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration) override;
/**
* \return the WifiMode used for the L-SIG (non-HT header) field
@@ -128,7 +128,7 @@ public:
*
* \see WIFI_PPDU_FIELD_TRAINING
*/
virtual Time GetTrainingDuration (WifiTxVector txVector,
virtual Time GetTrainingDuration (const WifiTxVector& txVector,
uint8_t nDataLtf, uint8_t nExtensionLtf = 0) const;
/**
* \return the duration of the HT-SIG field
@@ -403,7 +403,7 @@ public:
* \param staId the station ID (only here to have a common signature for all callbacks)
* \return the data bit rate in bps.
*/
static uint64_t GetDataRateFromTxVector (WifiTxVector txVector, uint16_t staId);
static uint64_t GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t staId);
/**
* Return the data rate corresponding to the supplied HT
* MCS index, channel width, guard interval, and number
@@ -456,12 +456,12 @@ protected:
* \param txVector the transmission parameters
* \return the number of BCC encoders used for data encoding
*/
virtual uint8_t GetNumberBccEncoders (WifiTxVector txVector) const;
virtual uint8_t GetNumberBccEncoders (const WifiTxVector& txVector) const;
/**
* \param txVector the transmission parameters
* \return the symbol duration (including GI)
*/
virtual Time GetSymbolDuration (WifiTxVector txVector) const;
virtual Time GetSymbolDuration (const WifiTxVector& txVector) const;
/**
* Return the PHY rate corresponding to

View File

@@ -31,7 +31,7 @@ namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("HtPpdu");
HtPpdu::HtPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, Time ppduDuration,
HtPpdu::HtPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, Time ppduDuration,
WifiPhyBand band, uint64_t uid)
: OfdmPpdu (psdu, txVector, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu
{
@@ -71,7 +71,7 @@ Time
HtPpdu::GetTxDuration (void) const
{
Time ppduDuration = Seconds (0);
WifiTxVector txVector = GetTxVector ();
const WifiTxVector& txVector = GetTxVector ();
ppduDuration = WifiPhy::CalculateTxDuration (m_htSig.GetHtLength (), txVector, m_band);
return ppduDuration;
}

View File

@@ -146,7 +146,7 @@ public:
* \param band the WifiPhyBand used for the transmission of this PPDU
* \param uid the unique ID of this PPDU
*/
HtPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, Time ppduDuration,
HtPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, Time ppduDuration,
WifiPhyBand band, uint64_t uid);
/**
* Destructor for HtPpdu.

View File

@@ -38,7 +38,7 @@ NS_LOG_COMPONENT_DEFINE ("InterferenceHelper");
* PHY event class
****************************************************************/
Event::Event (Ptr<const WifiPpdu> ppdu, WifiTxVector txVector, Time duration, RxPowerWattPerChannelBand rxPower)
Event::Event (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector, Time duration, RxPowerWattPerChannelBand rxPower)
: m_ppdu (ppdu),
m_txVector (txVector),
m_startTime (Simulator::Now ()),
@@ -187,7 +187,7 @@ InterferenceHelper::~InterferenceHelper ()
}
Ptr<Event>
InterferenceHelper::Add (Ptr<const WifiPpdu> ppdu, WifiTxVector txVector, Time duration, RxPowerWattPerChannelBand rxPowerW, bool isStartOfdmaRxing)
InterferenceHelper::Add (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector, Time duration, RxPowerWattPerChannelBand rxPowerW, bool isStartOfdmaRxing)
{
Ptr<Event> event = Create<Event> (ppdu, txVector, duration, rxPowerW);
AppendEvent (event, isStartOfdmaRxing);
@@ -384,7 +384,7 @@ InterferenceHelper::CalculateNoiseInterferenceW (Ptr<Event> event, NiChangesPerB
}
double
InterferenceHelper::CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode, WifiTxVector txVector) const
InterferenceHelper::CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode, const WifiTxVector& txVector) const
{
if (duration.IsZero ())
{
@@ -397,7 +397,7 @@ InterferenceHelper::CalculateChunkSuccessRate (double snir, Time duration, WifiM
}
double
InterferenceHelper::CalculatePayloadChunkSuccessRate (double snir, Time duration, WifiTxVector txVector, uint16_t staId) const
InterferenceHelper::CalculatePayloadChunkSuccessRate (double snir, Time duration, const WifiTxVector& txVector, uint16_t staId) const
{
if (duration.IsZero ())
{
@@ -417,7 +417,7 @@ InterferenceHelper::CalculatePayloadPer (Ptr<const Event> event, uint16_t channe
uint16_t staId, std::pair<Time, Time> window) const
{
NS_LOG_FUNCTION (this << channelWidth << band.first << band.second << staId << window.first << window.second);
const WifiTxVector txVector = event->GetTxVector ();
const WifiTxVector& txVector = event->GetTxVector ();
double psr = 1.0; /* Packet Success Rate */
auto ni_it = nis->find (band)->second;
auto j = ni_it.begin ();
@@ -468,7 +468,7 @@ InterferenceHelper::CalculatePhyHeaderSectionPsr (Ptr<const Event> event, NiChan
PhyEntity::PhyHeaderSections phyHeaderSections) const
{
NS_LOG_FUNCTION (this << band.first << band.second);
const WifiTxVector txVector = event->GetTxVector ();
const WifiTxVector& txVector = event->GetTxVector ();
double psr = 1.0; /* Packet Success Rate */
auto ni_it = nis->find (band)->second;
auto j = ni_it.begin ();
@@ -523,7 +523,7 @@ InterferenceHelper::CalculatePhyHeaderPer (Ptr<const Event> event, NiChangesPerB
WifiPpduField header) const
{
NS_LOG_FUNCTION (this << band.first << band.second << header);
const WifiTxVector txVector = event->GetTxVector ();
const WifiTxVector& txVector = event->GetTxVector ();
auto ni_it = nis->find (band)->second;
auto phyEntity = WifiPhy::GetStaticPhyEntity (txVector.GetModulationClass ());

View File

@@ -45,7 +45,7 @@ public:
* \param duration duration of the PPDU
* \param rxPower the received power per band (W)
*/
Event (Ptr<const WifiPpdu> ppdu, WifiTxVector txVector, Time duration, RxPowerWattPerChannelBand rxPower);
Event (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector, Time duration, RxPowerWattPerChannelBand rxPower);
~Event ();
/**
@@ -194,7 +194,7 @@ public:
*
* \return Event
*/
Ptr<Event> Add (Ptr<const WifiPpdu> ppdu, WifiTxVector txVector, Time duration, RxPowerWattPerChannelBand rxPower, bool isStartOfdmaRxing = false);
Ptr<Event> Add (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector, Time duration, RxPowerWattPerChannelBand rxPower, bool isStartOfdmaRxing = false);
/**
* Add a non-Wifi signal to interference helper.
@@ -291,7 +291,7 @@ protected:
*
* \return the success rate
*/
double CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode, WifiTxVector txVector) const;
double CalculateChunkSuccessRate (double snir, Time duration, WifiMode mode, const WifiTxVector& txVector) const;
private:
@@ -373,7 +373,7 @@ private:
*
* \return the success rate
*/
double CalculatePayloadChunkSuccessRate (double snir, Time duration, WifiTxVector txVector, uint16_t staId) const;
double CalculatePayloadChunkSuccessRate (double snir, Time duration, const WifiTxVector& txVector, uint16_t staId) const;
/**
* Calculate the error rate of the given PHY payload only in the provided time
* window (thus enabling per MPDU PER information). The PHY payload can be divided into

View File

@@ -217,7 +217,7 @@ NistErrorRateModel::GetBValue (WifiCodeRate codeRate) const
}
double
NistErrorRateModel::DoGetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const
NistErrorRateModel::DoGetChunkSuccessRate (WifiMode mode, const WifiTxVector& txVector, double snr, uint64_t nbits) const
{
NS_LOG_FUNCTION (this << mode << snr << nbits);
if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM

View File

@@ -48,7 +48,7 @@ public:
private:
//Inherited from ErrorRateModel
double DoGetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const;
double DoGetChunkSuccessRate (WifiMode mode, const WifiTxVector& txVector, double snr, uint64_t nbits) const;
/**
* Return the bValue such that coding rate = bValue / (bValue + 1).
*

View File

@@ -72,7 +72,7 @@ DsssPhy::~DsssPhy ()
}
WifiMode
DsssPhy::GetSigMode (WifiPpduField field, WifiTxVector txVector) const
DsssPhy::GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const
{
switch (field)
{
@@ -85,7 +85,7 @@ DsssPhy::GetSigMode (WifiPpduField field, WifiTxVector txVector) const
}
WifiMode
DsssPhy::GetHeaderMode (WifiTxVector txVector) const
DsssPhy::GetHeaderMode (const WifiTxVector& txVector) const
{
if (txVector.GetPreambleType () == WIFI_PREAMBLE_LONG
|| txVector.GetMode () == GetDsssRate1Mbps ())
@@ -107,7 +107,7 @@ DsssPhy::GetPpduFormats (void) const
}
Time
DsssPhy::GetDuration (WifiPpduField field, WifiTxVector txVector) const
DsssPhy::GetDuration (WifiPpduField field, const WifiTxVector& txVector) const
{
if (field == WIFI_PPDU_FIELD_PREAMBLE)
{
@@ -124,7 +124,7 @@ DsssPhy::GetDuration (WifiPpduField field, WifiTxVector txVector) const
}
Time
DsssPhy::GetPreambleDuration (WifiTxVector txVector) const
DsssPhy::GetPreambleDuration (const WifiTxVector& txVector) const
{
if (txVector.GetPreambleType () == WIFI_PREAMBLE_SHORT
&& (txVector.GetMode ().GetDataRate (22) > 1000000))
@@ -140,7 +140,7 @@ DsssPhy::GetPreambleDuration (WifiTxVector txVector) const
}
Time
DsssPhy::GetHeaderDuration (WifiTxVector txVector) const
DsssPhy::GetHeaderDuration (const WifiTxVector& txVector) const
{
if (txVector.GetPreambleType () == WIFI_PREAMBLE_SHORT
&& (txVector.GetMode ().GetDataRate (22) > 1000000))
@@ -156,7 +156,7 @@ DsssPhy::GetHeaderDuration (WifiTxVector txVector) const
}
Time
DsssPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand /* band */, MpduType /* mpdutype */,
DsssPhy::GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand /* band */, MpduType /* mpdutype */,
bool /* incFlag */, uint32_t & /* totalAmpduSize */, double & /* totalAmpduNumSymbols */,
uint16_t /* staId */) const
{
@@ -164,7 +164,7 @@ DsssPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand /
}
Ptr<WifiPpdu>
DsssPhy::BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration)
DsssPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration)
{
NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration);
return Create<DsssPpdu> (psdus.begin ()->second, txVector, ppduDuration,
@@ -209,7 +209,7 @@ DsssPhy::EndReceiveHeader (Ptr<Event> event)
Ptr<SpectrumValue>
DsssPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const
{
WifiTxVector txVector = ppdu->GetTxVector ();
const WifiTxVector& txVector = ppdu->GetTxVector ();
uint16_t centerFrequency = GetCenterFrequencyForChannelWidth (txVector);
uint16_t channelWidth = txVector.GetChannelWidth ();
NS_LOG_FUNCTION (this << centerFrequency << channelWidth << txPowerW);
@@ -306,7 +306,7 @@ DsssPhy::GetConstellationSize (const std::string& name)
}
uint64_t
DsssPhy::GetDataRateFromTxVector (WifiTxVector txVector, uint16_t /* staId */)
DsssPhy::GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t /* staId */)
{
WifiMode mode = txVector.GetMode ();
return DsssPhy::GetDataRate (mode.GetUniqueName (),

View File

@@ -55,13 +55,13 @@ public:
virtual ~DsssPhy ();
// Inherited
WifiMode GetSigMode (WifiPpduField field, WifiTxVector txVector) const override;
WifiMode GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const override;
const PpduFormats & GetPpduFormats (void) const override;
Time GetDuration (WifiPpduField field, WifiTxVector txVector) const override;
Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand band, MpduType mpdutype,
Time GetDuration (WifiPpduField field, const WifiTxVector& txVector) const override;
Time GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype,
bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols,
uint16_t staId) const override;
Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration) override;
Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration) override;
/**
* Initialize all HR/DSSS modes.
@@ -136,7 +136,7 @@ public:
* \param staId the station ID (only here to have a common signature for all callbacks)
* \return the data bit rate in bps.
*/
static uint64_t GetDataRateFromTxVector (WifiTxVector txVector, uint16_t staId);
static uint64_t GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t staId);
/**
* Return the data rate from the DSSS or HR/DSSS mode's unique name and
* the supplied parameters. This function is mainly used as a callback
@@ -171,7 +171,7 @@ private:
* \param txVector the transmission parameters
* \return the WifiMode used for the PHY header field
*/
WifiMode GetHeaderMode (WifiTxVector txVector) const;
WifiMode GetHeaderMode (const WifiTxVector& txVector) const;
/**
* \param txVector the transmission parameters
@@ -179,12 +179,12 @@ private:
*
* \see WIFI_PPDU_FIELD_PREAMBLE
*/
Time GetPreambleDuration (WifiTxVector txVector) const;
Time GetPreambleDuration (const WifiTxVector& txVector) const;
/**
* \param txVector the transmission parameters
* \return the duration of the PHY header field
*/
Time GetHeaderDuration (WifiTxVector txVector) const;
Time GetHeaderDuration (const WifiTxVector& txVector) const;
/**
* End receiving the header, perform DSSS-specific actions, and

View File

@@ -30,7 +30,7 @@ namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("DsssPpdu");
DsssPpdu::DsssPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, Time ppduDuration, uint64_t uid)
DsssPpdu::DsssPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, Time ppduDuration, uint64_t uid)
: WifiPpdu (psdu, txVector, uid)
{
NS_LOG_FUNCTION (this << psdu << txVector << ppduDuration << uid);
@@ -57,7 +57,7 @@ Time
DsssPpdu::GetTxDuration (void) const
{
Time ppduDuration = Seconds (0);
WifiTxVector txVector = GetTxVector ();
const WifiTxVector& txVector = GetTxVector ();
ppduDuration = MicroSeconds (m_dsssSig.GetLength ()) + WifiPhy::CalculatePhyPreambleAndHeaderDuration (txVector);
return ppduDuration;
}

View File

@@ -107,7 +107,7 @@ public:
* \param ppduDuration the transmission duration of this PPDU
* \param uid the unique ID of this PPDU
*/
DsssPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, Time ppduDuration, uint64_t uid);
DsssPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, Time ppduDuration, uint64_t uid);
/**
* Destructor for DsssPpdu.
*/

View File

@@ -67,26 +67,26 @@ ErpOfdmPhy::~ErpOfdmPhy ()
}
WifiMode
ErpOfdmPhy::GetHeaderMode (WifiTxVector txVector) const
ErpOfdmPhy::GetHeaderMode (const WifiTxVector& txVector) const
{
NS_ASSERT (txVector.GetMode ().GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM);
return GetErpOfdmRate6Mbps ();
}
Time
ErpOfdmPhy::GetPreambleDuration (WifiTxVector /* txVector */) const
ErpOfdmPhy::GetPreambleDuration (const WifiTxVector& /* txVector */) const
{
return MicroSeconds (16); //L-STF + L-LTF
}
Time
ErpOfdmPhy::GetHeaderDuration (WifiTxVector /* txVector */) const
ErpOfdmPhy::GetHeaderDuration (const WifiTxVector& /* txVector */) const
{
return MicroSeconds (4); //L-SIG
}
Ptr<WifiPpdu>
ErpOfdmPhy::BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time /* ppduDuration */)
ErpOfdmPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time /* ppduDuration */)
{
NS_LOG_FUNCTION (this << psdus << txVector);
return Create<ErpOfdmPpdu> (psdus.begin ()->second, txVector, m_wifiPhy->GetPhyBand (),
@@ -193,7 +193,7 @@ ErpOfdmPhy::GetPhyRate (const std::string& name, uint16_t channelWidth, uint16_t
}
uint64_t
ErpOfdmPhy::GetDataRateFromTxVector (WifiTxVector txVector, uint16_t /* staId */)
ErpOfdmPhy::GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t /* staId */)
{
return GetDataRate (txVector.GetMode ().GetUniqueName (),
txVector.GetChannelWidth (),

View File

@@ -55,7 +55,7 @@ public:
virtual ~ErpOfdmPhy ();
//Inherited
Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration) override;
Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration) override;
/**
* Initialize all ERP-OFDM modes.
@@ -167,7 +167,7 @@ public:
* \param staId the station ID (only here to have a common signature for all callbacks)
* \return the data bit rate in bps.
*/
static uint64_t GetDataRateFromTxVector (WifiTxVector txVector, uint16_t staId);
static uint64_t GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t staId);
/**
* Return the data rate from the ERP-OFDM mode's unique name and
* the supplied parameters. This function calls OfdmPhy::CalculateDataRate
@@ -194,9 +194,9 @@ public:
private:
// Inherited
WifiMode GetHeaderMode (WifiTxVector txVector) const override;
Time GetPreambleDuration (WifiTxVector txVector) const override;
Time GetHeaderDuration (WifiTxVector txVector) const override;
WifiMode GetHeaderMode (const WifiTxVector& txVector) const override;
Time GetPreambleDuration (const WifiTxVector& txVector) const override;
Time GetHeaderDuration (const WifiTxVector& txVector) const override;
/**
* Create an ERP-OFDM mode from a unique name, the unique name

View File

@@ -28,7 +28,7 @@ namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("ErpOfdmPpdu");
ErpOfdmPpdu::ErpOfdmPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector,
ErpOfdmPpdu::ErpOfdmPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector,
WifiPhyBand band, uint64_t uid)
: OfdmPpdu (psdu, txVector, band, uid, true) //instantiate LSigHeader of OfdmPpdu
{

View File

@@ -52,7 +52,7 @@ public:
* \param band the WifiPhyBand used for the transmission of this PPDU
* \param uid the unique ID of this PPDU
*/
ErpOfdmPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector,
ErpOfdmPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector,
WifiPhyBand band, uint64_t uid);
/**
* Destructor for ErpOfdmPpdu.

View File

@@ -118,7 +118,7 @@ OfdmPhy::~OfdmPhy ()
}
WifiMode
OfdmPhy::GetSigMode (WifiPpduField field, WifiTxVector txVector) const
OfdmPhy::GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const
{
switch (field)
{
@@ -131,7 +131,7 @@ OfdmPhy::GetSigMode (WifiPpduField field, WifiTxVector txVector) const
}
WifiMode
OfdmPhy::GetHeaderMode (WifiTxVector txVector) const
OfdmPhy::GetHeaderMode (const WifiTxVector& txVector) const
{
switch (txVector.GetChannelWidth ())
{
@@ -156,7 +156,7 @@ OfdmPhy::GetPpduFormats (void) const
}
Time
OfdmPhy::GetDuration (WifiPpduField field, WifiTxVector txVector) const
OfdmPhy::GetDuration (WifiPpduField field, const WifiTxVector& txVector) const
{
switch (field)
{
@@ -170,7 +170,7 @@ OfdmPhy::GetDuration (WifiPpduField field, WifiTxVector txVector) const
}
Time
OfdmPhy::GetPreambleDuration (WifiTxVector txVector) const
OfdmPhy::GetPreambleDuration (const WifiTxVector& txVector) const
{
switch (txVector.GetChannelWidth ())
{
@@ -191,7 +191,7 @@ OfdmPhy::GetPreambleDuration (WifiTxVector txVector) const
}
Time
OfdmPhy::GetHeaderDuration (WifiTxVector txVector) const
OfdmPhy::GetHeaderDuration (const WifiTxVector& txVector) const
{
switch (txVector.GetChannelWidth ())
{
@@ -214,7 +214,7 @@ OfdmPhy::GetHeaderDuration (WifiTxVector txVector) const
}
Time
OfdmPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand band, MpduType /* mpdutype */,
OfdmPhy::GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType /* mpdutype */,
bool /* incFlag */, uint32_t & /* totalAmpduSize */, double & /* totalAmpduNumSymbols */,
uint16_t /* staId */) const
{
@@ -246,7 +246,7 @@ OfdmPhy::GetSignalExtension (WifiPhyBand band) const
}
Ptr<WifiPpdu>
OfdmPhy::BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time /* ppduDuration */)
OfdmPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time /* ppduDuration */)
{
NS_LOG_FUNCTION (this << psdus << txVector);
return Create<OfdmPpdu> (psdus.begin ()->second, txVector, m_wifiPhy->GetPhyBand (),
@@ -313,7 +313,7 @@ OfdmPhy::IsAllConfigSupported (WifiPpduField /* field */, Ptr<const WifiPpdu> pp
Ptr<SpectrumValue>
OfdmPhy::GetTxPowerSpectralDensity (double txPowerW, Ptr<const WifiPpdu> ppdu) const
{
WifiTxVector txVector = ppdu->GetTxVector ();
const WifiTxVector& txVector = ppdu->GetTxVector ();
uint16_t centerFrequency = GetCenterFrequencyForChannelWidth (txVector);
uint16_t channelWidth = txVector.GetChannelWidth ();
NS_LOG_FUNCTION (this << centerFrequency << channelWidth << txPowerW);
@@ -536,7 +536,7 @@ OfdmPhy::GetCodeRatio (WifiCodeRate codeRate)
}
uint64_t
OfdmPhy::GetDataRateFromTxVector (WifiTxVector txVector, uint16_t /* staId */)
OfdmPhy::GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t /* staId */)
{
return GetDataRate (txVector.GetMode ().GetUniqueName (),
txVector.GetChannelWidth (),

View File

@@ -75,13 +75,13 @@ public:
virtual ~OfdmPhy ();
// Inherited
virtual WifiMode GetSigMode (WifiPpduField field, WifiTxVector txVector) const override;
virtual WifiMode GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const override;
virtual const PpduFormats & GetPpduFormats (void) const override;
virtual Time GetDuration (WifiPpduField field, WifiTxVector txVector) const override;
virtual Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand band, MpduType mpdutype,
virtual Time GetDuration (WifiPpduField field, const WifiTxVector& txVector) const override;
virtual Time GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype,
bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols,
uint16_t staId) const override;
virtual Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration) override;
virtual Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration) override;
/**
* Initialize all OFDM modes (for all variants).
@@ -292,7 +292,7 @@ public:
* \param staId the station ID (only here to have a common signature for all callbacks)
* \return the data bit rate in bps.
*/
static uint64_t GetDataRateFromTxVector (WifiTxVector txVector, uint16_t staId);
static uint64_t GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t staId);
/**
* Return the data rate from the OFDM mode's unique name and
* the supplied parameters. This function calls CalculateDataRate and
@@ -326,7 +326,7 @@ protected:
* \param txVector the transmission parameters
* \return the WifiMode used for the SIGNAL field
*/
virtual WifiMode GetHeaderMode (WifiTxVector txVector) const;
virtual WifiMode GetHeaderMode (const WifiTxVector& txVector) const;
/**
* \param txVector the transmission parameters
@@ -334,12 +334,12 @@ protected:
*
* \see WIFI_PPDU_FIELD_PREAMBLE
*/
virtual Time GetPreambleDuration (WifiTxVector txVector) const;
virtual Time GetPreambleDuration (const WifiTxVector& txVector) const;
/**
* \param txVector the transmission parameters
* \return the duration of the SIGNAL field
*/
virtual Time GetHeaderDuration (WifiTxVector txVector) const;
virtual Time GetHeaderDuration (const WifiTxVector& txVector) const;
/**
* \return the number of service bits

View File

@@ -30,7 +30,7 @@ namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("OfdmPpdu");
OfdmPpdu::OfdmPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector,
OfdmPpdu::OfdmPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector,
WifiPhyBand band, uint64_t uid,
bool instantiateLSig /* = true */)
: WifiPpdu (psdu, txVector, uid),
@@ -65,7 +65,7 @@ Time
OfdmPpdu::GetTxDuration (void) const
{
Time ppduDuration = Seconds (0);
WifiTxVector txVector = GetTxVector ();
const WifiTxVector& txVector = GetTxVector ();
ppduDuration = WifiPhy::CalculateTxDuration (m_lSig.GetLength (), txVector, m_band);
return ppduDuration;
}

View File

@@ -113,7 +113,7 @@ public:
* \param instantiateLSig flag used to instantiate LSigHeader (set LSigHeader's
* rate and length), should be disabled by child classes
*/
OfdmPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, WifiPhyBand band, uint64_t uid,
OfdmPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, WifiPhyBand band, uint64_t uid,
bool instantiateLSig = true);
/**
* Destructor for OfdmPpdu.

View File

@@ -138,7 +138,7 @@ PhyEntity::end (void) const
}
WifiMode
PhyEntity::GetSigMode (WifiPpduField field, WifiTxVector txVector) const
PhyEntity::GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const
{
NS_FATAL_ERROR ("PPDU field is not a SIG field (no sense in retrieving the signaled mode) or is unsupported: " << field);
return WifiMode (); //should be overloaded
@@ -173,7 +173,7 @@ PhyEntity::GetNextField (WifiPpduField currentField, WifiPreamble preamble) cons
}
Time
PhyEntity::GetDuration (WifiPpduField field, WifiTxVector txVector) const
PhyEntity::GetDuration (WifiPpduField field, const WifiTxVector& txVector) const
{
if (field > WIFI_PPDU_FIELD_SIG_B)
{
@@ -183,7 +183,7 @@ PhyEntity::GetDuration (WifiPpduField field, WifiTxVector txVector) const
}
Time
PhyEntity::CalculatePhyPreambleAndHeaderDuration (WifiTxVector txVector) const
PhyEntity::CalculatePhyPreambleAndHeaderDuration (const WifiTxVector& txVector) const
{
Time duration = MicroSeconds (0);
for (uint8_t field = WIFI_PPDU_FIELD_PREAMBLE; field < WIFI_PPDU_FIELD_DATA; ++field)
@@ -200,7 +200,7 @@ PhyEntity::GetAddressedPsduInPpdu (Ptr<const WifiPpdu> ppdu) const
}
PhyEntity::PhyHeaderSections
PhyEntity::GetPhyHeaderSections (WifiTxVector txVector, Time ppduStart) const
PhyEntity::GetPhyHeaderSections (const WifiTxVector& txVector, Time ppduStart) const
{
PhyHeaderSections map;
WifiPpduField field = WIFI_PPDU_FIELD_PREAMBLE; //preamble always present
@@ -219,7 +219,7 @@ PhyEntity::GetPhyHeaderSections (WifiTxVector txVector, Time ppduStart) const
}
Ptr<WifiPpdu>
PhyEntity::BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time /* ppduDuration */)
PhyEntity::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time /* ppduDuration */)
{
NS_LOG_FUNCTION (this << psdus << txVector);
NS_FATAL_ERROR ("This method is unsupported for the base PhyEntity class. Use the overloaded version in the amendment-specific subclasses instead!");
@@ -227,7 +227,7 @@ PhyEntity::BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Tim
}
Time
PhyEntity::GetDurationUpToField (WifiPpduField field, WifiTxVector txVector) const
PhyEntity::GetDurationUpToField (WifiPpduField field, const WifiTxVector& txVector) const
{
if (field == WIFI_PPDU_FIELD_DATA) //this field is not in the map returned by GetPhyHeaderSections
{
@@ -318,7 +318,7 @@ PhyEntity::EndReceiveField (WifiPpduField field, Ptr<Event> event)
Time
PhyEntity::GetRemainingDurationAfterField (Ptr<const WifiPpdu> ppdu, WifiPpduField field) const
{
WifiTxVector txVector = ppdu->GetTxVector ();
const WifiTxVector& txVector = ppdu->GetTxVector ();
return ppdu->GetTxDuration () - (GetDurationUpToField (field, txVector) + GetDuration (field, txVector));
}
@@ -362,7 +362,6 @@ PhyEntity::StartReceivePreamble (Ptr<WifiPpdu> ppdu, RxPowerWattPerChannelBand r
return p1.second < p2.second;
});
NS_LOG_FUNCTION (this << ppdu << it->second);
WifiTxVector txVector = ppdu->GetTxVector ();
Time rxDuration = ppdu->GetTxDuration (); //the actual duration of the PPDU should be considered
Ptr<Event> event = DoGetEvent (ppdu, rxPowersW);
@@ -521,7 +520,7 @@ PhyEntity::StartReceivePayload (Ptr<Event> event)
{
NS_LOG_FUNCTION (this << *event);
NS_ASSERT (m_wifiPhy->m_endPhyRxEvent.IsExpired ());
WifiTxVector txVector = event->GetTxVector ();
const WifiTxVector& txVector = event->GetTxVector ();
Time payloadDuration = event->GetPpdu ()->GetTxDuration () - CalculatePhyPreambleAndHeaderDuration (txVector);
//TODO: Add method in WifiPhy to clear all other PHYs (since this one is starting Rx)
@@ -551,7 +550,7 @@ PhyEntity::ScheduleEndOfMpdus (Ptr<Event> event)
NS_LOG_FUNCTION (this << *event);
Ptr<const WifiPpdu> ppdu = event->GetPpdu ();
Ptr<const WifiPsdu> psdu = GetAddressedPsduInPpdu (ppdu);
WifiTxVector txVector = event->GetTxVector ();
const WifiTxVector& txVector = event->GetTxVector ();
uint16_t staId = GetStaId (ppdu);
Time endOfMpduDuration = NanoSeconds (0);
Time relativeStart = NanoSeconds (0);
@@ -710,7 +709,7 @@ PhyEntity::GetReceptionStatus (Ptr<const WifiPsdu> psdu, Ptr<Event> event, uint1
}
std::pair<uint16_t, WifiSpectrumBand>
PhyEntity::GetChannelWidthAndBand (WifiTxVector txVector, uint16_t /* staId */) const
PhyEntity::GetChannelWidthAndBand (const WifiTxVector& txVector, uint16_t /* staId */) const
{
uint16_t channelWidth = std::min (m_wifiPhy->GetChannelWidth (), txVector.GetChannelWidth ());
return std::make_pair (channelWidth, m_wifiPhy->GetBand (channelWidth));
@@ -743,7 +742,7 @@ PhyEntity::DoGetEvent (Ptr<const WifiPpdu> ppdu, RxPowerWattPerChannelBand rxPow
}
Ptr<Event>
PhyEntity::CreateInterferenceEvent (Ptr<const WifiPpdu> ppdu, WifiTxVector txVector, Time duration, RxPowerWattPerChannelBand rxPower, bool isStartOfdmaRxing /* = false */)
PhyEntity::CreateInterferenceEvent (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector, Time duration, RxPowerWattPerChannelBand rxPower, bool isStartOfdmaRxing /* = false */)
{
return m_wifiPhy->m_interference.Add (ppdu, txVector, duration, rxPower, isStartOfdmaRxing);
}
@@ -1014,7 +1013,7 @@ PhyEntity::ObtainNextUid (const WifiTxVector& /* txVector */)
}
uint16_t
PhyEntity::GetCenterFrequencyForChannelWidth (WifiTxVector txVector) const
PhyEntity::GetCenterFrequencyForChannelWidth (const WifiTxVector& txVector) const
{
NS_LOG_FUNCTION (this << txVector);
uint16_t centerFrequencyForSupportedWidth = m_wifiPhy->GetFrequency ();
@@ -1072,7 +1071,7 @@ PhyEntity::GetTransmissionChannelWidth (Ptr<const WifiPpdu> ppdu) const
}
Time
PhyEntity::CalculateTxDuration (WifiConstPsduMap psduMap, WifiTxVector txVector, WifiPhyBand band) const
PhyEntity::CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band) const
{
NS_ASSERT (psduMap.size () == 1);
const auto & it = psduMap.begin ();

View File

@@ -212,7 +212,7 @@ public:
*
* This method is overridden by child classes.
*/
virtual WifiMode GetSigMode (WifiPpduField field, WifiTxVector txVector) const;
virtual WifiMode GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const;
/**
* \brief Return a const iterator to the first WifiMode
@@ -247,13 +247,13 @@ public:
*
* This method is overridden by child classes.
*/
virtual Time GetDuration (WifiPpduField field, WifiTxVector txVector) const;
virtual Time GetDuration (WifiPpduField field, const WifiTxVector& txVector) const;
/**
* \param txVector the transmission parameters
*
* \return the total duration of the PHY preamble and PHY header.
*/
Time CalculatePhyPreambleAndHeaderDuration (WifiTxVector txVector) const;
Time CalculatePhyPreambleAndHeaderDuration (const WifiTxVector& txVector) const;
/**
* \param size the number of bytes in the packet to send
@@ -271,7 +271,7 @@ public:
*
* \return the duration of the PSDU
*/
virtual Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand band, MpduType mpdutype,
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;
@@ -296,7 +296,7 @@ public:
*
* \see PhyHeaderSections
*/
PhyHeaderSections GetPhyHeaderSections (WifiTxVector txVector, Time ppduStart) const;
PhyHeaderSections GetPhyHeaderSections (const WifiTxVector& txVector, Time ppduStart) const;
/**
* Build amendment-specific PPDU.
@@ -310,7 +310,7 @@ public:
* This method is overridden by child classes to create their
* corresponding PPDU, e.g., HtPhy creates HtPpdu.
*/
virtual Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration);
virtual Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration);
/**
* Get the duration of the PPDU up to (but excluding) the given field.
@@ -319,7 +319,7 @@ public:
* \param txVector the transmission parameters
* \return the duration from the beginning of the PPDU up to the field
*/
Time GetDurationUpToField (WifiPpduField field, WifiTxVector txVector) const;
Time GetDurationUpToField (WifiPpduField field, const WifiTxVector& txVector) const;
/**
* Get the remaining duration of the PPDU after the end of the given field.
*
@@ -459,7 +459,7 @@ public:
*
* \return the total amount of time this PHY will stay busy for the transmission of the PPDU
*/
virtual Time CalculateTxDuration (WifiConstPsduMap psduMap, WifiTxVector txVector, WifiPhyBand band) const;
virtual Time CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band) const;
protected:
/**
@@ -651,7 +651,7 @@ protected:
* \param staId the station ID of the PSDU
* \return a pair of channel width (MHz) and band
*/
virtual std::pair<uint16_t, WifiSpectrumBand> GetChannelWidthAndBand (WifiTxVector txVector, uint16_t staId) const;
virtual std::pair<uint16_t, WifiSpectrumBand> GetChannelWidthAndBand (const WifiTxVector& txVector, uint16_t staId) const;
/**
* Abort the current reception.
@@ -712,7 +712,7 @@ protected:
*
* \copydoc InterferenceHelper::Add(Ptr<const WifiPpdu>, WifiTxVector, Time, RxPowerWattPerChannelBand, bool)
*/
Ptr<Event> CreateInterferenceEvent (Ptr<const WifiPpdu> ppdu, WifiTxVector txVector, Time duration, RxPowerWattPerChannelBand rxPower, bool isStartOfdmaRxing = false);
Ptr<Event> CreateInterferenceEvent (Ptr<const WifiPpdu> ppdu, const WifiTxVector& txVector, Time duration, RxPowerWattPerChannelBand rxPower, bool isStartOfdmaRxing = false);
/**
* Update an event in WifiPhy's InterferenceHelper class.
* Wrapper used by child classes.
@@ -755,7 +755,7 @@ protected:
* \param txVector the TXVECTOR that has the channel width that is to be used
* \return the center frequency in MHz corresponding to the channel width to be used
*/
uint16_t GetCenterFrequencyForChannelWidth (WifiTxVector txVector) const;
uint16_t GetCenterFrequencyForChannelWidth (const WifiTxVector& txVector) const;
/**
* \param currentChannelWidth channel width of the current transmission (MHz)

View File

@@ -140,7 +140,7 @@ TableBasedErrorRateModel::GetMcsForMode (WifiMode mode)
}
double
TableBasedErrorRateModel::DoGetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const
TableBasedErrorRateModel::DoGetChunkSuccessRate (WifiMode mode, const WifiTxVector& txVector, double snr, uint64_t nbits) const
{
NS_LOG_FUNCTION (this << mode << txVector << snr << nbits);
uint64_t size = std::max<uint64_t> (1, (nbits / 8));

View File

@@ -48,7 +48,7 @@ public:
~TableBasedErrorRateModel ();
//Inherited from ErrorRateModel
double DoGetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const;
double DoGetChunkSuccessRate (WifiMode mode, const WifiTxVector& txVector, double snr, uint64_t nbits) const;
/**
* \brief Utility function to convert WifiMode to an MCS value
@@ -76,7 +76,7 @@ private:
* \param nbits the number of bits
* \return the frame success rate for a given Wi-Fi mode, TXVECTOR, SNR and frame size
*/
double FetchFsr (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const;
double FetchFsr (WifiMode mode, const WifiTxVector& txVector, double snr, uint64_t nbits) const;
Ptr<ErrorRateModel> m_fallbackErrorModel; //!< Error rate model to fallback to if no value is found in the table

View File

@@ -106,7 +106,7 @@ VhtPhy::GetPpduFormats (void) const
}
WifiMode
VhtPhy::GetSigMode (WifiPpduField field, WifiTxVector txVector) const
VhtPhy::GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const
{
switch (field)
{
@@ -135,14 +135,14 @@ VhtPhy::GetSigAMode (void) const
}
WifiMode
VhtPhy::GetSigBMode (WifiTxVector txVector) const
VhtPhy::GetSigBMode (const WifiTxVector& txVector) const
{
NS_ABORT_MSG_IF (txVector.GetPreambleType () != WIFI_PREAMBLE_VHT_MU, "VHT-SIG-B only available for VHT MU");
return GetVhtMcs0 ();
}
Time
VhtPhy::GetDuration (WifiPpduField field, WifiTxVector txVector) const
VhtPhy::GetDuration (WifiPpduField field, const WifiTxVector& txVector) const
{
switch (field)
{
@@ -168,7 +168,7 @@ VhtPhy::GetHtSigDuration (void) const
}
Time
VhtPhy::GetTrainingDuration (WifiTxVector txVector,
VhtPhy::GetTrainingDuration (const WifiTxVector& txVector,
uint8_t nDataLtf, uint8_t nExtensionLtf /* = 0 */) const
{
NS_ABORT_MSG_IF (nDataLtf > 8, "Unsupported number of LTFs " << +nDataLtf << " for VHT");
@@ -183,13 +183,13 @@ VhtPhy::GetSigADuration (WifiPreamble /* preamble */) const
}
Time
VhtPhy::GetSigBDuration (WifiTxVector txVector) const
VhtPhy::GetSigBDuration (const WifiTxVector& txVector) const
{
return (txVector.GetPreambleType () == WIFI_PREAMBLE_VHT_MU) ? MicroSeconds (4) : MicroSeconds (0); //HE-SIG-B only for MU
}
uint8_t
VhtPhy::GetNumberBccEncoders (WifiTxVector txVector) const
VhtPhy::GetNumberBccEncoders (const WifiTxVector& txVector) const
{
WifiMode payloadMode = txVector.GetMode ();
/**
@@ -215,7 +215,7 @@ VhtPhy::GetNumberBccEncoders (WifiTxVector txVector) const
}
Ptr<WifiPpdu>
VhtPhy::BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration)
VhtPhy::BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration)
{
NS_LOG_FUNCTION (this << psdus << txVector << ppduDuration);
return Create<VhtPpdu> (psdus.begin ()->second, txVector, ppduDuration, m_wifiPhy->GetPhyBand (),
@@ -422,7 +422,7 @@ VhtPhy::GetPhyRate (uint8_t mcsValue, uint16_t channelWidth, uint16_t guardInter
}
uint64_t
VhtPhy::GetDataRateFromTxVector (WifiTxVector txVector, uint16_t /* staId */)
VhtPhy::GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t /* staId */)
{
return GetDataRate (txVector.GetMode ().GetMcsValue (),
txVector.GetChannelWidth (),

View File

@@ -61,13 +61,13 @@ public:
virtual ~VhtPhy ();
// Inherited
virtual WifiMode GetSigMode (WifiPpduField field, WifiTxVector txVector) const override;
virtual WifiMode GetSigMode (WifiPpduField field, const WifiTxVector& txVector) const override;
virtual const PpduFormats & GetPpduFormats (void) const override;
virtual Time GetDuration (WifiPpduField field, WifiTxVector txVector) const override;
virtual Time GetDuration (WifiPpduField field, const WifiTxVector& txVector) const override;
virtual Time GetLSigDuration (WifiPreamble preamble) const override;
virtual Time GetTrainingDuration (WifiTxVector txVector,
virtual Time GetTrainingDuration (const WifiTxVector& txVector,
uint8_t nDataLtf, uint8_t nExtensionLtf = 0) const override;
virtual Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, Time ppduDuration) override;
virtual Ptr<WifiPpdu> BuildPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, Time ppduDuration) override;
/**
* \return the WifiMode used for the SIG-A field
@@ -77,7 +77,7 @@ public:
* \param txVector the transmission parameters
* \return the WifiMode used for the SIG-B field
*/
virtual WifiMode GetSigBMode (WifiTxVector txVector) const;
virtual WifiMode GetSigBMode (const WifiTxVector& txVector) const;
/**
* \param preamble the type of preamble
@@ -88,7 +88,7 @@ public:
* \param txVector the transmission parameters
* \return the duration of the SIG-B field
*/
virtual Time GetSigBDuration (WifiTxVector txVector) const;
virtual Time GetSigBDuration (const WifiTxVector& txVector) const;
/**
* Initialize all VHT modes.
@@ -208,7 +208,7 @@ public:
* \param staId the station ID (only here to have a common signature for all callbacks)
* \return the data bit rate in bps.
*/
static uint64_t GetDataRateFromTxVector (WifiTxVector txVector, uint16_t staId);
static uint64_t GetDataRateFromTxVector (const WifiTxVector& txVector, uint16_t staId);
/**
* Return the data rate corresponding to
* the supplied VHT MCS index, channel width,
@@ -246,7 +246,7 @@ protected:
// Inherited
WifiMode GetHtSigMode (void) const override;
Time GetHtSigDuration (void) const override;
virtual uint8_t GetNumberBccEncoders (WifiTxVector txVector) const override;
virtual uint8_t GetNumberBccEncoders (const WifiTxVector& txVector) const override;
virtual PhyFieldRxStatus DoEndReceiveField (WifiPpduField field, Ptr<Event> event) override;
virtual bool IsAllConfigSupported (WifiPpduField field, Ptr<const WifiPpdu> ppdu) const override;

View File

@@ -30,7 +30,7 @@ namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("VhtPpdu");
VhtPpdu::VhtPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, Time ppduDuration,
VhtPpdu::VhtPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, Time ppduDuration,
WifiPhyBand band, uint64_t uid)
: OfdmPpdu (psdu, txVector, band, uid, false) //don't instantiate LSigHeader of OfdmPpdu
{
@@ -70,7 +70,7 @@ Time
VhtPpdu::GetTxDuration (void) const
{
Time ppduDuration = Seconds (0);
WifiTxVector txVector = GetTxVector ();
const WifiTxVector& txVector = GetTxVector ();
Time tSymbol = NanoSeconds (3200 + txVector.GetGuardInterval ());
Time preambleDuration = WifiPhy::CalculatePhyPreambleAndHeaderDuration (txVector);
Time calculatedDuration = MicroSeconds (((ceil (static_cast<double> (m_lSig.GetLength () + 3) / 3)) * 4) + 20);

View File

@@ -160,7 +160,7 @@ public:
* \param band the WifiPhyBand used for the transmission of this PPDU
* \param uid the unique ID of this PPDU
*/
VhtPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, Time ppduDuration,
VhtPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, Time ppduDuration,
WifiPhyBand band, uint64_t uid);
/**
* Destructor for VhtPpdu.

View File

@@ -66,7 +66,7 @@ WifiMode::GetPhyRate (uint16_t channelWidth, uint16_t guardInterval, uint8_t nss
}
uint64_t
WifiMode::GetPhyRate (WifiTxVector txVector) const
WifiMode::GetPhyRate (const WifiTxVector& txVector) const
{
return GetPhyRate (txVector.GetChannelWidth (), txVector.GetGuardInterval (), txVector.GetNss ());
}
@@ -78,7 +78,7 @@ WifiMode::GetDataRate (uint16_t channelWidth) const
}
uint64_t
WifiMode::GetDataRate (WifiTxVector txVector, uint16_t staId) const
WifiMode::GetDataRate (const WifiTxVector& txVector, uint16_t staId) const
{
WifiModeFactory::WifiModeItem *item = WifiModeFactory::GetFactory ()->Get (m_uid);
return item->GetDataRateFromTxVectorCallback (txVector, staId);
@@ -385,7 +385,7 @@ WifiModeFactory::GetFactory (void)
item->GetConstellationSizeCallback = MakeNullCallback<uint16_t> ();
item->GetPhyRateCallback = MakeNullCallback<uint64_t, uint16_t, uint16_t, uint8_t> ();
item->GetDataRateCallback = MakeNullCallback<uint64_t, uint16_t, uint16_t, uint8_t> ();
item->GetDataRateFromTxVectorCallback = MakeNullCallback<uint64_t, WifiTxVector, uint16_t> ();
item->GetDataRateFromTxVectorCallback = MakeNullCallback<uint64_t, const WifiTxVector&, uint16_t> ();
item->GetNonHtReferenceRateCallback = MakeNullCallback<uint64_t> ();
item->IsModeAllowedCallback = MakeNullCallback<bool, uint16_t, uint8_t> ();
isFirstTime = false;

View File

@@ -88,14 +88,14 @@ public:
*/
uint64_t GetPhyRate (uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const;
/**
* \param txVector the WifiTxVector of the signal
* \param txVector the const WifiTxVector& of the signal
*
* \returns the physical bit rate of this signal in bps.
*
* If a transmission mode uses 1/2 FEC, and if its
* data rate is 3.25Mbps, the PHY rate is 6.5Mbps
*/
uint64_t GetPhyRate (WifiTxVector txVector) const;
uint64_t GetPhyRate (const WifiTxVector& txVector) const;
/**
*
* \param channelWidth the considered channel width in MHz
@@ -106,12 +106,12 @@ public:
*/
uint64_t GetDataRate (uint16_t channelWidth, uint16_t guardInterval, uint8_t nss) const;
/**
* \param txVector the WifiTxVector of the signal
* \param txVector the const WifiTxVector& of the signal
* \param staId the station ID for MU (unused if SU)
*
* \returns the data bit rate of this signal.
*/
uint64_t GetDataRate (WifiTxVector txVector, uint16_t staId = SU_STA_ID) const;
uint64_t GetDataRate (const WifiTxVector& txVector, uint16_t staId = SU_STA_ID) const;
/**
* \param channelWidth the considered channel width in MHz
*
@@ -305,7 +305,7 @@ public:
* \param staId the station ID
* \return the data rate of the signal in bps.
*/
typedef Callback<uint64_t, WifiTxVector /* txVector */, uint16_t /* staId */> DataRateFromTxVectorCallback;
typedef Callback<uint64_t, const WifiTxVector& /* txVector */, uint16_t /* staId */> DataRateFromTxVectorCallback;
/**
* Typedef for callback used to calculate Non-HT Reference Rate of
* an MCS defined in HT or later amendment. For Non-HT modes (DSSS, OFDM,

View File

@@ -860,7 +860,7 @@ WifiPhy::GetChannelSwitchDelay (void) const
}
double
WifiPhy::CalculateSnr (WifiTxVector txVector, double ber) const
WifiPhy::CalculateSnr (const WifiTxVector& txVector, double ber) const
{
return m_interference.GetErrorRateModel ()->CalculateSnr (txVector, ber);
}
@@ -1807,13 +1807,13 @@ WifiPhy::GetPreambleDetectionDuration (void)
}
Time
WifiPhy::GetStartOfPacketDuration (WifiTxVector txVector)
WifiPhy::GetStartOfPacketDuration (const WifiTxVector& txVector)
{
return MicroSeconds (4);
}
Time
WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand band, MpduType mpdutype, uint16_t staId)
WifiPhy::GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype, uint16_t staId)
{
uint32_t totalAmpduSize;
double totalAmpduNumSymbols;
@@ -1821,7 +1821,7 @@ WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand b
}
Time
WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand band, MpduType mpdutype,
WifiPhy::GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype,
bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols,
uint16_t staId)
{
@@ -1831,19 +1831,19 @@ WifiPhy::GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand b
}
Time
WifiPhy::CalculatePhyPreambleAndHeaderDuration (WifiTxVector txVector)
WifiPhy::CalculatePhyPreambleAndHeaderDuration (const WifiTxVector& txVector)
{
return GetStaticPhyEntity (txVector.GetModulationClass ())->CalculatePhyPreambleAndHeaderDuration (txVector);
}
Time
WifiPhy::GetPpduFieldDuration (WifiPpduField field, WifiTxVector txVector)
WifiPhy::GetPpduFieldDuration (WifiPpduField field, const WifiTxVector& txVector)
{
return GetStaticPhyEntity (txVector.GetModulationClass ())->GetDuration (field, txVector);
}
Time
WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand band, uint16_t staId)
WifiPhy::CalculateTxDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, uint16_t staId)
{
Time duration = CalculatePhyPreambleAndHeaderDuration (txVector)
+ GetPayloadDuration (size, txVector, band, NORMAL_MPDU, staId);
@@ -1852,7 +1852,7 @@ WifiPhy::CalculateTxDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand
}
Time
WifiPhy::CalculateTxDuration (WifiConstPsduMap psduMap, WifiTxVector txVector, WifiPhyBand band)
WifiPhy::CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band)
{
return GetStaticPhyEntity (txVector.GetModulationClass ())->CalculateTxDuration (psduMap, txVector, band);
}
@@ -1983,7 +1983,7 @@ WifiPhy::NotifyMonitorSniffTx (Ptr<const WifiPsdu> psdu, uint16_t channelFreqMhz
}
void
WifiPhy::Send (Ptr<const WifiPsdu> psdu, WifiTxVector txVector)
WifiPhy::Send (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector)
{
NS_LOG_FUNCTION (this << *psdu << txVector);
WifiConstPsduMap psdus;
@@ -2431,7 +2431,7 @@ double
WifiPhy::GetTxPowerForTransmission (Ptr<const WifiPpdu> ppdu) const
{
NS_LOG_FUNCTION (this << m_powerRestricted << ppdu);
WifiTxVector txVector = ppdu->GetTxVector ();
const WifiTxVector& txVector = ppdu->GetTxVector ();
// Get transmit power before antenna gain
double txPowerDbm;
if (!m_powerRestricted)

View File

@@ -136,7 +136,7 @@ public:
* this PSDU, and txPowerLevel, a power level to use to send the whole PPDU. The real transmission
* power is calculated as txPowerMin + txPowerLevel * (txPowerMax - txPowerMin) / nTxLevels
*/
void Send (Ptr<const WifiPsdu> psdu, WifiTxVector txVector);
void Send (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector);
/**
* \param psdus the PSDUs to send
* \param txVector the TXVECTOR that has tx parameters such as mode, the transmission mode to use to send
@@ -225,7 +225,7 @@ public:
*
* \return the total amount of time this PHY will stay busy for the transmission of these bytes.
*/
static Time CalculateTxDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand band,
static Time CalculateTxDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band,
uint16_t staId = SU_STA_ID);
/**
* \param psduMap the PSDU(s) to transmit indexed by STA-ID
@@ -234,14 +234,14 @@ public:
*
* \return the total amount of time this PHY will stay busy for the transmission of the PPDU
*/
static Time CalculateTxDuration (WifiConstPsduMap psduMap, WifiTxVector txVector, WifiPhyBand band);
static Time CalculateTxDuration (WifiConstPsduMap psduMap, const WifiTxVector& txVector, WifiPhyBand band);
/**
* \param txVector the transmission parameters used for this packet
*
* \return the total amount of time this PHY will stay busy for the transmission of the PHY preamble and PHY header.
*/
static Time CalculatePhyPreambleAndHeaderDuration (WifiTxVector txVector);
static Time CalculatePhyPreambleAndHeaderDuration (const WifiTxVector& txVector);
/**
* Get the duration of the PPDU field (or group of fields)
* for the given transmission parameters.
@@ -251,7 +251,7 @@ public:
*
* \return the duration of the PPDU field
*/
static Time GetPpduFieldDuration (WifiPpduField field, WifiTxVector txVector);
static Time GetPpduFieldDuration (WifiPpduField field, const WifiTxVector& txVector);
/**
* \return the preamble detection duration, which is the time correlation needs to detect the start of an incoming frame.
*/
@@ -265,7 +265,7 @@ public:
*
* \return the duration of the PSDU
*/
static Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand band, MpduType mpdutype = NORMAL_MPDU,
static Time GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype = NORMAL_MPDU,
uint16_t staId = SU_STA_ID);
/**
* \param size the number of bytes in the packet to send
@@ -283,7 +283,7 @@ public:
*
* \return the duration of the PSDU
*/
static Time GetPayloadDuration (uint32_t size, WifiTxVector txVector, WifiPhyBand band, MpduType mpdutype,
static Time GetPayloadDuration (uint32_t size, const WifiTxVector& txVector, WifiPhyBand band, MpduType mpdutype,
bool incFlag, uint32_t &totalAmpduSize, double &totalAmpduNumSymbols,
uint16_t staId);
/**
@@ -291,7 +291,7 @@ public:
*
* \return the duration until the start of the packet
*/
static Time GetStartOfPacketDuration (WifiTxVector txVector);
static Time GetStartOfPacketDuration (const WifiTxVector& txVector);
/**
* The WifiPhy::GetModeList() method is used
@@ -353,7 +353,7 @@ public:
* \return the minimum SNR which is required to achieve
* the requested BER for the specified transmission vector. (W/W)
*/
double CalculateSnr (WifiTxVector txVector, double ber) const;
double CalculateSnr (const WifiTxVector& txVector, double ber) const;
/**
* Set the Short Interframe Space (SIFS) for this PHY.

View File

@@ -27,7 +27,7 @@ namespace ns3 {
NS_LOG_COMPONENT_DEFINE ("WifiPpdu");
WifiPpdu::WifiPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, uint64_t uid /* = UINT64_MAX */)
WifiPpdu::WifiPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, uint64_t uid /* = UINT64_MAX */)
: m_preamble (txVector.GetPreambleType ()),
m_modulation (txVector.IsValid () ? txVector.GetModulationClass () : WIFI_MOD_CLASS_UNKNOWN),
m_uid (uid),
@@ -38,7 +38,7 @@ WifiPpdu::WifiPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, uint64_t ui
m_psdus.insert (std::make_pair (SU_STA_ID, psdu));
}
WifiPpdu::WifiPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, uint64_t uid)
WifiPpdu::WifiPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, uint64_t uid)
: m_preamble (txVector.GetPreambleType ()),
m_modulation (txVector.IsValid () ? txVector.GetMode (psdus.begin()->first).GetModulationClass () : WIFI_MOD_CLASS_UNKNOWN),
m_uid (uid),

View File

@@ -58,7 +58,7 @@ public:
* \param txVector the TXVECTOR that was used for this PPDU
* \param uid the unique ID of this PPDU
*/
WifiPpdu (Ptr<const WifiPsdu> psdu, WifiTxVector txVector, uint64_t uid = UINT64_MAX);
WifiPpdu (Ptr<const WifiPsdu> psdu, const WifiTxVector& txVector, uint64_t uid = UINT64_MAX);
/**
* Create a PPDU storing a map of PSDUs.
*
@@ -66,7 +66,7 @@ public:
* \param txVector the TXVECTOR that was used for this PPDU
* \param uid the unique ID of this PPDU
*/
WifiPpdu (const WifiConstPsduMap & psdus, WifiTxVector txVector, uint64_t uid);
WifiPpdu (const WifiConstPsduMap & psdus, const WifiTxVector& txVector, uint64_t uid);
/**
* Destructor for WifiPpdu.
*/

View File

@@ -179,7 +179,7 @@ YansErrorRateModel::GetFecQamBer (double snr, uint64_t nbits,
}
double
YansErrorRateModel::DoGetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const
YansErrorRateModel::DoGetChunkSuccessRate (WifiMode mode, const WifiTxVector& txVector, double snr, uint64_t nbits) const
{
NS_LOG_FUNCTION (this << mode << txVector.GetMode () << snr << nbits);
if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM

View File

@@ -64,7 +64,7 @@ public:
private:
//Inherited from ErrorRateModel
double DoGetChunkSuccessRate (WifiMode mode, WifiTxVector txVector, double snr, uint64_t nbits) const;
double DoGetChunkSuccessRate (WifiMode mode, const WifiTxVector& txVector, double snr, uint64_t nbits) const;
/**
* Return BER of BPSK with the given parameters.
*