22 #include "ns3/simulator.h"
24 #include "ns3/packet-burst.h"
67 std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > > *downlinkBursts =
m_downlinkBursts;
68 std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > pair;
69 while (downlinkBursts->size ())
71 pair = downlinkBursts->front ();
80 std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > >*
92 dlMapIe->
SetCid (connection->GetCid ());
95 NS_LOG_INFO (
"BS scheduler, burst size: " << burst->GetSize () <<
" bytes" <<
", pkts: " << burst->GetNPackets ()
96 <<
", connection: " << connection->GetTypeStr () <<
", CID: " << connection->GetCid ());
99 NS_LOG_INFO (
", SFID: " << connection->GetServiceFlow ()->GetSfid () <<
", service: "
100 << connection->GetServiceFlow ()->GetSchedulingTypeStr ());
102 NS_LOG_INFO (
", modulation: " << modulationType <<
", DIUC: " << (uint32_t) diuc);
112 uint32_t nrSymbolsRequired = 0;
117 uint32_t availableSymbols =
GetBs ()->GetNrDlSymbols ();
121 if (connection !=
GetBs ()->GetInitialRangingConnection () && connection !=
GetBs ()->GetBroadcastConnection ())
126 modulationType = connection->GetServiceFlow ()->GetModulation ();
130 modulationType =
GetBs ()->GetSSManager ()->GetSSRecord (connection->GetCid ())->GetModulationType ();
132 diuc =
GetBs ()->GetBurstProfileManager ()->GetBurstProfile (modulationType,
135 else if (connection ==
GetBs ()->GetInitialRangingConnection () || connection
136 ==
GetBs ()->GetBroadcastConnection ())
150 nrSymbolsRequired = connection->GetServiceFlow ()->GetRecord ()->GetGrantSize ();
151 if (nrSymbolsRequired < availableSymbols)
153 burst =
CreateUgsBurst (connection->GetServiceFlow (), modulationType, nrSymbolsRequired);
157 burst =
CreateUgsBurst (connection->GetServiceFlow (), modulationType, availableSymbols);
159 if (burst->GetNPackets () != 0)
161 uint32_t BurstSizeSymbols =
GetBs ()->GetPhy ()->GetNrSymbols (burst->GetSize (), modulationType);
164 if (availableSymbols <= BurstSizeSymbols)
166 availableSymbols -= BurstSizeSymbols;
173 burst = Create<PacketBurst> ();
174 while (connection->HasPackets () ==
true)
177 nrSymbolsRequired =
GetBs ()->GetPhy ()->GetNrSymbols (FirstPacketSize, modulationType);
182 uint32_t availableByte =
GetBs ()->GetPhy ()->GetNrBytes (availableSymbols, modulationType);
184 availableSymbols = 0;
186 else if (availableSymbols >= nrSymbolsRequired)
188 packet = connection->Dequeue ();
189 availableSymbols -= nrSymbolsRequired;
195 burst->AddPacket (packet);
199 if (availableSymbols == 0)
209 << availableSymbols << std::endl <<
"BS scheduler, queues:" <<
" IR "
210 <<
GetBs ()->GetInitialRangingConnection ()->GetQueue ()->GetSize () <<
" broadcast "
211 <<
GetBs ()->GetBroadcastConnection ()->GetQueue ()->GetSize () <<
" basic "
222 std::vector<Ptr<WimaxConnection> >::const_iterator iter1;
223 std::vector<ServiceFlow*>::iterator iter2;
225 NS_LOG_INFO (
"BS Scheduler: Selecting connection...");
226 if (
GetBs ()->GetBroadcastConnection ()->HasPackets ())
229 connection =
GetBs ()->GetBroadcastConnection ();
232 else if (
GetBs ()->GetInitialRangingConnection ()->HasPackets ())
234 NS_LOG_INFO (
"Return GetInitialRangingConnection");
235 connection =
GetBs ()->GetInitialRangingConnection ();
240 std::vector<Ptr<WimaxConnection> > connections;
241 std::vector<ServiceFlow*> serviceFlows;
243 connections =
GetBs ()->GetConnectionManager ()->GetConnections (
Cid::BASIC);
244 for (iter1 = connections.begin (); iter1 != connections.end (); ++iter1)
246 if ((*iter1)->HasPackets ())
255 for (iter1 = connections.begin (); iter1 != connections.end (); ++iter1)
257 if ((*iter1)->HasPackets ())
266 for (iter2 = serviceFlows.begin (); iter2 != serviceFlows.end (); ++iter2)
268 serviceFlowRecord = (*iter2)->GetRecord ();
269 NS_LOG_INFO (
"processing UGS: HAS PACKET=" << (*iter2)->HasPackets () <<
"max Latency = "
270 << MilliSeconds ((*iter2)->GetMaximumLatency ()) <<
"Delay = " << ((currentTime
273 if ((*iter2)->HasPackets () && ((currentTime - serviceFlowRecord->
GetDlTimeStamp ())
274 +
GetBs ()->GetPhy ()->GetFrameDuration ()) > MilliSeconds ((*iter2)->GetMaximumLatency ()))
277 connection = (*iter2)->GetConnection ();
278 NS_LOG_INFO (
"Return UGS SF: CID = " << (*iter2)->GetCid () <<
"SFID = " << (*iter2)->GetSfid ());
284 for (iter2 = serviceFlows.begin (); iter2 != serviceFlows.end (); ++iter2)
286 serviceFlowRecord = (*iter2)->GetRecord ();
288 if ((*iter2)->HasPackets () && ((currentTime - serviceFlowRecord->
GetDlTimeStamp ())
289 +
GetBs ()->GetPhy ()->GetFrameDuration ()) > MilliSeconds ((*iter2)->GetMaximumLatency ()))
292 connection = (*iter2)->GetConnection ();
293 NS_LOG_INFO (
"Return RTPS SF: CID = " << (*iter2)->GetCid () <<
"SFID = " << (*iter2)->GetSfid ());
299 for (iter2 = serviceFlows.begin (); iter2 != serviceFlows.end (); ++iter2)
302 if ((*iter2)->HasPackets ())
304 NS_LOG_INFO (
"Return NRTPS SF: CID = " << (*iter2)->GetCid () <<
"SFID = " << (*iter2)->GetSfid ());
305 connection = (*iter2)->GetConnection ();
311 for (iter2 = serviceFlows.begin (); iter2 != serviceFlows.end (); ++iter2)
314 if ((*iter2)->HasPackets ())
316 NS_LOG_INFO (
"Return BE SF: CID = " << (*iter2)->GetCid () <<
"SFID = " << (*iter2)->GetSfid ());
317 connection = (*iter2)->GetConnection ();
328 uint32_t availableSymbols)
334 uint32_t nrSymbolsRequired = 0;
341 nrSymbolsRequired =
GetBs ()->GetPhy ()->GetNrSymbols (FirstPacketSize,modulationType);
346 uint32_t availableByte =
GetBs ()->GetPhy ()->GetNrBytes (availableSymbols, modulationType);
348 availableSymbols = 0;
352 packet = connection->Dequeue ();
353 availableSymbols -= nrSymbolsRequired;
355 burst->AddPacket (packet);
356 if (availableSymbols <= 0)
keep track of time values and allow control of global simulation resolution
smart pointer class similar to boost::intrusive_ptr
this class implements a structure to manage some parameters and statistics related to a service flow ...
Ptr< PacketBurst > CreateUgsBurst(ServiceFlow *serviceFlow, WimaxPhy::ModulationType modulationType, uint32_t availableSymbols)
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
bool SelectConnection(Ptr< WimaxConnection > &connection)
Ptr< WimaxConnection > GetConnection(void) const
bool CheckForFragmentation(Ptr< WimaxConnection > connection, int availableSymbols, WimaxPhy::ModulationType modulationType)
std::list< std::pair< OfdmDlMapIe *, Ptr< PacketBurst > > > * GetDownlinkBursts(void) const
void SetDiuc(uint8_t diuc)
std::list< std::pair< OfdmDlMapIe *, Ptr< PacketBurst > > > * m_downlinkBursts
NS_LOG_COMPONENT_DEFINE("BSSchedulerSimple")
This class implements service flows as described by the IEEE-802.16 standard.
virtual Ptr< BaseStationNetDevice > GetBs(void)
void AddDownlinkBurst(Ptr< const WimaxConnection > connection, uint8_t diuc, WimaxPhy::ModulationType modulationType, Ptr< PacketBurst > burst)
static Time Now(void)
Return the "current simulation time".
virtual void SetBs(Ptr< BaseStationNetDevice > bs)
void SetDlTimeStamp(Time dlTimeStamp)
Set the DlTimeStamp.
Doxygen introspection did not find any typical Config paths.
Time GetDlTimeStamp(void) const
#define NS_LOG_DEBUG(msg)
a base class which provides memory management and object aggregation
static TypeId GetTypeId(void)
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
bool HasPackets(void) const