wifi: Hold center frequency and channel width of the RX spectrum model in spectrum PHY interface

This commit is contained in:
Sébastien Deronne
2023-01-31 23:02:19 +01:00
committed by Sebastien Deronne
parent c219b17016
commit 38ed82a8ee
3 changed files with 57 additions and 11 deletions

View File

@@ -244,11 +244,11 @@ SpectrumWifiPhy::ResetSpectrumModel()
// Replace existing spectrum model with new one
const auto channelWidth = GetChannelWidth();
m_currentSpectrumPhyInterface->SetRxSpectrumModel(
WifiSpectrumValueHelper::GetSpectrumModel(GetFrequency(),
channelWidth,
GetBandBandwidth(),
GetGuardBandwidth(channelWidth)));
m_currentSpectrumPhyInterface->SetRxSpectrumModel(GetFrequency(),
channelWidth,
GetBandBandwidth(),
GetGuardBandwidth(channelWidth));
UpdateInterferenceHelperBands();
}

View File

@@ -41,7 +41,9 @@ WifiSpectrumPhyInterface::GetTypeId()
}
WifiSpectrumPhyInterface::WifiSpectrumPhyInterface(FrequencyRange range)
: m_range{range}
: m_range{range},
m_centerFrequency{0},
m_channelWidth{0}
{
NS_LOG_FUNCTION(this << range);
}
@@ -95,10 +97,18 @@ WifiSpectrumPhyInterface::SetChannel(const Ptr<SpectrumChannel> c)
}
void
WifiSpectrumPhyInterface::SetRxSpectrumModel(Ptr<const SpectrumModel> rxSpectrumModel)
WifiSpectrumPhyInterface::SetRxSpectrumModel(uint32_t centerFrequency,
uint16_t channelWidth,
uint32_t bandBandwidth,
uint16_t guardBandwidth)
{
NS_LOG_FUNCTION(this << rxSpectrumModel);
m_rxSpectrumModel = rxSpectrumModel;
NS_LOG_FUNCTION(this << centerFrequency << channelWidth << bandBandwidth << guardBandwidth);
m_centerFrequency = centerFrequency;
m_channelWidth = channelWidth;
m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel(centerFrequency,
channelWidth,
bandBandwidth,
guardBandwidth);
}
Ptr<SpectrumChannel>
@@ -125,6 +135,18 @@ WifiSpectrumPhyInterface::GetFrequencyRange() const
return m_range;
}
uint16_t
WifiSpectrumPhyInterface::GetCenterFrequency() const
{
return m_centerFrequency;
}
uint16_t
WifiSpectrumPhyInterface::GetChannelWidth() const
{
return m_channelWidth;
}
void
WifiSpectrumPhyInterface::StartRx(Ptr<SpectrumSignalParameters> params)
{

View File

@@ -83,6 +83,22 @@ class WifiSpectrumPhyInterface : public SpectrumPhy
*/
const FrequencyRange& GetFrequencyRange() const;
/**
* Get the center frequency in MHz of the the spectrum channel this interface is attached to
*
* \return the center frequency in MHz of the the spectrum channel this interface is attached to
* to
*/
uint16_t GetCenterFrequency() const;
/**
* Get the channel width in MHz covered by the spectrum channel this interface is attached to
*
* \return the channel width in MHz covered by the spectrum channel this interface is attached
* to to
*/
uint16_t GetChannelWidth() const;
/**
* Start transmission over the spectrum channel
*
@@ -93,9 +109,15 @@ class WifiSpectrumPhyInterface : public SpectrumPhy
/**
* Set the RX spectrum model
*
* \param rxSpectrumModel the RX spectrum model
* \param centerFrequency the center frequency in MHz
* \param channelWidth the channel width in MHz
* \param bandBandwidth the width of each band in Hz
* \param guardBandwidth the width of the guard band in MHz
*/
void SetRxSpectrumModel(Ptr<const SpectrumModel> rxSpectrumModel);
void SetRxSpectrumModel(uint32_t centerFrequency,
uint16_t channelWidth,
uint32_t bandBandwidth,
uint16_t guardBandwidth);
private:
void DoDispose() override;
@@ -104,6 +126,8 @@ class WifiSpectrumPhyInterface : public SpectrumPhy
Ptr<SpectrumWifiPhy> m_spectrumWifiPhy; ///< spectrum PHY
Ptr<NetDevice> m_netDevice; ///< the device
Ptr<SpectrumChannel> m_channel; ///< spectrum channel
uint16_t m_centerFrequency; ///< center frequency in MHz
uint16_t m_channelWidth; ///< channel width in MHz
Ptr<const SpectrumModel> m_rxSpectrumModel; ///< receive spectrum model
};