Browser width
is too narrow.

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

M/M/c Queue Simulation Model

M/M/c Queue: Theoretical Background

This system is a classic example of queuing theory and traffic theory.

This is a particular case of the M/M/∞ queue .

Entities arrive at a queue with FIFO discipline according to a Poisson process.

Queue capacity and queue timeout are infinite.

Entities from the queue are distributed between C servers.

If an idle server is found, the entity is passed to it, otherwise the entity is placed in a queue.

One of several idle servers is selected randomly.

The service time value of any server is exponentially distributed.

The characteristics under study are the probability of waiting, 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.

Watch the learning video about the M/M/c queuing.
 
M/M/c queue

M/M/c Model in OpenSIMPLY

The blocks Generator, Queue, Selector and Server are required to describe the model of this system.

In Delphi and Free Pascal, these blocks are represented by the TGenerator, TQueue, TSelector and TServer classes, respectively.

The Generator and Server blocks are described in the M/M/1/1 model example, the Queue block is described in the M/M/1 queue model example.

In the model under consideration, the Selector block is introduced.

Selector block

The Selector block distributes the entities arriving at the input of this block between the outputs (connection points) in accordance with the specified connection rule.

The outputs are connected to the blocks. In this example these are the Server blocks.

A block can be idle or busy. If there are at least two idle blocks, the connection rule determines which output should be connected the input to pass the entity.

Download executable model of the M/M/c queue as an ideal call center.
 
OpenSIMPLY block simulation model of the M/M/c queue

Model Creation

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

The connection 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.

Normally, the array of TServer should be created for the servers. But the Selector block can create the specified number of instances of the specified block type and automatically assign them to the selection points. That means no variable for array of the TServer is required.

Thus, only the variables Gen, Que and Sel will be used for the instances of the classes TGenerator,TQueue and TSelector, respectively. The TServer class and initial values will be specified as parameters for the TSelector block .

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)
  • 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)
  • ExpTime: a block function that returns exponentially distributed random values

Model Behavior

The code below defines the behavior of the M/M/c queue as an OpenSIMPLY model.

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

Que := TQueue.CreateDefault;                                        //  Creating an infinite FIFO Queue.

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

Gen.Connect(Que);                                                   //  Connecting the Generator to the Queue.

Que.Connect(Sel);                                                   //  Connecting the Queue to the Selector.

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


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

Complete Program Code with Input Data and Results

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

var
  Capacity,                            //  Model parameters.
  NumberOfServers: Integer;
  InterarrivalTime,
  ServiceTime: Double;
 
procedure TMyModel.Body;               //  Model behavior.
var                                    
  Gen: TGenerator;                     //  Blocks declaration.
  Que: TQueue;   
  Sel: TSelector;
begin 
  Gen := TGenerator.Create([Capacity, ExpTime, InterarrivalTime]);
  Que := TQueue.CreateDefault;
  Sel := TSelector.Create([NumberOfServers]);
  Gen.Connect(Que);
  Que.Connect(Sel);
  Sel.Connect(1, NumberOfServers, TServer, [ExpTime, ServiceTime]); 

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

  Que.ShowStat;                        //  Results.  
end;

begin
  Capacity := 3000;                    //  Initial values of the model.
  InterarrivalTime := 1;
  ServiceTime := 1.3;
  NumberOfServers := 2;

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

Model Validation

To validate the M/M/c queue model, verify its results against the exact formula. Thus, the probability of waiting, mean waiting time and mean queue length can be obtained using the Erlang C formula.

It should be noted that for the practical purposes the M/M/c queue cannot be used. There is no real system where the number of waiting places is infinite, or a client can wait for a service indefinitely. See more realistic model of the M/M/c/K queue with limited capacity.