QueueBasedTokenGenerator

Package: inet.queueing.tokengenerator

simple module QueueBasedTokenGenerator

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

inet.queueing.tokengenerator.QueueBasedTokenGeneratorQueueBasedTokenGeneratorsimple

Usage diagram

Inheritance diagram

Used in compound modules

Name

Type

Description

QueueFiller

compound module

Produces packets in order to prevent a queue from becoming empty.

Extends

Name

Type

Description

TokenGeneratorBase

simple module

Base module for various token generator modules.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“generated {numTokensGenerated} tk\nto {storageModule}”

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

numTokensCreated

number of created tokens

tokensCreated

sum,vector

tk

none

the statistical value is the number of created tokens

tokensCreated

tokens created

count(tokensCreated)

count

tk

the statistical value is the number of times tokens were created

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