# Weighted Round-Robin Classifier¶

The Weighted Round-Robin Classifier (WrrClassifier) module classifies packets to its outputs in a round-robin fashion, based on the configured weights of the outputs. For example, if the configured weights are [2,3], then first two packets are sent to output 0, the next three to output 1. If a component connected to an output is busy (the output is not pushable), the scheduler waits until it becomes available.

In this step, packets are produced periodically by an active packet source (ActivePacketSource). The single source is connected to a classifier (WrrClassifier), which is connected to three passive packet sinks (PassivePacketSink). The outputs of the classifier are configured to have the weights [1,3,2], thus the classifier forwards 1, 3 and 2 packet(s) to the three sinks in one round.

network WrrClassifierTutorialStep
{
@display("bgb=600,400");
submodules:
producer: ActivePacketSource {
@display("p=100,100");
}
classifier: WrrClassifier {
@display("p=300,100");
}
consumer1: PassivePacketSink {
@display("p=500,100");
}
consumer2: PassivePacketSink {
@display("p=500,200");
}
consumer3: PassivePacketSink {
@display("p=500,300");
}

connections allowunconnected:
producer.out --> classifier.in;
classifier.out++ --> consumer1.in;
classifier.out++ --> consumer2.in;
classifier.out++ --> consumer3.in;
}

[Config WrrClassifier]
network = WrrClassifierTutorialStep
sim-time-limit = 100s

*.producer.packetLength = 1B
*.producer.productionInterval = 1s
*.classifier.weights = "1 3 2"