Browser width is too narrow.

Rotate the screen or increase the width.
▲

The model of the M/M/1 loss system

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

The M/M/1 loss system in terms of queuing theory

Such a system contains a single server and no queue (waiting line). The entities arrive as a Poisson process to the server. The service time value is exponentially distributed.

If the server is busy serving an entity, and a new entity arrives, it is rejected due to no free server. They say an entity is "lost". Therefore, such a system is called a system with losses or otherwise a blocking system.

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

The M/M/1 loss model in terms of OpenSIMPLY

In this example only two blocks are used. The Generator block produces entities, the Server block simulates the entity serving.

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

Download executable models of queuing theory and call centers.
The M/M/1 loss system block model

Model creation

To describe the model behavior, the instances of required classes should be created. The variables Gen and Srv will be used for instances of the TGenerator and TServer classes, respectively.

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

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

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 behavior of the M/M/1 loss system in terms of the OpenSIMPLY model.

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

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

Gen.Connect(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" 
{$S-}
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.Connect(Srv);   

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

  Gen.ShowStats;               //  Results.
end;

begin
  Capacity := 1000;            //  Initial values of the model.
  InterarrivalTime := 1;
  ServiceTime := 0.5;

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


To validate the M/M/1 loss model, the simulation results should be verified using the exact formula

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

Simula-like simulation style

The M/M/1 loss model can easily be demonstrated using non-block simulation style. This is an advanced one, a Simula-like coding.

It is based on the process concept developed for the Simula simulation language. There are no blocks, no automatic statistics collection, no automatic destruction of class instances in this style. But, despite these "disadvantages", the simulation execution time is much shorter.

Take a look at an example of a Simula-like simulation style of the same M/M/1 loss system.