TokenBasedServer

Package: inet.queueing.server

TokenBasedServer

simple module

This module repeatedly pulls 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.

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 many 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
addedTokens added tokens tokensAdded sum tk none
removedTokens removed tokens tokensRemoved sum tk none
numTokensDepleted number of times tokens are depleted tokensDepleted count tk none
numTokens number of tokens sum(tokensAdded) - sum(tokensRemoved) vector tk sample-hold

Direct method calls (observed)

call tofunctioninfo
ContentBasedClassifierinet::queueing::ContentBasedClassifier::pushPacketpushPacket
PacketClassifierinet::queueing::PacketClassifier::pushPacketpushPacket
PacketMultiplexerinet::queueing::PacketMultiplexer::pushPacketpushPacket
DropTailQueueinet::queueing::PacketQueue::pullPacketpullPacket
PacketQueueinet::queueing::PacketQueue::pullPacketpullPacket
PacketQueueinet::queueing::PacketQueue::pushPacketpushPacket
PassivePacketSinkinet::queueing::PassivePacketSink::pushPacketpushPacket
PassivePacketSourceinet::queueing::PassivePacketSource::canPullPacketcanPullPacket
PassivePacketSourceinet::queueing::PassivePacketSource::pullPacketpullPacket
PacketBasedTokenGeneratorinet::queueing::PacketBasedTokenGenerator::receiveSignaltokensDepleted
SignalBasedTokenGeneratorinet::queueing::SignalBasedTokenGenerator::receiveSignaltokensDepleted

Called methods (observed)

functioninfocall from
inet::queueing::TokenBasedServer::addTokensaddTokensPacketBasedTokenGenerator, QueueBasedTokenGenerator, SignalBasedTokenGenerator, TimeBasedTokenGenerator
inet::queueing::TokenBasedServer::handleCanPullPacketChangedhandleCanPullPacketChangedDropTailQueue, PacketQueue, PassivePacketSource
inet::queueing::TokenBasedServer::handleCanPushPacketChangedhandleCanPushPacketChangedContentBasedClassifier, PacketClassifier, PacketMultiplexer, PacketQueue, PassivePacketSink

Pull in messages (observed)

gatemsgkindctrlsrcModuletags
inPacket0DropTailQueueDirectionTag, PacketProtocolTag
inPacket0PacketQueueDirectionTag?, DscpInd?, EcnInd?, HopLimitInd?, InterfaceInd?, L3AddressInd?, L4PortInd?, NetworkProtocolInd?, PacketProtocolTag?, TosInd?, TransportProtocolInd?
inPacket0PassivePacketSourceDirectionTag, PacketProtocolTag
inPacket1PacketQueue

Push out messages (observed)

gatemsgkindctrldestModuletags
outPacket0ContentBasedClassifierDirectionTag, PacketProtocolTag
outPacket0PacketClassifierDscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, L4PortInd, NetworkProtocolInd, TosInd, TransportProtocolInd
outPacket0PacketMultiplexerDirectionTag, PacketProtocolTag
outPacket0PacketQueueDirectionTag, PacketProtocolTag
outPacket0PassivePacketSinkDirectionTag, PacketProtocolTag
outPacket1PacketClassifier

Source code

//
// This module repeatedly pulls 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 many 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[addedTokens](title="added tokens"; source=tokensAdded; record=sum; unit=tk; interpolationmode=none);
        @statistic[removedTokens](title="removed tokens"; source=tokensRemoved; record=sum; unit=tk; interpolationmode=none);
        @statistic[numTokensDepleted](title="number of times tokens are depleted"; source=tokensDepleted; record=count; unit=tk; interpolationmode=none);
        @statistic[numTokens](title="number of tokens"; source=sum(tokensAdded) - sum(tokensRemoved); record=vector; unit=tk; interpolationmode=sample-hold);
        @class(TokenBasedServer);
}
File: src/inet/queueing/server/TokenBasedServer.ned