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

Thoughts on a Traffic Spectrum Analyser.

A spectrum analyser is a box that shows the power of AC signals in a bandwidth, as a Bar Graph.

Could we design a Traffic Spectrum Analyser as is a box that shows the counts of calls per second in a bandwidth of say dialled numbers?

You can take a body of traffic and group the calls. Within these groups, count calls over a period of time.

The groups are the 'bandwidth'.

The calls per period are the 'power'.

Thoughts on a traffic generators.

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

Thoughts 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 to multiple the interarrival time.

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;
	}
    }

Here is an AWK script that models the catch up call generator: cg6b.awk: - Traffic generator using Catch Up Calculations.

Here is simulation: cg6bop.txt: A simulation result.

Here is a web page simulation: cg6.htm: Web page simulation 10 cps

Here is a web page simulation: cg6low.htm: Web page simulation - 0.1 cps - low traffic rate.

Here is a web page simulation: cg6medium.htm: Web page simulation - 1 cps - medium traffic rate.

Here is a web page simulation: cg6high.htm: Web page simulation - 10 cps - high traffic rate.

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.

Call Gap simulations for different distributions

Using a simple AWK script that generates calls and increments time by the Inter Arrival Time calculated. The awk script is: cg2.awk

I have used constant IAT, uniform IAT and Neg Exp IAT. Using 10 calls per second, and running for 2 minutes, per gap interval, I have swept the Gap Intervals.

Call gapping is done by a timer that prevents calls being admitted for the duration of the Gap Interval

This represents 120 seconds * 10 cps = 1200 calls per simulation. The next section trys to measure the distributions less calls.

Simulations by cg6high_random.htm 10,000 calls, 1000 ticks, different IAT

Here is a web page simulation: cg6high_random.htm: Web page simulation - 10 cps - high traffic rate. 1000 timer ticks

The graphs below show the distributions for 10 cps using InterarrivalTimes and 1000 timer ticks.

This should be about 10,000 calls to from 5 SSP to 5 numbers. The script also simulates call gapping. Call gapping restricts the minimum time between related calls.

This represents 25 Call gappers with a Gap Interval of 1 second.

Each call generated randomly picks one of the 25 ( 5 SSP x 5 Dialled Numbers ) call gappers.

This explains the triangle shaped distributions for rejected and admitted calls in the Constant IAT graphs.

Here is another for different InterArrival Times and Call Picker functions.

constant IAT,random call picker | constant IAT, round robin call picker
random IAT,random call picker | random IAT, round robin call picker
neg Exp IAT,random call picker | neg Exp IAT, round robin call picker

The graphs are un- normalised probability density distributions. The Y scale needs to be divided by 1000 to give probabilities of a timer tick having n rejected calls, or n admitted calls.




NOTE: Subtract 1 from the X axis values. I cannot use Excel. The x axis should be 0,1,2,3,4,5, etc

It is my opinion that most call generators on the market are "Billy One Mate" call generators. A lot of call generators are ISDN primary rate. Each timeslot configured to dial one number. These timeslots are scanned sequentially with a constant time between the end of one call and the next.

The graphs below are using a round robin selection of SSP and Call gapper

cg6high_random_roundRobin.htm: Web page simulation - 10 cps - high traffic rate. 1000 timer ticks




NOTE: Subtract 1 from the X axis values. I cannot use Excel. The x axis should be 0,1,2,3,4,5, etc

1000 timer ticks had 0 rejected calls. No timer tick had any rejected calls!

When we use the round robin selection of SSP and Call gapper, No calls are call gapped. Call gapping relies on random Inter Arrival time to reject traffic.

Erlangs - B formulae - My take

We have a stream of random traffic. Each caller is idependent to each other.

Lets measure the average traffic over a long period. The Averages are:

	measuredAverageCallRate = numberOfCalls / measurementPeriod

	measuredAverageCallDuration = sumOfCallDurations / numberOfCalls
However no caller knows when the last caller made a call. They do not wait to space their call, a set period from the last call.

Also, the call duration is similar. It is argued that the caller ends the call without consideration of actual duration. Note: If a caller rings an automated voice service, then the durations profile may be shaped by the dialogue and menu options.

We now have a measuredAverageCallRate and measuredAverageCallDuration.

If we are going to generate traffic we actually have wantedAverageCallRate and wantedAverageCallDuration.


	probabilityOfCallStarting = exp( - period * wantedAverageCallRate  )

	probabilityOfEstablishedCallEndingInNextPeriod = exp( - period * wantedAverageCallDuration  )

	callRate = numberOfCalls / period

The Poission Distribution is the list of probabilities of n calls starting or n calls ending normalised by the exponential.

See: interactive Erlangs-B formulae

So we are going to generate traffic. We want to calculate the interval between calls and for each call, a duration that it will run.


	probabilityOfCallStarting = exp( - period * wantedAverageCallRate )

	probabilityOfEstablishedCallEndingInNextPeriod = exp( - period * wantedAverageCallDuration )

	callRate = numberOfCalls / period

becomes:

	log( probabilityOfCallStarting ) =  - period * wantedAverageCallRate 

	log( probabilityOfEstablishedCallEndingInNextPeriod ) =  - period * wantedAverageCallDuration

becomes:

	period = - log( probabilityOfCallStarting ) / wantedAverageCallRate

	period = - log( probabilityOfEstablishedCallEndingInNextPeriod ) / wantedAverageCallDuration

We want a random stream of traffic so replace the probabilities with a random number generator:
	InterArrivalTime = - log( random() ) / wantedAverageCallRate

	CallDuration = - log( random() ) / wantedAverageCallDuration


        random() returns a number in the range: 0 < random() < 1

	I was told to use: 

	period = - log( 1- random() ) / wantedAverageCallRate

	We must never work out -log( 0 ) as it throws an exception.
	
See: active Possion Distribution model


Thats enough for now!