A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
burst-profile-manager.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2007,2008 INRIA
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
19
*/
20
21
#include <stdint.h>
22
#include "
burst-profile-manager.h
"
23
#include "
bs-net-device.h
"
24
#include "
ss-net-device.h
"
25
#include "
ss-record.h
"
26
#include "
ss-manager.h
"
27
#include "ns3/log.h"
28
#include "
mac-messages.h
"
29
30
namespace
ns3
{
31
32
NS_LOG_COMPONENT_DEFINE
(
"BurstProfileManager"
);
33
34
NS_OBJECT_ENSURE_REGISTERED
(BurstProfileManager);
35
36
TypeId
BurstProfileManager::GetTypeId
(
void
)
37
{
38
static
TypeId
tid =
TypeId
(
"ns3::BurstProfileManager"
)
39
.
SetParent
<
Object
> ()
40
.SetGroupName(
"Wimax"
);
41
return
tid;
42
}
43
44
BurstProfileManager::BurstProfileManager
(
Ptr<WimaxNetDevice>
device)
45
: m_device (device)
46
{
47
}
48
49
BurstProfileManager::~BurstProfileManager
(
void
)
50
{
51
m_device
= 0;
52
}
53
54
void
55
BurstProfileManager::DoDispose
(
void
)
56
{
57
m_device
= 0;
58
}
59
60
61
uint16_t
BurstProfileManager::GetNrBurstProfilesToDefine
(
void
)
62
{
63
/*
64
* 7 modulation types
65
*/
66
return
7;
67
}
68
69
WimaxPhy::ModulationType
70
BurstProfileManager::GetModulationType
(uint8_t iuc,
71
WimaxNetDevice::Direction
direction)
const
72
{
73
if
(direction ==
WimaxNetDevice::DIRECTION_DOWNLINK
)
74
{
75
std::vector<OfdmDlBurstProfile> dlBurstProfiles =
76
m_device
->GetCurrentDcd ().GetDlBurstProfiles ();
77
for
(std::vector<OfdmDlBurstProfile>::iterator iter =
78
dlBurstProfiles.begin (); iter != dlBurstProfiles.end (); ++iter)
79
{
80
if
(iter->GetDiuc () == iuc)
81
{
82
return
(
WimaxPhy::ModulationType
) iter->GetFecCodeType ();
83
}
84
}
85
}
86
else
87
{
88
std::vector<OfdmUlBurstProfile> ulBurstProfiles =
89
m_device
->GetCurrentUcd ().GetUlBurstProfiles ();
90
for
(std::vector<OfdmUlBurstProfile>::iterator iter =
91
ulBurstProfiles.begin (); iter != ulBurstProfiles.end (); ++iter)
92
{
93
if
(iter->GetUiuc () == iuc)
94
{
95
return
(
WimaxPhy::ModulationType
) iter->GetFecCodeType ();
96
}
97
}
98
}
99
100
// burst profile got to be there in DCD/UCD, assuming always all profiles are defined in DCD/UCD
101
NS_FATAL_ERROR
(
"burst profile got to be there in DCD/UCD"
);
102
103
return
(
WimaxPhy::ModulationType
) -1;
104
}
105
106
uint8_t
107
BurstProfileManager::GetBurstProfile
(
108
WimaxPhy::ModulationType
modulationType,
109
WimaxNetDevice::Direction
direction)
const
110
{
111
if
(direction ==
WimaxNetDevice::DIRECTION_DOWNLINK
)
112
{
113
std::vector<OfdmDlBurstProfile> dlBurstProfiles =
114
m_device
->GetCurrentDcd ().GetDlBurstProfiles ();
115
for
(std::vector<OfdmDlBurstProfile>::iterator iter =
116
dlBurstProfiles.begin (); iter != dlBurstProfiles.end (); ++iter)
117
{
118
if
(iter->GetFecCodeType () == modulationType)
119
{
120
return
iter->GetDiuc ();
121
}
122
}
123
}
124
else
125
{
126
std::vector<OfdmUlBurstProfile> ulBurstProfiles =
127
m_device
->GetCurrentUcd ().GetUlBurstProfiles ();
128
for
(std::vector<OfdmUlBurstProfile>::iterator iter =
129
ulBurstProfiles.begin (); iter != ulBurstProfiles.end (); ++iter)
130
{
131
if
(iter->GetFecCodeType () == modulationType)
132
{
133
return
iter->GetUiuc ();
134
}
135
}
136
}
137
138
// burst profile got to be there in DCD/UCD, assuming always all profiles are defined in DCD/UCD
139
NS_FATAL_ERROR
(
"burst profile got to be there in DCD/UCD"
);
140
141
return
~0;
142
}
143
144
uint8_t
145
BurstProfileManager::GetBurstProfileForSS
(
const
SSRecord
*ssRecord,
146
const
RngReq
*rngreq,
WimaxPhy::ModulationType
&modulationType)
147
{
148
/*during initial ranging or periodic ranging (or when RNG-REQ is used instead of
149
DBPC) calculates the least robust burst profile for SS, e.g., based on distance,
150
power, signal etc, temporarily choosing same burst profile SS requested in RNG-REQ*/
151
152
modulationType =
GetModulationTypeForSS
(ssRecord, rngreq);
153
return
GetBurstProfile
(modulationType,
WimaxNetDevice::DIRECTION_DOWNLINK
);
154
}
155
156
WimaxPhy::ModulationType
157
BurstProfileManager::GetModulationTypeForSS
(
const
SSRecord
*ssRecord,
const
RngReq
*rngreq)
158
{
159
160
return
GetModulationType
(rngreq->
GetReqDlBurstProfile
(),
161
WimaxNetDevice::DIRECTION_DOWNLINK
);
162
}
163
164
uint8_t
165
BurstProfileManager::GetBurstProfileToRequest
(
void
)
166
{
167
/*modulation type is currently set by user in simulation script, shall
168
actually be determined based on SS's distance, power, signal etc*/
169
170
return
GetBurstProfile
(
171
m_device
->GetObject<
SubscriberStationNetDevice
> ()->
GetModulationType
(),
172
WimaxNetDevice::DIRECTION_DOWNLINK
);
173
}
174
175
}
// namespace ns3
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
ns3::SubscriberStationNetDevice::GetModulationType
WimaxPhy::ModulationType GetModulationType(void) const
Definition:
ss-net-device.cc:520
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3::WimaxNetDevice::Direction
Direction
Direction enumeration.
Definition:
wimax-net-device.h:73
ns3::BurstProfileManager::DoDispose
void DoDispose(void)
Destructor implementation.
Definition:
burst-profile-manager.cc:55
ss-net-device.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::BurstProfileManager::GetNrBurstProfilesToDefine
uint16_t GetNrBurstProfilesToDefine(void)
Definition:
burst-profile-manager.cc:61
ns3::BurstProfileManager::GetBurstProfileForSS
uint8_t GetBurstProfileForSS(const SSRecord *ssRecord, const RngReq *rngreq, WimaxPhy::ModulationType &modulationType)
Get burst profile for SS.
Definition:
burst-profile-manager.cc:145
ns3::RngReq::GetReqDlBurstProfile
uint8_t GetReqDlBurstProfile(void) const
Get request DL burst profile field.
Definition:
mac-messages.cc:147
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:923
ns3::BurstProfileManager::m_device
Ptr< WimaxNetDevice > m_device
the device
Definition:
burst-profile-manager.h:107
ns3::BurstProfileManager::GetBurstProfileToRequest
uint8_t GetBurstProfileToRequest(void)
Get burst profile to request.
Definition:
burst-profile-manager.cc:165
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition:
ptr.h:74
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition:
fatal-error.h:165
ns3::WimaxPhy::ModulationType
ModulationType
ModulationType enumeration.
Definition:
wimax-phy.h:50
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:88
mac-messages.h
ns3::BurstProfileManager::GetModulationType
WimaxPhy::ModulationType GetModulationType(uint8_t iuc, WimaxNetDevice::Direction direction) const
returns the modulation type of a given iuc
Definition:
burst-profile-manager.cc:70
ns3::SSRecord
This class is used by the base station to store some information related to subscriber station in the...
Definition:
ss-record.h:44
ns3::BurstProfileManager::GetBurstProfile
uint8_t GetBurstProfile(WimaxPhy::ModulationType modulationType, WimaxNetDevice::Direction direction) const
returns the burst profile
Definition:
burst-profile-manager.cc:107
ns3::BurstProfileManager::BurstProfileManager
BurstProfileManager(Ptr< WimaxNetDevice > device)
Constructor.
Definition:
burst-profile-manager.cc:44
ns3::SubscriberStationNetDevice
SubscriberStationNetDevice subclass of WimaxNetDevice.
Definition:
ss-net-device.h:49
ns3::WimaxNetDevice::DIRECTION_DOWNLINK
@ DIRECTION_DOWNLINK
Definition:
wimax-net-device.h:74
ss-record.h
ns3::BurstProfileManager::GetModulationTypeForSS
WimaxPhy::ModulationType GetModulationTypeForSS(const SSRecord *ssRecord, const RngReq *rngreq)
Get module ation type for SS.
Definition:
burst-profile-manager.cc:157
ss-manager.h
ns3::BurstProfileManager::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
burst-profile-manager.cc:36
ns3::BurstProfileManager::~BurstProfileManager
~BurstProfileManager(void)
Definition:
burst-profile-manager.cc:49
bs-net-device.h
burst-profile-manager.h
ns3::RngReq
This class implements the ranging request message described by "IEEE Standard for Local and metropoli...
Definition:
mac-messages.h:643
src
wimax
model
burst-profile-manager.cc
Generated on Fri Oct 1 2021 17:03:53 for ns-3 by
1.8.20