M/M/1 queue system in terms of OpenSIMPLY

M/M/1 queue system M/M/1 queue system is a classical example of queueing theory. The system consists of a queue with FIFO discipline and an single server. Entities are arrived as a Poisson process. Queue capacity and timeout (waiting time) are infinite. Service time value is exponentially distributed.

This example is only a bit complicated than the MM1 loss system example.

Watch also the learning video about M/M/1 queue system.

This model requires three blocks: block for entity generation, block for queue (queue discipline), and block for entity serving (delay block). The classes "TGenerator", "TQueue" and "TServer" are used for these purposes.

Queue discipline determines the processing for arriving entities from the input and requests for entity from the output. In case of M/M/1 queue system the idle server informs the queue about this, and if queue is not empty, the corresponding entity is forwarded further to the server.

Queue discipline for M/M/1 queue system is FIFO. Formally, the correct expression should be: M/M/1 FIFO queue system.

The abbreviation FIFO stands for "First-In, First-Out". That means an entity first placed into a queue will first to be retrieved from queue for serving.

Model parameters

  • Capacity is the total number of entities for simulation.
  • InterArrivalTime is mean value between entities arrivals.
  • ServiceTime is mean value of service time.
  • ExpTime is a block function returning exponentially distributed random values.

The variables "Gen", "Que" and "Srv" will be used for instances of TGenerator, TQueue and TServer classes accordingly.

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

Model behavior

Gen:=TGenerator.Create([Capacity,ExpTime,InterArrivalTime]);    //  Creating a Generator.
Que:=TQueue.CreateDefault;                                      //  Creating an infinite Queue (default).

Srv:=TServer.Create([ExpTime,ServiceTime]);                     //  Creating a Server.

Gen.Next:=Que;                                                  //  Connecting Generator to Queue.
Que.Next:=Srv;                                                  //  Connecting Queue to Server.

To compile a model, the code above should be placed in a standard wrapper of a model as in M/M/1 system example.

Complete program code containing input data and output of results.

program MM1queue;
{$apptype xxx }  // xxx "GUI" or "Console" 

  TMyModel = class(TModel)             //  Model declaration.  
    procedure Body; override;

  NumberOfServers: integer;            //  Model parameters.
  ServiceTime: Double;                  
procedure TMyModel.Body;               //  Model description.                      
  Gen: TGenerator;                     //  Blocks declaration. 
  Que: TQueue;                           
  Srv: TServer;                        

  Run(Gen);                            //  Starting of initial block.
  Que.ShowStat;                        //  Outputting of results.     

  Capacity:=3000;                      //  Initial values of the model.
  Simulate(TMyModel);                  //  Starting a model.

To validate the model of M/M/1 queue system, the simulation results can be verified with traffic theory analytics.
The value of queue probability can be obtained with Erlang_C formula.

The OpenSIMPLY tutorial will help you quickly get started. The tutorial contains practical examples with detailed descriptions.

The project documentation is available in different formats and compatible with any IDE.

Discrete event simulation software OpenSIMPLY is free and open source. Free download. Free use. Try it.