22#include "ns3/simulator.h"
74 uint16_t nrSymbolsRequired = 0;
83 "SS: Error while scheduling packets: The selected connection has no packets");
88 while (connection && connection->HasPackets(packetType))
90 NS_LOG_INFO(
"FRAG_DEBUG: SS Scheduler" << std::endl);
92 uint32_t availableByte =
m_ss->GetPhy()->GetNrBytes(availableSymbols, modulationType);
94 uint32_t requiredByte = connection->GetQueue()->GetFirstPacketRequiredByte(packetType);
96 NS_LOG_INFO(
"\t availableByte = " << availableByte <<
", requiredByte = " << requiredByte);
98 if (availableByte >= requiredByte)
102 "\n\t Send packet without other fragmentation"
105 packet = connection->Dequeue(packetType);
106 burst->AddPacket(packet);
108 nrSymbolsRequired =
m_ss->GetPhy()->GetNrSymbols(packet->GetSize(), modulationType);
109 availableSymbols -= nrSymbolsRequired;
116 "\n\t Check if the fragmentation is possible");
118 uint32_t headerSize = connection->GetQueue()->GetFirstPacketHdrSize(packetType);
119 if (!connection->GetQueue()->CheckForFragmentation(packetType))
125 <<
" headerSize = " << headerSize);
127 if (availableByte > headerSize)
130 packet = connection->Dequeue(packetType, availableByte);
131 burst->AddPacket(packet);
134 m_ss->GetPhy()->GetNrSymbols(packet->GetSize(), modulationType);
135 availableSymbols -= nrSymbolsRequired;
139 NS_LOG_INFO(
"\t Fragmentation IS NOT possible" << std::endl);
146 "\n\t Fragmentation IS NOT possible, "
160 NS_LOG_INFO(
"SS Scheduler: Selecting connection...");
161 if (
m_ss->GetInitialRangingConnection()->HasPackets())
164 return m_ss->GetInitialRangingConnection();
166 if (
m_ss->GetBasicConnection()->HasPackets())
169 return m_ss->GetBasicConnection();
171 if (
m_ss->GetPrimaryConnection()->HasPackets())
174 return m_ss->GetPrimaryConnection();
178 for (
auto iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
182 if ((*iter)->HasPackets() && (currentTime +
m_ss->GetPhy()->GetFrameDuration() >
185 NS_LOG_INFO(
"Return UGS SF: CID = " << (*iter)->GetCid()
186 <<
"SFID = " << (*iter)->GetSfid());
187 return (*iter)->GetConnection();
196 for (
auto iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
199 (currentTime +
m_ss->GetPhy()->GetFrameDuration() >
200 MilliSeconds((*iter)->GetUnsolicitedPollingInterval())))
202 NS_LOG_INFO(
"Return RTPS SF: CID = " << (*iter)->GetCid()
203 <<
"SFID = " << (*iter)->GetSfid());
204 return (*iter)->GetConnection();
209 for (
auto iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
213 NS_LOG_INFO(
"Return NRTPS SF: CID = " << (*iter)->GetCid()
214 <<
"SFID = " << (*iter)->GetSfid());
215 return (*iter)->GetConnection();
220 for (
auto iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
224 NS_LOG_INFO(
"Return BE SF: CID = " << (*iter)->GetCid()
225 <<
"SFID = " << (*iter)->GetSfid());
226 return (*iter)->GetConnection();
230 if (
m_ss->GetBroadcastConnection()->HasPackets())
232 return m_ss->GetBroadcastConnection();
A base class which provides memory management and object aggregation.
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.
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
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.