next up previous contents index
Next: 33.1.2.0.2 Inserting a Loss Up: 33.1.2 Inserting a Loss Previous: 33.1.2 Inserting a Loss

33.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 earlier Chapterchap:math. A more detailed discussion of error models was also described earlier in a different chapterChapterchap:error_model.




2000-08-24