



TGenerator, TServer,
and TQueue classes, respectively.

Gen, Que and Srv will be used for instances
of the classes TGenerator, TQueue and TServer, respectively.
TQueue class has the CreateDefault constructor,
the Queue block instance can be created with default values, and the items of the InitialValues parameter do not need to be explicitly specified.
InitialValues:
InfiniteCapacity for the Capacity itemInfiniteTimeout for the Timeout itemFIFO for the Discipline itemTotalEntities — the total number of entities to be simulated during the model run.InterarrivalTime — the mean time between entity arrivals.ServiceTime — the mean service time.ExpTime — a pointer to a function that returns exponentially distributed random values.Gen := TGenerator.Create([TotalEntities, ExpTime, InterarrivalTime]); // Creating Generator. Que := TQueue.CreateDefault; // Creating Queue with default initial values. Srv := TServer.Create([ExpTime, ServiceTime]); // Creating Server. Gen.Connect(Que); // Connecting Generator to Queue. Que.Connect(Srv); // Connecting Queue to Server.
program MM1;
{$apptype xxx } // xxx "GUI" or "Console"
{$S-}
uses
SimBase,
SimBlocks,
SimStdGUI;
type
TMyModel = class(TModel) // Model declaration.
procedure Body; override;
end;
var // Model parameters.
TotalEntities,
NumberOfServers: Integer;
InterarrivalTime,
ServiceTime: Double;
procedure TMyModel.Body; // Model behavior.
var
Gen: TGenerator; // Blocks declaration.
Que: TQueue;
Srv: TServer;
begin // Model behavior.
Gen := TGenerator.Create([TotalEntities, ExpTime, InterarrivalTime]);
Que := TQueue.CreateDefault;
Srv := TServer.Create([ExpTime, ServiceTime]);
Gen.Connect(Que);
Que.Connect(Srv);
Run(Gen); // Launching start block.
// Results.
Que.ShowStats; // Probability of waiting,
// mean waiting time, mean queue length
end;
begin
TotalEntities := 3000; // Initial values of model.
InterarrivalTime := 1;
ServiceTime := 1.3;
Simulate(TMyModel); // Starting model.
end.