wifi: (fixes #2673) Update WiFi spectrum model when channel is switched at run-time
This commit is contained in:
@@ -101,6 +101,7 @@ Bugs fixed
|
||||
- Bug 2660 - TrafficControlHelper::Default should not configure internal queue sizes
|
||||
- Bug 2665 - Ipv4RawSocket can not send packets to broadcast or multicast
|
||||
- Bug 2671 - ArpCache::Entry::SetMacAddress is misspelled
|
||||
- Bug 2673 - run-time channel switch does not update WiFi spectrum model
|
||||
- Bug 2717 - Fix mask generation for Ipv4RoutingTableEntry::CreateDefaultRoute
|
||||
- Bug 2722 - 802.11g sends DSSS spectrum signals using CreateOfdmTxPowerSpectralDensity
|
||||
- Bug 2741 - IPv4 fragmentation fails when last fragment have to be re-fragmented.
|
||||
|
||||
@@ -125,6 +125,62 @@ SpectrumWifiPhy::SetChannel (const Ptr<SpectrumChannel> channel)
|
||||
m_channel = channel;
|
||||
}
|
||||
|
||||
void
|
||||
SpectrumWifiPhy::ResetSpectrumModel (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_ASSERT_MSG (IsInitialized (), "Executing method before run-time");
|
||||
NS_LOG_DEBUG ("Run-time change of spectrum model from frequency/width pair of (" << GetFrequency () << ", " << (uint16_t)GetChannelWidth () << ")");
|
||||
// Replace existing spectrum model with new one, and must call AddRx ()
|
||||
// on the SpectrumChannel to provide this new spectrum model to it
|
||||
m_rxSpectrumModel = WifiSpectrumValueHelper::GetSpectrumModel (GetFrequency (), GetChannelWidth (), GetBandBandwidth (), GetGuardBandwidth ());
|
||||
m_channel->AddRx (m_wifiSpectrumPhyInterface);
|
||||
}
|
||||
|
||||
void
|
||||
SpectrumWifiPhy::SetChannelNumber (uint8_t nch)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << (uint16_t) nch);
|
||||
WifiPhy::SetChannelNumber (nch);
|
||||
if (IsInitialized ())
|
||||
{
|
||||
ResetSpectrumModel ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SpectrumWifiPhy::SetFrequency (uint16_t freq)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << freq);
|
||||
WifiPhy::SetFrequency (freq);
|
||||
if (IsInitialized ())
|
||||
{
|
||||
ResetSpectrumModel ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SpectrumWifiPhy::SetChannelWidth (uint8_t channelwidth)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << (uint16_t) channelwidth);
|
||||
WifiPhy::SetChannelWidth (channelwidth);
|
||||
if (IsInitialized ())
|
||||
{
|
||||
ResetSpectrumModel ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SpectrumWifiPhy::ConfigureStandard (WifiPhyStandard standard)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << standard);
|
||||
WifiPhy::ConfigureStandard (standard);
|
||||
if (IsInitialized ())
|
||||
{
|
||||
ResetSpectrumModel ();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
SpectrumWifiPhy::AddOperationalChannel (uint8_t channelNumber)
|
||||
{
|
||||
|
||||
@@ -160,6 +160,16 @@ public:
|
||||
|
||||
Ptr<Channel> GetChannel (void) const;
|
||||
|
||||
// The following four methods call to the base WifiPhy class method
|
||||
// but also generate a new SpectrumModel if called during runtime
|
||||
|
||||
virtual void SetChannelNumber (uint8_t id);
|
||||
|
||||
virtual void SetFrequency (uint16_t freq);
|
||||
|
||||
virtual void SetChannelWidth (uint8_t channelwidth);
|
||||
|
||||
virtual void ConfigureStandard (WifiPhyStandard standard);
|
||||
|
||||
protected:
|
||||
// Inherited
|
||||
@@ -180,6 +190,11 @@ private:
|
||||
*/
|
||||
Ptr<SpectrumValue> GetTxPowerSpectralDensity (uint16_t centerFrequency, uint8_t channelWidth, double txPowerW, WifiModulationClass modulationClass) const;
|
||||
|
||||
/**
|
||||
* Perform run-time spectrum model change
|
||||
*/
|
||||
void ResetSpectrumModel (void);
|
||||
|
||||
Ptr<SpectrumChannel> m_channel; //!< SpectrumChannel that this SpectrumWifiPhy is connected to
|
||||
std::vector<uint8_t> m_operationalChannelList; //!< List of possible channels
|
||||
|
||||
|
||||
@@ -588,14 +588,14 @@ public:
|
||||
*
|
||||
* Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1)
|
||||
*
|
||||
* where Starting channel frequency is standard-dependent, see SetStandard()
|
||||
* where Starting channel frequency is standard-dependent,
|
||||
* as defined in (Section 18.3.8.4.2 "Channel numbering"; IEEE Std 802.11-2012).
|
||||
* This method may fail to take action if the Phy model determines that
|
||||
* the channel number cannot be switched for some reason (e.g. sleep state)
|
||||
*
|
||||
* \param id the channel number
|
||||
*/
|
||||
void SetChannelNumber (uint8_t id);
|
||||
virtual void SetChannelNumber (uint8_t id);
|
||||
/**
|
||||
* Return current channel number.
|
||||
*
|
||||
@@ -612,7 +612,7 @@ public:
|
||||
*
|
||||
* \param standard the Wi-Fi standard
|
||||
*/
|
||||
void ConfigureStandard (WifiPhyStandard standard);
|
||||
virtual void ConfigureStandard (WifiPhyStandard standard);
|
||||
|
||||
/**
|
||||
* Get the configured Wi-Fi standard
|
||||
@@ -1488,7 +1488,7 @@ public:
|
||||
/**
|
||||
* \param freq the operating center frequency (MHz) on this node.
|
||||
*/
|
||||
void SetFrequency (uint16_t freq);
|
||||
virtual void SetFrequency (uint16_t freq);
|
||||
/**
|
||||
* \return the operating center frequency (MHz)
|
||||
*/
|
||||
@@ -1628,7 +1628,7 @@ public:
|
||||
/**
|
||||
* \param channelwidth channel width
|
||||
*/
|
||||
void SetChannelWidth (uint8_t channelwidth);
|
||||
virtual void SetChannelWidth (uint8_t channelwidth);
|
||||
/**
|
||||
* \param channelwidth channel width (in MHz) to support
|
||||
*/
|
||||
@@ -1695,7 +1695,6 @@ protected:
|
||||
EventId m_endRxEvent; //!< the end reeive event
|
||||
EventId m_endPlcpRxEvent; //!< the end PLCP receive event
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* \brief post-construction setting of frequency and/or channel number
|
||||
|
||||
Reference in New Issue
Block a user