wifi: Use dBm_per_Hz_u and dBm_per_MHz_u weak aliases

This commit is contained in:
Sébastien Deronne
2024-07-05 07:55:08 +02:00
committed by Sébastien Deronne
parent 8b54d54f1e
commit 9ffc5f6290
4 changed files with 12 additions and 12 deletions

View File

@@ -730,7 +730,7 @@ main(int argc, char* argv[])
// Configure signal and noise, and schedule first iteration
const auto BOLTZMANN = 1.3803e-23;
const auto noiseDensity = WToDbm(BOLTZMANN * 290); // 290K @ 20 MHz
const dBm_per_Hz_u noiseDensity = WToDbm(BOLTZMANN * 290); // 290K @ 20 MHz
const dBm_u noise = noiseDensity + (10 * log10(clientSelectedStandard.m_width * 1000000));
NS_LOG_DEBUG("Channel width " << wifiPhyPtrClient->GetChannelWidth() << " noise " << noise);

View File

@@ -292,7 +292,7 @@ WifiPhy::GetTypeId()
"limit (in dBm/MHz) set by regulators.",
DoubleValue(100.0), // set to a high value so as to have no effect
MakeDoubleAccessor(&WifiPhy::m_powerDensityLimit),
MakeDoubleChecker<double>())
MakeDoubleChecker<dBm_per_MHz_u>())
.AddAttribute("NotifyMacHdrRxEnd",
"Whether the PHY is capable of notifying the MAC about the end of "
"the reception of the MAC header of every MPDU.",
@@ -2307,7 +2307,7 @@ WifiPhy::GetTxPowerForTransmission(Ptr<const WifiPpdu> ppdu) const
// Apply power density constraint on EIRP
const auto channelWidth = ppdu->GetTxChannelWidth();
double txPowerDbmPerMhz =
dBm_per_MHz_u txPowerDbmPerMhz =
(txPower + GetTxGain()) - RatioToDb(channelWidth); // account for antenna gain since EIRP
NS_LOG_INFO("txPower=" << txPower << "dBm with txPowerDbmPerMhz=" << txPowerDbmPerMhz
<< " over " << channelWidth << " MHz");

View File

@@ -1598,12 +1598,12 @@ class WifiPhy : public Object
dBm_u m_ccaSensitivityThreshold; //!< Clear channel assessment (CCA) modulation and coding rate
//!< sensitivity threshold
dB_u m_txGain; //!< Transmission gain
dB_u m_rxGain; //!< Reception gain
dBm_u m_txPowerBase; //!< Minimum transmission power
dBm_u m_txPowerEnd; //!< Maximum transmission power
uint8_t m_nTxPower; //!< Number of available transmission power levels
double m_powerDensityLimit; //!< the power density limit (dBm/MHz)
dB_u m_txGain; //!< Transmission gain
dB_u m_rxGain; //!< Reception gain
dBm_u m_txPowerBase; //!< Minimum transmission power
dBm_u m_txPowerEnd; //!< Maximum transmission power
uint8_t m_nTxPower; //!< Number of available transmission power levels
dBm_per_MHz_u m_powerDensityLimit; //!< the power density limit
bool m_powerRestricted; //!< Flag whether transmit power is restricted by OBSS PD SR
dBm_u m_txPowerMaxSiso; //!< SISO maximum transmit power due to OBSS PD SR power restriction

View File

@@ -3003,9 +3003,9 @@ class TestUlOfdmaPhyTransmission : public TestCase
/**
* Set the PSD limit
* \param phy the PHY
* \param psdLimit the PSD limit in dBm/MHz
* \param psdLimit the PSD limit
*/
void SetPsdLimit(Ptr<WifiPhy> phy, double psdLimit);
void SetPsdLimit(Ptr<WifiPhy> phy, dBm_per_MHz_u psdLimit);
/**
* Generate interference function
@@ -3685,7 +3685,7 @@ TestUlOfdmaPhyTransmission::SetBssColor(Ptr<WifiPhy> phy, uint8_t bssColor)
}
void
TestUlOfdmaPhyTransmission::SetPsdLimit(Ptr<WifiPhy> phy, double psdLimit)
TestUlOfdmaPhyTransmission::SetPsdLimit(Ptr<WifiPhy> phy, dBm_per_MHz_u psdLimit)
{
NS_LOG_FUNCTION(this << phy << psdLimit);
phy->SetAttribute("PowerDensityLimit", DoubleValue(psdLimit));