wifi: Add getter and setter for OBSS-PD level

This commit is contained in:
Sebastien Deronne
2022-05-17 07:40:53 +02:00
committed by Sébastien Deronne
parent 39269451c3
commit ed9f62a153
3 changed files with 28 additions and 5 deletions

View File

@@ -93,9 +93,10 @@ ConstantObssPdAlgorithm::ReceiveHeSigA (HeSigAParameters params)
bool isObss = (bssColor != params.bssColor);
if (isObss)
{
if (WToDbm (params.rssiW) < m_obssPdLevel)
const double obssPdLevel = GetObssPdLevel ();
if (WToDbm (params.rssiW) < obssPdLevel)
{
NS_LOG_DEBUG ("Frame is OBSS and RSSI " << WToDbm(params.rssiW) << " is below OBSS-PD level of " << m_obssPdLevel << "; reset PHY to IDLE");
NS_LOG_DEBUG ("Frame is OBSS and RSSI " << WToDbm(params.rssiW) << " is below OBSS-PD level of " << obssPdLevel << "; reset PHY to IDLE");
ResetPhy (params);
}
else

View File

@@ -40,7 +40,8 @@ ObssPdAlgorithm::GetTypeId (void)
.AddAttribute ("ObssPdLevel",
"The current OBSS PD level (dBm).",
DoubleValue (-82.0),
MakeDoubleAccessor (&ObssPdAlgorithm::m_obssPdLevel),
MakeDoubleAccessor (&ObssPdAlgorithm::SetObssPdLevel,
&ObssPdAlgorithm::GetObssPdLevel),
MakeDoubleChecker<double> (-101, -62))
.AddAttribute ("ObssPdLevelMin",
"Minimum value (dBm) of OBSS PD level.",
@@ -109,4 +110,17 @@ ObssPdAlgorithm::ResetPhy (HeSigAParameters params)
phy->ResetCca (powerRestricted, txPowerMaxSiso, txPowerMaxMimo);
}
void
ObssPdAlgorithm::SetObssPdLevel (double level)
{
NS_LOG_FUNCTION (this << level);
m_obssPdLevel = level;
}
double
ObssPdAlgorithm::GetObssPdLevel (void) const
{
return m_obssPdLevel;
}
} //namespace ns3

View File

@@ -82,15 +82,23 @@ public:
*/
typedef void (* ResetTracedCallback)(uint8_t bssColor, double rssiDbm, bool powerRestricted, double txPowerMaxDbmSiso, double txPowerMaxDbmMimo);
/**
* \param level the current OBSS PD level in dBm
*/
void SetObssPdLevel (double level);
/**
* \return the current OBSS PD level in dBm.
*/
double GetObssPdLevel (void) const;
protected:
void DoDispose (void) override;
Ptr<WifiNetDevice> m_device; ///< Pointer to the WifiNetDevice
double m_obssPdLevel; ///< Current OBSS PD level (dBm)
private:
double m_obssPdLevel; ///< Current OBSS PD level (dBm)
double m_obssPdLevelMin; ///< Minimum OBSS PD level (dBm)
double m_obssPdLevelMax; ///< Maximum OBSS PD level (dBm)
double m_txPowerRefSiso; ///< SISO reference TX power level (dBm)