QueueBasedTokenGenerator

Package: inet.queueing.tokengenerator

QueueBasedTokenGenerator

simple module

This module generates tokens for a TokenBasedServer based on the observed state changes of a packet queue. It's 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 compound modules

Name Type Description
QueueFiller compound module

This module produces packets in order to prevent a queue from becoming empty.

Extends

Name Type Description
TokenGeneratorBase simple module

This is a 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

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
display i=block/control
class QueueBasedTokenGenerator

Signals

Name Type Unit
tokensCreated double

Statistics

Name Title Source Record Unit Interpolation Mode
tokensCreated tokens created count(tokensCreated) count tk
numTokensCreated number of created tokens tokensCreated sum, vector tk none

Direct method calls (observed)

call tofunctioninfo
TokenBasedServerinet::queueing::TokenBasedServer::addTokensaddTokens
QueueBasedTokenGeneratorinet::queueing::QueueBasedTokenGenerator::receiveSignalpacketPulled

Called methods (observed)

functioninfocall from
inet::queueing::QueueBasedTokenGenerator::receiveSignalpacketPulledPacketQueue, QueueBasedTokenGenerator

Source code

//
// This module generates tokens for a ~TokenBasedServer based on the observed state
// changes of a packet queue. It's 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
{
    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