MultiTokenBucketMeter

Package: inet.queueing.meter

MultiTokenBucketMeter

simple module

This module labels packets according to the first token bucket that contains the required number of tokens. If no such token bucket is found then the default label is attached to the packet.

Inheritance diagram

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

Known subclasses

Name Type Description
DualRateThreeColorMeter simple module

This packet meter module measures the packet flow that is passing through using two token buckets. The meter attaches a LabelsTag to each packet with either green, yellow or red color depending on which token bucket contains the required number of tokens for the packet.

SingleRateThreeColorMeter simple module

This packet meter module measures the packet flow that is passing through using two token buckets. The meter attaches a LabelsTag to each packet with either green, yellow or red color depending on which token bucket contains the required number of tokens for the packet.

Extends

Name Type Description
PacketMeterBase simple module

This is a base module for various packet meter modules. Derived modules must implement a single meterPacket() function which meters the flow of and attaches the required tags.

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

buckets object

array of objects specifying the token buckets, see TokenBucketMeter(1,2) for parameters example: [{initialNumTokens: 100, maxNumTokens: 1000, tokenProductionRate: 10, label: "green", excessTokenModule: ".other"}]

tokenConsumptionPerPacket double 0

how many tokens are consumed per packet

tokenConsumptionPerBit double 1

how many tokens are consumed per bit

defaultLabel string ""

the label that is attached to packets if there are not enouth tokens in the bucket, no label by default

labelPriority object []

the list of labels in the order of priority, if specified packets can only be promoted in this order

Properties

Name Value Description
display i=block/star
class MultiTokenBucketMeter

Gates

Name Direction Size Description
in input
out output

Signals

Name Type Unit
tokensChanged double

Statistics

Name Title Source Record Unit Interpolation Mode
numTokens number of tokens tokensChanged vector tk linear

Source code

//
// This module labels packets according to the first token bucket that contains
// the required number of tokens. If no such token bucket is found then the
// default label is attached to the packet.
//
simple MultiTokenBucketMeter extends PacketMeterBase like IPacketMeter
{
    parameters:
        object buckets; // array of objects specifying the token buckets, see ~TokenBucketMeter for parameters
                        // example: [{initialNumTokens: 100, maxNumTokens: 1000, tokenProductionRate: 10, label: "green", excessTokenModule: ".other"}]
        double tokenConsumptionPerPacket = default(0); // how many tokens are consumed per packet
        double tokenConsumptionPerBit = default(1); // how many tokens are consumed per bit
        string defaultLabel = default(""); // the label that is attached to packets if there are not enouth tokens in the bucket, no label by default
        object labelPriority = default([]); // the list of labels in the order of priority, if specified packets can only be promoted in this order
        displayStringTextFormat = default("contains %n tk\nmetered %p pk (%l)");
        @signal[tokensChanged](type=double);
        @statistic[numTokens](title="number of tokens"; source=tokensChanged; record=vector; unit=tk; interpolationmode=linear);
        @class(MultiTokenBucketMeter);
}
File: src/inet/queueing/meter/MultiTokenBucketMeter.ned