23 #include "ns3/simulator.h"
28 #include "ns3/uinteger.h"
82 std::list<OfdmUlMapIe>
98 uint32_t randNr = rand ();
99 if (randNr % 5 == 0 ||
GetBs ()->GetNrDcdSent () == 0)
105 if (randNr % 5 == 0 ||
GetBs ()->GetNrUcdSent () == 0)
134 if (timeSinceLastDcd >
GetBs ()->GetDcdInterval ())
140 if (timeSinceLastUcd >
GetBs ()->GetUcdInterval ())
150 return GetBs ()->GetNrDlSymbols () *
GetBs ()->GetPhy ()->GetPsPerSymbol () +
GetBs ()->GetTtg ();
155 const uint32_t &allocationSize,
156 uint32_t &symbolsToAllocation,
157 uint32_t &availableSymbols)
162 symbolsToAllocation += allocationSize;
163 availableSymbols -= allocationSize;
172 bool allocationForDsa =
false;
174 uint32_t symbolsToAllocation = 0;
175 uint32_t allocationSize = 0;
176 uint32_t availableSymbols =
GetBs ()->GetNrUlSymbols ();
180 std::vector<SSRecord*> *ssRecords =
GetBs ()->GetSSManager ()->GetSSRecords ();
181 for (std::vector<SSRecord*>::iterator iter = ssRecords->begin (); iter != ssRecords->end (); ++iter)
199 allocationSize =
GetBs ()->GetRangReqOppSize ();
202 if (availableSymbols >= allocationSize)
217 ulMapIe.
SetUiuc (
GetBs ()->GetBurstProfileManager ()->GetBurstProfile (modulationType,
227 if (!allocationForDsa)
229 allocationSize =
GetBs ()->GetPhy ()->GetNrSymbols (
sizeof(
DsaReq), modulationType);
231 if (availableSymbols >= allocationSize)
234 allocationForDsa =
true;
256 if (availableSymbols)
266 if (availableSymbols)
276 if (availableSymbols)
288 if (availableSymbols)
298 if (availableSymbols)
308 if (availableSymbols)
329 GetBs ()->GetBandwidthManager ()->SetSubframeRatio ();
337 uint32_t &symbolsToAllocation,
338 uint32_t &availableSymbols)
340 uint32_t allocationSize = 0;
341 uint8_t uiuc = ulMapIe.
GetUiuc ();
342 std::vector<ServiceFlow*> serviceFlows = ssRecord->
GetServiceFlows (schedulingType);
344 for (std::vector<ServiceFlow*>::iterator iter = serviceFlows.begin (); iter != serviceFlows.end (); ++iter)
352 allocationSize =
GetBs ()->GetBandwidthManager ()->CalculateAllocationSize (ssRecord, serviceFlow);
361 if (bps < serviceFlow->GetMinReservedTrafficRate ())
375 if (availableSymbols < allocationSize)
380 if (allocationSize > 0)
406 uint32_t &symbolsToAllocation,
407 uint32_t &availableSymbols)
409 std::vector<ServiceFlow*> serviceFlows = ssRecord->
GetServiceFlows (schedulingType);
411 for (std::vector<ServiceFlow*>::iterator iter = serviceFlows.begin (); iter != serviceFlows.end (); ++iter)
430 uint32_t &symbolsToAllocation,
431 uint32_t &availableSymbols)
433 uint32_t allocSizeBytes = 0;
434 uint32_t allocSizeSymbols = 0;
435 uint16_t sduSize = 0;
441 if (requiredBandwidth > 0)
446 allocSizeBytes = sduSize;
447 allocSizeSymbols =
GetBs ()->GetPhy ()->GetNrSymbols (sduSize, modulationType);
451 allocSizeBytes = requiredBandwidth;
452 allocSizeSymbols =
GetBs ()->GetPhy ()->GetNrSymbols (requiredBandwidth, modulationType);
455 if (availableSymbols >= allocSizeSymbols)
483 if (timeSinceLastIrInterval +
GetBs ()->GetPhy ()->GetFrameDuration () >
GetBs ()->GetInitialRangingInterval ()
484 && availableSymbols >= allocationSize)
488 ulMapIeIr.
SetCid ((
GetBs ()->GetBroadcastConnection ())->GetCid ());
492 NS_LOG_DEBUG (
"BS uplink scheduler, initial ranging allocation, size: " << allocationSize <<
" symbols"
493 <<
", modulation: BPSK 1/2");
498 GetBs ()->MarkRangingOppStart (ssUlStartTime + Seconds (symbolsToAllocation
499 *
GetBs ()->GetSymbolDuration ().GetSeconds ()) + Seconds (i *
GetBs ()->GetRangReqOppSize ()
500 *
GetBs ()->GetSymbolDuration ().GetSeconds ()));
511 uint8_t delayNrFrames = 1;
514 uint32_t bytesPerFrame =
515 (uint32_t ((
double)(bitsPerSecond) *
GetBs ()->GetPhy ()->GetFrameDuration ().GetSeconds ())) / 8;
516 uint32_t frameDurationMSec =
GetBs ()->GetPhy ()->GetFrameDuration ().GetMilliSeconds ();
530 uint32_t grantSize =
GetBs ()->GetPhy ()->GetNrSymbols (bytesPerFrame, modulation);
535 if (toleratedJitter > frameDurationMSec)
537 delayNrFrames = (uint8_t)(toleratedJitter / frameDurationMSec);
540 uint16_t interval = delayNrFrames * frameDurationMSec;
546 if (serviceFlow->
GetSduSize () > bytesPerFrame)
548 delayNrFrames = (uint8_t)(serviceFlow->
GetSduSize () / bytesPerFrame);
551 uint16_t interval = delayNrFrames * frameDurationMSec;
581 uint32_t grantedBandwidth = 0;
keep track of time values and allow control of global simulation resolution
enum WimaxPhy::ModulationType GetModulation(void) const
smart pointer class similar to boost::intrusive_ptr
void SetupServiceFlow(SSRecord *ssRecord, ServiceFlow *serviceFlow)
enum ServiceFlow::SchedulingType GetSchedulingType(void) const
virtual void SetDcdTimeStamp(Time dcdTimeStamp)
virtual Time GetUcdTimeStamp(void) const
void AddUplinkAllocation(OfdmUlMapIe &ulMapIe, const uint32_t &allocationSize, uint32_t &symbolsToAllocation, uint32_t &availableSymbols)
Cid GetBasicCid(void) const
void AllocateInitialRangingInterval(uint32_t &symbolsToAllocation, uint32_t &availableSymbols)
uint32_t GetRequestedBandwidth(void)
this class implements a structure to manage some parameters and statistics related to a service flow ...
void ServiceBandwidthRequests(const SSRecord *ssRecord, enum ServiceFlow::SchedulingType schedulingType, OfdmUlMapIe &ulMapIe, const WimaxPhy::ModulationType modulationType, uint32_t &symbolsToAllocation, uint32_t &availableSymbols)
bool GetAreServiceFlowsAllocated(void) const
virtual void SetIsIrIntrvlAllocated(bool isIrIntrvlAllocated)
void SetGrantedBandwidth(uint32_t grantedBandwidth)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
void ServiceUnsolicitedGrants(const SSRecord *ssRecord, enum ServiceFlow::SchedulingType schedulingType, OfdmUlMapIe &ulMapIe, const WimaxPhy::ModulationType modulationType, uint32_t &symbolsToAllocation, uint32_t &availableSymbols)
void GetChannelDescriptorsToUpdate(bool &, bool &, bool &, bool &)
Determines if channel descriptors sent in the current frame are required to be updated.
uint32_t GetSfid(void) const
WimaxNetDevice::RangingStatus GetRangingStatus(void) const
static TypeId GetTypeId(void)
Ptr< WimaxConnection > GetConnection(void) const
#define NS_FATAL_ERROR(msg)
fatal error handling
uint32_t GetMinReservedTrafficRate(void) const
std::list< OfdmUlMapIe > m_uplinkAllocations
virtual void SetTimeStampIrInterval(Time timeStampIrInterval)
virtual Time GetTimeStampIrInterval(void)
Time GetGrantTimeStamp(void) const
virtual void SetBs(Ptr< BaseStationNetDevice > bs)
uint32_t GetBwSinceLastExpiry(void)
static Cid InitialRanging(void)
void SetGrantTimeStamp(Time grantTimeStamp)
Set the grant time stamp.
void SetUnsolicitedPollingInterval(uint16_t)
virtual void SetNrIrOppsAllocated(uint8_t nrIrOppsAllocated)
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
virtual void SetIsInvIrIntrvlAllocated(bool isInvIrIntrvlAllocated)
uint8_t GetUiuc(void) const
UplinkSchedulerSimple(void)
std::list< OfdmUlMapIe > GetUplinkAllocations(void) const
void ProcessBandwidthRequest(const BandwidthRequestHeader &bwRequestHdr)
this class implements the bandwidth-request mac Header as described by IEEE Standard for Local and me...
virtual uint8_t GetNrIrOppsAllocated(void) const
NS_LOG_COMPONENT_DEFINE("UplinkSchedulerSimple")
uint8_t GetSduSize(void) const
This class implements service flows as described by the IEEE-802.16 standard.
virtual Ptr< BaseStationNetDevice > GetBs(void)
void SetStartTime(uint16_t startTime)
static Time Now(void)
Return the "current simulation time".
ServiceFlowRecord * GetRecord(void) const
bool GetPollForRanging(void) const
bool GetIsBroadcastSS(void)
virtual void SetUcdTimeStamp(Time ucdTimeStamp)
uint32_t GetToleratedJitter(void) const
~UplinkSchedulerSimple(void)
#define NS_LOG_DEBUG(msg)
bool GetIsMulticast(void) const
void SetBwSinceLastExpiry(uint32_t bwSinceLastExpiry)
void OnSetRequestedBandwidth(ServiceFlowRecord *sfr)
This class is used by the base station to store some information related to subscriber station in the...
a base class which provides memory management and object aggregation
void UpdateGrantedBandwidth(uint32_t grantedBandwidth)
uint32_t GetGrantedBandwidth(void)
Doxygen introspection did not find any typical Config paths.
uint32_t CalculateAllocationStartTime(void)
virtual Time GetDcdTimeStamp(void) const
a unique identifier for an interface.
void SetUiuc(uint8_t uiuc)
TypeId SetParent(TypeId tid)
WimaxPhy::ModulationType GetModulationType(void) const