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 | |
SpectrumDecision * | m_decisionMod |
bool | m_isPuOn |
bool | m_isSensing |
bool | m_isSwitching |
int | m_nodeId |
Ptr< Repository > | m_repository |
Time | m_senseTime |
SpectrumSensing * | m_sensingMod |
Time | m_transmitTime |
Ptr< RegularWifiMac > | m_wifiMac |
Ptr< WifiPhy > | m_wifiPhy |
Friends | |
class | SenseTimer |
class | TransmitTimer |
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.
ns3::SpectrumManager::SpectrumManager | ( | Ptr< RegularWifiMac > | mac, |
int | id | ||
) |
mac | the mac of the RX interface. This will be used for the cognitive cycle |
id | the 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 | ||
) |
mac | the mac of the RX interface. This will be used for the cognitive cycle |
phy | the PHY of the RX interface. This will be used for the cognitive cycle |
id | the node id (integer) |
sense_time | the duration of the sensing time |
transmit_time | the 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().
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 | ( | ) |
Definition at line 85 of file spectrum-manager.cc.
bool ns3::SpectrumManager::IsPuInterfering | ( | Time | txDuration | ) |
Definition at line 97 of file spectrum-manager.cc.
References NS_LOG_DEBUG.
void ns3::SpectrumManager::SenseEnded | ( | ) |
Callback for when sensing is finished by the PHY layer
Definition at line 149 of file spectrum-manager.cc.
References ns3::Object::GetObject(), NS_LOG_DEBUG, ns3::Simulator::Schedule(), ns3::WifiPhy::SetChannelNumber(), ns3::WifiPhy::StartSensing(), and TransmitEnded().
Referenced by SpectrumManager().
prob | Probability of mis-detecting the PU. Set to zero for 100% reliability |
p | a 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 | ) |
rep | a 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().