Rotate the screen

Model of M/M/1 loss

This system is really "Hello,world!" example for simulation model.

M/M/1 loss system in terms of quequeing theory

Considered M/M/1 loss system has no queue (waiting line) and has a single server only. The entities are arrived as a Poisson process to the server. The value of service time is exponentially distributed.

If server is busy by serving an entity and another entity is arriving, it is rejected because of no free server, or otherwise they say an entity "is lost". Therefore this simplest system is called system with losses or otherwise blocking system.

Watch the learning video about M/M/1 loss system.
M/M/1 loss

M/M/1 loss system in terms of OpenSIMPLY

In this example two blocks are used only. "Generator" block for entity generation and "Server" block for entity serving (delay).

In Delphi and FreePascal the corresponding classes "TGenerator" and "TServer" will be used.

Download executable models of queueing theory and call centers.
M/M/1 loss block model

Model creation

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

For the "Generator" block, the initial parameters of the total number of of entities for simulation and the mean inter-arrival time of the entities should be specified.

For the "Server" block, the initial parameter of mean service time value should be specified only.

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.

Model behavior

The lines below fully describe the model behaviour for M/M/1 loss system in terms of OpenSIMPLY:

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

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

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

Model wrapper

To compile a model, the code above should be placed in a standard wrapper of a model. This wrapper is the same for any model.

program MySimulation;
{$apptype xxx }  // xxx is either "GUI" or "Console" 

uses
  SimBase,
  SimBlocks,
  SimStdGUI;
  
type
  TMyModel = class(TModel)     //  Model declaration.
    procedure Body; override;
  end;
 
var 
                               //  Model parameters.

procedure TMyModel.Body;       //  Model description.
var
                               //  Blocks declaration.
begin
                               //  Model behavior.
end;

begin                           
       //  Assignment of initial values of the model.
 
  Simulate(TMyModel);           //  Starting a model.
end.

Complete program code containing input data and output of results.

program BlocksStyleMM1;
{$apptype xxx }  // xxx is either "GUI" or "Console" 

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 description.
var                            
  Gen: TGenerator;             //  Blocks declaration. 
  Srv: TServer;                
begin                          //  Model behavior.

  Gen:=TGenerator.Create([Capacity,ExpTime,InterArrivalTime]);
  Srv:=TServer.Create([ExpTime,ServiceTime]); 
  Gen.Next:=Srv;   
  
  Run(Gen);                    //  Starting an initial block.
  
  Gen.ShowStats;               //  Outputting results.
end;

begin
  Capacity:=1000;              //  Initial values of the model.
  InterArrivalTime:=1;                 
  ServiceTime:=0.5;                    
  
  Simulate(TMyModel);          // Starting a model.
end.


To validate the model of M/M/1 loss system, the simulation results should be verified with traffic theory analytics.

So, the value of loss (blocking) probability can be obtained with Erlang-B formula.

Simula-like simulation style

See also advanced Simula-like style simulation example of the same system.