MultiTokenBucketClassifier

Package: inet.queueing.classifier

simple module MultiTokenBucketClassifier

Classifies packets into the first bucket that contains the required number of tokens. The packet is forwarded to the output gate that corresponds to the selected bucket.

inet.queueing.classifier.MultiTokenBucketClassifierMultiTokenBucketClassifiersimple

Inheritance diagram

Known subclasses

Name

Type

Description

DualRateThreeColorClassifier

simple module

This packet classifier module classifies packets using two token buckets. Each packet is classified depending on which token bucket is the first one that contains the required number of tokens for the packet.

SingleRateThreeColorClassifier

simple module

This packet classifier module classifies packets using two token buckets. Each packet is classified depending on which token bucket is the first one that contains the required number of tokens for the packet.

Extends

Name

Type

Description

PacketClassifierBase

simple module

Base module for various packet classifier modules. Derived modules must implement a single packet classifier function which determines the index of the output gate for the next pushed packet.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“contains %n tk\nmetered %p pk (%l)”

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

reverseOrder

bool

false

buckets

object

Array of objects specifying the token buckets

tokenConsumptionPerPacket

double

0

How many tokens are consumed per packet

tokenConsumptionPerBit

double

1

How many tokens are consumed per bit

Properties

Name

Value

Description

class

MultiTokenBucketClassifier

display

i=block/classifier

Gates

Name

Direction

Size

Description

in

input

out [ ]

output

Signals

Name

Type

Unit

Description

packetPushed

inet::Packet

tokensChanged

double

Statistics

Name

Title

Source

Record

Unit

Interpolation Mode

Description

dataRate

data rate

throughput(packetPushed)

vector

bps

linear

the statistical value is the data rate of the classified packets

numTokens

number of tokens

demux(tokensChanged)

vector

tk

linear

packetLengths

packet lengths

packetLength(packetPushed)

sum,histogram,vector

b

none

the statistical value is the length of the classified packet

packets

packets

packetPushed

count

pk

the statistical value is the classified packet

Source code

//
// Classifies packets into the first bucket that contains the required
// number of tokens. The packet is forwarded to the output gate that corresponds to
// the selected bucket.
//
simple MultiTokenBucketClassifier extends PacketClassifierBase like IPacketClassifier
{
    parameters:
        object buckets; // Array of objects specifying the token buckets
                        // example: [{initialNumTokens: 100, maxNumTokens: 1000, tokenProductionRate: 10, excessTokenModule: ".other"}]
        double tokenConsumptionPerPacket = default(0); // How many tokens are consumed per packet
        double tokenConsumptionPerBit = default(1); // How many tokens are consumed per bit
        displayStringTextFormat = default("contains %n tk\nmetered %p pk (%l)");
        @signal[tokensChanged](type=double);
        @statistic[numTokens](title="number of tokens"; source=demux(tokensChanged); record=vector; unit=tk; interpolationmode=linear);
        @class(MultiTokenBucketClassifier);
}

File: src/inet/queueing/classifier/MultiTokenBucketClassifier.ned