LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2007,2008 INRIA | 3 * Copyright (c) 2007,2008 INRIA |
4 * 2009 TELEMATICS LAB, Politecnico di Bari | 4 * 2009 TELEMATICS LAB, Politecnico di Bari |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or modify | 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 | 7 * it under the terms of the GNU General Public License version 2 as |
8 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
9 * | 9 * |
10 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 std::list<OfdmUlMapIe> | 82 std::list<OfdmUlMapIe> |
83 UplinkSchedulerRtps::GetUplinkAllocations (void) const | 83 UplinkSchedulerRtps::GetUplinkAllocations (void) const |
84 { | 84 { |
85 return m_uplinkAllocations; | 85 return m_uplinkAllocations; |
86 } | 86 } |
87 | 87 |
88 void | 88 void |
89 UplinkSchedulerRtps::GetChannelDescriptorsToUpdate (bool &updateDcd, bool &updat
eUcd, bool &sendDcd, bool &sendUcd) | 89 UplinkSchedulerRtps::GetChannelDescriptorsToUpdate (bool &updateDcd, bool &updat
eUcd, bool &sendDcd, bool &sendUcd) |
90 { | 90 { |
91 NS_UNUSED(updateDcd); | 91 NS_UNUSED (updateDcd); |
92 NS_UNUSED(updateUcd); | 92 NS_UNUSED (updateUcd); |
93 /*DCD and UCD shall actually be updated when channel or burst profile definiti
ons | 93 /*DCD and UCD shall actually be updated when channel or burst profile definiti
ons |
94 change. burst profiles are updated based on number of SSs, network conditions
and etc. | 94 change. burst profiles are updated based on number of SSs, network conditions
and etc. |
95 for now temporarily assuming DCD/UCD shall be updated everytime */ | 95 for now temporarily assuming DCD/UCD shall be updated everytime */ |
96 | 96 |
97 uint32_t randNr = rand (); | 97 uint32_t randNr = rand (); |
98 if (randNr % 5 == 0 || GetBs ()->GetNrDcdSent () == 0) | 98 if (randNr % 5 == 0 || GetBs ()->GetNrDcdSent () == 0) |
99 { | 99 { |
100 sendDcd = true; | 100 sendDcd = true; |
101 } | 101 } |
102 | 102 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 { | 148 { |
149 return GetBs ()->GetNrDlSymbols () * GetBs ()->GetPhy ()->GetPsPerSymbol () +
GetBs ()->GetTtg (); | 149 return GetBs ()->GetNrDlSymbols () * GetBs ()->GetPhy ()->GetPsPerSymbol () +
GetBs ()->GetTtg (); |
150 } | 150 } |
151 | 151 |
152 void | 152 void |
153 UplinkSchedulerRtps::AddUplinkAllocation (OfdmUlMapIe &ulMapIe, | 153 UplinkSchedulerRtps::AddUplinkAllocation (OfdmUlMapIe &ulMapIe, |
154 const uint32_t &allocationSize, | 154 const uint32_t &allocationSize, |
155 uint32_t &symbolsToAllocation, | 155 uint32_t &symbolsToAllocation, |
156 uint32_t &availableSymbols) | 156 uint32_t &availableSymbols) |
157 { | 157 { |
158 ulMapIe.SetDuration (static_cast<uint16_t>(allocationSize)); | 158 ulMapIe.SetDuration (static_cast<uint16_t> (allocationSize)); |
159 ulMapIe.SetStartTime (static_cast<uint16_t>(symbolsToAllocation)); | 159 ulMapIe.SetStartTime (static_cast<uint16_t> (symbolsToAllocation)); |
160 m_uplinkAllocations.push_back (ulMapIe); | 160 m_uplinkAllocations.push_back (ulMapIe); |
161 symbolsToAllocation += allocationSize; | 161 symbolsToAllocation += allocationSize; |
162 availableSymbols -= allocationSize; | 162 availableSymbols -= allocationSize; |
163 } | 163 } |
164 | 164 |
165 void | 165 void |
166 UplinkSchedulerRtps::Schedule (void) | 166 UplinkSchedulerRtps::Schedule (void) |
167 { | 167 { |
168 m_uplinkAllocations.clear (); | 168 m_uplinkAllocations.clear (); |
169 SetIsIrIntrvlAllocated (false); | 169 SetIsIrIntrvlAllocated (false); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219
WimaxNetDevice::DIRECTION_UPLINK)); | 219
WimaxNetDevice::DIRECTION_UPLINK)); |
220 | 220 |
221 // establish service flows for SS | 221 // establish service flows for SS |
222 if (ssRecord->GetRangingStatus () == WimaxNetDevice::RANGING_STATUS_SU
CCESS | 222 if (ssRecord->GetRangingStatus () == WimaxNetDevice::RANGING_STATUS_SU
CCESS |
223 && !ssRecord->GetAreServiceFlowsAllocated ()) | 223 && !ssRecord->GetAreServiceFlowsAllocated ()) |
224 { | 224 { |
225 // allocating grant (with arbitrary size) to allow SS to send DSA
messages DSA-REQ and DSA-ACK | 225 // allocating grant (with arbitrary size) to allow SS to send DSA
messages DSA-REQ and DSA-ACK |
226 // only one DSA allocation per frame | 226 // only one DSA allocation per frame |
227 if (!allocationForDsa) | 227 if (!allocationForDsa) |
228 { | 228 { |
229 allocationSize = static_cast<uint32_t>(GetBs ()->GetPhy ()->Ge
tNrSymbols (sizeof(DsaReq), modulationType)); | 229 allocationSize = static_cast<uint32_t> (GetBs ()->GetPhy ()->G
etNrSymbols (sizeof(DsaReq), modulationType)); |
230 if (availableSymbols >= allocationSize) | 230 if (availableSymbols >= allocationSize) |
231 { | 231 { |
232 AddUplinkAllocation (ulMapIe, allocationSize, symbolsToAll
ocation, availableSymbols); | 232 AddUplinkAllocation (ulMapIe, allocationSize, symbolsToAll
ocation, availableSymbols); |
233 allocationForDsa = true; | 233 allocationForDsa = true; |
234 } | 234 } |
235 else | 235 else |
236 { | 236 { |
237 break; | 237 break; |
238 } | 238 } |
239 } | 239 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 modulationType, | 332 modulationType, |
333 symbolsToAllocation, | 333 symbolsToAllocation, |
334 availableSymbols); | 334 availableSymbols); |
335 } | 335 } |
336 } | 336 } |
337 } | 337 } |
338 } | 338 } |
339 | 339 |
340 OfdmUlMapIe ulMapIeEnd; | 340 OfdmUlMapIe ulMapIeEnd; |
341 ulMapIeEnd.SetCid (Cid::InitialRanging ()); | 341 ulMapIeEnd.SetCid (Cid::InitialRanging ()); |
342 ulMapIeEnd.SetStartTime (static_cast<uint16_t>(symbolsToAllocation)); | 342 ulMapIeEnd.SetStartTime (static_cast<uint16_t> (symbolsToAllocation)); |
343 ulMapIeEnd.SetUiuc (OfdmUlBurstProfile::UIUC_END_OF_MAP); | 343 ulMapIeEnd.SetUiuc (OfdmUlBurstProfile::UIUC_END_OF_MAP); |
344 ulMapIeEnd.SetDuration (0); | 344 ulMapIeEnd.SetDuration (0); |
345 m_uplinkAllocations.push_back (ulMapIeEnd); | 345 m_uplinkAllocations.push_back (ulMapIeEnd); |
346 | 346 |
347 // setting DL/UL subframe allocation for the next frame | 347 // setting DL/UL subframe allocation for the next frame |
348 GetBs ()->GetBandwidthManager ()->SetSubframeRatio (); | 348 GetBs ()->GetBandwidthManager ()->SetSubframeRatio (); |
349 } | 349 } |
350 | 350 |
351 void | 351 void |
352 UplinkSchedulerRtps::ServiceUnsolicitedGrants (const SSRecord *ssRecord, | 352 UplinkSchedulerRtps::ServiceUnsolicitedGrants (const SSRecord *ssRecord, |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 } | 392 } |
393 } | 393 } |
394 | 394 |
395 if (availableSymbols < allocationSize) | 395 if (availableSymbols < allocationSize) |
396 { | 396 { |
397 break; | 397 break; |
398 } | 398 } |
399 | 399 |
400 if (allocationSize > 0) | 400 if (allocationSize > 0) |
401 { | 401 { |
402 ulMapIe.SetStartTime (static_cast<uint16_t>(symbolsToAllocation)); | 402 ulMapIe.SetStartTime (static_cast<uint16_t> (symbolsToAllocation)); |
403 if (serviceFlow->GetSchedulingType () != ServiceFlow::SF_TYPE_UGS) | 403 if (serviceFlow->GetSchedulingType () != ServiceFlow::SF_TYPE_UGS) |
404 { | 404 { |
405 // special burst profile with most robust modulation type is used
for unicast polls (Request IEs) | 405 // special burst profile with most robust modulation type is used
for unicast polls (Request IEs) |
406 ulMapIe.SetUiuc (OfdmUlBurstProfile::UIUC_REQ_REGION_FULL); | 406 ulMapIe.SetUiuc (OfdmUlBurstProfile::UIUC_REQ_REGION_FULL); |
407 } | 407 } |
408 } | 408 } |
409 else | 409 else |
410 { | 410 { |
411 continue; | 411 continue; |
412 } | 412 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 ServiceFlowRecord *record = serviceFlow->GetRecord (); | 467 ServiceFlowRecord *record = serviceFlow->GetRecord (); |
468 sduSize = serviceFlow->GetSduSize (); | 468 sduSize = serviceFlow->GetSduSize (); |
469 | 469 |
470 uint32_t requiredBandwidth = record->GetRequestedBandwidth () - record->GetGra
ntedBandwidth (); | 470 uint32_t requiredBandwidth = record->GetRequestedBandwidth () - record->GetGra
ntedBandwidth (); |
471 if (requiredBandwidth > 0) | 471 if (requiredBandwidth > 0) |
472 { | 472 { |
473 if (sduSize > 0) | 473 if (sduSize > 0) |
474 { | 474 { |
475 // if SDU size is mentioned, allocate grant of that size | 475 // if SDU size is mentioned, allocate grant of that size |
476 allocSizeBytes = sduSize; | 476 allocSizeBytes = sduSize; |
477 allocSizeSymbols = static_cast<uint32_t>(GetBs ()->GetPhy ()->GetNrSym
bols (sduSize, modulationType)); | 477 allocSizeSymbols = static_cast<uint32_t> (GetBs ()->GetPhy ()->GetNrSy
mbols (sduSize, modulationType)); |
478 } | 478 } |
479 else | 479 else |
480 { | 480 { |
481 allocSizeBytes = requiredBandwidth; | 481 allocSizeBytes = requiredBandwidth; |
482 allocSizeSymbols = static_cast<uint32_t>(GetBs ()->GetPhy ()->GetNrSym
bols (requiredBandwidth, modulationType)); | 482 allocSizeSymbols = static_cast<uint32_t> (GetBs ()->GetPhy ()->GetNrSy
mbols (requiredBandwidth, modulationType)); |
483 } | 483 } |
484 | 484 |
485 if (availableSymbols >= allocSizeSymbols) | 485 if (availableSymbols >= allocSizeSymbols) |
486 { | 486 { |
487 | 487 |
488 NS_LOG_DEBUG ("BS uplink scheduler, " << serviceFlow->GetSchedulingTyp
eStr () << " allocation, size: " | 488 NS_LOG_DEBUG ("BS uplink scheduler, " << serviceFlow->GetSchedulingTyp
eStr () << " allocation, size: " |
489 << allocSizeSymbols << " symbols
" << ", CID: " << serviceFlow->GetConnection ()->GetCid () << ", SFID: " | 489 << allocSizeSymbols << " symbols
" << ", CID: " << serviceFlow->GetConnection ()->GetCid () << ", SFID: " |
490 << serviceFlow->GetSfid () << ",
bw requested: " << record->GetRequestedBandwidth () << ", bw granted: " | 490 << serviceFlow->GetSfid () << ",
bw requested: " << record->GetRequestedBandwidth () << ", bw granted: " |
491 << record->GetGrantedBandwidth (
)); | 491 << record->GetGrantedBandwidth (
)); |
492 | 492 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 { | 546 { |
547 record_[nbAllocation] = (*iter2)->GetRecord (); | 547 record_[nbAllocation] = (*iter2)->GetRecord (); |
548 uint32_t requiredBandwidth = record_[nbAllocation]->GetRequestedBa
ndwidth () | 548 uint32_t requiredBandwidth = record_[nbAllocation]->GetRequestedBa
ndwidth () |
549 - record_[nbAllocation]->GetGrantedBandwidth (); | 549 - record_[nbAllocation]->GetGrantedBandwidth (); |
550 | 550 |
551 if (requiredBandwidth > 0) | 551 if (requiredBandwidth > 0) |
552 { | 552 { |
553 modulationType_[nbAllocation] = modulationType; | 553 modulationType_[nbAllocation] = modulationType; |
554 ulMapIe_[nbAllocation] = ulMapIe; | 554 ulMapIe_[nbAllocation] = ulMapIe; |
555 allocSizeBytes = requiredBandwidth; | 555 allocSizeBytes = requiredBandwidth; |
556 allocSizeSymbols_[nbAllocation] = static_cast<uint32_t>(GetBs
()->GetPhy ()->GetNrSymbols (allocSizeBytes, | 556 allocSizeSymbols_[nbAllocation] = static_cast<uint32_t> (GetBs
()->GetPhy ()->GetNrSymbols (allocSizeBytes, |
557
modulationType_[nbAllocation])); | 557
modulationType_[nbAllocation])); |
558 totAllocSizeSymbols += allocSizeSymbols_[nbAllocation]; | 558 totAllocSizeSymbols += allocSizeSymbols_[nbAllocation]; |
559 | 559 |
560 NS_LOG_INFO ("\t\tUL Scheduler for CID = " << (*iter2)->GetCon
nection ()->GetCid ()); | 560 NS_LOG_INFO ("\t\tUL Scheduler for CID = " << (*iter2)->GetCon
nection ()->GetCid ()); |
561 NS_LOG_INFO ("\t\t\trequiredBandwidth = " << record_[nbAllocat
ion]->GetRequestedBandwidth () | 561 NS_LOG_INFO ("\t\t\trequiredBandwidth = " << record_[nbAllocat
ion]->GetRequestedBandwidth () |
562 << ", allocSizeSymbo
ls = " << allocSizeSymbols_[nbAllocation] << ", modulationType = " | 562 << ", allocSizeSymbo
ls = " << allocSizeSymbols_[nbAllocation] << ", modulationType = " |
563 << modulationType_[n
bAllocation]); | 563 << modulationType_[n
bAllocation]); |
564 | 564 |
565 nbAllocation += 1; | 565 nbAllocation += 1; |
566 } | 566 } |
(...skipping 17 matching lines...) Expand all Loading... |
584 totAllocSizeSymbols += allocSizeSymbols_[i]; | 584 totAllocSizeSymbols += allocSizeSymbols_[i]; |
585 NS_LOG_INFO ("\t\tnew allocSizeSymbols_[" << i << "] = " << allocSizeS
ymbols_[i]); | 585 NS_LOG_INFO ("\t\tnew allocSizeSymbols_[" << i << "] = " << allocSizeS
ymbols_[i]); |
586 } | 586 } |
587 NS_LOG_INFO ("\t\ttotAllocSizeSymbols = " << totAllocSizeSymbols); | 587 NS_LOG_INFO ("\t\ttotAllocSizeSymbols = " << totAllocSizeSymbols); |
588 } | 588 } |
589 | 589 |
590 // Uplink Bandwidth Allocation | 590 // Uplink Bandwidth Allocation |
591 for (int i = 0; i < nbAllocation; i++) | 591 for (int i = 0; i < nbAllocation; i++) |
592 { | 592 { |
593 AddUplinkAllocation (ulMapIe_[i], allocSizeSymbols_[i], symbolsToAllocatio
n, availableSymbols); | 593 AddUplinkAllocation (ulMapIe_[i], allocSizeSymbols_[i], symbolsToAllocatio
n, availableSymbols); |
594 allocSizeBytes = static_cast<uint32_t>(GetBs ()->GetPhy ()->GetNrBytes (al
locSizeSymbols_[i], modulationType_[i])); | 594 allocSizeBytes = static_cast<uint32_t> (GetBs ()->GetPhy ()->GetNrBytes (a
llocSizeSymbols_[i], modulationType_[i])); |
595 NS_LOG_INFO ("\t\tUpdateGrantedBandwidth for " << i << " = " << allocSizeB
ytes); | 595 NS_LOG_INFO ("\t\tUpdateGrantedBandwidth for " << i << " = " << allocSizeB
ytes); |
596 if (record_[i]->GetRequestedBandwidth () < allocSizeBytes) | 596 if (record_[i]->GetRequestedBandwidth () < allocSizeBytes) |
597 { | 597 { |
598 // the flow need new poll to set the newer requredBandwidth | 598 // the flow need new poll to set the newer requredBandwidth |
599 record_[i]->SetGrantedBandwidth (0); | 599 record_[i]->SetGrantedBandwidth (0); |
600 record_[i]->SetRequestedBandwidth (0); | 600 record_[i]->SetRequestedBandwidth (0); |
601 } | 601 } |
602 else | 602 else |
603 { | 603 { |
604 record_[i]->UpdateGrantedBandwidth (allocSizeBytes); | 604 record_[i]->UpdateGrantedBandwidth (allocSizeBytes); |
605 } | 605 } |
606 } | 606 } |
607 } | 607 } |
608 | 608 |
609 void | 609 void |
610 UplinkSchedulerRtps::AllocateInitialRangingInterval (uint32_t &symbolsToAllocati
on, uint32_t &availableSymbols) | 610 UplinkSchedulerRtps::AllocateInitialRangingInterval (uint32_t &symbolsToAllocati
on, uint32_t &availableSymbols) |
611 { | 611 { |
612 Time ssUlStartTime = Seconds (CalculateAllocationStartTime () * GetBs ()->GetP
sDuration ().GetSeconds ()); | 612 Time ssUlStartTime = Seconds (CalculateAllocationStartTime () * GetBs ()->GetP
sDuration ().GetSeconds ()); |
613 SetNrIrOppsAllocated (GetBs ()->GetLinkManager ()->CalculateRangingOppsToAlloc
ate ()); | 613 SetNrIrOppsAllocated (GetBs ()->GetLinkManager ()->CalculateRangingOppsToAlloc
ate ()); |
614 uint32_t allocationSize = GetNrIrOppsAllocated () * GetBs ()->GetRangReqOppSiz
e (); | 614 uint32_t allocationSize = GetNrIrOppsAllocated () * GetBs ()->GetRangReqOppSiz
e (); |
615 Time timeSinceLastIrInterval = Simulator::Now () - GetTimeStampIrInterval (); | 615 Time timeSinceLastIrInterval = Simulator::Now () - GetTimeStampIrInterval (); |
616 | 616 |
617 // adding one frame because may be the time has not elapsed now but will elaps
e before the next frame is sent | 617 // adding one frame because may be the time has not elapsed now but will elaps
e before the next frame is sent |
618 if (timeSinceLastIrInterval + GetBs ()->GetPhy ()->GetFrameDuration () > GetBs
()->GetInitialRangingInterval () | 618 if (timeSinceLastIrInterval + GetBs ()->GetPhy ()->GetFrameDuration () > GetBs
()->GetInitialRangingInterval () |
619 && availableSymbols >= allocationSize) | 619 && availableSymbols >= allocationSize) |
620 { | 620 { |
621 SetIsIrIntrvlAllocated (true); | 621 SetIsIrIntrvlAllocated (true); |
622 OfdmUlMapIe ulMapIeIr; | 622 OfdmUlMapIe ulMapIeIr; |
623 ulMapIeIr.SetCid (GetBs ()->GetBroadcastConnection ()->GetCid ()); | 623 ulMapIeIr.SetCid (GetBs ()->GetBroadcastConnection ()->GetCid ()); |
624 ulMapIeIr.SetStartTime (static_cast<uint16_t>(symbolsToAllocation)); | 624 ulMapIeIr.SetStartTime (static_cast<uint16_t> (symbolsToAllocation)); |
625 ulMapIeIr.SetUiuc (OfdmUlBurstProfile::UIUC_INITIAL_RANGING); | 625 ulMapIeIr.SetUiuc (OfdmUlBurstProfile::UIUC_INITIAL_RANGING); |
626 | 626 |
627 NS_LOG_DEBUG ("BS uplink scheduler, initial ranging allocation, size: " <<
allocationSize << " symbols" | 627 NS_LOG_DEBUG ("BS uplink scheduler, initial ranging allocation, size: " <<
allocationSize << " symbols" |
628 <<
", modulation: BPSK 1/2"); | 628 <<
", modulation: BPSK 1/2"); |
629 | 629 |
630 // marking start and end of each TO, only for debugging | 630 // marking start and end of each TO, only for debugging |
631 for (uint8_t i = 0; i < GetNrIrOppsAllocated (); i++) | 631 for (uint8_t i = 0; i < GetNrIrOppsAllocated (); i++) |
632 { | 632 { |
633 GetBs ()->MarkRangingOppStart (ssUlStartTime + Seconds (symbolsToAlloc
ation | 633 GetBs ()->MarkRangingOppStart (ssUlStartTime + Seconds (symbolsToAlloc
ation |
634 * GetBs ()->Ge
tSymbolDuration ().GetSeconds ()) + Seconds (i * GetBs ()->GetRangReqOppSize () | 634 * GetBs ()->Ge
tSymbolDuration ().GetSeconds ()) + Seconds (i * GetBs ()->GetRangReqOppSize () |
635
* GetBs ()->GetSymbolDuration ().Ge
tSeconds ())); | 635
* GetBs ()->GetSymbolDuration ().Ge
tSeconds ())); |
636 } | 636 } |
637 | 637 |
638 AddUplinkAllocation (ulMapIeIr, allocationSize, symbolsToAllocation, avail
ableSymbols); | 638 AddUplinkAllocation (ulMapIeIr, allocationSize, symbolsToAllocation, avail
ableSymbols); |
639 SetTimeStampIrInterval (Simulator::Now ()); | 639 SetTimeStampIrInterval (Simulator::Now ()); |
640 } | 640 } |
641 } | 641 } |
642 | 642 |
643 void | 643 void |
644 UplinkSchedulerRtps::SetupServiceFlow (SSRecord *ssRecord, ServiceFlow *serviceF
low) | 644 UplinkSchedulerRtps::SetupServiceFlow (SSRecord *ssRecord, ServiceFlow *serviceF
low) |
645 { | 645 { |
646 uint8_t delayNrFrames = 1; | 646 uint8_t delayNrFrames = 1; |
647 uint32_t bitsPerSecond = serviceFlow->GetMinReservedTrafficRate (); | 647 uint32_t bitsPerSecond = serviceFlow->GetMinReservedTrafficRate (); |
648 WimaxPhy::ModulationType modulation; | 648 WimaxPhy::ModulationType modulation; |
649 uint32_t bytesPerFrame = | 649 uint32_t bytesPerFrame = |
650 (uint32_t ((double)(bitsPerSecond) * GetBs ()->GetPhy ()->GetFrameDuration (
).GetSeconds ())) / 8; | 650 (uint32_t ((double)(bitsPerSecond) * GetBs ()->GetPhy ()->GetFrameDuration (
).GetSeconds ())) / 8; |
651 uint32_t frameDurationMSec = static_cast<uint32_t>(GetBs ()->GetPhy ()->GetFra
meDuration ().GetMilliSeconds ()); | 651 uint32_t frameDurationMSec = static_cast<uint32_t> (GetBs ()->GetPhy ()->GetFr
ameDuration ().GetMilliSeconds ()); |
652 | 652 |
653 switch (serviceFlow->GetSchedulingType ()) | 653 switch (serviceFlow->GetSchedulingType ()) |
654 { | 654 { |
655 case ServiceFlow::SF_TYPE_UGS: | 655 case ServiceFlow::SF_TYPE_UGS: |
656 { | 656 { |
657 if (serviceFlow->GetIsMulticast () == true) | 657 if (serviceFlow->GetIsMulticast () == true) |
658 { | 658 { |
659 modulation = serviceFlow->GetModulation (); | 659 modulation = serviceFlow->GetModulation (); |
660 } | 660 } |
661 else | 661 else |
662 { | 662 { |
663 modulation = ssRecord->GetModulationType (); | 663 modulation = ssRecord->GetModulationType (); |
664 } | 664 } |
665 uint32_t grantSize = static_cast<uint32_t>(GetBs ()->GetPhy ()->GetNrSym
bols (bytesPerFrame, modulation)); | 665 uint32_t grantSize = static_cast<uint32_t> (GetBs ()->GetPhy ()->GetNrSy
mbols (bytesPerFrame, modulation)); |
666 serviceFlow->GetRecord ()->SetGrantSize (grantSize); | 666 serviceFlow->GetRecord ()->SetGrantSize (grantSize); |
667 | 667 |
668 uint32_t toleratedJitter = serviceFlow->GetToleratedJitter (); | 668 uint32_t toleratedJitter = serviceFlow->GetToleratedJitter (); |
669 | 669 |
670 if (toleratedJitter > frameDurationMSec) | 670 if (toleratedJitter > frameDurationMSec) |
671 { | 671 { |
672 delayNrFrames = (uint8_t)(toleratedJitter / frameDurationMSec); | 672 delayNrFrames = (uint8_t)(toleratedJitter / frameDurationMSec); |
673 } | 673 } |
674 | 674 |
675 uint16_t interval = static_cast<uint16_t>(delayNrFrames * frameDurationM
Sec); | 675 uint16_t interval = static_cast<uint16_t> (delayNrFrames * frameDuration
MSec); |
676 serviceFlow->SetUnsolicitedGrantInterval (interval); | 676 serviceFlow->SetUnsolicitedGrantInterval (interval); |
677 } | 677 } |
678 break; | 678 break; |
679 case ServiceFlow::SF_TYPE_RTPS: | 679 case ServiceFlow::SF_TYPE_RTPS: |
680 { | 680 { |
681 if (serviceFlow->GetSduSize () > bytesPerFrame) | 681 if (serviceFlow->GetSduSize () > bytesPerFrame) |
682 { | 682 { |
683 delayNrFrames = (uint8_t)(serviceFlow->GetSduSize () / bytesPerFrame
); | 683 delayNrFrames = (uint8_t)(serviceFlow->GetSduSize () / bytesPerFrame
); |
684 } | 684 } |
685 | 685 |
686 uint16_t interval = static_cast<uint16_t>(delayNrFrames * frameDurationM
Sec); | 686 uint16_t interval = static_cast<uint16_t> (delayNrFrames * frameDuration
MSec); |
687 serviceFlow->SetUnsolicitedPollingInterval (interval); | 687 serviceFlow->SetUnsolicitedPollingInterval (interval); |
688 } | 688 } |
689 break; | 689 break; |
690 case ServiceFlow::SF_TYPE_NRTPS: | 690 case ServiceFlow::SF_TYPE_NRTPS: |
691 { | 691 { |
692 // no real-time guarantees are given to NRTPS, serviced based on availab
le bandwidth | 692 // no real-time guarantees are given to NRTPS, serviced based on availab
le bandwidth |
693 } | 693 } |
694 break; | 694 break; |
695 case ServiceFlow::SF_TYPE_BE: | 695 case ServiceFlow::SF_TYPE_BE: |
696 { | 696 { |
697 // no real-time guarantees are given to BE, serviced based on available
bandwidth | 697 // no real-time guarantees are given to BE, serviced based on available
bandwidth |
698 } | 698 } |
699 break; | 699 break; |
700 default: | 700 default: |
701 NS_FATAL_ERROR ("Invalid scheduling type"); | 701 NS_FATAL_ERROR ("Invalid scheduling type"); |
702 } | 702 } |
703 } | 703 } |
704 | 704 |
705 void | 705 void |
706 UplinkSchedulerRtps::InitOnce () | 706 UplinkSchedulerRtps::InitOnce () |
707 { | 707 { |
708 } | 708 } |
709 | 709 |
710 void | 710 void |
711 UplinkSchedulerRtps::ProcessBandwidthRequest (const BandwidthRequestHeader &bwRe
questHdr) | 711 UplinkSchedulerRtps::ProcessBandwidthRequest (const BandwidthRequestHeader &bwRe
questHdr) |
712 { | 712 { |
713 NS_UNUSED(bwRequestHdr); | 713 NS_UNUSED (bwRequestHdr); |
714 } | 714 } |
715 | 715 |
716 void | 716 void |
717 UplinkSchedulerRtps::OnSetRequestedBandwidth (ServiceFlowRecord *sfr) | 717 UplinkSchedulerRtps::OnSetRequestedBandwidth (ServiceFlowRecord *sfr) |
718 { | 718 { |
719 // m_grantedBandwidth must be reset to zero | 719 // m_grantedBandwidth must be reset to zero |
720 uint32_t grantedBandwidth = 0; | 720 uint32_t grantedBandwidth = 0; |
721 sfr->SetGrantedBandwidth (grantedBandwidth); | 721 sfr->SetGrantedBandwidth (grantedBandwidth); |
722 } | 722 } |
723 | 723 |
724 } // namespace ns3 | 724 } // namespace ns3 |
LEFT | RIGHT |