A call generator can be summarised as: make next Call, wait Inter Arrival Time.
A call generator could be implemented by starting a timer for the InterArrivalTime.
Alternatively, OnTimerTick, send enough calls to make wanted call rate.
When Timer Tick >> Average Inter Arrival Time, The call generator is very bursty. A simulation can be used to explore NegExp Traffic.
A fixed timer tick occurs. Call Inter Arrival Times are accumulated until simulated time catches up with real time.
// wait InterArrivalTime
OnTimerTick(){
makeCall();
startTimer( interArrivalTime )
}
|
// Wait fixed time, send enough calls.
OnTimerTick(){
catchUpCalls();
startTimer( tickTimerTime )
}
|
Make a call, wait the exact time to the next based on ideal requirements.
interArrivalTime = -Math.log(1-Math.random( )) / CallsPerSecond;
while( true ) {
sendCall(); // Call Opportunity - pick source,destination and call type
wait( InterArrivalTime )
}
This is like an oscillator, clocking the network. The oscillator may modulate the time between ticks using a distribution.
For each call pick the source, destination and call type.
The source and destinations can be the phone dialling a particular phone number or maybe the phone's exchange and the terminating phone number routed via a common exchange.
The system only has a constant time tick and the required inter arrival times are sometimes shorter than the the minimum tick timer that the call generator can provide. The call generator sometimes has to send multiple calls per timer tick.
Constant InterArrival Times:
Negative Exponential Distributed InterArrival Times:
while( true ) {
timeSlice()
wait( timerTick )
}
function timeSlice() {
// nowTime is simulated and as precise as required.
// This is run once per time slice.
// Normally this would go as fast at the hardware allows.
// Move simulated time on by timerTick
// nowTime is relative to real time
nowTime = nowTime - timerTickTime;
calls=0
if ( nowTime > 0.0 ) {
// No calls needed
} else {
// Catch up simulated time with real time
while ( nowTime < 0.0 ){
//# Catch up with calls as simulated time is behind real time
//# generate a time interval modulated by Neg Exp distribution
// interArrivalTime = -Math.log(1-Math.random( )) / CallsPerSecond;
interArrivalTime = calculateNextInterArrivalTime( CallsPerSecond );
sendCall(); // Call Opportunity - pick source,destination and call type
nowTime = nowTime + interArrivalTime;
}
}
}