Multi task on PIC16Fxx |Naming Symbols | Traffic Generation 2 | Traffic Generation 2 |

Thoughs on a traffic generators.

A traffic generator can be modelled by a process called once per timer tick. The process sends a traffic message.

You can start the timer with the required interArrival time.
You can start the timer with a fixed time and use probability to choose to send a call.
You can start the timer with a fixed time and use a catch up calculation to accumulate the interArrival Time until you have reached the timer tick. Each accumulation, you send a call.
Here is a traffic generator written in perl. Run these three Perl programs:
udp1.pl First Cuts in PERL - Traffic generator to 127.0.0.1 ports 2346 & 2347
udp2.pl First Cuts in PERL - Traffic sink on port 2346
udp3.pl First Cuts in PERL - Traffic sink on port 2347

udp4.pl First Cuts in PERL - Traffic generator to 127.0.0.1 ports 2346 & 2347 using Catch Up Calculations

A traffic generator can be modelled by a process called once per timer tick. The process sends a traffic message.

You can start the timer with the required interArrival time.
You can start the timer with a fixed time and use probability to choose to send a call.
You can start the timer with a fixed time and use a catch up calculation to accumulate the interArrival Time until you have reached the timer tick. Each accumulation, you send a call.

Thoughs on a traffic generators, and Norton / Thevenin equivalent circuits.

Electronic equivalent circuits come in two forms:
the voltage-source oriented Thévenin equivalent and the current-source oriented Norton equivalent (see figure). Norton @ wikipedia Thevenin @ wikipedia

I have defined terms for call generators:

In a call generator you have three parameters, which can be controlled with the others left to their own devices.

For a constant Interarrival time - calls are started at constant inter arrival times.

For a constant Erlang generator - the circuit occupancy is kept constant. Either by short calls or long calls.

For a constant Circuits generator - the number of circuits carrying calls is kept constant, when call ends another must start.

Where I use the word constant above, you can replace this by modulated. Modulated here means use a distribution like Negative exponential.

So for the "constant" Interarrival times, instead of using interArrivalTime = 10, use something like:

	# use rand() to generate a random number
        $interArrivalTime = -log( 1 - rand() ) / $CallsPerSecond;
Here is a bit of perl code from: udp4.pl: - Traffic generator using Catch Up Calculations.

This modulates the interarrival time and although it uses a constant tick, calls are sent to catch up the number sent.

This code quantises the times to the timer tick, but could be modified to impliment the other two equivalent call generators. Every timer tick you would check if the wanted Erlangs or circuits in use are matched by what is happening.

    # Catch Up calculation method. 
    # A fixed timer is used, and on each tick, 
    # calls are sent to catch up simulated time.

    my $nowTime = $timerTickTime;
 
    while( 1 ) {

	if ( $nowTime > 0.0 ) { 

           # start timer for a fixed period 
           $count = select( undef, undef, undef, $timerTickTime ) ;
           $nowTime = $nowTime - $timerTickTime;

	} else {        
        # Catch up with calls
        # generate a time interval modulated by Neg Exp distribution
        $interArrivalTime = -log( 1 - rand() ) / $CallsPerSecond;
        $sum         = $sum + $interArrivalTime;
        $running     = time - $StartedAt;


	# Now pick a call type
	$callType    = int( rand()*10 );

	# Now pick a destination
	$destination = int( rand()*10 );


        #print "Call Generator: $running,$sum,$callType,$destination,$interArrivalTime \r\n";
 
        #$ip = ;

	# Prepare Message
	# TS,Protocol,OrigID,DestID,Operation,P1,,,CRLF

        $message =  "$sum,0,0,$destination,MAKECAll,,,END\r\n";

        if ( rand() < 0.5 ) { 
          $hispaddr = sockaddr_in(2346, inet_aton("127.0.0.1") );
        } else {
          $hispaddr = sockaddr_in(2347, inet_aton("127.0.0.1") );
        }
        send(SOCKET, "CLG:,$message", 0, $hispaddr) ;

        print "Call Generator: $running,$sum,  $message";

	$nowTime = $nowTime + $interArrivalTime;
	}
    }


Thats enough for now!