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