SingleRateThreeColorMeter

Package: inet.queueing.meter

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.

The first token bucket is filled with tokens using the committed information rate. The maximum number of tokens is determined by the committed burst size. Excess tokens from the first token bucket overflow into the second token bucket.

By default, packets consume 1 token per byte.

See also: SingleRateTwoColorMeter, DualRateThreeColorMeter

See also: SingleRateTwoColorClassifier, SingleRateThreeColorClassifier, DualRateThreeColorClassifier

Inheritance diagram

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

Extends

Name Type Description
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.

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 [{initialNumTokens: dropUnit(committedBurstSize) / bitsPerToken, maxNumTokens: dropUnit(committedBurstSize) / bitsPerToken, tokenProductionRate: dropUnit(committedInformationRate) / bitsPerToken, label: "green"}, {initialNumTokens: dropUnit(excessBurstSize) / bitsPerToken, maxNumTokens: dropUnit(excessBurstSize) / bitsPerToken, tokenProductionRate: 0, label: "yellow"}]

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 / bitsPerToken

how many tokens are consumed per bit

defaultLabel string "red"

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

labelPriority object colorAware ? ["green", "yellow", "red"] : []

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

committedInformationRate double

committed information rate

committedBurstSize int

committed burst size

excessBurstSize int

excess burst size

bitsPerToken int 8

how many bits are represented by 1 token

colorAware bool false

enables color-aware mode where packets can only be demoted

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 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.
//
// The first token bucket is filled with tokens using the committed information
// rate. The maximum number of tokens is determined by the committed burst size.
// Excess tokens from the first token bucket overflow into the second token bucket.
//
// By default, packets consume 1 token per byte.
//
// @see ~SingleRateTwoColorMeter, ~DualRateThreeColorMeter
// @see ~SingleRateTwoColorClassifier, ~SingleRateThreeColorClassifier, ~DualRateThreeColorClassifier
//
simple SingleRateThreeColorMeter extends MultiTokenBucketMeter
{
    parameters:
        double committedInformationRate @unit(bps); // committed information rate
        int committedBurstSize @unit(b); // committed burst size
        int excessBurstSize @unit(b); // excess burst size
        int bitsPerToken = default(8); // how many bits are represented by 1 token
        bool colorAware = default(false); // enables color-aware mode where packets can only be demoted
        buckets = [{initialNumTokens: dropUnit(committedBurstSize) / bitsPerToken, maxNumTokens: dropUnit(committedBurstSize) / bitsPerToken, tokenProductionRate: dropUnit(committedInformationRate) / bitsPerToken, label: "green"},
                   {initialNumTokens: dropUnit(excessBurstSize) / bitsPerToken, maxNumTokens: dropUnit(excessBurstSize) / bitsPerToken, tokenProductionRate: 0, label: "yellow"}];
        tokenConsumptionPerBit = 1 / bitsPerToken;
        defaultLabel = default("red");
        labelPriority = default(colorAware ? ["green", "yellow", "red"] : []);
}
File: src/inet/queueing/meter/SingleRateThreeColorMeter.ned