Limiting the Data Rate of a Packet Stream¶
Rate meter modules (ExponentialRateMeter and SlidingWindowRateMeter) and rate limiter modules ():ned:StatisticalRateLimiter) can be used to limit the data rate of a stream of packets. The meter measures the data rate of the incoming stream of packets, and attaches a rate tag to each packet. The limiter module, based on the rate tag, limits the outgoing data rate to a configurable value.
In this step, packets are produced periodically by an active packet source (ActivePacketSource). The packets are consumed by a passive packet sink (PassivePacketSink). The packet rate is measured by a ExponentialRateMeter, and if the rate of packets is higher than a predefined threshold, then packets are dropped by the StatisticalRateLimiter.
network MeterTutorialStep
{
@display("bgb=875,200");
submodules:
producer: ActivePacketSource {
@display("p=100,100");
}
meter: ExponentialRateMeter {
@display("p=325,100");
}
limiter: StatisticalRateLimiter {
@display("p=550,100");
}
consumer: PassivePacketSink {
@display("p=775,100");
}
connections allowunconnected:
producer.out --> meter.in;
meter.out --> limiter.in;
limiter.out --> consumer.in;
}
[Config Meter]
network = MeterTutorialStep
sim-time-limit = 100s
*.producer.packetLength = 1B
*.producer.productionInterval = 1s
*.meter.alpha = 0.9
*.limiter.maxPacketrate = 0.5