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