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