QueueBasedTokenGeneratorTutorialStep

Package: inet.tutorials.queueing

QueueBasedTokenGeneratorTutorialStep

network

(no description)

provider : PassivePacketSource

A passive packet source which can be pulled for packets from the connected packet collector.

Source:
provider: PassivePacketSource {
    @display("p=100,125");
} server : TokenBasedServer

Repeatedly pulls packets from the connected packet provider and it pushes them into the connected...

Source:
server: TokenBasedServer {
    @display("p=325,125");
} queue : PacketQueue

Implements a configurable packet queue, which is suitable for use in MAC protocols, traffic...

Source:
queue: PacketQueue {
    @display("p=550,125");
} collector : ActivePacketSink

An active packet sink which pulls packets from the connected module.

Source:
collector: ActivePacketSink {
    @display("p=775,125");
} tokenGenerator : QueueBasedTokenGenerator

Generates tokens for a ~TokenBasedServer based on the observed state changes of a packet queue.

Source:
tokenGenerator: QueueBasedTokenGenerator {
    @display("p=100,250");
    storageModule = "^.server";
    queueModule = "^.queue";
}

Usage diagram

The following diagram shows usage relationships between types. Unresolved types are missing from the diagram.

Properties

Name Value Description
isNetwork
display bgb=875,350

Unassigned submodule parameters

Name Type Default value Description
provider.displayStringTextFormat string "created %p pk (%l)"

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

provider.packetNameFormat string "%a-%c"

See directives in module documentation

provider.packetRepresentation string "byteCount"

Determines the chunk of the packet data

provider.packetProtocol string "unknown"
provider.packetLength int
provider.packetData int -1
provider.attachCreationTimeTag bool true
provider.attachIdentityTag bool true
provider.attachDirectionTag bool true
provider.clockModule string ""

Relative path of a module that implements IClock(1,2); optional

provider.initialProvidingOffset double 0s

Initial duration before which packets are not provided

provider.providingInterval double 0s

Elapsed time between subsequent packets allowed to be pulled by the connected packet collector, 0 means any number of packets can be pulled at the same simulation time

provider.scheduleForAbsoluteTime bool true

When a clock is used, relative means that setting the clock will not affect the simulation time of the event

server.displayStringTextFormat string "contains %n tk\nserved %p pk (%l)"

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

server.initialNumTokens double 0

Initial number of tokens

server.maxNumTokens double nan

Maximum number of tokens

server.tokenConsumptionPerPacket double 1

How many tokens are consumed per processed packet

server.tokenConsumptionPerBit double 0

How many tokens are consumed per processed bit

queue.displayStringTextFormat string "contains %p pk (%l) pushed %u\npulled %o removed %r dropped %d"

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

queue.packetCapacity int -1

Maximum number of packets in the queue, no limit by default

queue.dataCapacity int -1b

Maximum total length of packets in the queue, no limit by default

queue.dropperClass string ""

Determines which packets are dropped when the queue is overloaded, packets are not dropped by default; the parameter must be the name of a C++ class which implements the IPacketDropperFunction C++ interface and is registered via Register_Class

queue.comparatorClass string ""

Determines the order of packets in the queue, insertion order by default; the parameter must be the name of a C++ class which implements the IPacketComparatorFunction C++ interface and is registered via Register_Class

queue.bufferModule string ""

Relative module path to the IPacketBuffer module used by this queue, implicit buffer by default

collector.displayStringTextFormat string "received %p pk (%l)"

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

collector.clockModule string ""

Relative path of a module that implements IClock(1,2); optional

collector.initialCollectionOffset double -1s

Initial duration before which packets are not collected, negative value means: try the first collection in initialize()

collector.collectionInterval double

Elapsed time between subsequent packets pulled from the connected packet provider

collector.scheduleForAbsoluteTime bool true

When a clock is used, relative means that setting the clock will not affect the simulation time of the event

tokenGenerator.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

tokenGenerator.minNumPackets int 1
tokenGenerator.minTotalLength int 0 b
tokenGenerator.numTokens double 1

Number of tokens generated when the queue becomes empty

Source code

network QueueBasedTokenGeneratorTutorialStep
{
    @display("bgb=875,350");
    submodules:
        provider: PassivePacketSource {
            @display("p=100,125");
        }
        server: TokenBasedServer {
            @display("p=325,125");
        }
        queue: PacketQueue {
            @display("p=550,125");
        }
        collector: ActivePacketSink {
            @display("p=775,125");
        }
        tokenGenerator: QueueBasedTokenGenerator {
            @display("p=100,250");
            storageModule = "^.server";
            queueModule = "^.queue";
        }
    connections allowunconnected:
        provider.out --> server.in;
        server.out --> queue.in;
        queue.out --> collector.in;
}

//-------------------------------------------------

File: tutorials/queueing/QueueingTutorial.ned