diff --git a/examples/wireless/wifi-eht-network.cc b/examples/wireless/wifi-eht-network.cc index 5ebbd9d73..407107712 100644 --- a/examples/wireless/wifi-eht-network.cc +++ b/examples/wireless/wifi-eht-network.cc @@ -527,8 +527,12 @@ main(int argc, char* argv[]) clientNodes.Add(downlink ? wifiApNode.Get(0) : wifiStaNodes.Get(i)); } - const auto maxLoad = - nLinks * EhtPhy::GetDataRate(mcs, width, NanoSeconds(gi), 1) / nStations; + const auto maxLoad = nLinks * + EhtPhy::GetDataRate(mcs, + MHz_u{static_cast(width)}, + NanoSeconds(gi), + 1) / + nStations; if (udp) { // UDP flow diff --git a/examples/wireless/wifi-he-network.cc b/examples/wireless/wifi-he-network.cc index bd9021ec5..407d39442 100644 --- a/examples/wireless/wifi-he-network.cc +++ b/examples/wireless/wifi-he-network.cc @@ -398,7 +398,9 @@ main(int argc, char* argv[]) clientNodes.Add(downlink ? wifiApNode.Get(0) : wifiStaNodes.Get(i)); } - const auto maxLoad = HePhy::GetDataRate(mcs, width, NanoSeconds(gi), 1) / nStations; + const auto maxLoad = + HePhy::GetDataRate(mcs, MHz_u{static_cast(width)}, NanoSeconds(gi), 1) / + nStations; if (udp) { // UDP flow diff --git a/examples/wireless/wifi-ht-network.cc b/examples/wireless/wifi-ht-network.cc index afb4d05ec..701652053 100644 --- a/examples/wireless/wifi-ht-network.cc +++ b/examples/wireless/wifi-ht-network.cc @@ -267,8 +267,10 @@ main(int argc, char* argv[]) apNodeInterface = address.Assign(apDevice); /* Setting applications */ - const auto maxLoad = - HtPhy::GetDataRate(mcs, width, NanoSeconds(sgi ? 400 : 800), 1); + const auto maxLoad = HtPhy::GetDataRate(mcs, + MHz_u{static_cast(width)}, + NanoSeconds(sgi ? 400 : 800), + 1); ApplicationContainer serverApp; if (udp) { diff --git a/examples/wireless/wifi-power-adaptation-distance.cc b/examples/wireless/wifi-power-adaptation-distance.cc index a3082b06f..e03ac21c7 100644 --- a/examples/wireless/wifi-power-adaptation-distance.cc +++ b/examples/wireless/wifi-power-adaptation-distance.cc @@ -281,7 +281,7 @@ NodeStatistics::PhyCallback(std::string path, Ptr packet, double p void NodeStatistics::PowerCallback(std::string path, double oldPower, double newPower, Mac48Address dest) { - m_currentPower[dest] = newPower; + m_currentPower[dest] = dBm_u{newPower}; } void diff --git a/examples/wireless/wifi-power-adaptation-interference.cc b/examples/wireless/wifi-power-adaptation-interference.cc index 60cc17cbf..9988f2174 100644 --- a/examples/wireless/wifi-power-adaptation-interference.cc +++ b/examples/wireless/wifi-power-adaptation-interference.cc @@ -302,7 +302,7 @@ NodeStatistics::PhyCallback(std::string path, Ptr packet, double p void NodeStatistics::PowerCallback(std::string path, double oldPower, double newPower, Mac48Address dest) { - m_currentPower[dest] = newPower; + m_currentPower[dest] = dBm_u{newPower}; } void diff --git a/examples/wireless/wifi-vht-network.cc b/examples/wireless/wifi-vht-network.cc index 82bc4eb9f..8790760f5 100644 --- a/examples/wireless/wifi-vht-network.cc +++ b/examples/wireless/wifi-vht-network.cc @@ -300,8 +300,10 @@ main(int argc, char* argv[]) apNodeInterface = address.Assign(apDevice); /* Setting applications */ - const auto maxLoad = - VhtPhy::GetDataRate(mcs, width, NanoSeconds(sgi ? 400 : 800), 1); + const auto maxLoad = VhtPhy::GetDataRate(mcs, + MHz_u{static_cast(width)}, + NanoSeconds(sgi ? 400 : 800), + 1); ApplicationContainer serverApp; if (udp) { diff --git a/src/wifi/examples/wifi-manager-example.cc b/src/wifi/examples/wifi-manager-example.cc index 2d02b12c0..80fbfb320 100644 --- a/src/wifi/examples/wifi-manager-example.cc +++ b/src/wifi/examples/wifi-manager-example.cc @@ -210,8 +210,8 @@ main(int argc, char* argv[]) uint16_t clientNss = 1; uint16_t serverShortGuardInterval = 800; uint16_t clientShortGuardInterval = 800; - uint16_t serverChannelWidth = 0; // use default for standard and band - uint16_t clientChannelWidth = 0; // use default for standard and band + MHz_u serverChannelWidth{0}; // use default for standard and band + MHz_u clientChannelWidth{0}; // use default for standard and band std::string wifiManager("Ideal"); std::string standard("802.11a"); StandardInfo serverSelectedStandard; diff --git a/src/wifi/examples/wifi-test-interference-helper.cc b/src/wifi/examples/wifi-test-interference-helper.cc index 8c1519233..e5e421d1d 100644 --- a/src/wifi/examples/wifi-test-interference-helper.cc +++ b/src/wifi/examples/wifi-test-interference-helper.cc @@ -77,8 +77,8 @@ class InterferenceExperiment meter_u xB; ///< x B std::string txModeA; ///< transmit mode A std::string txModeB; ///< transmit mode B - double txPowerLevelA; ///< transmit power level A - double txPowerLevelB; ///< transmit power level B + dBm_u txPowerLevelA; ///< transmit power level A + dBm_u txPowerLevelB; ///< transmit power level B uint32_t packetSizeA; ///< packet size A uint32_t packetSizeB; ///< packet size B uint16_t channelA; ///< channel number A @@ -89,7 +89,7 @@ class InterferenceExperiment WifiPhyBand band; ///< band WifiPreamble preamble; ///< preamble bool captureEnabled; ///< whether physical layer capture is enabled - double captureMargin; ///< margin used for physical layer capture + dB_u captureMargin; ///< margin used for physical layer capture }; InterferenceExperiment(); diff --git a/src/wifi/model/he/he-phy.cc b/src/wifi/model/he/he-phy.cc index 82cfa1a55..c9e122b0a 100644 --- a/src/wifi/model/he/he-phy.cc +++ b/src/wifi/model/he/he-phy.cc @@ -1228,7 +1228,7 @@ HePhy::GetPer20MHzDurations(const Ptr ppdu) if (ppduBw <= m_wifiPhy->GetChannelWidth() && ppdu->DoesOverlapChannel(subchannelMinFreq, subchannelMaxFreq)) { - std::optional obssPdLevel{std::nullopt}; + std::optional obssPdLevel{std::nullopt}; if (m_obssPdAlgorithm) { obssPdLevel = m_obssPdAlgorithm->GetObssPdLevel(); diff --git a/src/wifi/model/phy-entity.cc b/src/wifi/model/phy-entity.cc index 60ad464ed..874c92f24 100644 --- a/src/wifi/model/phy-entity.cc +++ b/src/wifi/model/phy-entity.cc @@ -693,7 +693,7 @@ PhyEntity::EndOfMpdu(Ptr event, signalNoiseIt->second = rxInfo.second; RxSignalInfo rxSignalInfo; - rxSignalInfo.snr = DbToRatio(rxInfo.second.signal - rxInfo.second.noise); + rxSignalInfo.snr = DbToRatio(dB_u{rxInfo.second.signal - rxInfo.second.noise}); rxSignalInfo.rssi = rxInfo.second.signal; auto statusPerMpduIt = m_statusPerMpduMap.find({ppdu->GetUid(), staId}); diff --git a/src/wifi/model/spectrum-wifi-phy.cc b/src/wifi/model/spectrum-wifi-phy.cc index ca1488146..0bb921438 100644 --- a/src/wifi/model/spectrum-wifi-phy.cc +++ b/src/wifi/model/spectrum-wifi-phy.cc @@ -684,7 +684,7 @@ SpectrumWifiPhy::GetGuardBandwidth(MHz_u currentChannelWidth) const uint32_t SpectrumWifiPhy::GetNumBandsBetweenSegments(const std::vector& centerFrequencies, MHz_u totalWidth, - uint32_t subcarrierSpacing) + Hz_u subcarrierSpacing) { const auto numSegments = centerFrequencies.size(); NS_ABORT_MSG_IF(numSegments > 2, "Only 2 non-contiguous frequency segments are supported"); @@ -789,7 +789,7 @@ SpectrumWifiPhy::ConvertIndicesToFrequenciesForInterface( auto startGuardBand = rxSpectrumModel->Begin(); auto startChannel = std::next(startGuardBand, indices.first); auto endChannel = std::next(startGuardBand, indices.second + 1); - return {startChannel->fc, endChannel->fc}; + return {Hz_u{startChannel->fc}, Hz_u{endChannel->fc}}; } std::tuple diff --git a/src/wifi/model/spectrum-wifi-phy.h b/src/wifi/model/spectrum-wifi-phy.h index 42955a829..4a46b40b7 100644 --- a/src/wifi/model/spectrum-wifi-phy.h +++ b/src/wifi/model/spectrum-wifi-phy.h @@ -177,7 +177,7 @@ class SpectrumWifiPhy : public WifiPhy */ static uint32_t GetNumBandsBetweenSegments(const std::vector& centerFrequencies, MHz_u totalWidth, - uint32_t subcarrierSpacing); + Hz_u subcarrierSpacing); /** * @param callback the callback to invoke when operating channel has switched. diff --git a/src/wifi/model/table-based-error-rate-model.cc b/src/wifi/model/table-based-error-rate-model.cc index 324b850a2..c09a5ab0d 100644 --- a/src/wifi/model/table-based-error-rate-model.cc +++ b/src/wifi/model/table-based-error-rate-model.cc @@ -70,7 +70,7 @@ TableBasedErrorRateModel::RoundSnr(dB_u snr, double precision) const { NS_LOG_FUNCTION(this << snr); const auto multiplier = std::round(std::pow(10.0, precision)); - return std::floor(snr * multiplier + 0.5) / multiplier; + return dB_u{std::floor(snr * multiplier + 0.5) / multiplier}; } std::optional diff --git a/src/wifi/model/wifi-phy.cc b/src/wifi/model/wifi-phy.cc index 85eafb2f6..2c2f684a6 100644 --- a/src/wifi/model/wifi-phy.cc +++ b/src/wifi/model/wifi-phy.cc @@ -724,7 +724,7 @@ WifiPhy::GetPower(uint8_t powerLevel) const dBm_u dbm; if (m_nTxPower > 1) { - dbm = m_txPowerBase + powerLevel * (m_txPowerEnd - m_txPowerBase) / (m_nTxPower - 1); + dbm = m_txPowerBase + dB_u{powerLevel * (m_txPowerEnd - m_txPowerBase) / (m_nTxPower - 1)}; } else { diff --git a/src/wifi/model/wifi-phy.h b/src/wifi/model/wifi-phy.h index ef2c260f6..da8ccc72f 100644 --- a/src/wifi/model/wifi-phy.h +++ b/src/wifi/model/wifi-phy.h @@ -987,7 +987,8 @@ class WifiPhy : public Object * @return the bandwidth for the transmission */ MHz_u GetTxBandwidth(WifiMode mode, - MHz_u maxAllowedBandWidth = std::numeric_limits::max()) const; + MHz_u maxAllowedBandWidth = MHz_u{ + std::numeric_limits::max()}) const; /** * @param antennas the number of antennas on this node. */ diff --git a/src/wifi/model/wifi-spectrum-value-helper.cc b/src/wifi/model/wifi-spectrum-value-helper.cc index 4ab719705..1bdcede19 100644 --- a/src/wifi/model/wifi-spectrum-value-helper.cc +++ b/src/wifi/model/wifi-spectrum-value-helper.cc @@ -892,7 +892,7 @@ WifiSpectrumValueHelper::CreateSpectrumMaskForOfdm( (i <= betweenPsdsBand->second && i >= betweenPsdsBand->first)) { // value for PSD mask 1 - std::vector txPowerWPsds(2); + std::vector txPowerWPsds(2); if (i <= middleBandsRight.at(0).second && i >= middleBandsRight.at(0).first) { txPowerWPsds.at(0) = diff --git a/src/wifi/model/yans-wifi-channel.cc b/src/wifi/model/yans-wifi-channel.cc index 3fc7eb322..db257f594 100644 --- a/src/wifi/model/yans-wifi-channel.cc +++ b/src/wifi/model/yans-wifi-channel.cc @@ -93,7 +93,7 @@ YansWifiChannel::Send(Ptr sender, Ptr ppdu, dBm_u t auto receiverMobility = (*i)->GetMobility()->GetObject(); const auto delay = m_delay->GetDelay(senderMobility, receiverMobility); - const auto rxPower = m_loss->CalcRxPower(txPower, senderMobility, receiverMobility); + const dBm_u rxPower{m_loss->CalcRxPower(txPower, senderMobility, receiverMobility)}; NS_LOG_DEBUG("propagation: txPower=" << txPower << "dBm, rxPower=" << rxPower << "dBm, " << "distance=" << senderMobility->GetDistanceFrom(receiverMobility) diff --git a/src/wifi/test/inter-bss-test-suite.cc b/src/wifi/test/inter-bss-test-suite.cc index 9127a5ff0..eb162bb5e 100644 --- a/src/wifi/test/inter-bss-test-suite.cc +++ b/src/wifi/test/inter-bss-test-suite.cc @@ -665,31 +665,32 @@ TestInterBssConstantObssPdAlgo::NotifyPhyTxBegin(std::string context, { uint32_t idx = ConvertContextToNodeId(context); uint32_t pktSize = p->GetSize() - 38; + Watt_u txPower{txPowerW}; if ((idx == 0) && ((pktSize == m_payloadSize1) || (pktSize == (m_payloadSize1 / 10)))) { m_numSta1PacketsSent++; - NS_TEST_EXPECT_MSG_EQ(TestDoubleIsEqual(WToDbm(txPowerW), m_expectedTxPower, 1e-12), + NS_TEST_EXPECT_MSG_EQ(TestDoubleIsEqual(WToDbm(txPower), m_expectedTxPower, 1e-12), true, "Tx power is not correct!"); } else if ((idx == 1) && ((pktSize == m_payloadSize2) || (pktSize == (m_payloadSize2 / 10)))) { m_numSta2PacketsSent++; - NS_TEST_EXPECT_MSG_EQ(TestDoubleIsEqual(WToDbm(txPowerW), m_expectedTxPower, 1e-12), + NS_TEST_EXPECT_MSG_EQ(TestDoubleIsEqual(WToDbm(txPower), m_expectedTxPower, 1e-12), true, "Tx power is not correct!"); } else if ((idx == 3) && ((pktSize == m_payloadSize1) || (pktSize == (m_payloadSize1 / 10)))) { m_numAp1PacketsSent++; - NS_TEST_EXPECT_MSG_EQ(TestDoubleIsEqual(WToDbm(txPowerW), m_expectedTxPower, 1e-12), + NS_TEST_EXPECT_MSG_EQ(TestDoubleIsEqual(WToDbm(txPower), m_expectedTxPower, 1e-12), true, "Tx power is not correct!"); } else if ((idx == 4) && ((pktSize == m_payloadSize2) || (pktSize == (m_payloadSize2 / 10)))) { m_numAp2PacketsSent++; - NS_TEST_EXPECT_MSG_EQ(TestDoubleIsEqual(WToDbm(txPowerW), m_expectedTxPower, 1e-12), + NS_TEST_EXPECT_MSG_EQ(TestDoubleIsEqual(WToDbm(txPower), m_expectedTxPower, 1e-12), true, "Tx power is not correct!"); } diff --git a/src/wifi/test/wifi-emlsr-test.cc b/src/wifi/test/wifi-emlsr-test.cc index 130fda9c0..6e69dfe90 100644 --- a/src/wifi/test/wifi-emlsr-test.cc +++ b/src/wifi/test/wifi-emlsr-test.cc @@ -4693,7 +4693,7 @@ EmlsrLinkSwitchTest::CheckResults() } } -EmlsrCcaBusyTest::EmlsrCcaBusyTest(uint16_t auxPhyMaxChWidth) +EmlsrCcaBusyTest::EmlsrCcaBusyTest(MHz_u auxPhyMaxChWidth) : EmlsrOperationsTestBase(std::string("Check EMLSR link switching (auxPhyMaxChWidth=") + std::to_string(auxPhyMaxChWidth) + "MHz )"), m_auxPhyMaxChWidth(auxPhyMaxChWidth), diff --git a/src/wifi/test/wifi-emlsr-test.h b/src/wifi/test/wifi-emlsr-test.h index 0343bb13c..ec44f37e5 100644 --- a/src/wifi/test/wifi-emlsr-test.h +++ b/src/wifi/test/wifi-emlsr-test.h @@ -817,7 +817,7 @@ class EmlsrLinkSwitchTest : public EmlsrOperationsTestBase //!< with the link on which the main PHY has just //!< switched to, the second value controls whether //!< a main PHY channel switch can be interrupted - MHz_u auxPhyMaxChWidth; //!< max channel width (MHz) supported by aux PHYs + MHz_u auxPhyMaxChWidth; //!< max channel width supported by aux PHYs }; /** @@ -886,7 +886,7 @@ class EmlsrLinkSwitchTest : public EmlsrOperationsTestBase m_resetCamStateAndInterruptSwitch; /**< whether to reset the state of the ChannelAccessManager associated with the link on which the main PHY has just switched to and whether main PHY switch can be interrupted */ - MHz_u m_auxPhyMaxChWidth; //!< max channel width (MHz) supported by aux PHYs + MHz_u m_auxPhyMaxChWidth; //!< max channel width supported by aux PHYs std::size_t m_countQoSframes; //!< counter for QoS data frames std::size_t m_countIcfFrames; //!< counter for ICF frames std::size_t m_countRtsFrames; //!< counter for RTS frames @@ -931,9 +931,9 @@ class EmlsrCcaBusyTest : public EmlsrOperationsTestBase /** * Constructor * - * @param auxPhyMaxChWidth max channel width (MHz) supported by aux PHYs + * @param auxPhyMaxChWidth max channel width supported by aux PHYs */ - EmlsrCcaBusyTest(uint16_t auxPhyMaxChWidth); + EmlsrCcaBusyTest(MHz_u auxPhyMaxChWidth); ~EmlsrCcaBusyTest() override = default; @@ -966,7 +966,7 @@ class EmlsrCcaBusyTest : public EmlsrOperationsTestBase */ void CheckPoint3(); - uint16_t m_auxPhyMaxChWidth; //!< max channel width (MHz) supported by aux PHYs + MHz_u m_auxPhyMaxChWidth; //!< max channel width supported by aux PHYs Time m_channelSwitchDelay; //!< the PHY channel switch delay uint8_t m_currMainPhyLinkId; //!< the ID of the link the main PHY switches from uint8_t m_nextMainPhyLinkId; //!< the ID of the link the main PHY switches to diff --git a/src/wifi/test/wifi-mac-ofdma-test.cc b/src/wifi/test/wifi-mac-ofdma-test.cc index efb2697f6..a94a47856 100644 --- a/src/wifi/test/wifi-mac-ofdma-test.cc +++ b/src/wifi/test/wifi-mac-ofdma-test.cc @@ -400,7 +400,7 @@ class OfdmaAckSequenceTest : public TestCase */ struct Params { - MHz_u channelWidth; ///< PHY channel bandwidth in MHz + MHz_u channelWidth; ///< PHY channel bandwidth WifiAcknowledgment::Method dlMuAckType; ///< DL MU ack sequence type uint32_t maxAmpduSize; ///< maximum A-MPDU size in bytes uint16_t txopLimit; ///< TXOP limit in microseconds diff --git a/src/wifi/test/wifi-phy-ofdma-test.cc b/src/wifi/test/wifi-phy-ofdma-test.cc index 19631d9c5..159adb390 100644 --- a/src/wifi/test/wifi-phy-ofdma-test.cc +++ b/src/wifi/test/wifi-phy-ofdma-test.cc @@ -3555,7 +3555,7 @@ TestUlOfdmaPhyTransmission::CheckOfdmaRxPower(Ptr phy, * duration when calling GetEnergyDuration. */ NS_LOG_FUNCTION(this << band << expectedRxPower); - double step = 5e-3; + Watt_u step{5e-3}; if (expectedRxPower > 0.0) { NS_TEST_ASSERT_MSG_EQ( diff --git a/src/wifi/test/wifi-phy-rx-trace-helper-test.cc b/src/wifi/test/wifi-phy-rx-trace-helper-test.cc index 74adbf793..d5bc12c7a 100644 --- a/src/wifi/test/wifi-phy-rx-trace-helper-test.cc +++ b/src/wifi/test/wifi-phy-rx-trace-helper-test.cc @@ -84,25 +84,23 @@ class TestWifiPhyRxTraceHelper : public TestCase /** * Sends a PPDU containing two MPDUs addressed to specific receivers. - * @param rxPowerDbm The transmit power in dBm. + * @param rxPower The transmit power. * @param add1 The MAC address of the first receiver. * @param add2 The MAC address of the second receiver. * @param tx_phy The transmitting PHY object. */ - void SendPpduWithTwoMpdus(double rxPowerDbm, + void SendPpduWithTwoMpdus(dBm_u rxPower, Mac48Address add1, Mac48Address add2, Ptr tx_phy); /** * Sends a PPDU containing one MPDU addressed to a specific receiver. - * @param rxPowerDbm The transmit power in dBm. + * @param rxPower The transmit power. * @param add1 The MAC address of the receiver. * @param tx_phy The transmitting PHY object. */ - void SendPpduWithOneMpdu(double rxPowerDbm, - Mac48Address add1, - Ptr tx_phy); + void SendPpduWithOneMpdu(dBm_u rxPower, Mac48Address add1, Ptr tx_phy); /** * Checks the statistics of PPDU and MPDU reception success and failure. @@ -170,7 +168,7 @@ TestWifiPhyRxTraceHelper::TestWifiPhyRxTraceHelper(std::string test_name) void TestWifiPhyRxTraceHelper::DoSetup() { - double txPower = 20; + dBm_u txPower{20}; auto spectrumChannel = CreateObject(); @@ -249,12 +247,12 @@ TestWifiPhyRxTraceHelper::DoTeardown() } void -TestWifiPhyRxTraceHelper::SendPpduWithTwoMpdus(double rxPowerDbm, +TestWifiPhyRxTraceHelper::SendPpduWithTwoMpdus(dBm_u rxPower, Mac48Address receiver1, Mac48Address receiver2, Ptr tx_phy) { - double txPower = rxPowerDbm; + auto txPower = rxPower; tx_phy->SetTxPowerStart(txPower); tx_phy->SetTxPowerEnd(txPower); @@ -290,11 +288,11 @@ TestWifiPhyRxTraceHelper::SendPpduWithTwoMpdus(double rxPowerDbm, } void -TestWifiPhyRxTraceHelper::SendPpduWithOneMpdu(double rxPowerDbm, +TestWifiPhyRxTraceHelper::SendPpduWithOneMpdu(dBm_u rxPower, Mac48Address receiver1, Ptr tx_phy) { - double txPower = rxPowerDbm; + auto txPower = rxPower; tx_phy->SetTxPowerStart(txPower); tx_phy->SetTxPowerEnd(txPower); @@ -395,7 +393,7 @@ TestWifiPhyRxTraceHelper::DoRun() RngSeedManager::SetSeed(1); RngSeedManager::SetRun(2); int64_t streamNumber = 1; - double rxPowerDbm = -80; + dBm_u rxPower{-80}; streamNumber += m_txA->AssignStreams(streamNumber); streamNumber += m_txB->AssignStreams(streamNumber); streamNumber += m_rx->AssignStreams(streamNumber); @@ -415,7 +413,7 @@ TestWifiPhyRxTraceHelper::DoRun() Simulator::Schedule(Seconds(0.1), &TestWifiPhyRxTraceHelper::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_txA); @@ -450,12 +448,12 @@ TestWifiPhyRxTraceHelper::DoRun() expectedStats.m_failedMpdus = 1; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 1; - rxPowerDbm = -83; + rxPower = dBm_u{-83}; // A-MPDU 1 Simulator::Schedule(Seconds(0.3), &TestWifiPhyRxTraceHelper::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_txA); @@ -490,12 +488,12 @@ TestWifiPhyRxTraceHelper::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; // A-MPDU 1 Simulator::Schedule(Seconds(0.5), &TestWifiPhyRxTraceHelper::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, wrongReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_txA); @@ -530,12 +528,12 @@ TestWifiPhyRxTraceHelper::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -83; + rxPower = dBm_u{-83}; // A-MPDU 1 Simulator::Schedule(Seconds(0.7), &TestWifiPhyRxTraceHelper::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, wrongReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_txA); @@ -571,19 +569,19 @@ TestWifiPhyRxTraceHelper::DoRun() expectedStats.m_failedMpdus = 2; expectedStats.m_overlappingPpdus = 2; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; // A-MPDU 1 Simulator::Schedule(Seconds(0.9), &TestWifiPhyRxTraceHelper::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txA); // A-MPDU 2 Simulator::Schedule(Seconds(0.9), &TestWifiPhyRxTraceHelper::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txB); @@ -618,19 +616,19 @@ TestWifiPhyRxTraceHelper::DoRun() expectedStats.m_failedMpdus = 1; expectedStats.m_overlappingPpdus = 1; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; // A-MPDU 1 Simulator::Schedule(Seconds(1.1), &TestWifiPhyRxTraceHelper::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txA); // A-MPDU 2 Simulator::Schedule(Seconds(1.1), &TestWifiPhyRxTraceHelper::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, wrongReceiver, // One MPDU addressed to m_txB); @@ -668,14 +666,14 @@ TestWifiPhyRxTraceHelper::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 1; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; m_rxTraceHelper.Start(Seconds(1.29)); // A-MPDU 1 Simulator::Schedule(Seconds(1.3), &TestWifiPhyRxTraceHelper::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txA); @@ -711,7 +709,7 @@ TestWifiPhyRxTraceHelper::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; m_rxTraceHelper.Start(Seconds(1.41)); @@ -721,7 +719,7 @@ TestWifiPhyRxTraceHelper::DoRun() Simulator::Schedule(Seconds(1.45), &TestWifiPhyRxTraceHelper::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txA); @@ -755,13 +753,13 @@ TestWifiPhyRxTraceHelper::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 1; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; // A-MPDU 1 Simulator::Schedule(Seconds(1.6), &TestWifiPhyRxTraceHelper::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txA); @@ -799,7 +797,7 @@ TestWifiPhyRxTraceHelper::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; m_rxTraceHelper.Start(Seconds(1.79)); @@ -807,7 +805,7 @@ TestWifiPhyRxTraceHelper::DoRun() Simulator::Schedule(Seconds(1.8), &TestWifiPhyRxTraceHelper::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txA); @@ -871,25 +869,23 @@ class TestWifiPhyRxTraceHelperMloStr : public TestCase /** * Sends a PPDU containing two MPDUs addressed to specific receivers, simulating an MLO * scenario. - * @param rxPowerDbm The transmit power in dBm. + * @param rxPower The transmit power. * @param add1 The MAC address of the first receiver. * @param add2 The MAC address of the second receiver. * @param tx_phy The transmitting PHY object for MLO. */ - void SendPpduWithTwoMpdus(double rxPowerDbm, + void SendPpduWithTwoMpdus(dBm_u rxPower, Mac48Address add1, Mac48Address add2, Ptr tx_phy); /** * Sends a PPDU containing one MPDU addressed to a specific receiver, within an MLO setup. - * @param rxPowerDbm The transmit power in dBm. + * @param rxPower The transmit power. * @param add1 The MAC address of the receiver. * @param tx_phy The transmitting PHY object for MLO. */ - void SendPpduWithOneMpdu(double rxPowerDbm, - Mac48Address add1, - Ptr tx_phy); + void SendPpduWithOneMpdu(dBm_u rxPower, Mac48Address add1, Ptr tx_phy); /** * Checks the statistics of PPDU and MPDU reception success and failure. @@ -975,7 +971,7 @@ TestWifiPhyRxTraceHelperMloStr::TestWifiPhyRxTraceHelperMloStr() void TestWifiPhyRxTraceHelperMloStr::DoSetup() { - double txPower = 20; + dBm_u txPower{20}; auto ehtConfiguration = CreateObject(); auto nodeA = CreateObject(); @@ -1123,12 +1119,12 @@ TestWifiPhyRxTraceHelperMloStr::DoTeardown() } void -TestWifiPhyRxTraceHelperMloStr::SendPpduWithTwoMpdus(double rxPowerDbm, +TestWifiPhyRxTraceHelperMloStr::SendPpduWithTwoMpdus(dBm_u rxPower, Mac48Address receiver1, Mac48Address receiver2, Ptr tx_phy) { - double txPower = rxPowerDbm; + auto txPower = rxPower; tx_phy->SetTxPowerStart(txPower); tx_phy->SetTxPowerEnd(txPower); @@ -1164,11 +1160,11 @@ TestWifiPhyRxTraceHelperMloStr::SendPpduWithTwoMpdus(double rxPowerDbm, } void -TestWifiPhyRxTraceHelperMloStr::SendPpduWithOneMpdu(double rxPowerDbm, +TestWifiPhyRxTraceHelperMloStr::SendPpduWithOneMpdu(dBm_u rxPower, Mac48Address receiver1, Ptr tx_phy) { - double txPower = rxPowerDbm; + auto txPower = rxPower; tx_phy->SetTxPowerStart(txPower); tx_phy->SetTxPowerEnd(txPower); @@ -1339,7 +1335,7 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() RngSeedManager::SetSeed(1); RngSeedManager::SetRun(2); int64_t streamNumber = 1; - double rxPowerDbm = -80; + dBm_u rxPower{-80}; streamNumber += m_tx0A->AssignStreams(streamNumber); streamNumber += m_tx0B->AssignStreams(streamNumber); streamNumber += m_tx1A->AssignStreams(streamNumber); @@ -1362,7 +1358,7 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() Simulator::Schedule(Seconds(0.1), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_tx0A); @@ -1370,7 +1366,7 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() Simulator::Schedule(Seconds(0.1), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_tx0B); @@ -1405,12 +1401,12 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() expectedStats.m_failedMpdus = 2; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 2; - rxPowerDbm = -83; + rxPower = dBm_u{-83}; // A-MPDU 1 Simulator::Schedule(Seconds(0.3), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_tx0A); @@ -1418,7 +1414,7 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() Simulator::Schedule(Seconds(0.3), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_tx0B); @@ -1453,12 +1449,12 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; // A-MPDU 1 Simulator::Schedule(Seconds(0.5), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, wrongReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_tx0A); @@ -1467,7 +1463,7 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() Simulator::Schedule(Seconds(0.5), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, wrongReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_tx0B); @@ -1502,12 +1498,12 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -83; + rxPower = dBm_u{-83}; // A-MPDU 1 Simulator::Schedule(Seconds(0.7), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, wrongReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_tx0A); @@ -1516,7 +1512,7 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() Simulator::Schedule(Seconds(0.7), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, wrongReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_tx0B); @@ -1552,19 +1548,19 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() expectedStats.m_failedMpdus = 4; expectedStats.m_overlappingPpdus = 4; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; // A-MPDU 1 Simulator::Schedule(Seconds(0.9), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_tx0A); // A-MPDU 2 Simulator::Schedule(Seconds(0.9), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_tx1A); @@ -1572,14 +1568,14 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() Simulator::Schedule(Seconds(0.9), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_tx0B); // A-MPDU 2 Simulator::Schedule(Seconds(0.9), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_tx1B); @@ -1614,19 +1610,19 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() expectedStats.m_failedMpdus = 2; expectedStats.m_overlappingPpdus = 2; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; // A-MPDU 1 Simulator::Schedule(Seconds(1.1), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_tx0A); // A-MPDU 2 Simulator::Schedule(Seconds(1.1), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, wrongReceiver, // One MPDU addressed to m_tx1A); @@ -1634,14 +1630,14 @@ TestWifiPhyRxTraceHelperMloStr::DoRun() Simulator::Schedule(Seconds(1.1), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_tx0B); // A-MPDU 2 Simulator::Schedule(Seconds(1.1), &TestWifiPhyRxTraceHelperMloStr::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, wrongReceiver, // One MPDU addressed to m_tx1B); @@ -1703,23 +1699,23 @@ class TestWifiPhyRxTraceHelperYans : public TestCase /** * Sends a PPDU containing two MPDUs addressed to specific receivers. - * @param rxPowerDbm The transmit power in dBm. + * @param rxPower The transmit power. * @param add1 The MAC address of the first receiver. * @param add2 The MAC address of the second receiver. * @param tx_phy The transmitting PHY object. */ - void SendPpduWithTwoMpdus(double rxPowerDbm, + void SendPpduWithTwoMpdus(dBm_u rxPower, Mac48Address add1, Mac48Address add2, Ptr tx_phy); /** * Sends a PPDU containing one MPDU addressed to a specific receiver. - * @param rxPowerDbm The transmit power in dBm. + * @param rxPower The transmit power. * @param add1 The MAC address of the receiver. * @param tx_phy The transmitting PHY object. */ - void SendPpduWithOneMpdu(double rxPowerDbm, Mac48Address add1, Ptr tx_phy); + void SendPpduWithOneMpdu(dBm_u rxPower, Mac48Address add1, Ptr tx_phy); /** * Checks the statistics of PPDU and MPDU reception success and failure. @@ -1791,7 +1787,7 @@ TestWifiPhyRxTraceHelperYans::TestWifiPhyRxTraceHelperYans() void TestWifiPhyRxTraceHelperYans::DoSetup() { - double txPower = 20; + dBm_u txPower{20}; auto yansChannel = CreateObject(); auto propDelay = CreateObject(); @@ -1886,12 +1882,12 @@ TestWifiPhyRxTraceHelperYans::DoTeardown() } void -TestWifiPhyRxTraceHelperYans::SendPpduWithTwoMpdus(double rxPowerDbm, +TestWifiPhyRxTraceHelperYans::SendPpduWithTwoMpdus(dBm_u rxPower, Mac48Address receiver1, Mac48Address receiver2, Ptr tx_phy) { - propLoss->SetRss(rxPowerDbm); + propLoss->SetRss(rxPower); WifiTxVector txVector = WifiTxVector(HePhy::GetHeMcs0(), 0, @@ -1933,11 +1929,11 @@ TestWifiPhyRxTraceHelperYans::SendPpduWithTwoMpdus(double rxPowerDbm, } void -TestWifiPhyRxTraceHelperYans::SendPpduWithOneMpdu(double rxPowerDbm, +TestWifiPhyRxTraceHelperYans::SendPpduWithOneMpdu(dBm_u rxPower, Mac48Address receiver1, Ptr tx_phy) { - propLoss->SetRss(rxPowerDbm); + propLoss->SetRss(rxPower); auto txVector = WifiTxVector(HePhy::GetHeMcs0(), 0, @@ -2046,7 +2042,7 @@ TestWifiPhyRxTraceHelperYans::DoRun() RngSeedManager::SetSeed(1); RngSeedManager::SetRun(2); int64_t streamNumber = 1; - double rxPowerDbm = -80; + dBm_u rxPower{-80}; streamNumber += m_txA->AssignStreams(streamNumber); streamNumber += m_txB->AssignStreams(streamNumber); streamNumber += m_rx->AssignStreams(streamNumber); @@ -2066,7 +2062,7 @@ TestWifiPhyRxTraceHelperYans::DoRun() Simulator::Schedule(Seconds(0.1), &TestWifiPhyRxTraceHelperYans::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_txA); @@ -2100,12 +2096,12 @@ TestWifiPhyRxTraceHelperYans::DoRun() expectedStats.m_failedMpdus = 1; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 1; - rxPowerDbm = -83; + rxPower = dBm_u{-83}; // A-MPDU 1 Simulator::Schedule(Seconds(0.3), &TestWifiPhyRxTraceHelperYans::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_txA); @@ -2140,12 +2136,12 @@ TestWifiPhyRxTraceHelperYans::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; // A-MPDU 1 Simulator::Schedule(Seconds(0.5), &TestWifiPhyRxTraceHelperYans::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, wrongReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_txA); @@ -2180,12 +2176,12 @@ TestWifiPhyRxTraceHelperYans::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -83; + rxPower = dBm_u{-83}; // A-MPDU 1 Simulator::Schedule(Seconds(0.7), &TestWifiPhyRxTraceHelperYans::SendPpduWithTwoMpdus, this, - rxPowerDbm, + rxPower, wrongReceiver, // One MPDU addressed to wrongReceiver, // One MPDU addressed to m_txA); @@ -2221,19 +2217,19 @@ TestWifiPhyRxTraceHelperYans::DoRun() expectedStats.m_failedMpdus = 2; expectedStats.m_overlappingPpdus = 2; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; // A-MPDU 1 Simulator::Schedule(Seconds(0.9), &TestWifiPhyRxTraceHelperYans::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txA); // A-MPDU 2 Simulator::Schedule(Seconds(0.9), &TestWifiPhyRxTraceHelperYans::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txB); @@ -2268,19 +2264,19 @@ TestWifiPhyRxTraceHelperYans::DoRun() expectedStats.m_failedMpdus = 1; expectedStats.m_overlappingPpdus = 1; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; // A-MPDU 1 Simulator::Schedule(Seconds(1.1), &TestWifiPhyRxTraceHelperYans::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txA); // A-MPDU 2 Simulator::Schedule(Seconds(1.1), &TestWifiPhyRxTraceHelperYans::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, wrongReceiver, // One MPDU addressed to m_txB); @@ -2318,14 +2314,14 @@ TestWifiPhyRxTraceHelperYans::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 1; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; m_rxTraceHelper.Start(Seconds(1.29)); // A-MPDU 1 Simulator::Schedule(Seconds(1.3), &TestWifiPhyRxTraceHelperYans::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txA); @@ -2361,7 +2357,7 @@ TestWifiPhyRxTraceHelperYans::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; m_rxTraceHelper.Start(Seconds(1.41)); @@ -2371,7 +2367,7 @@ TestWifiPhyRxTraceHelperYans::DoRun() Simulator::Schedule(Seconds(1.45), &TestWifiPhyRxTraceHelperYans::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txA); @@ -2405,13 +2401,13 @@ TestWifiPhyRxTraceHelperYans::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 1; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; // A-MPDU 1 Simulator::Schedule(Seconds(1.6), &TestWifiPhyRxTraceHelperYans::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txA); @@ -2449,7 +2445,7 @@ TestWifiPhyRxTraceHelperYans::DoRun() expectedStats.m_failedMpdus = 0; expectedStats.m_overlappingPpdus = 0; expectedStats.m_nonOverlappingPpdus = 0; - rxPowerDbm = -80; + rxPower = dBm_u{-80}; m_rxTraceHelper.Start(Seconds(1.79)); @@ -2457,7 +2453,7 @@ TestWifiPhyRxTraceHelperYans::DoRun() Simulator::Schedule(Seconds(1.8), &TestWifiPhyRxTraceHelperYans::SendPpduWithOneMpdu, this, - rxPowerDbm, + rxPower, correctReceiver, // One MPDU addressed to m_txA); diff --git a/src/wifi/test/wifi-transmit-mask-test.cc b/src/wifi/test/wifi-transmit-mask-test.cc index 20e4af6b8..9ab495c92 100644 --- a/src/wifi/test/wifi-transmit-mask-test.cc +++ b/src/wifi/test/wifi-transmit-mask-test.cc @@ -261,9 +261,9 @@ WifiOfdmMaskSlopesTestCase::InterpolateAndAppendValues(IndexPowerVect& vect, double slope = (stop.second - start.second) / (stop.first - start.first); for (uint32_t i = start.first; i <= stop.first; i++) { - double val = start.second + slope * (i - start.first); + dB_u val = start.second + slope * (i - start.first); double multiplier = std::round(std::pow(10.0, static_cast(m_precision))); - val = std::floor(val * multiplier + 0.5) / multiplier; + val = dB_u{std::floor(val * multiplier + 0.5) / multiplier}; vect.emplace_back(i, val); NS_LOG_LOGIC("Append (" << i << ", " << val << ")"); } @@ -282,13 +282,13 @@ WifiOfdmMaskSlopesTestCase::DoRun() vit != m_actualSpectrum->ConstValuesEnd(); ++vit) { - maxPower = std::max(maxPower, *vit); + maxPower = std::max(maxPower, Watt_u{*vit}); } NS_LOG_INFO("Compare expected PSD"); for (const auto& [subcarrier, expectedValue] : m_expectedPsd) { - currentPower = 10.0 * std::log10((*m_actualSpectrum)[subcarrier] / maxPower); + currentPower = dBr_u{10.0 * std::log10((*m_actualSpectrum)[subcarrier] / maxPower)}; NS_LOG_LOGIC("For " << subcarrier << ", expected: " << expectedValue << " vs obtained: " << currentPower); NS_TEST_EXPECT_MSG_EQ_TOL(currentPower,