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 as an example of MM1 loss system.

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

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

Queue discipline is a queue behavior for arriving entities from one side (input) and requests for entity from another side (output). In case of M/M/C1 queue idle server can inform queue about that.

Queue discipline for M/M/1 queue system is FIFO. It is a default discipline, and therefore it can not be indicated explicitly. But formally 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.

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

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, simulation results can be verified using traffic theory analytics.
The value of queue probability can be obtained by the 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.