wifi: Reduce amount of Watt/dBm conversion
This commit is contained in:
committed by
Sébastien Deronne
parent
7a8da34944
commit
c288ebbbe7
@@ -72,7 +72,7 @@ ConstantObssPdAlgorithm::ConnectWifiNetDevice(const Ptr<WifiNetDevice> device)
|
||||
void
|
||||
ConstantObssPdAlgorithm::ReceiveHeSigA(HeSigAParameters params)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << +params.bssColor << WToDbm(params.rssiW));
|
||||
NS_LOG_FUNCTION(this << +params.bssColor << params.rssiDbm);
|
||||
|
||||
Ptr<StaWifiMac> mac = m_device->GetMac()->GetObject<StaWifiMac>();
|
||||
if (mac && !mac->IsAssociated())
|
||||
@@ -100,12 +100,12 @@ ConstantObssPdAlgorithm::ReceiveHeSigA(HeSigAParameters params)
|
||||
bool isObss = (bssColor != params.bssColor);
|
||||
if (isObss)
|
||||
{
|
||||
const double obssPdLevel = GetObssPdLevel();
|
||||
if (WToDbm(params.rssiW) < obssPdLevel)
|
||||
const auto obssPdLevel = GetObssPdLevel();
|
||||
if (params.rssiDbm < obssPdLevel)
|
||||
{
|
||||
NS_LOG_DEBUG("Frame is OBSS and RSSI " << WToDbm(params.rssiW)
|
||||
<< " is below OBSS-PD level of " << obssPdLevel
|
||||
<< "; reset PHY to IDLE");
|
||||
NS_LOG_DEBUG("Frame is OBSS and RSSI "
|
||||
<< params.rssiDbm << " dBm is below OBSS-PD level of " << obssPdLevel
|
||||
<< " dBm; reset PHY to IDLE");
|
||||
ResetPhy(params);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -612,9 +612,10 @@ HePhy::ProcessSigA(Ptr<Event> event, PhyFieldRxStatus status)
|
||||
NS_LOG_FUNCTION(this << *event << status);
|
||||
// Notify end of SIG-A (in all cases)
|
||||
const auto& txVector = event->GetPpdu()->GetTxVector();
|
||||
HeSigAParameters params;
|
||||
params.rssiW = GetRxPowerWForPpdu(event);
|
||||
params.bssColor = txVector.GetBssColor();
|
||||
HeSigAParameters params{
|
||||
.rssiDbm = WToDbm(GetRxPowerWForPpdu(event)),
|
||||
.bssColor = txVector.GetBssColor(),
|
||||
};
|
||||
NotifyEndOfHeSigA(params); // if OBSS_PD CCA_RESET, set power restriction first and wait till
|
||||
// field is processed before switching to IDLE
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class ObssPdAlgorithm;
|
||||
*/
|
||||
struct HeSigAParameters
|
||||
{
|
||||
double rssiW; ///< RSSI in W
|
||||
double rssiDbm; ///< RSSI in dBm
|
||||
uint8_t bssColor; ///< BSS color
|
||||
};
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ ObssPdAlgorithm::ResetPhy(HeSigAParameters params)
|
||||
txPowerMaxMimo = m_txPowerRefMimo - (m_obssPdLevel - m_obssPdLevelMin);
|
||||
powerRestricted = true;
|
||||
}
|
||||
m_resetEvent(bssColor, WToDbm(params.rssiW), powerRestricted, txPowerMaxSiso, txPowerMaxMimo);
|
||||
m_resetEvent(bssColor, params.rssiDbm, powerRestricted, txPowerMaxSiso, txPowerMaxMimo);
|
||||
phy->ResetCca(powerRestricted, txPowerMaxSiso, txPowerMaxMimo);
|
||||
}
|
||||
|
||||
|
||||
@@ -526,26 +526,26 @@ void
|
||||
WifiPhy::SetCcaEdThreshold(double threshold)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << threshold);
|
||||
m_ccaEdThresholdW = DbmToW(threshold);
|
||||
m_ccaEdThresholdDbm = threshold;
|
||||
}
|
||||
|
||||
double
|
||||
WifiPhy::GetCcaEdThreshold() const
|
||||
{
|
||||
return WToDbm(m_ccaEdThresholdW);
|
||||
return m_ccaEdThresholdDbm;
|
||||
}
|
||||
|
||||
void
|
||||
WifiPhy::SetCcaSensitivityThreshold(double threshold)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << threshold);
|
||||
m_ccaSensitivityThresholdW = DbmToW(threshold);
|
||||
m_ccaSensitivityThresholdDbm = threshold;
|
||||
}
|
||||
|
||||
double
|
||||
WifiPhy::GetCcaSensitivityThreshold() const
|
||||
{
|
||||
return WToDbm(m_ccaSensitivityThresholdW);
|
||||
return m_ccaSensitivityThresholdDbm;
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1609,11 +1609,11 @@ class WifiPhy : public Object
|
||||
Time m_ackTxTime; //!< estimated Ack TX time
|
||||
Time m_blockAckTxTime; //!< estimated BlockAck TX time
|
||||
|
||||
double m_rxSensitivityDbm; //!< Receive sensitivity threshold in dBm
|
||||
double m_ccaEdThresholdW; //!< Clear channel assessment (CCA) energy detection (ED) threshold in
|
||||
//!< watts
|
||||
double m_ccaSensitivityThresholdW; //!< Clear channel assessment (CCA) modulation and coding
|
||||
//!< rate sensitivity threshold in watts
|
||||
double m_rxSensitivityDbm; //!< Receive sensitivity threshold in dBm
|
||||
double m_ccaEdThresholdDbm; //!< Clear channel assessment (CCA) energy detection (ED) threshold
|
||||
//!< in dBm
|
||||
double m_ccaSensitivityThresholdDbm; //!< Clear channel assessment (CCA) modulation and coding
|
||||
//!< rate sensitivity threshold in dBm
|
||||
|
||||
double m_txGainDb; //!< Transmission gain (dB)
|
||||
double m_rxGainDb; //!< Reception gain (dB)
|
||||
|
||||
Reference in New Issue
Block a user