SingleRateTwoColorClassifier

Package: inet.queueing.classifier

SingleRateTwoColorClassifier

simple module

This packet classifier module classifies packets using one token bucket. Each packet is classified depending on whether the token bucket contains the required number of tokens for the packet.

The token bucket is filled with tokens using the committed information rate. The maximum number of tokens is determined by the committed burst size.

By default, packets consume 1 token per byte.

See also: SingleRateTwoColorMeter, SingleRateThreeColorMeter(1,2), DualRateThreeColorMeter

See also: SingleRateThreeColorClassifier, DualRateThreeColorClassifier

Inheritance diagram

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

Extends

Name Type Description
TokenBucketClassifier simple module

This module classifies packets to the first output gate if the bucket contains enough number of tokens for the packet passing through, otherwise the second output gate is used. The amount of required tokens is equal to the packet length in bits and is subtracted from the number of stored tokens. New tokens are generated with the provided constant rate and they may also be added by other modules.

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

reverseOrder bool false
initialNumTokens double maxNumTokens

initial number of tokens

maxNumTokens double dropUnit(committedBurstSize) / bitsPerToken

maximum number of tokens

tokenProductionRate double dropUnit(committedInformationRate) / bitsPerToken
tokenConsumptionPerPacket double 0

how many tokens are consumed per packet

tokenConsumptionPerBit double 1 / bitsPerToken

how many tokens are consumed per bit

excessTokenModule string ""

specifies the module (ITokenConsumer) that receives the excess tokens that are produced by this module

committedInformationRate double

committed information rate

committedBurstSize int

committed burst size

bitsPerToken int 8

how many bits are represented by 1 token

Properties

Name Value Description
display i=block/classifier
class TokenBucketClassifier

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 classifier module classifies packets using one token bucket. Each
// packet is classified depending on whether the token bucket contains the required
// number of tokens for the packet.
//
// The token bucket is filled with tokens using the committed information rate.
// The maximum number of tokens is determined by the committed burst size.
//
// By default, packets consume 1 token per byte.
//
// @see ~SingleRateTwoColorMeter, ~SingleRateThreeColorMeter, ~DualRateThreeColorMeter
// @see ~SingleRateThreeColorClassifier, ~DualRateThreeColorClassifier
//
simple SingleRateTwoColorClassifier extends TokenBucketClassifier
{
    parameters:
        double committedInformationRate @unit(bps); // committed information rate
        int committedBurstSize @unit(b); // committed burst size
        int bitsPerToken = default(8); // how many bits are represented by 1 token
        initialNumTokens = default(maxNumTokens);
        maxNumTokens = dropUnit(committedBurstSize) / bitsPerToken;
        tokenProductionRate = dropUnit(committedInformationRate) / bitsPerToken;
        tokenConsumptionPerBit = 1 / bitsPerToken;
}
File: src/inet/queueing/classifier/SingleRateTwoColorClassifier.ned