21 #include "ns3/simulator.h"
44 .SetGroupName(
"Wimax");
84 uint16_t nrSymbolsRequired = 0;
93 "SS: Error while scheduling packets: The selected connection has no packets");
98 while (connection && connection->HasPackets (packetType))
100 NS_LOG_INFO (
"FRAG_DEBUG: SS Scheduler" << std::endl);
102 uint32_t availableByte =
m_ss->GetPhy ()->
103 GetNrBytes (availableSymbols, modulationType);
105 uint32_t requiredByte = connection->GetQueue ()->GetFirstPacketRequiredByte (packetType);
107 NS_LOG_INFO (
"\t availableByte = " << availableByte <<
108 ", requiredByte = " << requiredByte);
110 if (availableByte >= requiredByte)
114 "\n\t Send packet without other fragmentation" << std::endl);
116 packet = connection->Dequeue (packetType);
117 burst->AddPacket (packet);
119 nrSymbolsRequired =
m_ss->GetPhy ()->
120 GetNrSymbols (packet->
GetSize (), modulationType);
121 availableSymbols -= nrSymbolsRequired;
128 "\n\t Check if the fragmentation is possible");
130 uint32_t headerSize = connection->GetQueue ()->GetFirstPacketHdrSize (packetType);
131 if (!connection->GetQueue ()->CheckForFragmentation (packetType))
136 NS_LOG_INFO (
"\t availableByte = " << availableByte <<
137 " headerSize = " << headerSize);
139 if (availableByte > headerSize)
142 packet = connection->Dequeue (packetType, availableByte);
143 burst->AddPacket (packet);
145 nrSymbolsRequired =
m_ss->GetPhy ()->
146 GetNrSymbols (packet->
GetSize (), modulationType);
147 availableSymbols -= nrSymbolsRequired;
151 NS_LOG_INFO (
"\t Fragmentation IS NOT possible" << std::endl);
158 "\n\t Fragmentation IS NOT possible, " << std::endl);
170 std::vector<ServiceFlow*>::const_iterator iter;
171 std::vector<ServiceFlow*> serviceFlows;
173 NS_LOG_INFO (
"SS Scheduler: Selecting connection...");
174 if (
m_ss->GetInitialRangingConnection ()->HasPackets ())
176 NS_LOG_INFO (
"Return GetInitialRangingConnection");
177 return m_ss->GetInitialRangingConnection ();
179 if (
m_ss->GetBasicConnection ()->HasPackets ())
182 return m_ss->GetBasicConnection ();
184 if (
m_ss->GetPrimaryConnection ()->HasPackets ())
187 return m_ss->GetPrimaryConnection ();
191 for (iter = serviceFlows.begin (); iter != serviceFlows.end (); ++iter)
195 if ((*iter)->HasPackets () && (currentTime
197 (*iter)->GetUnsolicitedGrantInterval ())))
199 NS_LOG_INFO (
"Return UGS SF: CID = " << (*iter)->GetCid () <<
"SFID = "
200 << (*iter)->GetSfid ());
201 return (*iter)->GetConnection ();
209 for (iter = serviceFlows.begin (); iter != serviceFlows.end (); ++iter)
212 && (currentTime +
m_ss->GetPhy ()->GetFrameDuration ()
214 (*iter)->GetUnsolicitedPollingInterval ())))
216 NS_LOG_INFO (
"Return RTPS SF: CID = " << (*iter)->GetCid () <<
"SFID = "
217 << (*iter)->GetSfid ());
218 return (*iter)->GetConnection ();
223 for (iter = serviceFlows.begin (); iter != serviceFlows.end (); ++iter)
227 NS_LOG_INFO (
"Return NRTPS SF: CID = " << (*iter)->GetCid () <<
"SFID = "
228 << (*iter)->GetSfid ());
229 return (*iter)->GetConnection ();
234 for (iter = serviceFlows.begin (); iter != serviceFlows.end (); ++iter)
238 NS_LOG_INFO (
"Return BE SF: CID = " << (*iter)->GetCid () <<
"SFID = "
239 << (*iter)->GetSfid ());
240 return (*iter)->GetConnection ();
244 if (
m_ss->GetBroadcastConnection ()->HasPackets ())
246 return m_ss->GetBroadcastConnection ();