33 #include "ns3/simulator.h"
85 uint16_t nrSymbolsRequired = 0;
94 "SS: Error while scheduling packets: The selected connection has no packets");
99 while (connection && connection->HasPackets(packetType))
101 NS_LOG_INFO(
"FRAG_DEBUG: SS Scheduler" << std::endl);
103 uint32_t availableByte =
m_ss->GetPhy()->GetNrBytes(availableSymbols, modulationType);
105 uint32_t requiredByte = connection->GetQueue()->GetFirstPacketRequiredByte(packetType);
107 NS_LOG_INFO(
"\t availableByte = " << availableByte <<
", requiredByte = " << requiredByte);
109 if (availableByte >= requiredByte)
113 "\n\t Send packet without other fragmentation"
116 packet = connection->Dequeue(packetType);
117 burst->AddPacket(packet);
119 nrSymbolsRequired =
m_ss->GetPhy()->GetNrSymbols(packet->
GetSize(), modulationType);
120 availableSymbols -= nrSymbolsRequired;
127 "\n\t Check if the fragmentation is possible");
129 uint32_t headerSize = connection->GetQueue()->GetFirstPacketHdrSize(packetType);
130 if (!connection->GetQueue()->CheckForFragmentation(packetType))
136 <<
" headerSize = " << headerSize);
138 if (availableByte > headerSize)
141 packet = connection->Dequeue(packetType, availableByte);
142 burst->AddPacket(packet);
145 m_ss->GetPhy()->GetNrSymbols(packet->
GetSize(), modulationType);
146 availableSymbols -= nrSymbolsRequired;
150 NS_LOG_INFO(
"\t Fragmentation IS NOT possible" << std::endl);
157 "\n\t Fragmentation IS NOT possible, "
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())
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 +
m_ss->GetPhy()->GetFrameDuration() >
198 NS_LOG_INFO(
"Return UGS SF: CID = " << (*iter)->GetCid()
199 <<
"SFID = " << (*iter)->GetSfid());
200 return (*iter)->GetConnection();
209 for (iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
212 (currentTime +
m_ss->GetPhy()->GetFrameDuration() >
213 MilliSeconds((*iter)->GetUnsolicitedPollingInterval())))
215 NS_LOG_INFO(
"Return RTPS SF: CID = " << (*iter)->GetCid()
216 <<
"SFID = " << (*iter)->GetSfid());
217 return (*iter)->GetConnection();
222 for (iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
226 NS_LOG_INFO(
"Return NRTPS SF: CID = " << (*iter)->GetCid()
227 <<
"SFID = " << (*iter)->GetSfid());
228 return (*iter)->GetConnection();
233 for (iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
237 NS_LOG_INFO(
"Return BE SF: CID = " << (*iter)->GetCid()
238 <<
"SFID = " << (*iter)->GetSfid());
239 return (*iter)->GetConnection();
243 if (
m_ss->GetBroadcastConnection()->HasPackets())
245 return m_ss->GetBroadcastConnection();
A base class which provides memory management and object aggregation.
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Smart pointer class similar to boost::intrusive_ptr.
SSScheduler(Ptr< SubscriberStationNetDevice > ss)
Constructor.
bool m_pollMe
poll me flag
void DoDispose() override
Destructor implementation.
Ptr< PacketBurst > Schedule(uint16_t availableSymbols, WimaxPhy::ModulationType modulationType, MacHeaderType::HeaderType packetType, Ptr< WimaxConnection > &connection)
static TypeId GetTypeId()
Get the type ID.
Ptr< SubscriberStationNetDevice > m_ss
the subscriber station
void SetPollMe(bool pollMe)
Set poll me value.
Ptr< WimaxConnection > SelectConnection()
Select connection.
bool GetPollMe() const
Get the poll me value.
static Time Now()
Return the current simulation virtual time.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
ModulationType
ModulationType enumeration.
#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_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Every class exported by the ns3 library is enclosed in the ns3 namespace.