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 ();
void DoDispose(void)
Destructor implementation.
Simulation virtual time values and global simulation resolution.
Smart pointer class similar to boost::intrusive_ptr.
Ptr< PacketBurst > Schedule(uint16_t availableSymbols, WimaxPhy::ModulationType modulationType, MacHeaderType::HeaderType packetType, Ptr< WimaxConnection > &connection)
void SetPollMe(bool pollMe)
Set poll me value.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
bool m_pollMe
poll me flag
Ptr< SubscriberStationNetDevice > m_ss
the subscriber station
SSScheduler(Ptr< SubscriberStationNetDevice > ss)
Constructor.
bool GetPollMe(void) const
Get the poll me value.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TypeId GetTypeId(void)
Get the type ID.
static Time Now(void)
Return the current simulation virtual time.
ModulationType
ModulationType enumeration.
A base class which provides memory management and object aggregation.
Ptr< WimaxConnection > SelectConnection(void)
Select connection.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.