A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
bs-uplink-scheduler-mbqos.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2009 INRIA/LRC - Computer Networks Laboratory
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 * Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
18 * Flavio Kobuta <flaviokubota@gmail.com>
19 *
20 */
21
22#ifndef UPLINK_SCHEDULER_MBQOS_H
23#define UPLINK_SCHEDULER_MBQOS_H
24
25#include "bs-uplink-scheduler.h"
26#include "service-flow-record.h"
27#include "service-flow.h"
28#include "ul-job.h"
29#include "ul-mac-messages.h"
30#include "wimax-phy.h"
31
32#include "ns3/nstime.h"
33#include "ns3/object.h"
34
35#include <stdint.h>
36
37namespace ns3
38{
39
40class BaseStationNetDevice;
41class SSRecord;
42class ServiceFlow;
43class ServiceFlowRecord;
44class UlJob;
45
46/**
47 * \ingroup wimax
48 * \brief This class implements a Migration-based Quality of Service uplink scheduler(MBQoS).
49 *
50 * This uplink scheduler uses three queues, the low priority
51 * queue, the intermediate queue and the high priority queue.
52 * The scheduler serves the requests in strict priority order
53 * from the high priority queue to the low priority queue. The
54 * low priority queue stores the bandwidth requests of the BE
55 * service flow. The intermediate queue holds bandwidth requests
56 * sent by rtPS and by nrtPS connections. rtPS and nrtPS requests
57 * can migrate to the high priority queue to guarantee that
58 * their QoS requirements are met. Besides the requests migrated
59 * from the intermediate queue, the high priority queue stores
60 * periodic grants and unicast request opportunities that must be
61 * scheduled in the following frame. To guarantee the maximum delay
62 * requirement, the BS assigns a deadline to each rtPS bandwidth
63 * request in the intermediate queue. The minimum bandwidth
64 * requirement of both rtPS and nrtPS connections is guaranteed
65 * over a window of duration T .
66 * Implementation of uplink scheduler:
67 * Freitag, J.; da Fonseca, N.L.S., "Uplink Scheduling with Quality of Service in IEEE 802.16
68 * Networks," Global Telecommunications Conference, 2007. GLOBECOM '07. IEEE , vol., no.,
69 * pp.2503-2508, 26-30 Nov. 2007 URL:
70 * http://ieeexplore.ieee.org/stamp/stamp.jsp?arnumber=4411386&isnumber=4410910
71 */
73{
74 public:
76 /**
77 * Constructor
78 *
79 * \param time the time
80 */
82 ~UplinkSchedulerMBQoS() override;
83
84 /**
85 * \brief Get the type ID.
86 * \return the object TypeId
87 */
88 static TypeId GetTypeId();
89
90 /**
91 * Get uplink allocations
92 * \returns std::list<OfdmUlMapIe>
93 */
94 std::list<OfdmUlMapIe> GetUplinkAllocations() const override;
95
96 /**
97 * Determines if channel descriptors sent in the current frame are
98 * required to be updated
99 * \param updateDcd update DCD if true
100 * \param updateUcd update UCD if true
101 * \param sendDcd send DCD if true
102 * \param sendUcd send UCD if true
103 */
104 void GetChannelDescriptorsToUpdate(bool& updateDcd,
105 bool& updateUcd,
106 bool& sendDcd,
107 bool& sendUcd) override;
108 /**
109 * Calculate allocation start time
110 * \returns the allocation start time
111 */
113 /**
114 * Add uplink allocation
115 * \param ulMapIe the UL map IE
116 * \param allocationSize the allocation size
117 * \param symbolsToAllocation the symbols to allocation
118 * \param availableSymbols the available symbols
119 */
120 void AddUplinkAllocation(OfdmUlMapIe& ulMapIe,
121 const uint32_t& allocationSize,
122 uint32_t& symbolsToAllocation,
123 uint32_t& availableSymbols) override;
124
125 /**
126 * Schedule function
127 */
128 void Schedule() override;
129 /**
130 * Service unsolicited grants
131 * \param ssRecord the SS record
132 * \param schedulingType the scheduling type
133 * \param ulMapIe the UL map IE
134 * \param modulationType the modulation type
135 * \param symbolsToAllocation the symbols to allocation
136 * \param availableSymbols the available symbols
137 */
138 void ServiceUnsolicitedGrants(const SSRecord* ssRecord,
139 ServiceFlow::SchedulingType schedulingType,
140 OfdmUlMapIe& ulMapIe,
141 const WimaxPhy::ModulationType modulationType,
142 uint32_t& symbolsToAllocation,
143 uint32_t& availableSymbols) override;
144 /**
145 * Service bandwidth requests
146 * \param ssRecord the SS record
147 * \param schedulingType the scheduling type
148 * \param ulMapIe the UL map IE
149 * \param modulationType the modulation type
150 * \param symbolsToAllocation the symbols to allocation
151 * \param availableSymbols the available symbols
152 */
153 void ServiceBandwidthRequests(const SSRecord* ssRecord,
154 ServiceFlow::SchedulingType schedulingType,
155 OfdmUlMapIe& ulMapIe,
156 const WimaxPhy::ModulationType modulationType,
157 uint32_t& symbolsToAllocation,
158 uint32_t& availableSymbols) override;
159 /**
160 * Service bandwidth requests
161 * \param serviceFlow the service flow
162 * \param schedulingType the scheduling type
163 * \param ulMapIe the UL map IE
164 * \param modulationType the modulation type
165 * \param symbolsToAllocation the symbols to allocation
166 * \param availableSymbols the available symbols
167 * \returns true if successful
168 */
169 bool ServiceBandwidthRequests(ServiceFlow* serviceFlow,
170 ServiceFlow::SchedulingType schedulingType,
171 OfdmUlMapIe& ulMapIe,
172 const WimaxPhy::ModulationType modulationType,
173 uint32_t& symbolsToAllocation,
174 uint32_t& availableSymbols) override;
175 /**
176 * Allocate initial ranging interval
177 * \param symbolsToAllocation the symbols to allocation
178 * \param availableSymbols the available symbols
179 */
180 void AllocateInitialRangingInterval(uint32_t& symbolsToAllocation,
181 uint32_t& availableSymbols) override;
182 /**
183 * Setup service flow
184 * \param ssRecord the SS record
185 * \param serviceFlow the service flow
186 */
187 void SetupServiceFlow(SSRecord* ssRecord, ServiceFlow* serviceFlow) override;
188
189 /**
190 * \param availableSymbols available symbols in the uplink frame
191 * \brief Check deadline from jobs. Migrate requests if necessary.
192 *
193 * This method verifies for each rtPS request whether it should be
194 * migrated to the high priority queue or not. The conditions for
195 * migration are: request deadline expires in the frame following
196 * the next one, and the amount of bandwidth requested is less than
197 * or equal to the amount of available bytes in the next uplink frame.
198 */
199 void CheckDeadline(uint32_t& availableSymbols);
200
201 /**
202 * \param availableSymbols available symbols in the uplink frame.
203 * \brief Check if Minimum bandwidth is guarantee. Migrate requests if necessary.
204 *
205 * This method first calculate a priority value for each request
206 * in the intermediate queue. Then, sorts the intermediate queue
207 * according to the priority values. Finally, while there is available
208 * bandwidth, the scheduler migrate the requests to the high priority queue.
209 */
210 void CheckMinimumBandwidth(uint32_t& availableSymbols);
211
212 /**
213 * \brief Reset the current window.
214 * According to a configured time, reset the window.
215 */
217
218 /**
219 * \param priority Priority of queue
220 * \param job job information
221 *
222 * \brief Enqueue a job in a priority queue.
223 */
224 void EnqueueJob(UlJob::JobPriority priority, Ptr<UlJob> job);
225
226 /**
227 * \param priority Priority of queue
228 * \return Ptr<UlJob>
229 *
230 * \brief Dequeue a job from a priority queue.
231 */
233
234 void ProcessBandwidthRequest(const BandwidthRequestHeader& bwRequestHdr) override;
235
236 /**
237 * \param serviceFlow Service flow of connection
238 * \return Time
239 *
240 * \brief Calculates deadline of a request.
241 */
242 Time DetermineDeadline(ServiceFlow* serviceFlow);
243
244 /**
245 * This method is called once to initialize window.
246 */
247 void InitOnce() override;
248
249 /**
250 * \param jobs List of jobs
251 * \returns the symbols count
252 *
253 * Sum the amount of symbols of each job of a queue
254 */
255 uint32_t CountSymbolsQueue(std::list<Ptr<UlJob>> jobs);
256
257 /**
258 * \param job job
259 * \returns the symbols count
260 *
261 * Count the amount of symbols of a job.
262 */
264
265 /**
266 * Set requested bandwidth
267 * \param sfr the service flow record
268 */
269 void OnSetRequestedBandwidth(ServiceFlowRecord* sfr) override;
270
271 /**
272 * \param ssRecord Subscriber station record
273 * \param schedType Service flow type
274 * \param reqType Type of packet
275 * \return Ptr<UlJob>
276 *
277 * Create and fill information of a job.
278 */
281 ReqType reqType);
282
283 /**
284 * \param serviceFlow ServiceFlow
285 * \return Ptr<UlJob>
286 *
287 * Get pending size.
288 */
289 uint32_t GetPendingSize(ServiceFlow* serviceFlow);
290
291 /**
292 * Service bandwidth requests bytes.
293 * \param serviceFlow the service flow
294 * \param schedulingType the scheduling type
295 * \param ulMapIe the UL map IE
296 * \param modulationType the modulation type
297 * \param symbolsToAllocation the symbols to allocation
298 * \param availableSymbols the available symbols
299 * \param allocationSizeBytes the allocation size in bytes
300 * \returns true if successful
301 */
303 ServiceFlow::SchedulingType schedulingType,
304 OfdmUlMapIe& ulMapIe,
305 const WimaxPhy::ModulationType modulationType,
306 uint32_t& symbolsToAllocation,
307 uint32_t& availableSymbols,
308 uint32_t allocationSizeBytes);
309
310 private:
311 std::list<OfdmUlMapIe> m_uplinkAllocations; ///< uplink allocations
312
313 // queues for scheduler
314 std::list<Ptr<UlJob>> m_uplinkJobs_high; ///< uplink jobs high priority
315 std::list<Ptr<UlJob>> m_uplinkJobs_inter; ///< uplink jobs intermedite priority
316 std::list<Ptr<UlJob>> m_uplinkJobs_low; ///< uplink jobs low priority
317
318 // interval to reset window
319 Time m_windowInterval; ///< windows interval
320};
321
322} // namespace ns3
323
324#endif /* UPLINK_SCHEDULER_MBQOS_H */
This class implements the bandwidth-request mac Header as described by IEEE Standard for Local and me...
This class implements the UL-MAP_IE message as described by "IEEE Standard for Local and metropolitan...
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
This class is used by the base station to store some information related to subscriber station in the...
Definition: ss-record.h:46
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:43
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
Definition: service-flow.h:62
this class implements a structure to manage some parameters and statistics related to a service flow
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
JobPriority
Job priority enumeration.
Definition: ul-job.h:54
ModulationType
ModulationType enumeration.
Definition: wimax-phy.h:54
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ReqType
Request type enumeration.
Definition: ul-job.h:40