Browser width
is too narrow.

Rotate the screen
or increase
the width.
OpenSIMPLY Free open source simulation software
▲

Simulation model of G/M/C/K,T queuing system

The G/M/C/K,T queuing system in terms of queuing theory

Such a system is an advanced case of M/M/C/K,T queuing system.

In some particular case, the G/M/C/K,T queuing system can represent a retrial queuing system.

Entities arrive at a queue with FIFO discipline according to a Poisson process. The queue capacity is limited with K waiting places. The queue timeout (maximum waiting time) is exponentially distributed with T mean value.

Entities from the queue are distributed between C servers. The service time value of all servers is exponentially distributed. Free server is selected randomly.

The considered queuing system model represents already real objects.

The difference from the M/M/C/K,T queuing system is that the entities rejected from the queue due to a timeout are split into two flows. The entities of the first one are destroyed. This simulates the loss of clients that don't want to try again to get service again. The second flow entities are delayed for a while before being sent back to the queue. This simulates the attempt of clients to get service again. After some delay, these entities are mixed with newly arrived entities and passed together to the queue.

So, the mixed flow entering the queue is non-Poisson process, and, therefore, the designation of this system is G/M/C/K,T queue, where G stands for the general distribution.

The characteristics under study are the queue probability, mean waiting time and mean queue length.

Since how an idle server is selected does not affect the characteristics of interest, this rule can be any, not necessarily random.
G/M/C/K,T queuing system

The model of a G/M/C/K,T queuing system in terms of OpenSIMPLY

The Generator, Selector and Server blocks are used for this system description as for M/M/C/K,T queuing model.

Instead of Queue block, the YQueue block with additional secondary output will be used in this model. Through this output, entities rejected because of timeout are not destroyed, but are passed on further.

Additionally, the Mixer, Splitter, Terminal and InfiniteServer blocks will be used for this model. The Mixer combines the entity flows from the multi-input. The Splitter divides the entity flow from the input into two outputs according with the specified portion. The Terminal just destroys the entities, it is an end station. The InfiniteServer block accepts every entity and delays it for a specified time.

In Delphi and Free Pascal, these blocks are represented by the TGenerator, TMixer, TYQueue, TSelector, TServer, TSplitter, TTerminal, and TInfiniteServer classes, respectively.

Download executable model of the G/M/C/K,T queuing retrial system as a real call center.
 
Block model of the G/M/C/K,T queuing system

Model creation

The FIFO is a default discipline for the Queue block, and therefore that must not be specified explicitly.

The сonnection rule item of the Selector block parameter should be specified with the RandomConnection value. But, based on remark above, the default FirstIdleConnection value can used instead. Therefore, this parameter can be omitted.

The Gen, Mix, YQue, Sel, Splt, Trm and InfSrv variables will be used for the instances of the TGenerator, TMixer, TYQueue, TSelector, TSplitter, TTerminal and TInfiniteServer classes, respectively.

Since the Selector block can create the specified number of instances of the block of the specified type and automatically assign them to the selection points, the array for a number of servers of a TServer type should not be created, and therefore no variable is required. The TServer class and the parameters will be specified in the Assign method of the TSelector.

Model parameters

The following variables and functions will be used for the initial values of the blocks.
  • Capacity: to specify the total number of entities for simulation (Generator)
  • QueueCapacity: to specify the number of waiting places for entities (Queue)
  • QueueTimeout: to specify the maximum waiting time for an entity (Queue)
  • NumberOfServers: to specify the number of servers in the system (Selector)
  • InterarrivalTime: to specify the mean value between entities arrivals (Generator)
  • ServiceTime: to specify the mean value of service time (Server)
  • RetrialsPercentage: to specify the percentage of entities rejected after timeout that try to get service again (Splitter)
  • RetrialDelay: to specify the mean time an entity is waiting before the attempt to get service again (Infinite Server)
  • ExpTime: a block function that returns exponentially distributed random values

Model behavior

The lines below fully describe the behavior of G/M/C/K,T queuing retrial system in terms of OpenSIMPLY:

Gen := TGenerator.Create([Capacity, ExpTime, InterarrivalTime]);    //  Creating a Generator.

Mix := TMixer.CreateDefault;                                        //  Creating a Mixer.

YQue := TYQueue.Create([QueueCapacity, ExpTime, QueueTimeout]);     //  Creating a YQueue.

Sel := TSelector.Create([NumberOfServers]);                         //  Creating a Selector with a default rule.

Splt := TSplitter.Create(RetrialsPercentage);                       //  Creating a Splitter.

Trm := TTerminal.CreateDefault;                                     //  Creating a Terminal.

InfSrv := TInfServer.Create(ExpTime,RetrialDelay);                  //  Creating an Infinite Server.

Gen.Connect(Mix);                                                   //  Connecting Generator to Mixer.

Mix.Connect(YQue);                                                  //  Connecting Mixer to YQueue.

YQue.Connect(1, Sel);                                               //  Connecting YQueue to Selector.

YQue.Connect(2, Splt);                                              //  Connecting YQueue to Splitter.

Sel.Connect(1, NumberOfServers, TServer, [ExpTime, ServiceTime]);   //  Creating Servers and assigning them to Selector.

Splt.Connect(1, InfSrv);                                            //  Connecting Splitter to InfiniteServer.

Splt.Connect(2, Trm);                                               //  Connecting Splitter to Terminal.

InfSrv.Connect(Mix);                                                //  Connecting InfiniteServer to Mixer.


To compile a model, the code above should be placed in a standard wrapper of a model.
 

Complete program code containing input data and output of results.

program MMCKTqueue;
{$AppType GUI} 
{$S-}
uses
  SimBase,
  SimBlocks,
  SimStdGUI;
  
type
  TMyModel = class(TModel)           //  Model declaration.  
    procedure Body; override;
  end;

var
  Capacity,                          //  Model parameters.
  QueueCapacity,
  NumberOfServers: Integer;
  InterarrivalTime,
  QueueTimeout,
  ServiceTime,
  RetrialsPercentage,
  RetrialDelay: Double;
 
procedure TMyModel.Body;             //  Model description.
var                                    
  Gen: TGenerator;                   //  Blocks declaration.
  Mix: TMixer;
  YQue: TYQueue;
  Sel: TSelector;
  Splt: TSplitter;
  Trm: TTerminal;
  InfSrv: TInfServer;
begin 
  Gen := TGenerator.Create([Capacity, ExpTime, InterarrivalTime]);
  Mix := TMixer.CreateDefault;
  YQue := TYQueue.Create([QueueCapacity, ExpTime, QueueTimeout]);
  Sel := TSelector.Create([NumberOfServers]);
  Splt := TSplitter.Create(RetrialsPercentage);
  Trm := TTerminal.CreateDefault;
  InfSrv := TInfServer.Create(ExpTime, RetrialDelay);

  Gen.Connect(Mix);
  Mix.Connect(YQue);
  YQue.Connect(1, Sel);
  YQue.Connect(2, Splt);
  Sel.Connect(1, NumberOfServers, TServer, [ExpTime, ServiceTime]);
  Splt.Connect(1, InfSrv);
  Splt.Connect(2, Trm);
  InfSrv.Connect(Mix);

  Run(Gen);                          //  Launching the start block.

  YQue.ShowStat;                     //  Results.
end;

begin
  Capacity := 3000;                  //  Initial values of the model.
  InterarrivalTime := 1;
  QueueCapacity := 3;
  QueueTimeout := 1;
  ServiceTime := 1.3;
  NumberOfServers := 2;
  RetrialsPercentage := 20;
  RetrialDelay := 0.16;

  Simulate(TMyModel);                //  Starting a model.
end.