Table Of Contents
Table Of Contents

Markov-Chain-Based Scheduler

The MarkovScheduler module uses a Markov process to schedule packets. The current state of the Markov process selects the input gate; a configurable transition matrix determines the probabilities of state change; the configured wait intervals determine the time between state changes. If the provider at the selected input cannot prodivide a packet for duration of the state’s wait interval, the process switches to the next state without pulling a packet.

In this example network, packets are generated by two passive packet sources (PassivePacketSource). The packet sources are connected to a scheduler (MarkovScheduler). Packets are popped from the scheduler by an active packet sink (ActivePacketSink). The scheduler in turn pops packets from one of the packet sources, based on the current state of the Markov process.

network MarkovSchedulerTutorialStep
{
    @display("bgb=600,300");
    submodules:
        provider1: PassivePacketSource {
            @display("p=100,100");
        }
        provider2: PassivePacketSource {
            @display("p=100,200");
        }
        scheduler: MarkovScheduler {
            @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 MarkovScheduler]
network = MarkovSchedulerTutorialStep
sim-time-limit = 100s

*.provider*.packetLength = 1B
*.collector*.collectionInterval = uniform(0s, 2s)
*.scheduler.transitionProbabilities = "0 1 1 0"
*.scheduler.waitIntervals = "40 4"