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 (auto iter = dlBurstProfiles.begin(); iter != dlBurstProfiles.end(); ++iter)
80 {
81 if (iter->GetDiuc() == iuc)
82 {
83 return (WimaxPhy::ModulationType)iter->GetFecCodeType();
84 }
85 }
86 }
87 else
88 {
89 std::vector<OfdmUlBurstProfile> ulBurstProfiles =
90 m_device->GetCurrentUcd().GetUlBurstProfiles();
91 for (auto iter = 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
106uint8_t
108 WimaxNetDevice::Direction direction) const
109{
110 if (direction == WimaxNetDevice::DIRECTION_DOWNLINK)
111 {
112 std::vector<OfdmDlBurstProfile> dlBurstProfiles =
113 m_device->GetCurrentDcd().GetDlBurstProfiles();
114 for (auto iter = dlBurstProfiles.begin(); iter != dlBurstProfiles.end(); ++iter)
115 {
116 if (iter->GetFecCodeType() == modulationType)
117 {
118 return iter->GetDiuc();
119 }
120 }
121 }
122 else
123 {
124 std::vector<OfdmUlBurstProfile> ulBurstProfiles =
125 m_device->GetCurrentUcd().GetUlBurstProfiles();
126 for (auto iter = ulBurstProfiles.begin(); iter != ulBurstProfiles.end(); ++iter)
127 {
128 if (iter->GetFecCodeType() == modulationType)
129 {
130 return iter->GetUiuc();
131 }
132 }
133 }
134
135 // burst profile got to be there in DCD/UCD, assuming always all profiles are defined in DCD/UCD
136 NS_FATAL_ERROR("burst profile got to be there in DCD/UCD");
137
138 return ~0;
139}
140
141uint8_t
143 const RngReq* rngreq,
144 WimaxPhy::ModulationType& modulationType) const
145{
146 /*during initial ranging or periodic ranging (or when RNG-REQ is used instead of
147 DBPC) calculates the least robust burst profile for SS, e.g., based on distance,
148 power, signal etc, temporarily choosing same burst profile SS requested in RNG-REQ*/
149
150 modulationType = GetModulationTypeForSS(ssRecord, rngreq);
152}
153
156{
158}
159
160uint8_t
162{
163 /*modulation type is currently set by user in simulation script, shall
164 actually be determined based on SS's distance, power, signal etc*/
165
168}
169
170} // 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:77
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:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
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.