Connecting Multiple Active Sources to a Passive Sink¶
The PacketMultiplexer module connects to multiple active packet sources on its inputs, and pushes all incoming packets onto a passive packet sink on its single output.
In this example network, packets are produced at random intervals by several active packet sources (ActivePacketSource). The packets are consumed by a single passive packet sink (PassivePacketSink) upon arrival. The single sink is connected to multiple sources using an intermediary component (PacketMultiplexer) which simply forwards packets.
network MultiplexerTutorialStep
{
parameters:
int numProducers;
submodules:
producer[numProducers]: ActivePacketSource {
@display("p=100,100,c,100");
}
multiplexer: PacketMultiplexer {
@display("p=300,100");
}
consumer: PassivePacketSink {
@display("p=500,100");
}
connections allowunconnected:
for i=0..numProducers-1 {
producer[i].out --> multiplexer.in++;
}
multiplexer.out --> consumer.in;
}
[Config Multiplexer]
network = MultiplexerTutorialStep
sim-time-limit = 10s
*.numProducers = 3
*.producer[*].packetLength = 1B
*.producer[*].productionInterval = uniform(0s, 2s)