A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ns3::SpectrumManager Class Reference

APIs for Cognitive Radio extension. More...

#include <spectrum-manager.h>

Public Member Functions

 SpectrumManager (Ptr< RegularWifiMac > mac, int id)
 
 SpectrumManager (Ptr< RegularWifiMac > mac, Ptr< WifiPhy > phy, int id, Time sense_time, Time transmit_time)
 
void HandoffEnded ()
 
bool IsChannelAvailable ()
 
bool IsPuInterfering (Time txDuration)
 
void SenseEnded ()
 
void SetPuModel (double prob, Ptr< PUModel > p)
 
void SetRepository (Ptr< Repository > rep)
 
void Start ()
 
void TransmitEnded ()
 

Private Attributes

SpectrumDecisionm_decisionMod
 
bool m_isPuOn
 
bool m_isSensing
 
bool m_isSwitching
 
int m_nodeId
 
Ptr< Repositorym_repository
 
Time m_senseTime
 
SpectrumSensingm_sensingMod
 
Time m_transmitTime
 
Ptr< RegularWifiMacm_wifiMac
 
Ptr< WifiPhym_wifiPhy
 

Friends

class SenseTimer
 
class TransmitTimer
 

Detailed Description

APIs for Cognitive Radio extension.

This class can helps put together all cognitive radio exposed functions (APIs) in one class. A researcher must instantiate this class in the run script and use a reference to it whenever it wants to call any of the cognitive radio functions from any given network layer.

Definition at line 69 of file spectrum-manager.h.

Constructor & Destructor Documentation

ns3::SpectrumManager::SpectrumManager ( Ptr< RegularWifiMac mac,
int  id 
)
Parameters
macthe mac of the RX interface. This will be used for the cognitive cycle
idthe node id

Spectrum Manager initializer

Definition at line 27 of file spectrum-manager.cc.

ns3::SpectrumManager::SpectrumManager ( Ptr< RegularWifiMac mac,
Ptr< WifiPhy phy,
int  id,
Time  sense_time,
Time  transmit_time 
)
Parameters
macthe mac of the RX interface. This will be used for the cognitive cycle
phythe PHY of the RX interface. This will be used for the cognitive cycle
idthe node id (integer)
sense_timethe duration of the sensing time
transmit_timethe duration of the transmission time

Spectrum Manager initializer

Definition at line 45 of file spectrum-manager.cc.

References HandoffEnded(), ns3::MakeCallback(), SenseEnded(), ns3::WifiPhy::SetHandoffEndedCallback(), and ns3::WifiPhy::SetSenseEndedCallback().

Member Function Documentation

void ns3::SpectrumManager::HandoffEnded ( )

Callback for when handoff is finished by the PHY layer

Definition at line 269 of file spectrum-manager.cc.

References NS_LOG_DEBUG, and ns3::WifiPhy::StartSensing().

Referenced by SpectrumManager().

bool ns3::SpectrumManager::IsChannelAvailable ( )
Returns
true if CR is not sensing or performing hand off.

Definition at line 85 of file spectrum-manager.cc.

bool ns3::SpectrumManager::IsPuInterfering ( Time  txDuration)
Returns
true if PU is active while receiving the packet, on the current listening channel.

Definition at line 97 of file spectrum-manager.cc.

References NS_LOG_DEBUG.

void ns3::SpectrumManager::SenseEnded ( )
void ns3::SpectrumManager::SetPuModel ( double  prob,
Ptr< PUModel p 
)
Parameters
probProbability of mis-detecting the PU. Set to zero for 100% reliability
pa reference to the PUModel

Sets the PU model and probability of misdetection in the spectrum manager

Definition at line 124 of file spectrum-manager.cc.

void ns3::SpectrumManager::SetRepository ( Ptr< Repository rep)
Parameters
repa reference to the global repository

Sets the reference the global repository that is shared among all nodes

Definition at line 134 of file spectrum-manager.cc.

References ns3::WifiPhy::SetChannelNumber().

void ns3::SpectrumManager::Start ( )

Start the sensing/handoff/transmission cycle on the RX iface.

Definition at line 75 of file spectrum-manager.cc.

References ns3::WifiPhy::StartSensing().

void ns3::SpectrumManager::TransmitEnded ( )

Callback for when the transmission period has ended. Now we usually start sensing

Definition at line 244 of file spectrum-manager.cc.

References NS_LOG_DEBUG, and ns3::WifiPhy::StartSensing().

Referenced by SenseEnded().


The documentation for this class was generated from the following files: