A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
spectrum-manager.h
1
/*
2
* This program is free software; you can redistribute it and/or modify
3
* it under the terms of the GNU General Public License version 2 as
4
* published by the Free Software Foundation;
5
*
6
* This program is distributed in the hope that it will be useful,
7
* but WITHOUT ANY WARRANTY; without even the implied warranty of
8
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9
* GNU General Public License for more details.
10
*
11
* You should have received a copy of the GNU General Public License
12
* along with this program; if not, write to the Free Software
13
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14
*
15
* Author: Abdulla K. Al-Ali <abdulla.alali@qu.edu.qa>
16
*/
17
18
/*
19
* Implementation of the spectrum management activities performed by CRs
20
* Includes:
21
* 1. Spectrum sensing: PU detection through Carrier Sensing Detection
22
* 2. Spectrum decision: Decision of the next-channel to be used in case of PU detection
23
* 3. Spectrum mobility: Handoff Managment
24
* 4. Spectrum data loader: Loader of spectrum information
25
* 5. Spectrum timers: Timers for spectrum management (handoff/sensing/transmitting/...)
26
*/
27
28
#ifndef SPECTRUM_MANAGER_H
29
#define SPECTRUM_MANAGER_H
30
31
#include "spectrum-sensing.h"
32
#include "spectrum-decision.h"
33
#include "spectrum-data.h"
34
35
#include "pu-model.h"
36
#include "repository.h"
37
#include "ns3/regular-wifi-mac.h"
38
#include "ns3/nstime.h"
39
40
// Spectrum Manager modules
41
// Enable/Disable channel allocation performed at MAC Layer, by the SpectrumDecision Module
42
// Comment this line if channel allocation is performed by the routing agent
43
#define CHANNEL_DECISION_MAC_LAYER
44
45
// Enable/Disable Notifications MAC->NET layers, in case of PU detection on the current channel
46
#define ENABLE_SPECTRUM_HANDOFF_NOTIFICATION
47
48
49
namespace
ns3 {
50
51
// Other classes
52
class
SpectrumSensing;
53
class
SpectrumDecision;
54
class
SpectrumMobility;
55
class
HandoffTimer;
56
class
SenseTimer;
57
class
TransmitTimer;
58
class
RegularWifiMac;
59
69
class
SpectrumManager
{
70
71
friend
class
SenseTimer;
72
friend
class
TransmitTimer;
73
74
public
:
75
82
SpectrumManager
(
Ptr<RegularWifiMac>
mac,
int
id
);
83
93
SpectrumManager
(
Ptr<RegularWifiMac>
mac,
Ptr<WifiPhy>
phy,
94
int
id
,
Time
sense_time,
Time
transmit_time);
95
96
virtual
~
SpectrumManager
();
97
98
102
void
Start
();
103
107
bool
IsChannelAvailable
();
108
112
bool
IsPuInterfering
(
Time
txDuration);
113
117
void
SenseEnded
();
118
122
void
HandoffEnded
();
123
128
void
TransmitEnded
();
129
136
void
SetPuModel
(
double
prob,
Ptr<PUModel>
p);
137
143
void
SetRepository
(
Ptr<Repository>
rep);
144
145
private
:
146
147
// Spectrum Cycle Timers and Variables
148
// Sensing interval
149
Time
m_senseTime;
150
// Transmitting interval
151
Time
m_transmitTime;
152
153
// State Variables
154
// pu_on_ is true wheter PU activity is detected in the current sensing cycle
155
bool
m_isPuOn;
156
// sensing_ is true wheter a CR is performing sensing
157
bool
m_isSensing;
158
// switching
159
bool
m_isSwitching;
160
161
162
// MAC References and address
163
Ptr<RegularWifiMac>
m_wifiMac;
164
int
m_nodeId;
165
// WifiPhy reference
166
Ptr<WifiPhy>
m_wifiPhy;
167
168
// Modules
169
// Cross-layer repository for information sharing about the current channel
170
Ptr<Repository>
m_repository;
171
172
// Spectrum Sensing Module
173
SpectrumSensing
*m_sensingMod;
174
// Spectrum Decision Module
175
SpectrumDecision
*m_decisionMod;
176
177
};
178
}
179
#endif
180
181
ns3::SpectrumManager
APIs for Cognitive Radio extension.
Definition:
spectrum-manager.h:69
ns3::SpectrumManager::SpectrumManager
SpectrumManager(Ptr< RegularWifiMac > mac, int id)
Definition:
spectrum-manager.cc:27
ns3::Time
keep track of time unit.
Definition:
nstime.h:149
ns3::Ptr
smart pointer class similar to boost::intrusive_ptr
Definition:
ptr.h:59
ns3::SpectrumManager::HandoffEnded
void HandoffEnded()
Definition:
spectrum-manager.cc:269
ns3::SpectrumDecision
Definition:
spectrum-decision.h:44
ns3::SpectrumManager::SetPuModel
void SetPuModel(double prob, Ptr< PUModel > p)
Definition:
spectrum-manager.cc:124
ns3::SpectrumManager::Start
void Start()
Definition:
spectrum-manager.cc:75
ns3::SpectrumManager::SenseEnded
void SenseEnded()
Definition:
spectrum-manager.cc:149
ns3::SpectrumManager::IsPuInterfering
bool IsPuInterfering(Time txDuration)
Definition:
spectrum-manager.cc:97
ns3::SpectrumManager::TransmitEnded
void TransmitEnded()
Definition:
spectrum-manager.cc:244
ns3::SpectrumManager::IsChannelAvailable
bool IsChannelAvailable()
Definition:
spectrum-manager.cc:85
ns3::SpectrumSensing
Definition:
spectrum-sensing.h:32
ns3::SpectrumManager::SetRepository
void SetRepository(Ptr< Repository > rep)
Definition:
spectrum-manager.cc:134
src
cognitive
model
spectrum-manager.h
Generated on Sun Mar 16 2014 11:25:01 for ns-3 by
1.8.6