A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
bs-scheduler-rtps.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007,2008 INRIA
3 * 2009 TELEMATICS LAB, Politecnico di Bari
4 *
5 * SPDX-License-Identifier: GPL-2.0-only
6 *
7 * Author: Giuseppe Piro <g.piro@poliba.it>
8 */
9
10#include "bs-scheduler-rtps.h"
11
12#include "bs-net-device.h"
14#include "cid.h"
15#include "connection-manager.h"
17#include "service-flow-record.h"
18#include "service-flow.h"
19#include "ss-manager.h"
20#include "ss-record.h"
21#include "wimax-connection.h"
22#include "wimax-mac-header.h"
23#include "wimax-mac-queue.h"
24
25#include "ns3/log.h"
26#include "ns3/packet-burst.h"
27#include "ns3/simulator.h"
28
29namespace ns3
30{
31
32NS_LOG_COMPONENT_DEFINE("BSSchedulerRtps");
33
34NS_OBJECT_ENSURE_REGISTERED(BSSchedulerRtps);
35
36TypeId
38{
39 static TypeId tid = TypeId("ns3::BSSchedulerRtps")
41 .SetGroupName("Wimax")
42 .AddConstructor<BSSchedulerRtps>();
43 return tid;
44}
45
47 : m_downlinkBursts(new std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst>>>())
48{
49 SetBs(nullptr);
50}
51
53 : m_downlinkBursts(new std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst>>>())
54{
55 // m_downlinkBursts is filled by AddDownlinkBurst and emptied by
56 // wimax-bs-net-device::sendBurst and wimax-ss-net-device::sendBurst
57 SetBs(bs);
58}
59
61{
62 std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst>>>* downlinkBursts = m_downlinkBursts;
63 std::pair<OfdmDlMapIe*, Ptr<PacketBurst>> pair;
64 while (!downlinkBursts->empty())
65 {
66 pair = downlinkBursts->front();
67 pair.second = nullptr;
68 delete pair.first;
69 }
70
71 SetBs(nullptr);
72 delete m_downlinkBursts;
73 m_downlinkBursts = nullptr;
74}
75
76std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst>>>*
81
82void
84 uint8_t diuc,
85 WimaxPhy::ModulationType modulationType,
86 Ptr<PacketBurst> burst)
87{
88 auto dlMapIe = new OfdmDlMapIe();
89 dlMapIe->SetCid(connection->GetCid());
90 dlMapIe->SetDiuc(diuc);
91
92 NS_LOG_INFO("BS scheduler, burst size: " << burst->GetSize() << " bytes"
93 << ", pkts: " << burst->GetNPackets()
94 << ", connection: " << connection->GetTypeStr()
95 << ", CID: " << connection->GetCid());
96 if (connection->GetType() == Cid::TRANSPORT)
97 {
98 NS_LOG_INFO(", SFID: " << connection->GetServiceFlow()->GetSfid() << ", service: "
99 << connection->GetServiceFlow()->GetSchedulingTypeStr());
100 }
101 NS_LOG_INFO(", modulation: " << modulationType << ", DIUC: " << (uint32_t)diuc);
102
103 m_downlinkBursts->emplace_back(dlMapIe, burst);
104}
105
106/**
107 * \brief A DownLink Scheduler for rtPS Flows
108 *
109 * The DL Scheduler assigns the available bandwidth in the following order:
110 * - IR Connections
111 * - Broadcast Connections
112 * - Basic and Primary Connections
113 * - UGS Connections
114 * - rtPS Connections
115 * - nrtPS Connections
116 * - BE Connections
117 * All rtPS flows that have packets in the queue can transmit at least one
118 * packet, according to the available bandwidth.
119 */
120void
122{
123 uint32_t availableSymbols = GetBs()->GetNrDlSymbols();
124
125 BSSchedulerBroadcastConnection(availableSymbols);
126
127 BSSchedulerInitialRangingConnection(availableSymbols);
128
129 BSSchedulerBasicConnection(availableSymbols);
130
131 BSSchedulerPrimaryConnection(availableSymbols);
132
133 BSSchedulerUGSConnection(availableSymbols);
134
135 BSSchedulerRTPSConnection(availableSymbols);
136
137 BSSchedulerNRTPSConnection(availableSymbols);
138
139 BSSchedulerBEConnection(availableSymbols);
140
141 if (!m_downlinkBursts->empty())
142 {
144 "BS scheduler, number of bursts: "
145 << m_downlinkBursts->size() << ", symbols left: " << availableSymbols << std::endl
146 << "BS scheduler, queues:"
147 << " IR " << GetBs()->GetInitialRangingConnection()->GetQueue()->GetSize()
148 << " broadcast " << GetBs()->GetBroadcastConnection()->GetQueue()->GetSize()
149 << " basic "
150 << GetBs()->GetConnectionManager()->GetNPackets(Cid::BASIC, ServiceFlow::SF_TYPE_NONE)
151 << " primary "
152 << GetBs()->GetConnectionManager()->GetNPackets(Cid::PRIMARY, ServiceFlow::SF_TYPE_NONE)
153 << " transport "
154 << GetBs()->GetConnectionManager()->GetNPackets(Cid::TRANSPORT,
156 }
157}
158
161 WimaxPhy::ModulationType modulationType,
162 uint32_t availableSymbols)
163{
164 Time timeStamp;
166 Ptr<Packet> packet;
168 uint32_t nrSymbolsRequired = 0;
169
170 // serviceFlow->CleanUpQueue ();
171 Ptr<WimaxConnection> connection = serviceFlow->GetConnection();
172 while (serviceFlow->HasPackets())
173 {
174 uint32_t FirstPacketSize =
175 connection->GetQueue()->GetFirstPacketRequiredByte(MacHeaderType::HEADER_TYPE_GENERIC);
176 nrSymbolsRequired = GetBs()->GetPhy()->GetNrSymbols(FirstPacketSize, modulationType);
177 if (availableSymbols < nrSymbolsRequired &&
178 CheckForFragmentation(connection, availableSymbols, modulationType))
179 {
180 uint32_t availableByte =
181 GetBs()->GetPhy()->GetNrBytes(availableSymbols, modulationType);
182 packet = connection->Dequeue(MacHeaderType::HEADER_TYPE_GENERIC, availableByte);
183 availableSymbols = 0;
184 }
185 else
186 {
187 packet = connection->Dequeue();
188 availableSymbols -= nrSymbolsRequired;
189 }
190 burst->AddPacket(packet);
191 if (availableSymbols <= 0)
192 {
193 break;
194 }
195 }
196 return burst;
197}
198
199bool
201{
202 return false;
203}
204
205void
207{
208 Ptr<WimaxConnection> connection;
211 uint32_t nrSymbolsRequired = 0;
213 Ptr<Packet> packet;
215
216 while (GetBs()->GetBroadcastConnection()->HasPackets() && availableSymbols > 0)
217 {
218 connection = GetBs()->GetBroadcastConnection();
219
220 packet = connection->GetQueue()->Peek(hdr);
221 nrSymbolsRequired = GetBs()->GetPhy()->GetNrSymbols(packet->GetSize(), modulationType);
222
223 if (availableSymbols < nrSymbolsRequired &&
224 !CheckForFragmentation(connection, availableSymbols, modulationType))
225 {
226 break;
227 }
228 else if (availableSymbols < nrSymbolsRequired &&
229 CheckForFragmentation(connection, availableSymbols, modulationType))
230 {
231 uint32_t availableByte =
232 GetBs()->GetPhy()->GetNrBytes(availableSymbols, modulationType);
233 packet = connection->Dequeue(MacHeaderType::HEADER_TYPE_GENERIC, availableByte);
234 }
235 else
236 {
237 packet = connection->Dequeue();
238 }
239
240 NS_ASSERT_MSG(hdr.GetCid().GetIdentifier() == connection->GetCid(),
241 "Base station: Error while scheduling broadcast connection: header CID != "
242 "connection CID");
243 burst->AddPacket(packet);
244 availableSymbols -= nrSymbolsRequired;
245 }
246 if (burst->GetNPackets() != 0)
247 {
248 AddDownlinkBurst(connection, diuc, modulationType, burst);
249 }
250}
251
252void
254{
255 Ptr<WimaxConnection> connection;
258 uint32_t nrSymbolsRequired = 0;
260 Ptr<Packet> packet;
262
263 while (GetBs()->GetInitialRangingConnection()->HasPackets() && availableSymbols > 0)
264 {
265 connection = GetBs()->GetInitialRangingConnection();
266
267 packet = connection->GetQueue()->Peek(hdr);
268 nrSymbolsRequired = GetBs()->GetPhy()->GetNrSymbols(packet->GetSize(), modulationType);
269
270 // PIRO: check for fragmentation
271 if (availableSymbols < nrSymbolsRequired &&
272 !CheckForFragmentation(connection, availableSymbols, modulationType))
273 {
274 break;
275 }
276 else if (availableSymbols < nrSymbolsRequired &&
277 CheckForFragmentation(connection, availableSymbols, modulationType))
278 {
279 uint32_t availableByte =
280 GetBs()->GetPhy()->GetNrBytes(availableSymbols, modulationType);
281 packet = connection->Dequeue(MacHeaderType::HEADER_TYPE_GENERIC, availableByte);
282 }
283 else
284 {
285 packet = connection->Dequeue();
286 }
287
288 NS_ASSERT_MSG(hdr.GetCid() == connection->GetCid(),
289 "Base station: Error while scheduling initial ranging connection: header CID "
290 "!= connection CID");
291 burst->AddPacket(packet);
292 availableSymbols -= nrSymbolsRequired;
293 }
294 if (burst->GetNPackets())
295 {
296 AddDownlinkBurst(connection, diuc, modulationType, burst);
297 }
298}
299
300void
302{
303 Ptr<WimaxConnection> connection;
306 uint32_t nrSymbolsRequired = 0;
308 Ptr<Packet> packet;
310
311 std::vector<Ptr<WimaxConnection>> connections;
312
313 connections = GetBs()->GetConnectionManager()->GetConnections(Cid::BASIC);
314 for (auto iter = connections.begin(); iter != connections.end(); ++iter)
315 {
316 while ((*iter)->HasPackets() && availableSymbols > 0)
317 {
318 connection = *iter;
319
320 modulationType =
321 GetBs()->GetSSManager()->GetSSRecord(connection->GetCid())->GetModulationType();
322 diuc = GetBs()->GetBurstProfileManager()->GetBurstProfile(
323 modulationType,
325
326 packet = connection->GetQueue()->Peek(hdr);
327 nrSymbolsRequired = GetBs()->GetPhy()->GetNrSymbols(packet->GetSize(), modulationType);
328
329 // PIRO: check for fragmentation
330 if (availableSymbols < nrSymbolsRequired &&
331 !CheckForFragmentation(connection, availableSymbols, modulationType))
332 {
333 break;
334 }
335 else if (availableSymbols < nrSymbolsRequired &&
336 CheckForFragmentation(connection, availableSymbols, modulationType))
337 {
338 uint32_t availableByte =
339 GetBs()->GetPhy()->GetNrBytes(availableSymbols, modulationType);
340 packet = connection->Dequeue(MacHeaderType::HEADER_TYPE_GENERIC, availableByte);
341 }
342 else
343 {
344 packet = connection->Dequeue();
345 }
346
347 NS_ASSERT_MSG(hdr.GetCid() == connection->GetCid(),
348 "Base station: Error while scheduling basic connection: header CID != "
349 "connection CID");
350 burst->AddPacket(packet);
351 availableSymbols -= nrSymbolsRequired;
352 }
353 if (burst->GetNPackets() != 0)
354 {
355 AddDownlinkBurst(connection, diuc, modulationType, burst);
356 burst = Create<PacketBurst>();
357 }
358 }
359}
360
361void
363{
364 Ptr<WimaxConnection> connection;
366 uint8_t diuc = 0;
367 uint32_t nrSymbolsRequired = 0;
369 Ptr<Packet> packet;
371
372 std::vector<Ptr<WimaxConnection>> connections;
373
374 connections = GetBs()->GetConnectionManager()->GetConnections(Cid::PRIMARY);
375 for (auto iter = connections.begin(); iter != connections.end(); ++iter)
376 {
377 while ((*iter)->HasPackets() && availableSymbols > 0)
378 {
379 connection = *iter;
380
381 modulationType =
382 GetBs()->GetSSManager()->GetSSRecord(connection->GetCid())->GetModulationType();
383 diuc = GetBs()->GetBurstProfileManager()->GetBurstProfile(
384 modulationType,
386
387 packet = connection->GetQueue()->Peek(hdr);
388 nrSymbolsRequired = GetBs()->GetPhy()->GetNrSymbols(packet->GetSize(), modulationType);
389
390 // PIRO: check for fragmentation
391 if (availableSymbols < nrSymbolsRequired &&
392 !CheckForFragmentation(connection, availableSymbols, modulationType))
393 {
394 break;
395 }
396 else if (availableSymbols < nrSymbolsRequired &&
397 CheckForFragmentation(connection, availableSymbols, modulationType))
398 {
399 uint32_t availableByte =
400 GetBs()->GetPhy()->GetNrBytes(availableSymbols, modulationType);
401 packet = connection->Dequeue(MacHeaderType::HEADER_TYPE_GENERIC, availableByte);
402 }
403 else
404 {
405 packet = connection->Dequeue();
406 }
407
408 NS_ASSERT_MSG(hdr.GetCid() == connection->GetCid(),
409 "Base station: Error while scheduling primary connection: header CID != "
410 "connection CID");
411 burst->AddPacket(packet);
412 availableSymbols -= nrSymbolsRequired;
413 }
414 if (burst->GetNPackets() != 0)
415 {
416 AddDownlinkBurst(connection, diuc, modulationType, burst);
417 }
418 }
419}
420
421void
423{
424 Ptr<WimaxConnection> connection;
426 uint8_t diuc;
427 uint32_t nrSymbolsRequired = 0;
429 Ptr<Packet> packet;
431
432 Time currentTime = Simulator::Now();
433
434 ServiceFlowRecord* serviceFlowRecord;
435 std::vector<ServiceFlow*> serviceFlows;
436
437 serviceFlows = GetBs()->GetServiceFlowManager()->GetServiceFlows(ServiceFlow::SF_TYPE_UGS);
438 for (auto iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
439 {
440 serviceFlowRecord = (*iter)->GetRecord();
441 // if latency would exceed in case grant is allocated in next frame then allocate in current
442 // frame
443 if ((*iter)->HasPackets() &&
444 ((currentTime - serviceFlowRecord->GetDlTimeStamp()) +
445 GetBs()->GetPhy()->GetFrameDuration()) > MilliSeconds((*iter)->GetMaximumLatency()))
446 {
447 connection = (*iter)->GetConnection();
448 if (connection->GetType() == Cid::MULTICAST)
449 {
450 modulationType = connection->GetServiceFlow()->GetModulation();
451 }
452 else
453 {
454 modulationType =
455 GetBs()->GetSSManager()->GetSSRecord(connection->GetCid())->GetModulationType();
456 }
457 diuc = GetBs()->GetBurstProfileManager()->GetBurstProfile(
458 modulationType,
460
461 nrSymbolsRequired = connection->GetServiceFlow()->GetRecord()->GetGrantSize();
462
463 // Packet fragmentation for UGS connections has not been implemented yet!
464 if (availableSymbols > nrSymbolsRequired)
465 {
466 availableSymbols -= nrSymbolsRequired;
467 burst =
468 CreateUgsBurst(connection->GetServiceFlow(), modulationType, nrSymbolsRequired);
469 if (burst->GetNPackets() != 0)
470 {
471 AddDownlinkBurst(connection, diuc, modulationType, burst);
472 currentTime = Simulator::Now();
473 serviceFlowRecord->SetDlTimeStamp(currentTime);
474 burst = Create<PacketBurst>();
475 }
476 }
477 }
478 }
479}
480
481void
483{
484 Ptr<WimaxConnection> connection;
486 Ptr<Packet> packet;
488
489 Time currentTime = Simulator::Now();
490
491 std::vector<Ptr<WimaxConnection>> connections;
492 ServiceFlowRecord* serviceFlowRecord;
493 std::vector<ServiceFlow*> serviceFlows;
494
495 uint32_t symbolsRequired[100];
496 WimaxPhy::ModulationType modulationType_[100];
497 uint8_t diuc_[100];
498 Ptr<WimaxConnection> rtPSConnection[100];
499 uint32_t dataToSend;
500 uint32_t totSymbolsRequired = 0;
501 int nbConnection = 0;
502
503 NS_LOG_INFO("\tDL Scheduler for rtPS flows \n"
504 << "\t\tavailableSymbols = " << availableSymbols);
505
506 serviceFlows = GetBs()->GetServiceFlowManager()->GetServiceFlows(ServiceFlow::SF_TYPE_RTPS);
507 nbConnection = 0;
508 for (auto iter2 = serviceFlows.begin(); iter2 != serviceFlows.end(); ++iter2)
509 {
510 // DL RTPS Scheduler works for all rtPS connection that have packets to transmitt!!!
511 serviceFlowRecord = (*iter2)->GetRecord();
512
513 if ((*iter2)->HasPackets())
514 {
515 currentTime = Simulator::Now();
516 serviceFlowRecord->SetDlTimeStamp(currentTime);
517 rtPSConnection[nbConnection] = (*iter2)->GetConnection();
518 if (rtPSConnection[nbConnection]->GetType() == Cid::MULTICAST)
519 {
520 modulationType_[nbConnection] =
521 rtPSConnection[nbConnection]->GetServiceFlow()->GetModulation();
522 }
523 else
524 {
525 modulationType_[nbConnection] =
526 GetBs()
527 ->GetSSManager()
528 ->GetSSRecord(rtPSConnection[nbConnection]->GetCid())
529 ->GetModulationType();
530 }
531 diuc_[nbConnection] = GetBs()->GetBurstProfileManager()->GetBurstProfile(
532 modulationType_[nbConnection],
534
535 dataToSend = rtPSConnection[nbConnection]->GetQueue()->GetQueueLengthWithMACOverhead();
536 NS_LOG_INFO("\t\tRTPS DL Scheduler for CID = " << rtPSConnection[nbConnection]->GetCid()
537 << "\n\t\t\t dataToSend = "
538 << dataToSend);
539
540 symbolsRequired[nbConnection] =
541 GetBs()->GetPhy()->GetNrSymbols(dataToSend, modulationType_[nbConnection]);
542
543 totSymbolsRequired += symbolsRequired[nbConnection];
544 nbConnection++;
545 }
546 }
547
548 NS_LOG_INFO("\t\ttotSymbolsRequired = " << totSymbolsRequired);
549
550 // Channel Saturation
551 while (totSymbolsRequired > availableSymbols)
552 {
553 NS_LOG_INFO("\tDL Channel Saturation: totSymbolsRequired > availableSymbols_rtPS");
554 double delta = double(availableSymbols) / double(totSymbolsRequired);
555 NS_LOG_INFO("\t\tdelta = " << delta);
556 totSymbolsRequired = 0;
557 for (int i = 0; i < nbConnection; i++)
558 {
559 NS_LOG_INFO("\t\tprevious symbolsRequired[" << i << "] = " << symbolsRequired[i]);
560 symbolsRequired[i] = (uint32_t)std::floor(symbolsRequired[i] * delta);
561 totSymbolsRequired += symbolsRequired[i];
562 NS_LOG_INFO("\t\tnew symbolsRequired[" << i << "] = " << symbolsRequired[i]);
563 }
564 NS_LOG_INFO("\t\ttotSymbolsRequired = " << totSymbolsRequired);
565 }
566
567 // Downlink Bandwidth Allocation
568 for (int i = 0; i < nbConnection; i++)
569 {
570 packet = rtPSConnection[i]->GetQueue()->Peek(hdr);
571 uint32_t symbolsForPacketTransmission = 0;
572 burst = Create<PacketBurst>();
573 NS_LOG_INFO("\t\tCID = " << rtPSConnection[i]->GetCid()
574 << " assignedSymbols = " << symbolsRequired[i]);
575
576 while (symbolsRequired[i] > 0)
577 {
578 symbolsForPacketTransmission = GetBs()->GetPhy()->GetNrSymbols(
579 rtPSConnection[i]->GetQueue()->GetFirstPacketRequiredByte(
581 modulationType_[i]);
582
583 // PIRO: check for fragmentation
584 if (symbolsForPacketTransmission > symbolsRequired[i] &&
585 !CheckForFragmentation(rtPSConnection[i], symbolsRequired[i], modulationType_[i]))
586 {
587 break;
588 }
589 else if (symbolsForPacketTransmission > symbolsRequired[i] &&
590 CheckForFragmentation(rtPSConnection[i],
591 symbolsRequired[i],
592 modulationType_[i]))
593 {
594 uint32_t availableByte =
595 GetBs()->GetPhy()->GetNrBytes(symbolsRequired[i], modulationType_[i]);
596 packet =
597 rtPSConnection[i]->Dequeue(MacHeaderType::HEADER_TYPE_GENERIC, availableByte);
598 symbolsRequired[i] = 0;
599 }
600 else
601 {
602 packet = rtPSConnection[i]->Dequeue();
603 symbolsRequired[i] -= symbolsForPacketTransmission;
604 }
605
606 NS_ASSERT_MSG(hdr.GetCid() == rtPSConnection[i]->GetCid(),
607 "Base station: Error while scheduling RTPs connection: header CID != "
608 "connection CID");
609 burst->AddPacket(packet);
610 }
611
612 if (burst->GetNPackets() != 0)
613 {
614 AddDownlinkBurst(rtPSConnection[i], diuc_[i], modulationType_[i], burst);
615 }
616 }
617
618 availableSymbols -= totSymbolsRequired;
619}
620
621void
623{
624 Ptr<WimaxConnection> connection;
626 uint8_t diuc = 0;
627 uint32_t nrSymbolsRequired = 0;
629 Ptr<Packet> packet;
631
632 std::vector<ServiceFlow*> serviceFlows;
633
634 serviceFlows = GetBs()->GetServiceFlowManager()->GetServiceFlows(ServiceFlow::SF_TYPE_NRTPS);
635 for (auto iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
636 {
637 connection = (*iter)->GetConnection();
638
639 while ((*iter)->HasPackets() && availableSymbols > 0)
640 {
641 if (connection->GetType() == Cid::MULTICAST)
642 {
643 modulationType = connection->GetServiceFlow()->GetModulation();
644 }
645 else
646 {
647 modulationType =
648 GetBs()->GetSSManager()->GetSSRecord(connection->GetCid())->GetModulationType();
649 }
650
651 diuc = GetBs()->GetBurstProfileManager()->GetBurstProfile(
652 modulationType,
654
655 packet = connection->GetQueue()->Peek(hdr);
656 nrSymbolsRequired = GetBs()->GetPhy()->GetNrSymbols(packet->GetSize(), modulationType);
657
658 if (availableSymbols < nrSymbolsRequired)
659 {
660 break;
661 }
662
663 packet = connection->Dequeue();
664 NS_ASSERT_MSG(hdr.GetCid() == connection->GetCid(),
665 "Base station: Error while scheduling NRTPs connection: header CID != "
666 "connection CID");
667 burst->AddPacket(packet);
668 availableSymbols -= nrSymbolsRequired;
669 }
670 if (burst->GetNPackets() != 0)
671 {
672 AddDownlinkBurst(connection, diuc, modulationType, burst);
673 burst = Create<PacketBurst>();
674 }
675 }
676}
677
678void
680{
681 Ptr<WimaxConnection> connection;
683 uint8_t diuc = 0;
684 uint32_t nrSymbolsRequired = 0;
686 Ptr<Packet> packet;
688
689 std::vector<ServiceFlow*> serviceFlows;
690
691 serviceFlows = GetBs()->GetServiceFlowManager()->GetServiceFlows(ServiceFlow::SF_TYPE_BE);
692 for (auto iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
693 {
694 connection = (*iter)->GetConnection();
695
696 while ((*iter)->HasPackets() && availableSymbols > 0)
697 {
698 if (connection->GetType() == Cid::MULTICAST)
699 {
700 modulationType = connection->GetServiceFlow()->GetModulation();
701 }
702 else
703 {
704 modulationType =
705 GetBs()->GetSSManager()->GetSSRecord(connection->GetCid())->GetModulationType();
706 }
707 diuc = GetBs()->GetBurstProfileManager()->GetBurstProfile(
708 modulationType,
710
711 packet = connection->GetQueue()->Peek(hdr);
712 nrSymbolsRequired = GetBs()->GetPhy()->GetNrSymbols(packet->GetSize(), modulationType);
713
714 if (availableSymbols < nrSymbolsRequired)
715 {
716 break;
717 }
718
719 packet = connection->Dequeue();
721 hdr.GetCid() == connection->GetCid(),
722 "Base station: Error while scheduling BE connection: header CID != connection CID");
723 burst->AddPacket(packet);
724 availableSymbols -= nrSymbolsRequired;
725 }
726 if (burst->GetNPackets() != 0)
727 {
728 AddDownlinkBurst(connection, diuc, modulationType, burst);
729 burst = Create<PacketBurst>();
730 }
731 }
732}
733
734} // namespace ns3
BaseStation Scheduler.
virtual Ptr< BaseStationNetDevice > GetBs()
Get the base station.
virtual void SetBs(Ptr< BaseStationNetDevice > bs)
Set the base station.
bool CheckForFragmentation(Ptr< WimaxConnection > connection, int availableSymbols, WimaxPhy::ModulationType modulationType)
Check if the packet fragmentation is possible for transport connection.
This class implements a simple downlink scheduler for rtPS flows.
static TypeId GetTypeId()
Get the type ID.
void Schedule() override
Schedule function.
void BSSchedulerPrimaryConnection(uint32_t &availableSymbols)
schedules the primary connection
std::list< std::pair< OfdmDlMapIe *, Ptr< PacketBurst > > > * GetDownlinkBursts() const override
This function returns all the downlink bursts scheduled for the next downlink sub-frame.
void BSSchedulerUGSConnection(uint32_t &availableSymbols)
schedules the UGS connection
void BSSchedulerBEConnection(uint32_t &availableSymbols)
schedules the BE connection
void BSSchedulerBasicConnection(uint32_t &availableSymbols)
schedules the basic connections
void AddDownlinkBurst(Ptr< const WimaxConnection > connection, uint8_t diuc, WimaxPhy::ModulationType modulationType, Ptr< PacketBurst > burst) override
This function adds a downlink burst to the list of downlink bursts scheduled for the next downlink su...
void BSSchedulerInitialRangingConnection(uint32_t &availableSymbols)
schedules the IR connections
void BSSchedulerRTPSConnection(uint32_t &availableSymbols)
Downlink Scheduler for rtPS connections.
void BSSchedulerBroadcastConnection(uint32_t &availableSymbols)
schedules the broadcast connections
void BSSchedulerNRTPSConnection(uint32_t &availableSymbols)
schedules the NRTPS connections
Ptr< PacketBurst > CreateUgsBurst(ServiceFlow *serviceFlow, WimaxPhy::ModulationType modulationType, uint32_t availableSymbols) override
Creates a downlink UGS burst.
bool SelectConnection(Ptr< WimaxConnection > &connection) override
Selects a connection from the list of connections having packets to be sent .
std::list< std::pair< OfdmDlMapIe *, Ptr< PacketBurst > > > * m_downlinkBursts
down link bursts
@ PRIMARY
Definition cid.h:34
@ TRANSPORT
Definition cid.h:35
@ MULTICAST
Definition cid.h:36
@ BASIC
Definition cid.h:33
uint16_t GetIdentifier() const
Definition cid.cc:34
This class implements the Generic mac Header as described by IEEE Standard for Local and metropolitan...
Cid GetCid() const
Get CID field.
This class implements the OFDM DL-MAP information element as described by "IEEE Standard forLocal and...
this class implement a burst as a list of packets
Smart pointer class similar to boost::intrusive_ptr.
This class implements service flows as described by the IEEE-802.16 standard.
bool HasPackets() const
Check if packets are present.
Ptr< WimaxConnection > GetConnection() const
Can return a null connection is this service flow has not been associated yet to a connection.
this class implements a structure to manage some parameters and statistics related to a service flow
void SetDlTimeStamp(Time dlTimeStamp)
Set the DlTimeStamp.
static Time Now()
Return the current simulation virtual time.
Definition simulator.cc:197
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
ModulationType
ModulationType enumeration.
Definition wimax-phy.h:43
@ MODULATION_TYPE_BPSK_12
Definition wimax-phy.h:44
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition assert.h:75
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition log.h:257
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition log.h:264
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
Definition ptr.h:436
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition nstime.h:1320
Every class exported by the ns3 library is enclosed in the ns3 namespace.
uint32_t GetSize(Ptr< const Packet > packet, const WifiMacHeader *hdr, bool isAmpdu)
Return the total size of the packet after WifiMacHeader and FCS trailer have been added.
STL namespace.