From 9ffc5f6290e68648b6696b19069dab1eba1feada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deronne?= Date: Fri, 5 Jul 2024 07:55:08 +0200 Subject: [PATCH] wifi: Use dBm_per_Hz_u and dBm_per_MHz_u weak aliases --- src/wifi/examples/wifi-manager-example.cc | 2 +- src/wifi/model/wifi-phy.cc | 4 ++-- src/wifi/model/wifi-phy.h | 12 ++++++------ src/wifi/test/wifi-phy-ofdma-test.cc | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/wifi/examples/wifi-manager-example.cc b/src/wifi/examples/wifi-manager-example.cc index aeec4c5a6..68f353104 100644 --- a/src/wifi/examples/wifi-manager-example.cc +++ b/src/wifi/examples/wifi-manager-example.cc @@ -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); diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 425d296e1..ce59dbfa4 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -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()) + MakeDoubleChecker()) .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 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"); diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index 9f07074d3..9212105f9 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -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 diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index e4b9440d6..70b29f224 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -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 phy, double psdLimit); + void SetPsdLimit(Ptr phy, dBm_per_MHz_u psdLimit); /** * Generate interference function @@ -3685,7 +3685,7 @@ TestUlOfdmaPhyTransmission::SetBssColor(Ptr phy, uint8_t bssColor) } void -TestUlOfdmaPhyTransmission::SetPsdLimit(Ptr phy, double psdLimit) +TestUlOfdmaPhyTransmission::SetPsdLimit(Ptr phy, dBm_per_MHz_u psdLimit) { NS_LOG_FUNCTION(this << phy << psdLimit); phy->SetAttribute("PowerDensityLimit", DoubleValue(psdLimit));