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, "
171 NS_LOG_INFO(
"SS Scheduler: Selecting connection...");
172 if (
m_ss->GetInitialRangingConnection()->HasPackets())
175 return m_ss->GetInitialRangingConnection();
177 if (
m_ss->GetBasicConnection()->HasPackets())
180 return m_ss->GetBasicConnection();
182 if (
m_ss->GetPrimaryConnection()->HasPackets())
185 return m_ss->GetPrimaryConnection();
189 for (
auto iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
193 if ((*iter)->HasPackets() && (currentTime +
m_ss->GetPhy()->GetFrameDuration() >
196 NS_LOG_INFO(
"Return UGS SF: CID = " << (*iter)->GetCid()
197 <<
"SFID = " << (*iter)->GetSfid());
198 return (*iter)->GetConnection();
207 for (
auto iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
210 (currentTime +
m_ss->GetPhy()->GetFrameDuration() >
211 MilliSeconds((*iter)->GetUnsolicitedPollingInterval())))
213 NS_LOG_INFO(
"Return RTPS 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 NRTPS SF: CID = " << (*iter)->GetCid()
225 <<
"SFID = " << (*iter)->GetSfid());
226 return (*iter)->GetConnection();
231 for (
auto iter = serviceFlows.begin(); iter != serviceFlows.end(); ++iter)
235 NS_LOG_INFO(
"Return BE SF: CID = " << (*iter)->GetCid()
236 <<
"SFID = " << (*iter)->GetSfid());
237 return (*iter)->GetConnection();
241 if (
m_ss->GetBroadcastConnection()->HasPackets())
243 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.