TokenBasedServer

Package: inet.queueing.server

TokenBasedServer

simple module

This module repeatedly pops packets from the connected packet provider and it pushes them into the connected packet consumer. The packets are processed in zero simulation time, and the process continues until the available number of tokens is not sufficient anymore.

TokenBasedServer

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
ResponseProducer compound module

This module is capable of generating several different streams of packets, one after the other. For each traffic category, the packets are produced by a separate token based server. The traffic stream can be started by adding tokens the corresponding server module. The packet data, packet length, and timing distributions can be configured in the corresponding packet provider.

Extends

Name Type Description
PacketServerBase simple module

This is a base module for various packet server modules.

Parameters

Name Type Default value Description
displayStringTextFormat string "contains %n tk\nserved %p pk (%l)"

determines the text that is written on top of the submodule

initialNumTokens double 0

initial number of tokens

maxNumTokens double nan

maximum number of tokens

tokenConsumptionPerPacket double 1

how many tokens are consumed per processed packet

tokenConsumptionPerBit double 0

how may tokens are consumed per processed bit

Properties

Name Value Description
display i=block/server
class TokenBasedServer

Gates

Name Direction Size Description
in input
out output

Signals

Name Type Unit
tokensAdded double
tokensRemoved double
tokensDepleted double

Statistics

Name Title Source Record Unit Interpolation Mode
tokensAdded tokens added sum none
tokensRemoved tokens removed sum none
tokensDepleted tokens depleted count none

Source code

//
// This module repeatedly pops packets from the connected packet provider and
// it pushes them into the connected packet consumer. The packets are processed
// in zero simulation time, and the process continues until the available number
// of tokens is not sufficient anymore.
//
simple TokenBasedServer extends PacketServerBase like IPacketServer
{
    parameters:
        double initialNumTokens = default(0); // initial number of tokens
        double maxNumTokens = default(nan); // maximum number of tokens
        volatile double tokenConsumptionPerPacket = default(1); // how many tokens are consumed per processed packet
        volatile double tokenConsumptionPerBit = default(0); // how may tokens are consumed per processed bit
        displayStringTextFormat = default("contains %n tk\nserved %p pk (%l)"); // determines display string text above the submodule
        @signal[tokensAdded](type=double);
        @signal[tokensRemoved](type=double);
        @signal[tokensDepleted](type=double);
        @statistic[tokensAdded](title="tokens added"; record=sum; interpolationmode=none);
        @statistic[tokensRemoved](title="tokens removed"; record=sum; interpolationmode=none);
        @statistic[tokensDepleted](title="tokens depleted"; record=count; interpolationmode=none);
        @class(TokenBasedServer);
}
File: src/inet/queueing/server/TokenBasedServer.ned