35#include "ns3/simulator.h"
96 allocationSize = bs->GetBwReqOppSize();
105 allocationSize = bs->GetBwReqOppSize();
112 allocationSize = bs->GetBwReqOppSize();
119 return allocationSize;
129 std::vector<ServiceFlow*> serviceFlows =
132 for (std::vector<ServiceFlow*>::iterator iter = serviceFlows.begin();
133 iter != serviceFlows.end();
144 bytesToRequest = serviceFlow->
GetQueue()->GetQueueLengthWithMACOverhead();
161 if (!serviceFlow || !bytesToRequest)
172 bwRequestHdr.
SetBr(bytesToRequest);
175 packet->AddHeader(bwRequestHdr);
181 "Send Bandwidth Request: !UIUC_REQ_REGION_FULL");
194 bs->GetConnectionManager()->GetConnection(bwRequestHdr.
GetCid())->GetServiceFlow();
197 serviceFlow->GetRecord()->UpdateRequestedBandwidth(bwRequestHdr.
GetBr());
201 serviceFlow->GetRecord()->SetRequestedBandwidth(bwRequestHdr.
GetBr());
202 bs->GetUplinkScheduler()->OnSetRequestedBandwidth(serviceFlow->GetRecord());
204 bs->GetUplinkScheduler()->ProcessBandwidthRequest(bwRequestHdr);
206 serviceFlow->GetRecord()->IncreaseBacklogged(bwRequestHdr.
GetBr());
216 uint32_t symbolsPerFrame = bs->GetPhy()->GetSymbolsPerFrame();
220 bs->SetNrDlSymbols(symbolsPerFrame / 2);
221 bs->SetNrUlSymbols(symbolsPerFrame / 2);
231 std::vector<SSRecord*>* ssRecords = bs->GetSSManager()->GetSSRecords();
232 for (std::vector<SSRecord*>::const_iterator iter1 = ssRecords->begin();
233 iter1 != ssRecords->end();
236 std::vector<ServiceFlow*> ssServiceFlows =
238 for (std::vector<ServiceFlow*>::const_iterator iter2 = ssServiceFlows.begin();
239 iter2 != ssServiceFlows.end();
242 allocationPerFrame += (*iter2)->GetRecord()->GetGrantSize();
245 return allocationPerFrame;
void SetSubframeRatio()
Set subframe ratio.
uint16_t m_nrBwReqsSent
bandwidth requests sent
uint32_t GetSymbolsPerFrameAllocated()
Get symbols per frame allocated.
Ptr< WimaxNetDevice > m_device
the device
uint32_t CalculateAllocationSize(const SSRecord *ssRecord, const ServiceFlow *serviceFlow)
Calculate allocation size function.
ServiceFlow * SelectFlowForRequest(uint32_t &bytesToRequest)
Select flow for request function.
void DoDispose() override
Destructor implementation.
~BandwidthManager() override
BandwidthManager(Ptr< WimaxNetDevice > device)
Constructor.
void ProcessBandwidthRequest(const BandwidthRequestHeader &bwRequestHdr)
Process bandwidth request.
void SendBandwidthRequest(uint8_t uiuc, uint16_t allocationSize)
Send bandwidth request.
static TypeId GetTypeId()
Get the type ID.
This class implements the bandwidth-request mac Header as described by IEEE Standard for Local and me...
void SetBr(uint32_t br)
Set BR field.
uint32_t GetBr() const
Get BR field.
void SetType(uint8_t type)
Set type field.
Cid GetCid() const
Get CID field.
void SetCid(Cid cid)
Set CID field.
@ HEADER_TYPE_INCREMENTAL
uint8_t GetType() const
Get type field.
A base class which provides memory management and object aggregation.
Smart pointer class similar to boost::intrusive_ptr.
This class is used by the base station to store some information related to subscriber station in the...
bool GetHasServiceFlowUgs() const
Check if at least one flow has scheduling type SF_TYPE_UGS.
bool GetPollMeBit() const
Get poll ME bit.
This class implements service flows as described by the IEEE-802.16 standard.
ServiceFlow::SchedulingType GetSchedulingType() const
Get scheduling type.
uint16_t GetUnsolicitedPollingInterval() const
Get unsolicited polling interval.
bool HasPackets() const
Check if packets are present.
ServiceFlowRecord * GetRecord() const
Get service flow record.
Ptr< WimaxMacQueue > GetQueue() const
Get pointer to queue.
uint16_t GetUnsolicitedGrantInterval() const
Get unsolicited grant interval.
Ptr< WimaxConnection > GetConnection() const
Can return a null connection is this service flow has not been associated yet to a connection.
Time GetGrantTimeStamp() const
uint32_t GetGrantSize() const
void SetGrantTimeStamp(Time grantTimeStamp)
Set the grant time stamp.
static Time Now()
Return the current simulation virtual time.
SubscriberStationNetDevice subclass of WimaxNetDevice.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.