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 
43 {
44  SetBs (0);
45  SetTimeStampIrInterval (Seconds (0));
47  SetIsIrIntrvlAllocated (false);
51 }
52 
54 {
55  SetBs (bs);
56  SetTimeStampIrInterval (Seconds (0));
58  SetIsIrIntrvlAllocated (false);
62 }
63 
65 {
66  SetBs (0);
67  m_uplinkAllocations.clear ();
68 }
69 
70 TypeId
72 {
73  static TypeId tid = TypeId ("ns3::UplinkSchedulerRtps").SetParent<UplinkScheduler> ();
74  return tid;
75 }
76 
77 std::list<OfdmUlMapIe>
79 {
80  return m_uplinkAllocations;
81 }
82 
83 void
84 UplinkSchedulerRtps::GetChannelDescriptorsToUpdate (bool &updateDcd, bool &updateUcd, bool &sendDcd, bool &sendUcd)
85 {
86  /*DCD and UCD shall actually be updated when channel or burst profile definitions
87  change. burst profiles are updated based on number of SSs, network conditions and etc.
88  for now temporarily assuming DCD/UCD shall be updated everytime */
89 
90  uint32_t randNr = rand ();
91  if (randNr % 5 == 0 || GetBs ()->GetNrDcdSent () == 0)
92  {
93  sendDcd = true;
94  }
95 
96  randNr = rand ();
97  if (randNr % 5 == 0 || GetBs ()->GetNrUcdSent () == 0)
98  {
99  sendUcd = true;
100  }
101 
102  // -------------------------------------
103  // additional, just to send more frequently
104  if (!sendDcd)
105  {
106  randNr = rand ();
107  if (randNr % 4 == 0)
108  {
109  sendDcd = true;
110  }
111  }
112 
113  if (!sendUcd)
114  {
115  randNr = rand ();
116  if (randNr % 4 == 0)
117  {
118  sendUcd = true;
119  }
120  }
121  // -------------------------------------
122 
123  Time timeSinceLastDcd = Simulator::Now () - GetDcdTimeStamp ();
124  Time timeSinceLastUcd = Simulator::Now () - GetUcdTimeStamp ();
125 
126  if (timeSinceLastDcd > GetBs ()->GetDcdInterval ())
127  {
128  sendDcd = true;
130  }
131 
132  if (timeSinceLastUcd > GetBs ()->GetUcdInterval ())
133  {
134  sendUcd = true;
136  }
137 }
138 
139 uint32_t
141 {
142  return GetBs ()->GetNrDlSymbols () * GetBs ()->GetPhy ()->GetPsPerSymbol () + GetBs ()->GetTtg ();
143 }
144 
145 void
147  const uint32_t &allocationSize,
148  uint32_t &symbolsToAllocation,
149  uint32_t &availableSymbols)
150 {
151  ulMapIe.SetDuration (allocationSize);
152  ulMapIe.SetStartTime (symbolsToAllocation);
153  m_uplinkAllocations.push_back (ulMapIe);
154  symbolsToAllocation += allocationSize;
155  availableSymbols -= allocationSize;
156 }
157 
158 void
160 {
161  m_uplinkAllocations.clear ();
162  SetIsIrIntrvlAllocated (false);
164  bool allocationForDsa = false;
165 
166  uint32_t symbolsToAllocation = 0;
167  uint32_t allocationSize = 0; // size in symbols
168  uint32_t availableSymbols = GetBs ()->GetNrUlSymbols ();
169 
170  WimaxPhy::ModulationType modulationType;
171  Cid cid;
172 
173  AllocateInitialRangingInterval (symbolsToAllocation, availableSymbols);
174 
175  std::vector<SSRecord*> *ssRecords = GetBs ()->GetSSManager ()->GetSSRecords ();
176  NS_LOG_INFO ("UL Scheduler start, availableSymbols = " << availableSymbols);
177 
178  for (std::vector<SSRecord*>::iterator iter = ssRecords->begin (); iter != ssRecords->end (); ++iter)
179  {
180  SSRecord *ssRecord = *iter;
181  if (ssRecord->GetIsBroadcastSS ())
182  {
183  continue;
184  }
185  cid = ssRecord->GetBasicCid ();
186  OfdmUlMapIe ulMapIe;
187  ulMapIe.SetCid (cid);
188 
190  {
191  // SS's ranging is not yet complete
192  // allocating invited initial ranging interval
194  allocationSize = GetBs ()->GetRangReqOppSize ();
196 
197  if (availableSymbols >= allocationSize)
198  {
199  AddUplinkAllocation (ulMapIe, allocationSize, symbolsToAllocation, availableSymbols);
200  }
201  else
202  {
203  break;
204  }
205  }
206  else
207  {
208  modulationType = ssRecord->GetModulationType ();
209 
210  // need to update because modulation/FEC to UIUC mapping may vary over time
211  ulMapIe.SetUiuc (GetBs ()->GetBurstProfileManager ()->GetBurstProfile (modulationType,
213 
214  // establish service flows for SS
216  && !ssRecord->GetAreServiceFlowsAllocated ())
217  {
218  // allocating grant (with arbitrary size) to allow SS to send DSA messages DSA-REQ and DSA-ACK
219  // only one DSA allocation per frame
220  if (!allocationForDsa)
221  {
222  allocationSize = GetBs ()->GetPhy ()->GetNrSymbols (sizeof(DsaReq), modulationType);
223  if (availableSymbols >= allocationSize)
224  {
225  AddUplinkAllocation (ulMapIe, allocationSize, symbolsToAllocation, availableSymbols);
226  allocationForDsa = true;
227  }
228  else
229  {
230  break;
231  }
232  }
233  }
234  else
235  {
236  // all service flows associated to SS are established now
237 
238  /*allocating grants for data transmission for UGS flows (Data Grant Burst Type IEs, 6.3.7.4.3.3)
239  (grant has been referred by different names e.g. transmission opportunity, slot, uplink allocation, etc)*/
240  ServiceUnsolicitedGrants (ssRecord,
242  ulMapIe,
243  modulationType,
244  symbolsToAllocation,
245  availableSymbols);
246 
247  // allocate unicast polls for rtPS flows if bandwidth is available
248  if (availableSymbols)
249  {
250  ServiceUnsolicitedGrants (ssRecord,
252  ulMapIe,
253  modulationType,
254  symbolsToAllocation,
255  availableSymbols);
256  }
257  // allocate unicast polls for nrtPS flows if bandwidth is available
258  if (availableSymbols)
259  {
260  ServiceUnsolicitedGrants (ssRecord,
262  ulMapIe,
263  modulationType,
264  symbolsToAllocation,
265  availableSymbols);
266  }
267  // finally allocate unicast polls for BE flows if bandwidth is available
268  if (availableSymbols)
269  {
270  ServiceUnsolicitedGrants (ssRecord,
272  ulMapIe,
273  modulationType,
274  symbolsToAllocation,
275  availableSymbols);
276  }
277  }
278  }
279  }
280 
281  /*
282  * Uplink Scheduler for rtPS Connection
283  */
284  if (availableSymbols)
285  {
286  ULSchedulerRTPSConnection (symbolsToAllocation, availableSymbols);
287  }
288 
289  // UL Scheduler for nrtPS and BE flows
290  if (availableSymbols)
291  {
292  for (std::vector<SSRecord*>::iterator iter = ssRecords->begin (); iter != ssRecords->end (); ++iter)
293  {
294  SSRecord *ssRecord = *iter;
295  if (ssRecord->GetIsBroadcastSS ())
296  {
297  continue;
298  }
299  if (!ssRecord->GetPollForRanging () && ssRecord->GetRangingStatus ()
301  {
302  OfdmUlMapIe ulMapIe;
303  cid = ssRecord->GetBasicCid ();
304  ulMapIe.SetCid (cid);
305  modulationType = ssRecord->GetModulationType ();
306  ulMapIe.SetUiuc (GetBs ()->GetBurstProfileManager ()->GetBurstProfile (modulationType,
308 
309  // allocate unicast polls for nrtPS flows if bandwidth is available
310  if (availableSymbols)
311  {
312  ServiceBandwidthRequests (ssRecord,
314  ulMapIe,
315  modulationType,
316  symbolsToAllocation,
317  availableSymbols);
318  }
319  // finally allocate unicast polls for BE flows if bandwidth is available
320  if (availableSymbols)
321  {
322  ServiceBandwidthRequests (ssRecord,
324  ulMapIe,
325  modulationType,
326  symbolsToAllocation,
327  availableSymbols);
328  }
329  }
330  }
331  }
332 
333  OfdmUlMapIe ulMapIeEnd;
334  ulMapIeEnd.SetCid (Cid::InitialRanging ());
335  ulMapIeEnd.SetStartTime (symbolsToAllocation);
337  ulMapIeEnd.SetDuration (0);
338  m_uplinkAllocations.push_back (ulMapIeEnd);
339 
340  // setting DL/UL subframe allocation for the next frame
341  GetBs ()->GetBandwidthManager ()->SetSubframeRatio ();
342 }
343 
344 void
346  enum ServiceFlow::SchedulingType schedulingType,
347  OfdmUlMapIe &ulMapIe,
348  const WimaxPhy::ModulationType modulationType,
349  uint32_t &symbolsToAllocation,
350  uint32_t &availableSymbols)
351 {
352  uint32_t allocationSize = 0; // size in symbols
353  uint8_t uiuc = ulMapIe.GetUiuc (); // SS's burst profile
354  std::vector<ServiceFlow*> serviceFlows = ssRecord->GetServiceFlows (schedulingType);
355 
356  for (std::vector<ServiceFlow*>::iterator iter = serviceFlows.begin (); iter != serviceFlows.end (); ++iter)
357  {
358  ServiceFlow *serviceFlow = *iter;
359 
360  /* in case of rtPS, nrtPS and BE, allocating unicast polls for bandwidth requests (Request IEs, 6.3.7.4.3.1).
361  in case of UGS, allocating grants for data transmission (Data Grant Burst Type IEs, 6.3.7.4.3.3) (grant has
362  been referred in this code by different names e.g. transmission opportunity, slot, allocation, etc) */
363 
364  allocationSize = GetBs ()->GetBandwidthManager ()->CalculateAllocationSize (ssRecord, serviceFlow);
365 
366  // verifying that minimum reserved traffic rate of nrtPS flow is maintained
367  if (serviceFlow->GetSchedulingType () == ServiceFlow::SF_TYPE_NRTPS)
368  {
369  Time currentTime = Simulator::Now ();
370  ServiceFlowRecord *record = serviceFlow->GetRecord ();
371  if (currentTime - record->GetGrantTimeStamp () > Seconds (1))
372  {
373  uint32_t bps = (record->GetBwSinceLastExpiry () * 8);
374  if (bps < serviceFlow->GetMinReservedTrafficRate ())
375  {
376  ServiceBandwidthRequests (serviceFlow,
377  schedulingType,
378  ulMapIe,
379  modulationType,
380  symbolsToAllocation,
381  availableSymbols);
382  record->SetBwSinceLastExpiry (0);
383  record->SetGrantTimeStamp (currentTime);
384  }
385  }
386  }
387 
388  if (availableSymbols < allocationSize)
389  {
390  break;
391  }
392 
393  if (allocationSize > 0)
394  {
395  ulMapIe.SetStartTime (symbolsToAllocation);
396  if (serviceFlow->GetSchedulingType () != ServiceFlow::SF_TYPE_UGS)
397  {
398  // special burst profile with most robust modulation type is used for unicast polls (Request IEs)
400  }
401  }
402  else
403  {
404  continue;
405  }
406 
407  if (serviceFlow->GetSchedulingType () == ServiceFlow::SF_TYPE_UGS)
408  {
409  NS_LOG_DEBUG ("BS uplink scheduler, UGS allocation, size: " << allocationSize << " symbols");
410  }
411  else
412  {
413  NS_LOG_DEBUG ("BS uplink scheduler, " << serviceFlow->GetSchedulingTypeStr () << " unicast poll, size: "
414  << allocationSize << " symbols" << ", modulation: BPSK 1/2");
415  }
416 
417  NS_LOG_DEBUG (", CID: " << serviceFlow->GetConnection ()->GetCid () << ", SFID: " << serviceFlow->GetSfid ());
418 
419  AddUplinkAllocation (ulMapIe, allocationSize, symbolsToAllocation, availableSymbols);
420  ulMapIe.SetUiuc (uiuc);
421  }
422 }
423 
424 void
426  enum ServiceFlow::SchedulingType schedulingType,
427  OfdmUlMapIe &ulMapIe,
428  const WimaxPhy::ModulationType modulationType,
429  uint32_t &symbolsToAllocation,
430  uint32_t &availableSymbols)
431 {
432  std::vector<ServiceFlow*> serviceFlows = ssRecord->GetServiceFlows (schedulingType);
433 
434  for (std::vector<ServiceFlow*>::iterator iter = serviceFlows.begin (); iter != serviceFlows.end (); ++iter)
435  {
436  if (!ServiceBandwidthRequests (*iter,
437  schedulingType,
438  ulMapIe,
439  modulationType,
440  symbolsToAllocation,
441  availableSymbols))
442  {
443  break;
444  }
445  }
446 }
447 
448 bool
450  enum ServiceFlow::SchedulingType schedulingType,
451  OfdmUlMapIe &ulMapIe,
452  const WimaxPhy::ModulationType modulationType,
453  uint32_t &symbolsToAllocation,
454  uint32_t &availableSymbols)
455 {
456  uint32_t allocSizeBytes = 0;
457  uint32_t allocSizeSymbols = 0;
458  uint16_t sduSize = 0;
459 
460  ServiceFlowRecord *record = serviceFlow->GetRecord ();
461  sduSize = serviceFlow->GetSduSize ();
462 
463  uint32_t requiredBandwidth = record->GetRequestedBandwidth () - record->GetGrantedBandwidth ();
464  if (requiredBandwidth > 0)
465  {
466  if (sduSize > 0)
467  {
468  // if SDU size is mentioned, allocate grant of that size
469  allocSizeBytes = sduSize;
470  allocSizeSymbols = GetBs ()->GetPhy ()->GetNrSymbols (sduSize, modulationType);
471  }
472  else
473  {
474  allocSizeBytes = requiredBandwidth;
475  allocSizeSymbols = GetBs ()->GetPhy ()->GetNrSymbols (requiredBandwidth, modulationType);
476  }
477 
478  if (availableSymbols >= allocSizeSymbols)
479  {
480 
481  NS_LOG_DEBUG ("BS uplink scheduler, " << serviceFlow->GetSchedulingTypeStr () << " allocation, size: "
482  << allocSizeSymbols << " symbols" << ", CID: " << serviceFlow->GetConnection ()->GetCid () << ", SFID: "
483  << serviceFlow->GetSfid () << ", bw requested: " << record->GetRequestedBandwidth () << ", bw granted: "
484  << record->GetGrantedBandwidth ());
485 
486  record->UpdateGrantedBandwidth (allocSizeBytes);
487 
488  if (schedulingType == ServiceFlow::SF_TYPE_NRTPS)
489  {
490  record->SetBwSinceLastExpiry (allocSizeBytes);
491  }
492 
493  AddUplinkAllocation (ulMapIe, allocSizeSymbols, symbolsToAllocation, availableSymbols);
494  }
495  else
496  {
497  return false;
498  }
499  }
500  return true;
501 }
502 
503 void
504 UplinkSchedulerRtps::ULSchedulerRTPSConnection (uint32_t &symbolsToAllocation, uint32_t &availableSymbols)
505 {
506  NS_LOG_INFO ("\tUL Scheduler for rtPS flows");
507  NS_LOG_INFO ("\t\tavailableSymbols = " << availableSymbols);
508  ServiceFlowRecord *record_[100];
509  uint32_t allocSizeSymbols_[100]; // symbolsRequired for each SSRecord
510  OfdmUlMapIe ulMapIe_[100];
511  OfdmUlMapIe ulMapIe;
512  WimaxPhy::ModulationType modulationType_[100];
513  WimaxPhy::ModulationType modulationType;
514  int nbAllocation = 0;
515  uint32_t allocSizeBytes;
516  uint32_t totAllocSizeSymbols = 0;
517 
518  Cid cid;
519  std::vector<SSRecord*> *ssRecords = GetBs ()->GetSSManager ()->GetSSRecords ();
520 
521  for (std::vector<SSRecord*>::iterator iter = ssRecords->begin (); iter != ssRecords->end (); ++iter)
522  {
523  SSRecord *ssRecord = *iter;
524  if (ssRecord->GetIsBroadcastSS ())
525  {
526  continue;
527  }
529  && ssRecord->GetAreServiceFlowsAllocated ())
530  {
531  cid = ssRecord->GetBasicCid ();
532  ulMapIe.SetCid (cid);
533  modulationType = ssRecord->GetModulationType ();
534  ulMapIe.SetUiuc (GetBs ()->GetBurstProfileManager ()->GetBurstProfile (modulationType,
536 
537  std::vector<ServiceFlow*> serviceFlows = ssRecord->GetServiceFlows (ServiceFlow::SF_TYPE_RTPS);
538  for (std::vector<ServiceFlow*>::iterator iter2 = serviceFlows.begin (); iter2 != serviceFlows.end (); ++iter2)
539  {
540  record_[nbAllocation] = (*iter2)->GetRecord ();
541  uint32_t requiredBandwidth = record_[nbAllocation]->GetRequestedBandwidth ()
542  - record_[nbAllocation]->GetGrantedBandwidth ();
543 
544  if (requiredBandwidth > 0)
545  {
546  modulationType_[nbAllocation] = modulationType;
547  ulMapIe_[nbAllocation] = ulMapIe;
548  allocSizeBytes = requiredBandwidth;
549  allocSizeSymbols_[nbAllocation] = GetBs ()->GetPhy ()->GetNrSymbols (allocSizeBytes,
550  modulationType_[nbAllocation]);
551  totAllocSizeSymbols += allocSizeSymbols_[nbAllocation];
552 
553  NS_LOG_INFO ("\t\tUL Scheduler for CID = " << (*iter2)->GetConnection ()->GetCid ());
554  NS_LOG_INFO ("\t\t\trequiredBandwidth = " << record_[nbAllocation]->GetRequestedBandwidth ()
555  << ", allocSizeSymbols = " << allocSizeSymbols_[nbAllocation] << ", modulationType = "
556  << modulationType_[nbAllocation]);
557 
558  nbAllocation += 1;
559  }
560  }
561  }
562  }
563 
564  NS_LOG_INFO ("\t\ttotAllocSizeSymbols = " << totAllocSizeSymbols);
565 
566  // Channel Saturation
567  while (totAllocSizeSymbols > availableSymbols)
568  {
569  NS_LOG_INFO ("\tUL Channel Saturation: totAllocSizeSymbols > availableSymbols");
570  double delta = double(availableSymbols) / double(totAllocSizeSymbols);
571  NS_LOG_INFO ("\t\tdelta = " << delta);
572  totAllocSizeSymbols = 0;
573  for (int i = 0; i < nbAllocation; i++)
574  {
575  NS_LOG_INFO ("\t\tprevious allocSizeSymbols_[" << i << "] = " << allocSizeSymbols_[i]);
576  allocSizeSymbols_[i] = (uint32_t) std::floor (allocSizeSymbols_[i] * delta);
577  totAllocSizeSymbols += allocSizeSymbols_[i];
578  NS_LOG_INFO ("\t\tnew allocSizeSymbols_[" << i << "] = " << allocSizeSymbols_[i]);
579  }
580  NS_LOG_INFO ("\t\ttotAllocSizeSymbols = " << totAllocSizeSymbols);
581  }
582 
583  // Uplink Bandwidth Allocation
584  for (int i = 0; i < nbAllocation; i++)
585  {
586  AddUplinkAllocation (ulMapIe_[i], allocSizeSymbols_[i], symbolsToAllocation, availableSymbols);
587  allocSizeBytes = GetBs ()->GetPhy ()->GetNrBytes (allocSizeSymbols_[i], modulationType_[i]);
588  NS_LOG_INFO ("\t\tUpdateGrantedBandwidth for " << i << " = " << allocSizeBytes);
589  if (record_[i]->GetRequestedBandwidth () < allocSizeBytes)
590  {
591  // the flow need new poll to set the newer requredBandwidth
592  record_[i]->SetGrantedBandwidth (0);
593  record_[i]->SetRequestedBandwidth (0);
594  }
595  else
596  {
597  record_[i]->UpdateGrantedBandwidth (allocSizeBytes);
598  }
599  }
600 }
601 
602 void
603 UplinkSchedulerRtps::AllocateInitialRangingInterval (uint32_t &symbolsToAllocation, uint32_t &availableSymbols)
604 {
605  Time ssUlStartTime = Seconds (CalculateAllocationStartTime () * GetBs ()->GetPsDuration ().GetSeconds ());
606  SetNrIrOppsAllocated (GetBs ()->GetLinkManager ()->CalculateRangingOppsToAllocate ());
607  uint32_t allocationSize = GetNrIrOppsAllocated () * GetBs ()->GetRangReqOppSize ();
608  Time timeSinceLastIrInterval = Simulator::Now () - GetTimeStampIrInterval ();
609 
610  // adding one frame because may be the time has not elapsed now but will elapse before the next frame is sent
611  if (timeSinceLastIrInterval + GetBs ()->GetPhy ()->GetFrameDuration () > GetBs ()->GetInitialRangingInterval ()
612  && availableSymbols >= allocationSize)
613  {
614  SetIsIrIntrvlAllocated (true);
615  OfdmUlMapIe ulMapIeIr;
616  ulMapIeIr.SetCid (GetBs ()->GetBroadcastConnection ()->GetCid ());
617  ulMapIeIr.SetStartTime (symbolsToAllocation);
619 
620  NS_LOG_DEBUG ("BS uplink scheduler, initial ranging allocation, size: " << allocationSize << " symbols"
621  << ", modulation: BPSK 1/2");
622 
623  // marking start and end of each TO, only for debugging
624  for (uint8_t i = 0; i < GetNrIrOppsAllocated (); i++)
625  {
626  GetBs ()->MarkRangingOppStart (ssUlStartTime + Seconds (symbolsToAllocation
627  * GetBs ()->GetSymbolDuration ().GetSeconds ()) + Seconds (i * GetBs ()->GetRangReqOppSize ()
628  * GetBs ()->GetSymbolDuration ().GetSeconds ()));
629  }
630 
631  AddUplinkAllocation (ulMapIeIr, allocationSize, symbolsToAllocation, availableSymbols);
633  }
634 }
635 
636 void
638 {
639  uint8_t delayNrFrames = 1;
640  uint32_t bitsPerSecond = serviceFlow->GetMinReservedTrafficRate ();
641  WimaxPhy::ModulationType modulation;
642  uint32_t bytesPerFrame =
643  (uint32_t ((double)(bitsPerSecond) * GetBs ()->GetPhy ()->GetFrameDuration ().GetSeconds ())) / 8;
644  uint32_t frameDurationMSec = GetBs ()->GetPhy ()->GetFrameDuration ().GetMilliSeconds ();
645 
646  switch (serviceFlow->GetSchedulingType ())
647  {
649  {
650  if (serviceFlow->GetIsMulticast () == true)
651  {
652  modulation = serviceFlow->GetModulation ();
653  }
654  else
655  {
656  modulation = ssRecord->GetModulationType ();
657  }
658  uint32_t grantSize = GetBs ()->GetPhy ()->GetNrSymbols (bytesPerFrame, modulation);
659  serviceFlow->GetRecord ()->SetGrantSize (grantSize);
660 
661  uint32_t toleratedJitter = serviceFlow->GetToleratedJitter ();
662 
663  if (toleratedJitter > frameDurationMSec)
664  {
665  delayNrFrames = (uint8_t)(toleratedJitter / frameDurationMSec);
666  }
667 
668  uint16_t interval = delayNrFrames * frameDurationMSec;
669  serviceFlow->SetUnsolicitedGrantInterval (interval);
670  }
671  break;
673  {
674  if (serviceFlow->GetSduSize () > bytesPerFrame)
675  {
676  delayNrFrames = (uint8_t)(serviceFlow->GetSduSize () / bytesPerFrame);
677  }
678 
679  uint16_t interval = delayNrFrames * frameDurationMSec;
680  serviceFlow->SetUnsolicitedPollingInterval (interval);
681  }
682  break;
684  {
685  // no real-time guarantees are given to NRTPS, serviced based on available bandwidth
686  }
687  break;
689  {
690  // no real-time guarantees are given to BE, serviced based on available bandwidth
691  }
692  break;
693  default:
694  NS_FATAL_ERROR ("Invalid scheduling type");
695  }
696 }
697 
698 void
700 {
701 }
702 
703 void
705 {
706 }
707 
708 void
710 {
711  // m_grantedBandwidth must be reset to zero
712  uint32_t grantedBandwidth = 0;
713  sfr->SetGrantedBandwidth (grantedBandwidth);
714 }
715 
716 } // namespace ns3
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
enum WimaxPhy::ModulationType GetModulation(void) const
smart pointer class similar to boost::intrusive_ptr
Definition: ptr.h:60
enum ServiceFlow::SchedulingType GetSchedulingType(void) const
void SetCid(Cid cid)
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register the class in the ns-3 factory.
Definition: object-base.h:38
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)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:170
uint32_t GetSfid(void) const
WimaxNetDevice::RangingStatus GetRangingStatus(void) const
Definition: ss-record.cc:176
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:223
#define NS_FATAL_ERROR(msg)
fatal error handling
Definition: fatal-error.h:95
Ptr< WimaxConnection > GetConnection(void) const
char * GetSchedulingTypeStr(void) const
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)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:213
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:610
WimaxPhy::ModulationType GetModulationType(void) const
Definition: ss-record.cc:164