QueueBasedTokenGenerator

Package: inet.queueing.tokengenerator

QueueBasedTokenGenerator

simple module

C++ definition

Generates tokens for a ~TokenBasedServer based on the observed state changes of a packet queue. Its primary purpose is to allow applications to produce traffic which completely utilizes a network interface. This is achieved by generating tokens whenever the observed packet queue becomes empty.

Available display string text format directives: %p - number of processed packets %l - processed total packet length %t - number of generated tokens

Inheritance diagram

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

Used in

Name Type Description
QueueBasedTokenGeneratorTutorialStep network (no description)

Extends

Name Type Description
TokenGeneratorBase simple module

Base module for various token generator modules.

Parameters

Name Type Default value Description
displayStringTextFormat string "generated %t tk\nto %s"

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

storageModule string

Module path of the token storage where the tokens are generated via C++ method call

queueModule string

Module path of the observed packet queue

minNumPackets int 1
minTotalLength int 0 b
numTokens double 1

Number of tokens generated when the queue becomes empty

Properties

Name Value Description
class QueueBasedTokenGenerator
display i=block/control

Signals

Name Type Unit Description
tokensCreated double

Statistics

Name Title Source Record Unit Interpolation Mode Description
tokensCreated tokens created count(tokensCreated) count tk

the statistical value is the number of times tokens were created

numTokensCreated number of created tokens tokensCreated sum, vector tk none

the statistical value is the number of created tokens

Source code

//
// Generates tokens for a ~TokenBasedServer based on the observed state
// changes of a packet queue. Its primary purpose is to allow applications to
// produce traffic which completely utilizes a network interface. This is achieved
// by generating tokens whenever the observed packet queue becomes empty.
//
// Available display string text format directives:
//  %p - number of processed packets
//  %l - processed total packet length
//  %t - number of generated tokens
//
simple QueueBasedTokenGenerator extends TokenGeneratorBase like ITokenGenerator
{
    parameters:
        string queueModule; // Module path of the observed packet queue
        int minNumPackets = default(1);
        int minTotalLength @unit(b) = default(0 b);
        volatile double numTokens = default(1); // Number of tokens generated when the queue becomes empty
        @class(QueueBasedTokenGenerator);
        @display("i=block/control");
}
File: src/inet/queueing/tokengenerator/QueueBasedTokenGenerator.ned