A Discrete-Event Network Simulator
API
bs-uplink-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  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Giuseppe Piro <g.piro@poliba.it>
19  */
20 
22 
23 #include "bandwidth-manager.h"
24 #include "bs-link-manager.h"
25 #include "bs-net-device.h"
26 #include "burst-profile-manager.h"
27 #include "cid.h"
28 #include "service-flow-record.h"
29 #include "service-flow.h"
30 #include "ss-manager.h"
31 #include "ss-record.h"
32 
33 #include "ns3/log.h"
34 #include "ns3/simulator.h"
35 #include "ns3/uinteger.h"
36 
37 namespace ns3
38 {
39 
40 NS_LOG_COMPONENT_DEFINE("UplinkSchedulerRtps");
41 
42 NS_OBJECT_ENSURE_REGISTERED(UplinkSchedulerRtps);
43 
45 {
46  SetBs(nullptr);
53 }
54 
56 {
57  SetBs(bs);
64 }
65 
67 {
68  SetBs(nullptr);
69  m_uplinkAllocations.clear();
70 }
71 
72 TypeId
74 {
75  static TypeId tid = TypeId("ns3::UplinkSchedulerRtps")
77  .SetGroupName("Wimax")
78  .AddConstructor<UplinkSchedulerRtps>();
79  return tid;
80 }
81 
82 std::list<OfdmUlMapIe>
84 {
85  return m_uplinkAllocations;
86 }
87 
88 void
90  bool& updateUcd,
91  bool& sendDcd,
92  bool& sendUcd)
93 {
94  /*DCD and UCD shall actually be updated when channel or burst profile definitions
95  change. burst profiles are updated based on number of SSs, network conditions and etc.
96  for now temporarily assuming DCD/UCD shall be updated every time */
97 
98  uint32_t randNr = rand();
99  if (randNr % 5 == 0 || GetBs()->GetNrDcdSent() == 0)
100  {
101  sendDcd = true;
102  }
103 
104  randNr = rand();
105  if (randNr % 5 == 0 || GetBs()->GetNrUcdSent() == 0)
106  {
107  sendUcd = true;
108  }
109 
110  // -------------------------------------
111  // additional, just to send more frequently
112  if (!sendDcd)
113  {
114  randNr = rand();
115  if (randNr % 4 == 0)
116  {
117  sendDcd = true;
118  }
119  }
120 
121  if (!sendUcd)
122  {
123  randNr = rand();
124  if (randNr % 4 == 0)
125  {
126  sendUcd = true;
127  }
128  }
129  // -------------------------------------
130 
131  Time timeSinceLastDcd = Simulator::Now() - GetDcdTimeStamp();
132  Time timeSinceLastUcd = Simulator::Now() - GetUcdTimeStamp();
133 
134  if (timeSinceLastDcd > GetBs()->GetDcdInterval())
135  {
136  sendDcd = true;
138  }
139 
140  if (timeSinceLastUcd > GetBs()->GetUcdInterval())
141  {
142  sendUcd = true;
144  }
145 }
146 
147 uint32_t
149 {
150  return GetBs()->GetNrDlSymbols() * GetBs()->GetPhy()->GetPsPerSymbol() + GetBs()->GetTtg();
151 }
152 
153 void
155  const uint32_t& allocationSize,
156  uint32_t& symbolsToAllocation,
157  uint32_t& availableSymbols)
158 {
159  ulMapIe.SetDuration(allocationSize);
160  ulMapIe.SetStartTime(symbolsToAllocation);
161  m_uplinkAllocations.push_back(ulMapIe);
162  symbolsToAllocation += allocationSize;
163  availableSymbols -= allocationSize;
164 }
165 
166 void
168 {
169  m_uplinkAllocations.clear();
170  SetIsIrIntrvlAllocated(false);
172  bool allocationForDsa = false;
173 
174  uint32_t symbolsToAllocation = 0;
175  uint32_t allocationSize = 0; // size in symbols
176  uint32_t availableSymbols = GetBs()->GetNrUlSymbols();
177 
178  WimaxPhy::ModulationType modulationType;
179  Cid cid;
180 
181  AllocateInitialRangingInterval(symbolsToAllocation, availableSymbols);
182 
183  std::vector<SSRecord*>* ssRecords = GetBs()->GetSSManager()->GetSSRecords();
184  NS_LOG_INFO("UL Scheduler start, availableSymbols = " << availableSymbols);
185 
186  for (std::vector<SSRecord*>::iterator iter = ssRecords->begin(); iter != ssRecords->end();
187  ++iter)
188  {
189  SSRecord* ssRecord = *iter;
190  if (ssRecord->GetIsBroadcastSS())
191  {
192  continue;
193  }
194  cid = ssRecord->GetBasicCid();
195  OfdmUlMapIe ulMapIe;
196  ulMapIe.SetCid(cid);
197 
198  if (ssRecord->GetPollForRanging() &&
200  {
201  // SS's ranging is not yet complete
202  // allocating invited initial ranging interval
204  allocationSize = GetBs()->GetRangReqOppSize();
206 
207  if (availableSymbols >= allocationSize)
208  {
209  AddUplinkAllocation(ulMapIe, allocationSize, symbolsToAllocation, availableSymbols);
210  }
211  else
212  {
213  break;
214  }
215  }
216  else
217  {
218  modulationType = ssRecord->GetModulationType();
219 
220  // need to update because modulation/FEC to UIUC mapping may vary over time
221  ulMapIe.SetUiuc(GetBs()->GetBurstProfileManager()->GetBurstProfile(
222  modulationType,
224 
225  // establish service flows for SS
227  !ssRecord->GetAreServiceFlowsAllocated())
228  {
229  // allocating grant (with arbitrary size) to allow SS to send DSA messages DSA-REQ
230  // and DSA-ACK only one DSA allocation per frame
231  if (!allocationForDsa)
232  {
233  allocationSize =
234  GetBs()->GetPhy()->GetNrSymbols(sizeof(DsaReq), modulationType);
235  if (availableSymbols >= allocationSize)
236  {
237  AddUplinkAllocation(ulMapIe,
238  allocationSize,
239  symbolsToAllocation,
240  availableSymbols);
241  allocationForDsa = true;
242  }
243  else
244  {
245  break;
246  }
247  }
248  }
249  else
250  {
251  // all service flows associated to SS are established now
252 
253  /*allocating grants for data transmission for UGS flows (Data Grant Burst Type
254  IEs, 6.3.7.4.3.3) (grant has been referred by different names e.g. transmission
255  opportunity, slot, uplink allocation, etc)*/
256  ServiceUnsolicitedGrants(ssRecord,
258  ulMapIe,
259  modulationType,
260  symbolsToAllocation,
261  availableSymbols);
262 
263  // allocate unicast polls for rtPS flows if bandwidth is available
264  if (availableSymbols)
265  {
266  ServiceUnsolicitedGrants(ssRecord,
268  ulMapIe,
269  modulationType,
270  symbolsToAllocation,
271  availableSymbols);
272  }
273  // allocate unicast polls for nrtPS flows if bandwidth is available
274  if (availableSymbols)
275  {
276  ServiceUnsolicitedGrants(ssRecord,
278  ulMapIe,
279  modulationType,
280  symbolsToAllocation,
281  availableSymbols);
282  }
283  // finally allocate unicast polls for BE flows if bandwidth is available
284  if (availableSymbols)
285  {
286  ServiceUnsolicitedGrants(ssRecord,
288  ulMapIe,
289  modulationType,
290  symbolsToAllocation,
291  availableSymbols);
292  }
293  }
294  }
295  }
296 
297  /*
298  * Uplink Scheduler for rtPS Connection
299  */
300  if (availableSymbols)
301  {
302  ULSchedulerRTPSConnection(symbolsToAllocation, availableSymbols);
303  }
304 
305  // UL Scheduler for nrtPS and BE flows
306  if (availableSymbols)
307  {
308  for (std::vector<SSRecord*>::iterator iter = ssRecords->begin(); iter != ssRecords->end();
309  ++iter)
310  {
311  SSRecord* ssRecord = *iter;
312  if (ssRecord->GetIsBroadcastSS())
313  {
314  continue;
315  }
316  if (!ssRecord->GetPollForRanging() &&
318  ssRecord->GetAreServiceFlowsAllocated())
319  {
320  OfdmUlMapIe ulMapIe;
321  cid = ssRecord->GetBasicCid();
322  ulMapIe.SetCid(cid);
323  modulationType = ssRecord->GetModulationType();
324  ulMapIe.SetUiuc(GetBs()->GetBurstProfileManager()->GetBurstProfile(
325  modulationType,
327 
328  // allocate unicast polls for nrtPS flows if bandwidth is available
329 
330  ServiceBandwidthRequests(ssRecord,
332  ulMapIe,
333  modulationType,
334  symbolsToAllocation,
335  availableSymbols);
336 
337  // finally allocate unicast polls for BE flows if bandwidth is available
338  if (availableSymbols)
339  {
340  ServiceBandwidthRequests(ssRecord,
342  ulMapIe,
343  modulationType,
344  symbolsToAllocation,
345  availableSymbols);
346  }
347  }
348  }
349  }
350 
351  OfdmUlMapIe ulMapIeEnd;
352  ulMapIeEnd.SetCid(Cid::InitialRanging());
353  ulMapIeEnd.SetStartTime(symbolsToAllocation);
355  ulMapIeEnd.SetDuration(0);
356  m_uplinkAllocations.push_back(ulMapIeEnd);
357 
358  // setting DL/UL subframe allocation for the next frame
359  GetBs()->GetBandwidthManager()->SetSubframeRatio();
360 }
361 
362 void
364  enum ServiceFlow::SchedulingType schedulingType,
365  OfdmUlMapIe& ulMapIe,
366  const WimaxPhy::ModulationType modulationType,
367  uint32_t& symbolsToAllocation,
368  uint32_t& availableSymbols)
369 {
370  uint32_t allocationSize = 0; // size in symbols
371  uint8_t uiuc = ulMapIe.GetUiuc(); // SS's burst profile
372  std::vector<ServiceFlow*> serviceFlows = ssRecord->GetServiceFlows(schedulingType);
373 
374  for (std::vector<ServiceFlow*>::iterator iter = serviceFlows.begin();
375  iter != serviceFlows.end();
376  ++iter)
377  {
378  ServiceFlow* serviceFlow = *iter;
379 
380  /* in case of rtPS, nrtPS and BE, allocating unicast polls for bandwidth requests (Request
381  IEs, 6.3.7.4.3.1). in case of UGS, allocating grants for data transmission (Data Grant
382  Burst Type IEs, 6.3.7.4.3.3) (grant has been referred in this code by different names e.g.
383  transmission opportunity, slot, allocation, etc) */
384 
385  allocationSize =
386  GetBs()->GetBandwidthManager()->CalculateAllocationSize(ssRecord, serviceFlow);
387 
388  // verifying that minimum reserved traffic rate of nrtPS flow is maintained
389  if (serviceFlow->GetSchedulingType() == ServiceFlow::SF_TYPE_NRTPS)
390  {
391  Time currentTime = Simulator::Now();
392  ServiceFlowRecord* record = serviceFlow->GetRecord();
393  if (currentTime - record->GetGrantTimeStamp() > Seconds(1))
394  {
395  uint32_t bps = (record->GetBwSinceLastExpiry() * 8);
396  if (bps < serviceFlow->GetMinReservedTrafficRate())
397  {
398  ServiceBandwidthRequests(serviceFlow,
399  schedulingType,
400  ulMapIe,
401  modulationType,
402  symbolsToAllocation,
403  availableSymbols);
404  record->SetBwSinceLastExpiry(0);
405  record->SetGrantTimeStamp(currentTime);
406  }
407  }
408  }
409 
410  if (availableSymbols < allocationSize)
411  {
412  break;
413  }
414 
415  if (allocationSize > 0)
416  {
417  ulMapIe.SetStartTime(symbolsToAllocation);
418  if (serviceFlow->GetSchedulingType() != ServiceFlow::SF_TYPE_UGS)
419  {
420  // special burst profile with most robust modulation type is used for unicast polls
421  // (Request IEs)
423  }
424  }
425  else
426  {
427  continue;
428  }
429 
430  if (serviceFlow->GetSchedulingType() == ServiceFlow::SF_TYPE_UGS)
431  {
432  NS_LOG_DEBUG("BS uplink scheduler, UGS allocation, size: " << allocationSize
433  << " symbols");
434  }
435  else
436  {
437  NS_LOG_DEBUG("BS uplink scheduler, " << serviceFlow->GetSchedulingTypeStr()
438  << " unicast poll, size: " << allocationSize
439  << " symbols"
440  << ", modulation: BPSK 1/2");
441  }
442 
443  NS_LOG_DEBUG(", CID: " << serviceFlow->GetConnection()->GetCid()
444  << ", SFID: " << serviceFlow->GetSfid());
445 
446  AddUplinkAllocation(ulMapIe, allocationSize, symbolsToAllocation, availableSymbols);
447  ulMapIe.SetUiuc(uiuc);
448  }
449 }
450 
451 void
453  enum ServiceFlow::SchedulingType schedulingType,
454  OfdmUlMapIe& ulMapIe,
455  const WimaxPhy::ModulationType modulationType,
456  uint32_t& symbolsToAllocation,
457  uint32_t& availableSymbols)
458 {
459  std::vector<ServiceFlow*> serviceFlows = ssRecord->GetServiceFlows(schedulingType);
460 
461  for (std::vector<ServiceFlow*>::iterator iter = serviceFlows.begin();
462  iter != serviceFlows.end();
463  ++iter)
464  {
465  if (!ServiceBandwidthRequests(*iter,
466  schedulingType,
467  ulMapIe,
468  modulationType,
469  symbolsToAllocation,
470  availableSymbols))
471  {
472  break;
473  }
474  }
475 }
476 
477 bool
479  enum ServiceFlow::SchedulingType schedulingType,
480  OfdmUlMapIe& ulMapIe,
481  const WimaxPhy::ModulationType modulationType,
482  uint32_t& symbolsToAllocation,
483  uint32_t& availableSymbols)
484 {
485  uint32_t allocSizeBytes = 0;
486  uint32_t allocSizeSymbols = 0;
487  uint16_t sduSize = 0;
488 
489  ServiceFlowRecord* record = serviceFlow->GetRecord();
490  sduSize = serviceFlow->GetSduSize();
491 
492  uint32_t requiredBandwidth = record->GetRequestedBandwidth() - record->GetGrantedBandwidth();
493  if (requiredBandwidth > 0)
494  {
495  if (sduSize > 0)
496  {
497  // if SDU size is mentioned, allocate grant of that size
498  allocSizeBytes = sduSize;
499  allocSizeSymbols = GetBs()->GetPhy()->GetNrSymbols(sduSize, modulationType);
500  }
501  else
502  {
503  allocSizeBytes = requiredBandwidth;
504  allocSizeSymbols = GetBs()->GetPhy()->GetNrSymbols(requiredBandwidth, modulationType);
505  }
506 
507  if (availableSymbols >= allocSizeSymbols)
508  {
509  NS_LOG_DEBUG("BS uplink scheduler, "
510  << serviceFlow->GetSchedulingTypeStr()
511  << " allocation, size: " << allocSizeSymbols << " symbols"
512  << ", CID: " << serviceFlow->GetConnection()->GetCid()
513  << ", SFID: " << serviceFlow->GetSfid()
514  << ", bw requested: " << record->GetRequestedBandwidth()
515  << ", bw granted: " << record->GetGrantedBandwidth());
516 
517  record->UpdateGrantedBandwidth(allocSizeBytes);
518 
519  if (schedulingType == ServiceFlow::SF_TYPE_NRTPS)
520  {
521  record->SetBwSinceLastExpiry(allocSizeBytes);
522  }
523 
524  AddUplinkAllocation(ulMapIe, allocSizeSymbols, symbolsToAllocation, availableSymbols);
525  }
526  else
527  {
528  return false;
529  }
530  }
531  return true;
532 }
533 
534 void
536  uint32_t& availableSymbols)
537 {
538  NS_LOG_INFO("\tUL Scheduler for rtPS flows");
539  NS_LOG_INFO("\t\tavailableSymbols = " << availableSymbols);
540  ServiceFlowRecord* record_[100];
541  uint32_t allocSizeSymbols_[100]; // symbolsRequired for each SSRecord
542  OfdmUlMapIe ulMapIe_[100];
543  OfdmUlMapIe ulMapIe;
544  WimaxPhy::ModulationType modulationType_[100];
545  WimaxPhy::ModulationType modulationType;
546  int nbAllocation = 0;
547  uint32_t allocSizeBytes;
548  uint32_t totAllocSizeSymbols = 0;
549 
550  Cid cid;
551  std::vector<SSRecord*>* ssRecords = GetBs()->GetSSManager()->GetSSRecords();
552 
553  for (std::vector<SSRecord*>::iterator iter = ssRecords->begin(); iter != ssRecords->end();
554  ++iter)
555  {
556  SSRecord* ssRecord = *iter;
557  if (ssRecord->GetIsBroadcastSS())
558  {
559  continue;
560  }
561  if (!ssRecord->GetPollForRanging() &&
563  ssRecord->GetAreServiceFlowsAllocated())
564  {
565  cid = ssRecord->GetBasicCid();
566  ulMapIe.SetCid(cid);
567  modulationType = ssRecord->GetModulationType();
568  ulMapIe.SetUiuc(GetBs()->GetBurstProfileManager()->GetBurstProfile(
569  modulationType,
571 
572  std::vector<ServiceFlow*> serviceFlows =
574  for (std::vector<ServiceFlow*>::iterator iter2 = serviceFlows.begin();
575  iter2 != serviceFlows.end();
576  ++iter2)
577  {
578  record_[nbAllocation] = (*iter2)->GetRecord();
579  uint32_t requiredBandwidth = record_[nbAllocation]->GetRequestedBandwidth() -
580  record_[nbAllocation]->GetGrantedBandwidth();
581 
582  if (requiredBandwidth > 0)
583  {
584  modulationType_[nbAllocation] = modulationType;
585  ulMapIe_[nbAllocation] = ulMapIe;
586  allocSizeBytes = requiredBandwidth;
587  allocSizeSymbols_[nbAllocation] =
588  GetBs()->GetPhy()->GetNrSymbols(allocSizeBytes,
589  modulationType_[nbAllocation]);
590  totAllocSizeSymbols += allocSizeSymbols_[nbAllocation];
591 
592  NS_LOG_INFO(
593  "\t\tUL Scheduler for CID = " << (*iter2)->GetConnection()->GetCid());
594  NS_LOG_INFO("\t\t\trequiredBandwidth = "
595  << record_[nbAllocation]->GetRequestedBandwidth()
596  << ", allocSizeSymbols = " << allocSizeSymbols_[nbAllocation]
597  << ", modulationType = " << modulationType_[nbAllocation]);
598 
599  nbAllocation += 1;
600  }
601  }
602  }
603  }
604 
605  NS_LOG_INFO("\t\ttotAllocSizeSymbols = " << totAllocSizeSymbols);
606 
607  // Channel Saturation
608  while (totAllocSizeSymbols > availableSymbols)
609  {
610  NS_LOG_INFO("\tUL Channel Saturation: totAllocSizeSymbols > availableSymbols");
611  double delta = double(availableSymbols) / double(totAllocSizeSymbols);
612  NS_LOG_INFO("\t\tdelta = " << delta);
613  totAllocSizeSymbols = 0;
614  for (int i = 0; i < nbAllocation; i++)
615  {
616  NS_LOG_INFO("\t\tprevious allocSizeSymbols_[" << i << "] = " << allocSizeSymbols_[i]);
617  allocSizeSymbols_[i] = (uint32_t)std::floor(allocSizeSymbols_[i] * delta);
618  totAllocSizeSymbols += allocSizeSymbols_[i];
619  NS_LOG_INFO("\t\tnew allocSizeSymbols_[" << i << "] = " << allocSizeSymbols_[i]);
620  }
621  NS_LOG_INFO("\t\ttotAllocSizeSymbols = " << totAllocSizeSymbols);
622  }
623 
624  // Uplink Bandwidth Allocation
625  for (int i = 0; i < nbAllocation; i++)
626  {
627  AddUplinkAllocation(ulMapIe_[i],
628  allocSizeSymbols_[i],
629  symbolsToAllocation,
630  availableSymbols);
631  allocSizeBytes = GetBs()->GetPhy()->GetNrBytes(allocSizeSymbols_[i], modulationType_[i]);
632  NS_LOG_INFO("\t\tUpdateGrantedBandwidth for " << i << " = " << allocSizeBytes);
633  if (record_[i]->GetRequestedBandwidth() < allocSizeBytes)
634  {
635  // the flow need new poll to set the newer requredBandwidth
636  record_[i]->SetGrantedBandwidth(0);
637  record_[i]->SetRequestedBandwidth(0);
638  }
639  else
640  {
641  record_[i]->UpdateGrantedBandwidth(allocSizeBytes);
642  }
643  }
644 }
645 
646 void
648  uint32_t& availableSymbols)
649 {
650  Time ssUlStartTime =
651  Seconds(CalculateAllocationStartTime() * GetBs()->GetPsDuration().GetSeconds());
652  SetNrIrOppsAllocated(GetBs()->GetLinkManager()->CalculateRangingOppsToAllocate());
653  uint32_t allocationSize = GetNrIrOppsAllocated() * GetBs()->GetRangReqOppSize();
654  Time timeSinceLastIrInterval = Simulator::Now() - GetTimeStampIrInterval();
655 
656  // adding one frame because may be the time has not elapsed now but will elapse before the next
657  // frame is sent
658  if (timeSinceLastIrInterval + GetBs()->GetPhy()->GetFrameDuration() >
659  GetBs()->GetInitialRangingInterval() &&
660  availableSymbols >= allocationSize)
661  {
663  OfdmUlMapIe ulMapIeIr;
664  ulMapIeIr.SetCid(GetBs()->GetBroadcastConnection()->GetCid());
665  ulMapIeIr.SetStartTime(symbolsToAllocation);
667 
668  NS_LOG_DEBUG("BS uplink scheduler, initial ranging allocation, size: "
669  << allocationSize << " symbols"
670  << ", modulation: BPSK 1/2");
671 
672  // marking start and end of each TO, only for debugging
673  for (uint8_t i = 0; i < GetNrIrOppsAllocated(); i++)
674  {
675  GetBs()->MarkRangingOppStart(
676  ssUlStartTime +
677  Seconds(symbolsToAllocation * GetBs()->GetSymbolDuration().GetSeconds()) +
678  Seconds(i * GetBs()->GetRangReqOppSize() *
679  GetBs()->GetSymbolDuration().GetSeconds()));
680  }
681 
682  AddUplinkAllocation(ulMapIeIr, allocationSize, symbolsToAllocation, availableSymbols);
684  }
685 }
686 
687 void
689 {
690  uint8_t delayNrFrames = 1;
691  uint32_t bitsPerSecond = serviceFlow->GetMinReservedTrafficRate();
692  WimaxPhy::ModulationType modulation;
693  uint32_t bytesPerFrame =
694  (uint32_t((double)(bitsPerSecond)*GetBs()->GetPhy()->GetFrameDuration().GetSeconds())) / 8;
695  uint32_t frameDurationMSec = GetBs()->GetPhy()->GetFrameDuration().GetMilliSeconds();
696 
697  switch (serviceFlow->GetSchedulingType())
698  {
700  if (serviceFlow->GetIsMulticast() == true)
701  {
702  modulation = serviceFlow->GetModulation();
703  }
704  else
705  {
706  modulation = ssRecord->GetModulationType();
707  }
708  uint32_t grantSize = GetBs()->GetPhy()->GetNrSymbols(bytesPerFrame, modulation);
709  serviceFlow->GetRecord()->SetGrantSize(grantSize);
710 
711  uint32_t toleratedJitter = serviceFlow->GetToleratedJitter();
712 
713  if (toleratedJitter > frameDurationMSec)
714  {
715  delayNrFrames = (uint8_t)(toleratedJitter / frameDurationMSec);
716  }
717 
718  uint16_t interval = delayNrFrames * frameDurationMSec;
719  serviceFlow->SetUnsolicitedGrantInterval(interval);
720  }
721  break;
723  if (serviceFlow->GetSduSize() > bytesPerFrame)
724  {
725  delayNrFrames = (uint8_t)(serviceFlow->GetSduSize() / bytesPerFrame);
726  }
727 
728  uint16_t interval = delayNrFrames * frameDurationMSec;
729  serviceFlow->SetUnsolicitedPollingInterval(interval);
730  }
731  break;
733  // no real-time guarantees are given to NRTPS, serviced based on available bandwidth
734  }
735  break;
737  // no real-time guarantees are given to BE, serviced based on available bandwidth
738  }
739  break;
740  default:
741  NS_FATAL_ERROR("Invalid scheduling type");
742  }
743 }
744 
745 void
747 {
748 }
749 
750 void
752 {
753 }
754 
755 void
757 {
758  // m_grantedBandwidth must be reset to zero
759  uint32_t grantedBandwidth = 0;
760  sfr->SetGrantedBandwidth(grantedBandwidth);
761 }
762 
763 } // namespace ns3
This class implements the bandwidth-request mac Header as described by IEEE Standard for Local and me...
Cid class.
Definition: cid.h:37
static Cid InitialRanging()
Definition: cid.cc:87
This class implements the DSA-REQ message described by "IEEE Standard for Local and metropolitan area...
Definition: mac-messages.h:386
This class implements the UL-MAP_IE message as described by "IEEE Standard for Local and metropolitan...
void SetStartTime(uint16_t startTime)
Set start time.
uint8_t GetUiuc() const
Get UIUC.
void SetDuration(uint16_t duration)
Set duration.
void SetCid(const Cid &cid)
Set CID.
void SetUiuc(uint8_t uiuc)
Set UIUC.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
This class is used by the base station to store some information related to subscriber station in the...
Definition: ss-record.h:46
Cid GetBasicCid() const
Get basic CID.
Definition: ss-record.cc:95
WimaxNetDevice::RangingStatus GetRangingStatus() const
Get ranging status.
Definition: ss-record.cc:179
bool GetPollForRanging() const
Get poll for ranging.
Definition: ss-record.cc:197
std::vector< ServiceFlow * > GetServiceFlows(enum ServiceFlow::SchedulingType schedulingType) const
Get service flows.
Definition: ss-record.cc:233
bool GetAreServiceFlowsAllocated() const
Check if service flows are allocated.
Definition: ss-record.cc:209
bool GetIsBroadcastSS() const
Get is broadcast SS.
Definition: ss-record.cc:256
WimaxPhy::ModulationType GetModulationType() const
Get modulation type.
Definition: ss-record.cc:167
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:43
enum ServiceFlow::SchedulingType GetSchedulingType() const
Get scheduling type.
uint32_t GetSfid() const
Get SFID.
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
Definition: service-flow.h:62
char * GetSchedulingTypeStr() const
Get scheduling type string.
uint32_t GetMinReservedTrafficRate() const
Get minimum reserved traffic rate.
uint8_t GetSduSize() const
Get SDU size.
void SetUnsolicitedGrantInterval(uint16_t unsolicitedGrantInterval)
Set unsolicited grant interval.
ServiceFlowRecord * GetRecord() const
Get service flow record.
enum WimaxPhy::ModulationType GetModulation() const
Get modulation.
void SetUnsolicitedPollingInterval(uint16_t unsolicitedPollingInterval)
Set unsolicited polling interval.
bool GetIsMulticast() const
Get is multicast.
uint32_t GetToleratedJitter() const
Get tolerated jitter.
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
uint32_t GetRequestedBandwidth() const
void SetRequestedBandwidth(uint32_t requestedBandwidth)
set the requested bandwidth
void SetGrantSize(uint32_t grantSize)
Set the grant size (only for UGS service flows)
uint32_t GetGrantedBandwidth() const
void SetBwSinceLastExpiry(uint32_t bwSinceLastExpiry)
set BW since last expiry
void UpdateGrantedBandwidth(uint32_t grantedBandwidth)
update the granted bandwidth
uint32_t GetBwSinceLastExpiry() const
void SetGrantTimeStamp(Time grantTimeStamp)
Set the grant time stamp.
void SetGrantedBandwidth(uint32_t grantedBandwidth)
set the granted bandwidth
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:60
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
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_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Every class exported by the ns3 library is enclosed in the ns3 namespace.