The system M/M/1 queue in terms of OpenSIMPLY

M/M/1 queue system The M/M/1 queue system is a classical example of queueing theory. This system has a queue before the only server. Thus, this example is only a bit complicated as the example of MM1 loss system.

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

The block "TGenerator" is used for the incoming entities stream simulation. The class "TServer" is used for entites serving (delay) simulation. Besides tese ones, the block for queue (queue discipline) will be introduced.

The queue discipline is the behavior of the queue according to arriving entities from the one side and requests for entity from the server (if idle) from another side.

The queue discipline for M/M/1 queue system is FIFO. It is a default discipline, therefore it can not be indicate explicitly. But formally the correct expression is: M/M/1 FIFO queue system.

The abriviation FIFO stands for "Fisrt-In, First-Out". That means that the entity the first placed into the queue will the first to be retrieved from the queue head for serving.

The parameters that will be used in the model

  • Capacity is the total number of entities for simulation.
  • QCapacity is the number of waiting places. In the classical example is infinite.
  • Timeout is the maximum waiting time. In the classical example is infinite too.
  • lambda is the mean value of arrived entities stream.
  • mu is the mean value of service time.
  • ExpTime is the block parameter for the function for exponentially distributed random values.

M/M/1 queue model in terms of OpenSIMPLY:

As it was already told, only the block for queue simulation has to be added to the model behavior. The indication of FIFO discipline for this block is not needed. This discipline is the default one for the block TQueue (see below).





To compile your model for receiving the executing file, the code of the model description has to be placed in the standard model wrapper that is the same for practically any model.

The complete program code containing the input data and the output of the results.

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

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

var                                    //  Global variables of the model.
  Capacity, QCapacity: integer;
  lambda, mu, Timeout: Double;
procedure TMyModel.Body;               //  Model description.
var                                    //  Block variables
  Gen: TGenerator;
  Que: TQueue;
  Srv: TServer;
  Gen:=TGenerator.Create([Capacity,ExpTime,lambda]);   //  These 
  Que:=TQueue.Create([QCapacity,Timeout]);             //  lines
  Srv:=TServer.Create([ExpTime,mu]);                   //  are the  
  Gen.Next:=Que;                                       //  model 
  Que.Next:=Srv;                                       //  description.
  Run(Gen);                            //  Starting of initial block.
                                       //  Outputting of results.
  with Que do 
    OutTextRealLn('Queue probability',DelayedCount/Count);    

  Capacity:=3000;                      // The initial values of the model.
  Simulate(TMyModel);                  // Starting of the model.
OpenSIMPLY tutorial contains the practical examples with detailed description.
Download OpenSIMPLY to play around.