Table Of Contents
Table Of Contents

Generic Scheduler

The PacketScheduler connects to multiple passive packet sources on its inputs, and one active packet sink on its output. When a packet is popped from the scheduler, it pops a packet from one of its inputs, based on the configured packet scheduler function.

In this network, packets are generated by two passive packet sources (PassivePacketSource). The sources are connected to a PacketScheduler. An active packet sink (ActivePacketSink) pops packets from the scheduler, which pops packets from one of the packet sources.

Packets are generated by the providers at random intervals of 0 to 2 seconds; the collector pops a packet each second. The packets contain one byte of random data (0-255). The scheduler is configured to use the PacketDataScheduler function to schedule packets. The function selects the highest data value of the packets currently offered by the connected schedulers.

Note that when a provider generates a packet, it cannot generate another one for the configured providing interval. In this period, the provider doesn’t have an available packet. In this case, the scheduler pops packets from the other provider if it has an available packet; if it doesn’t, the next packet is popped as soon as one becomes available.

../../../_images/GenericScheduler.png
network GenericSchedulerTutorialStep
{
    @display("bgb=600,300");
    submodules:
        provider1: PassivePacketSource {
            @display("p=100,100");
        }
        provider2: PassivePacketSource {
            @display("p=100,200");
        }
        scheduler: PacketScheduler {
            @display("p=300,100");
        }
        collector: ActivePacketSink {
            @display("p=500,100");
        }
    connections allowunconnected:
        provider1.out --> scheduler.in++;
        provider2.out --> scheduler.in++;
        scheduler.out --> collector.in;
}
[Config GenericScheduler]
network = GenericSchedulerTutorialStep
sim-time-limit = 10s

*.provider*.providingInterval = uniform(0s, 2s)
*.provider*.packetLength = 1B
*.provider*.packetData = intuniform(0,255)
*.collector.collectionInterval = 1s