PriorityQueue

Package: inet.queueing.queue

PriorityQueue

compound module

Implements a priority queue with multiple inner queues and an optional shared memory buffer.

buffer : like IPacketBuffer

IPacketBuffer: Interface for packet buffer modules.

Source:
buffer: <default("")> like IPacketBuffer if typename != "" {
    parameters:
        @display("p=100,225");
} classifier : like IPacketClassifier

PacketClassifier: Connects one packet producer to multiple packet consumers.

IPacketClassifier: Interface for packet classifier modules.

Source:
classifier: <default("PacketClassifier")> like IPacketClassifier {
    parameters:
        @display("p=100,100");
} queue[numQueues] : like IPacketQueue

PacketQueue: Implements a configurable packet queue, which is suitable for use in MAC protocols, traffic...

IPacketQueue: Interface for packet queue modules.

Source:
queue[numQueues]: <default("PacketQueue")> like IPacketQueue {
    parameters:
        bufferModule = default(exists(parent.buffer) ? "^.buffer" : "");
        @display("p=300,100,column,125");
} scheduler : like IPacketScheduler

PriorityScheduler: This scheduler pulls packets from the first non-empty among its connected packet providers.

IPacketScheduler: Interface for packet scheduler modules.

Source:
scheduler: <default("PriorityScheduler")> like IPacketScheduler {
    parameters:
        @display("p=500,100");
}

Usage diagram

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Used in

Name Type Description
PriorityQueueTutorialStep network (no description)

Known subclasses

Name Type Description
EthernetPriorityQueue compound module (no description)

Extends

Name Type Description
CompoundPacketQueueBase compound module

This compound module serves as a base module for complex packet queues formed by combining several queueing components.

Parameters

Name Type Default value Description
displayStringTextFormat string "contains %p pk (%l) pushed %u created %c\n pulled %o removed %r dropped %d"

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

packetCapacity int -1

Maximum number of packets in the queue, no limit by default

dataCapacity int -1b

Maximum total length of packets in the queue, no limit by default

dropperClass string ""

Determines which packets are dropped when the queue is overloaded, packets are not dropped by default; the parameter must be the name of a C++ class which implements the IPacketDropperFunction C++ interface and is registered via Register_Class

numQueues int

Properties

Name Value Description
class CompoundPacketQueueBase
display i=block/queue
defaultStatistic queueLength:vector

Gates

Name Direction Size Description
in input
out output

Signals

Name Type Unit Description
packetRemoved inet::Packet
packetPushStarted inet::Packet
packetDropped inet::Packet
packetPushEnded inet::Packet?
packetPulled inet::Packet

Statistics

Name Title Source Record Unit Interpolation Mode Description
queueBitLength queue bit length warmup(atomic(constant0(localSignal(packetPushEnded)) + sum(packetLength(localSignal(packetPushStarted))) - sum(packetLength(localSignal(packetPulled))) - sum(packetLength(localSignal(packetRemoved))) - sum(packetLength(localSignal(packetDropped))))) last, max, timeavg, vector b sample-hold

the statistical value is the total bit length of all packets in the queue

queueLength queue length warmup(atomic(constant0(localSignal(packetPushEnded)) + count(localSignal(packetPushStarted)) - count(localSignal(packetPulled)) - count(localSignal(packetRemoved)) - count(localSignal(packetDropped)))) last, max, timeavg, vector pk sample-hold

the statistical value is the number of packets in the queue

droppedPacketsQueueOverflow dropped packets: queue overflow packetDropReasonIsQueueOverflow(localSignal(packetDropped)) count pk none

the statistical value is the packet that is dropped due to queue overflow

queueingTime queueing times queueingTime(localSignal(packetPulled)) histogram, vector s none

the statistical value is the queueing time of packets

incomingDataRate incoming datarate throughput(localSignal(packetPushStarted)) vector bps linear

the statistical value is the data rate of the incoming packets

flowQueueingTime flow queueing times queueingTime(demuxFlow(localSignal(packetPulled))) histogram, vector s none

the statistical value is the flow specific queueing time of packets

incomingPacketLengths incoming packet lengths packetLength(localSignal(packetPushStarted)) sum, histogram, vector b none

the statistical value is the length of the incoming packet

flowIncomingDataRate flow specific incoming data rate throughput(flowPacketLength(demuxFlow(localSignal(packetPushStarted)))) vector bps linear

the statistical value is the flow specific data rate of the incoming packets

outgoingDataRate outgoing datarate throughput(localSignal(packetPulled)) vector bps linear

the statistical value is the data rate of the outgoing packets

outgoingPacketLengths outgoing packet lengths packetLength(localSignal(packetPulled)) sum, histogram, vector b none

the statistical value is the length of the outgoing packet

droppedPacketLengthsQueueOverflow dropped packet lengths: queue overflow packetLength(packetDropReasonIsQueueOverflow(localSignal(packetDropped))) sum, vector b none

the statistical value is the length of the packet that is dropped due to queue overflow

flowOutgoingDataRate flow specific outgoing data rate throughput(flowPacketLength(demuxFlow(localSignal(packetPulled)))) vector bps linear

the statistical value is the flow specific data rate of the outgoing packets

incomingPackets incoming packets localSignal(packetPushStarted) count pk

the statistical value is the incoming packet

outgoingPackets outgoing packets localSignal(packetPulled) count pk

the statistical value is the outgoing packet

Source code

//
// Implements a priority queue with multiple inner queues and an
// optional shared memory buffer.
//
module PriorityQueue extends CompoundPacketQueueBase
{
    parameters:
        int numQueues;
    submodules:
        buffer: <default("")> like IPacketBuffer if typename != "" {
            parameters:
                @display("p=100,225");
        }
        classifier: <default("PacketClassifier")> like IPacketClassifier {
            parameters:
                @display("p=100,100");
        }
        queue[numQueues]: <default("PacketQueue")> like IPacketQueue {
            parameters:
                bufferModule = default(exists(parent.buffer) ? "^.buffer" : "");
                @display("p=300,100,column,125");
        }
        scheduler: <default("PriorityScheduler")> like IPacketScheduler {
            parameters:
                @display("p=500,100");
        }
    connections:
        in --> { @display("m=w"); } --> classifier.in;
        for i=0..sizeof(queue)-1 {
            classifier.out++ --> queue[i].in;
            queue[i].out --> scheduler.in++;
        }
        scheduler.out --> { @display("m=e"); } --> out;
}

File: src/inet/queueing/queue/PriorityQueue.ned