ChannelId -> ChannelNumber and also in the base class WifiPhy
This commit is contained in:
@@ -337,7 +337,7 @@ uint16_t MeshWifiInterfaceMac::GetFrequencyChannel () const
|
||||
|
||||
Ptr<YansWifiPhy> phy = m_phy->GetObject<YansWifiPhy> ();
|
||||
if (phy != 0)
|
||||
return phy->GetFrequencyChannel ();
|
||||
return phy->GetChannelNumber ();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -360,7 +360,7 @@ void MeshWifiInterfaceMac::SwitchFrequencyChannel (uint16_t new_id)
|
||||
NS_ASSERT(CanSwitchChannel());
|
||||
|
||||
Ptr<YansWifiPhy> phy = m_phy->GetObject<YansWifiPhy> ();
|
||||
phy->SetFrequencyChannel (new_id);
|
||||
phy->SetChannelNumber (new_id);
|
||||
// Don't know NAV on new channel
|
||||
m_dcfManager->NotifyNavResetNow (Seconds (0));
|
||||
}
|
||||
|
||||
@@ -241,7 +241,19 @@ public:
|
||||
* the requested ber for the specified transmission mode. (W/W)
|
||||
*/
|
||||
virtual double CalculateSnr (WifiMode txMode, double ber) const = 0;
|
||||
|
||||
|
||||
/**
|
||||
* \brief Set channel number.
|
||||
*
|
||||
* Channel center frequency = Channel starting frequency + 5 MHz * (nch - 1)
|
||||
*
|
||||
* where Starting channel frequency is standard-dependent, see SetStandard()
|
||||
* as defined in IEEE 802.11-2007 17.3.8.3.2.
|
||||
*/
|
||||
virtual void SetChannelNumber (uint16_t id) = 0;
|
||||
/// Return current channel number, see SetChannelNumber()
|
||||
virtual uint16_t GetChannelNumber () const = 0;
|
||||
|
||||
virtual Ptr<WifiChannel> GetChannel (void) const = 0;
|
||||
|
||||
static WifiMode Get6mba (void);
|
||||
|
||||
@@ -82,7 +82,7 @@ YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double
|
||||
if (sender != (*i))
|
||||
{
|
||||
// For now don't account for inter channel interference
|
||||
if ((*i)->GetFrequencyChannel() != sender->GetFrequencyChannel())
|
||||
if ((*i)->GetChannelNumber() != sender->GetChannelNumber())
|
||||
continue;
|
||||
|
||||
Ptr<MobilityModel> receiverMobility = (*i)->GetMobility ()->GetObject<MobilityModel> ();
|
||||
|
||||
@@ -308,28 +308,28 @@ YansWifiPhy::SetChannel (Ptr<YansWifiChannel> channel)
|
||||
}
|
||||
|
||||
void
|
||||
YansWifiPhy::SetFrequencyChannel (uint16_t nch)
|
||||
YansWifiPhy::SetChannelNumber (uint16_t nch)
|
||||
{
|
||||
Simulator::Schedule (m_channelSwitchDelay, &YansWifiPhy::DoSetChannelId, this, nch);
|
||||
Simulator::Schedule (m_channelSwitchDelay, &YansWifiPhy::DoSetChannelNumber, this, nch);
|
||||
}
|
||||
|
||||
void
|
||||
YansWifiPhy::DoSetChannelId (uint16_t nch)
|
||||
YansWifiPhy::DoSetChannelNumber (uint16_t nch)
|
||||
{
|
||||
NS_LOG_DEBUG("switching channel " << m_channelId << " -> " << nch);
|
||||
m_channelId = nch;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
YansWifiPhy::GetFrequencyChannel() const
|
||||
YansWifiPhy::GetChannelNumber() const
|
||||
{
|
||||
return m_channelId;
|
||||
}
|
||||
|
||||
double
|
||||
YansWifiPhy::GetCenterFrequencyMhz() const
|
||||
YansWifiPhy::GetChannelFrequencyMhz() const
|
||||
{
|
||||
return m_channelStartingFrequency + 5 * (GetFrequencyChannel() - 1);
|
||||
return m_channelStartingFrequency + 5 * (GetChannelNumber() - 1);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -443,7 +443,7 @@ YansWifiPhy::SendPacket (Ptr<const Packet> packet, WifiMode txMode, WifiPreamble
|
||||
NotifyTxBegin (packet);
|
||||
uint32_t dataRate500KbpsUnits = txMode.GetDataRate () / 500000;
|
||||
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == preamble);
|
||||
NotifyPromiscSniffTx (packet, (uint16_t)GetCenterFrequencyMhz(), dataRate500KbpsUnits, isShortPreamble);
|
||||
NotifyPromiscSniffTx (packet, (uint16_t)GetChannelFrequencyMhz(), dataRate500KbpsUnits, isShortPreamble);
|
||||
m_state->SwitchToTx (txDuration, packet, txMode, preamble, txPower);
|
||||
m_channel->Send (this, packet, GetPowerDbm (txPower) + m_txGainDb, txMode, preamble);
|
||||
}
|
||||
@@ -622,7 +622,7 @@ YansWifiPhy::EndSync (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event)
|
||||
bool isShortPreamble = (WIFI_PREAMBLE_SHORT == event->GetPreambleType ());
|
||||
double signalDbm = RatioToDb (event->GetRxPowerW ()) + 30;
|
||||
double noiseDbm = RatioToDb(event->GetRxPowerW() / snrPer.snr) - GetRxNoiseFigure() + 30 ;
|
||||
NotifyPromiscSniffRx (packet, (uint16_t)GetCenterFrequencyMhz(), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
|
||||
NotifyPromiscSniffRx (packet, (uint16_t)GetChannelFrequencyMhz(), dataRate500KbpsUnits, isShortPreamble, signalDbm, noiseDbm);
|
||||
m_state->SwitchFromSyncEndOk (packet, snrPer.snr, event->GetPayloadMode (), event->GetPreambleType ());
|
||||
}
|
||||
else
|
||||
|
||||
@@ -78,11 +78,11 @@ public:
|
||||
* where Starting channel frequency is standard-dependent, see SetStandard()
|
||||
* as defined in IEEE 802.11-2007 17.3.8.3.2.
|
||||
*/
|
||||
void SetFrequencyChannel (uint16_t id);
|
||||
/// Return current channel ID, see SetChannelId()
|
||||
uint16_t GetFrequencyChannel () const;
|
||||
/// Return current center channel frequency in MHz, see SetFrequencyChannel()
|
||||
double GetCenterFrequencyMhz() const;
|
||||
void SetChannelNumber (uint16_t id);
|
||||
/// Return current channel number, see SetChannelNumber()
|
||||
uint16_t GetChannelNumber () const;
|
||||
/// Return current center channel frequency in MHz, see SetСhannelNumber()
|
||||
double GetChannelFrequencyMhz() const;
|
||||
|
||||
void StartReceivePacket (Ptr<Packet> packet,
|
||||
double rxPowerDbm,
|
||||
@@ -150,7 +150,7 @@ private:
|
||||
double RatioToDb (double ratio) const;
|
||||
double GetPowerDbm (uint8_t power) const;
|
||||
void EndSync (Ptr<Packet> packet, Ptr<InterferenceHelper::Event> event);
|
||||
void DoSetChannelId(uint16_t id);
|
||||
void DoSetChannelNumber(uint16_t id);
|
||||
|
||||
private:
|
||||
double m_edThresholdW;
|
||||
|
||||
Reference in New Issue
Block a user