25#include "ns3/packet-burst.h" 
   26#include "ns3/simulator.h" 
   40                            .SetGroupName(
"Wimax")
 
 
   61    std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst>>>* downlinkBursts = 
m_downlinkBursts;
 
   62    std::pair<OfdmDlMapIe*, Ptr<PacketBurst>> pair;
 
   63    while (!downlinkBursts->empty())
 
   65        pair = downlinkBursts->front();
 
   66        pair.second = 
nullptr;
 
 
   74std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst>>>*
 
   87    dlMapIe->SetCid(connection->GetCid());
 
   88    dlMapIe->SetDiuc(diuc);
 
   90    NS_LOG_INFO(
"BS scheduler, burst size: " << burst->GetSize() << 
" bytes" 
   91                                             << 
", pkts: " << burst->GetNPackets()
 
   92                                             << 
", connection: " << connection->GetTypeStr()
 
   93                                             << 
", CID: " << connection->GetCid());
 
   96        NS_LOG_INFO(
", SFID: " << connection->GetServiceFlow()->GetSfid() << 
", service: " 
   97                               << connection->GetServiceFlow()->GetSchedulingTypeStr());
 
 
  119        if (connection != 
GetBs()->GetInitialRangingConnection() &&
 
  120            connection != 
GetBs()->GetBroadcastConnection())
 
  126                modulationType = connection->GetServiceFlow()->GetModulation();
 
  131                    GetBs()->GetSSManager()->GetSSRecord(connection->GetCid())->GetModulationType();
 
  133            diuc = 
GetBs()->GetBurstProfileManager()->GetBurstProfile(
 
  137        else if (connection == 
GetBs()->GetInitialRangingConnection() ||
 
  138                 connection == 
GetBs()->GetBroadcastConnection())
 
  151            nrSymbolsRequired = connection->GetServiceFlow()->GetRecord()->GetGrantSize();
 
  152            if (nrSymbolsRequired < availableSymbols)
 
  155                    CreateUgsBurst(connection->GetServiceFlow(), modulationType, nrSymbolsRequired);
 
  160                    CreateUgsBurst(connection->GetServiceFlow(), modulationType, availableSymbols);
 
  162            if (burst->GetNPackets() != 0)
 
  165                    GetBs()->GetPhy()->GetNrSymbols(burst->GetSize(), modulationType);
 
  168                if (availableSymbols <= BurstSizeSymbols)
 
  179            while (connection->HasPackets())
 
  181                uint32_t FirstPacketSize = connection->GetQueue()->GetFirstPacketRequiredByte(
 
  184                    GetBs()->GetPhy()->GetNrSymbols(FirstPacketSize, modulationType);
 
  185                if (availableSymbols < nrSymbolsRequired &&
 
  189                        GetBs()->GetPhy()->GetNrBytes(availableSymbols, modulationType);
 
  191                    availableSymbols = 0;
 
  193                else if (availableSymbols >= nrSymbolsRequired)
 
  195                    packet = connection->Dequeue();
 
  196                    availableSymbols -= nrSymbolsRequired;
 
  202                burst->AddPacket(packet);
 
  206        if (availableSymbols == 0)
 
  215            "BS scheduler, number of bursts: " 
  216            << 
m_downlinkBursts->size() << 
", symbols left: " << availableSymbols << std::endl
 
  217            << 
"BS scheduler, queues:" 
  218            << 
" IR " << 
GetBs()->GetInitialRangingConnection()->GetQueue()->
GetSize()
 
  219            << 
" broadcast " << 
GetBs()->GetBroadcastConnection()->GetQueue()->
GetSize()
 
 
  233    connection = 
nullptr;
 
  236    NS_LOG_INFO(
"BS Scheduler: Selecting connection...");
 
  237    if (
GetBs()->GetBroadcastConnection()->HasPackets())
 
  240        connection = 
GetBs()->GetBroadcastConnection();
 
  243    else if (
GetBs()->GetInitialRangingConnection()->HasPackets())
 
  246        connection = 
GetBs()->GetInitialRangingConnection();
 
  251        std::vector<Ptr<WimaxConnection>> connections;
 
  252        std::vector<ServiceFlow*> serviceFlows;
 
  254        connections = 
GetBs()->GetConnectionManager()->GetConnections(
Cid::BASIC);
 
  255        for (
auto iter1 = connections.begin(); iter1 != connections.end(); ++iter1)
 
  257            if ((*iter1)->HasPackets())
 
  266        for (
auto iter1 = connections.begin(); iter1 != connections.end(); ++iter1)
 
  268            if ((*iter1)->HasPackets())
 
  277        for (
auto iter2 = serviceFlows.begin(); iter2 != serviceFlows.end(); ++iter2)
 
  279            serviceFlowRecord = (*iter2)->GetRecord();
 
  281                        << (*iter2)->HasPackets() << 
"max Latency = " 
  282                        << 
MilliSeconds((*iter2)->GetMaximumLatency()) << 
"Delay = " 
  284                            GetBs()->GetPhy()->GetFrameDuration()));
 
  287            if ((*iter2)->HasPackets() && ((currentTime - serviceFlowRecord->
GetDlTimeStamp()) +
 
  288                                           GetBs()->GetPhy()->GetFrameDuration()) >
 
  292                connection = (*iter2)->GetConnection();
 
  293                NS_LOG_INFO(
"Return UGS SF: CID = " << (*iter2)->GetCid()
 
  294                                                    << 
"SFID = " << (*iter2)->GetSfid());
 
  300        for (
auto iter2 = serviceFlows.begin(); iter2 != serviceFlows.end(); ++iter2)
 
  302            serviceFlowRecord = (*iter2)->GetRecord();
 
  305            if ((*iter2)->HasPackets() && ((currentTime - serviceFlowRecord->
GetDlTimeStamp()) +
 
  306                                           GetBs()->GetPhy()->GetFrameDuration()) >
 
  310                connection = (*iter2)->GetConnection();
 
  311                NS_LOG_INFO(
"Return RTPS SF: CID = " << (*iter2)->GetCid()
 
  312                                                     << 
"SFID = " << (*iter2)->GetSfid());
 
  319        for (
auto iter2 = serviceFlows.begin(); iter2 != serviceFlows.end(); ++iter2)
 
  322            if ((*iter2)->HasPackets())
 
  324                NS_LOG_INFO(
"Return NRTPS SF: CID = " << (*iter2)->GetCid()
 
  325                                                      << 
"SFID = " << (*iter2)->GetSfid());
 
  326                connection = (*iter2)->GetConnection();
 
  332        for (
auto iter2 = serviceFlows.begin(); iter2 != serviceFlows.end(); ++iter2)
 
  335            if ((*iter2)->HasPackets())
 
  337                NS_LOG_INFO(
"Return BE SF: CID = " << (*iter2)->GetCid()
 
  338                                                   << 
"SFID = " << (*iter2)->GetSfid());
 
  339                connection = (*iter2)->GetConnection();
 
 
  365        nrSymbolsRequired = 
GetBs()->GetPhy()->GetNrSymbols(FirstPacketSize, modulationType);
 
  366        if (availableSymbols < nrSymbolsRequired &&
 
  370                GetBs()->GetPhy()->GetNrBytes(availableSymbols, modulationType);
 
  372            availableSymbols = 0;
 
  376            packet = connection->Dequeue();
 
  377            availableSymbols -= nrSymbolsRequired;
 
  379        burst->AddPacket(packet);
 
  380        if (availableSymbols <= 0)
 
 
virtual Ptr< BaseStationNetDevice > GetBs()
Get the base station.
virtual void SetBs(Ptr< BaseStationNetDevice > bs)
Set the base station.
bool CheckForFragmentation(Ptr< WimaxConnection > connection, int availableSymbols, WimaxPhy::ModulationType modulationType)
Check if the packet fragmentation is possible for transport connection.
BaseStation Scheduler - simplified.
~BSSchedulerSimple() override
std::list< std::pair< OfdmDlMapIe *, Ptr< PacketBurst > > > * GetDownlinkBursts() const override
This function returns all the downlink bursts scheduled for the next downlink sub-frame.
void AddDownlinkBurst(Ptr< const WimaxConnection > connection, uint8_t diuc, WimaxPhy::ModulationType modulationType, Ptr< PacketBurst > burst) override
This function adds a downlink burst to the list of downlink bursts scheduled for the next downlink su...
std::list< std::pair< OfdmDlMapIe *, Ptr< PacketBurst > > > * m_downlinkBursts
down link bursts
static TypeId GetTypeId()
Get the type ID.
void Schedule() override
the scheduling function for the downlink subframe.
Ptr< PacketBurst > CreateUgsBurst(ServiceFlow *serviceFlow, WimaxPhy::ModulationType modulationType, uint32_t availableSymbols) override
Creates a downlink UGS burst.
bool SelectConnection(Ptr< WimaxConnection > &connection) override
Selects a connection from the list of connections having packets to be sent .
This class implements the OFDM DL-MAP information element as described by "IEEE Standard forLocal and...
this class implement a burst as a list of packets
Smart pointer class similar to boost::intrusive_ptr.
This class implements service flows as described by the IEEE-802.16 standard.
SchedulingType
section 11.13.11 Service flow scheduling type, page 701
bool HasPackets() const
Check if packets are present.
Ptr< WimaxConnection > GetConnection() const
Can return a null connection is this service flow has not been associated yet to a connection.
this class implements a structure to manage some parameters and statistics related to a service flow
void SetDlTimeStamp(Time dlTimeStamp)
Set the DlTimeStamp.
Time GetDlTimeStamp() const
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.
@ MODULATION_TYPE_BPSK_12
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#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.
uint32_t GetSize(Ptr< const Packet > packet, const WifiMacHeader *hdr, bool isAmpdu)
Return the total size of the packet after WifiMacHeader and FCS trailer have been added.