[Click] Poisson traffic

María Gómez maria_gn1 at hotmail.com
Thu Aug 27 05:34:31 EDT 2009


Hi,
I have a configuration (file.click) with a RatedSource element and Script element 
to generate a particular repeatable traffic pattern: Poisson.
This is my configuration:

//Poisson traffic like Bernoulli traffic

r::RatedSource(\<0x0800>, RATE 200, LIMIT 10000)
    ->c::Counter
    ->Print
    ->Discard

Script(TYPE ACTIVE,    
    set c 0.5,                    //sets the value of the load    
    set t $(sub $(div 1 $(r.rate)) 0),        //calculated t (length of a packet), 1/rate 
    set cont 0,                    //a counter
    label begin_loop,                //loop start
    set r $(div $(random 0 10) 10),            //generates a random number [0,1] jumps from 0.1
    print $r,    
    set control $(lt $c $r),            //compare
    goto ok $control,                //goto ok if c<=r -> send one packet
    goto no,                    //goto no if c>r -> not send a packet
    label ok,
    print "dentro de ok",
    write r.active true,    
    wait $t,
    write r.active false,            
    set cont $(add $cont 1),
    print "Contador" $cont,    
    goto begin_loop $(lt $cont $(r.limit)),
    stop,
    label no,
    print "dentro de no",
    wait $t,
    print "Contador" $cont,    
    goto begin_loop $(lt $cont $(r.limit)),        //this follows checking while counter <r.limit
    stop);
    

The problem is that sometimes the generator sends 2 packets instead of one.

Thanks for your help
Regards

_________________________________________________________________
¿Quieres los nuevos emoticonos en 3D? ¡Descárgatelos gratis!
http://www.vivelive.com/emoticonos3d/index2.html


More information about the click mailing list