46.1.2.0.1 Creating a Loss Module

Before we can insert a loss module in between a source-receiver pair, we have to create the loss module. Basically, a loss module compares two values to decide whether to drop a packet. The first value is obtained every time when the loss module receives a packet from a random variable. The second value is fixed and configured when the loss module is created.

The following code gives an example to create a uniform 0.1 loss rate.

        # creating the uniform distribution random variable
        set loss_random_variable [new RandomVariable/Uniform] 
        $loss_random_variable set min_ 0 # set the range of the random variable;
        $loss_random_variable set max_ 100

        set loss_module [new ErrorModel] # create the error model;
        $loss_module drop-target [new Agent/Null] 
        $loss_module set rate_ 10 # set error rate to \(0.1 = 10 / (100 - 0)\);
        $loss_module ranvar $loss_random_variable # attach random var. to loss module;
A catalogue of the random variable distributions was described earlierChapterchap:math. A more detailed discussion of error models was also described earlier in a different chapterChapterchap:error_model.



Tom Henderson 2014-12-17