Discrete Process Simulation

(Tools: Resources)














 

 

 

 

 


Resources

Resources are ment to model limited capacity problems in an elegant way. For this purpose two object classes are introduced:

  • the class TomasSemaphore.
  • the class TomasResource.

TomasSemaphore
TomasSemaphore is a basic class representing some kind of object with limited capacity. Each TomasElement can 'claim' some amount of capacity and the TomasSemaphore itself will handle all succeeding claims. The process of a TomasElement is suspended until the claim is honoured. If so, the element 'passes' the semaphore and resumes it's process. A TomasSemaphore is typically a data element dividing capacity among competing active TomasElements.

TomasResource
TomasResource is a descendant class of TomasElement with it's own process and limited capacity. For each arbitrary object some amount of capacity of the TomasResource can be 'claimed' for some amount of time. The TomasResource determines the moment, when a claim can be honoured, assigns the capacity claimed to the object and releases the capacity again after the requested period.
So a TomasResource is typically an active Tomaselement dividing capacity among competing data elements.

Application
A TomasSemaphore is normally used by active TomasElements. Especially traffic system can make good use of this facility. A TomasResource will mostly be needed in production environments to easily model machines, production lines etc.

To show the ease of a TomasResource the following example describes the processes in a single machine environment. On the left hand side of the table the machine's and generator's process are described using only TOMAS. On the right hand side the machine is defined as a TomasResource with capacity 1 and the user only needs a generator's process to make the same simulation.

Basic approach with TomasElements

Procedure TGenerator.Process;
Var
  • Job: TJob;
Begin
  • While TRUE Do
  • Begin
    • Job:=TJob.Create('Job');
    • Job.JobTime:=JobTimes.Sample;
    • Machine.Jobs.AddToTail(Job);
    • If Machine.Status = Passive Then
    • Machine.Resume(TNow);
    • Hold(InterArrivals.Sample);
  • End;
End;

Procedure TMachine.Process;
Begin
  • While TRUE Do
  • Begin
    • While Jobs.Length > 0 Do
    • Begin
      • Job:=Jobs.FirstElement;
      • Hold(Job.JobTime);
      • Jobs.Remove(Job);
      • Job.Free;
    • End;
    • Suspend;
  • End;
End;
Resource Approach

Procedure TGenerator.Process;
Var
  • Job: TJob;
Begin
  • While TRUE Do
  • Begin
    • Job:=TJob.Create('Job');
    • Job.JobTime:=JobTimes.Sample;
    • Machine.Claim(Job,1,Job.JobTime);
    • Hold(InterArrivals.Sample);
  • End;
End;