Discrete Process Simulation

(Processes)














 

 

 

 

 

TomasWeb offers object oriented simulation tools that are implemented in Delphi 5, 6, 7, 2005 and 2007. They are all based on the so-called 'process oriented approach': a description-method, where several events (state changes) are combined into one single 'process'.

On this website this kind of simulation will be referred to as 'DISCRETE PROCESS SIMULATION' rather than 'discrete event simulation'. All events, involving some action of the same element, are combined into one single process description. This description is implemented as a normal object method. To realize the progress of time, methods are needed to suspend a running process.

Where traditional discrete event simulation offers methods to react on a state change, the discrete process scheduling mechanism offers methods to indicate that the state of an element does not change for some amount of time.

Each process description belongs to an element class. At any moment during a simulation one and only one process is 'current' (the 'current process') belonging to the 'current element'.  

The process oriented approach of TomasWeb incorporates five methods for the current process:

  • Hold(T): to suspend the current process for T time units
  • StandBy: to suspend the current process until some condition is met
  • Suspend: to suspend the current process indefinitely
  • Stop: to stop the current process
  • StopAndLeave: to stop the current process and remove the element involved from the system.

We strongly support the use of process descriptions for active elements instead of process descriptions for elements being handled. This last approach is referred to as "flow oriented approach". Our process approach can easily be linked to the modeling concept of "systems approach". This can best be explained by an example.

Example Suppose a job shop receives every day an average of 3 new jobs. This number is exponentially distributed. Every job consists of 5 tasks on the average, to be executed sequentially. The number of tasks is normally distributed with standard deviation 1. During preparation of a job prescriptions of the tasks are made. This takes always 1 day. A transportation department delivers the tasks to the department where the next task must be executed. Transportation takes about 0.5 day. Execution of a task takes on average 4 days. The execution time follows a uniform distribution between 1 and 7 days. When the last task is finished, the job is transported to packaging and delivered. Packaging takes about 2 days.

Questions:

  • Determine the number of jobs in the job shop
  • Determine the leadtimes of jobs
Although this example can easily be solved analytically, we make a simulation model as a first step for further research of scheduling mechanisms. We distinguish 4 active elements:
  1. An element to prepare jobs.
  2. An element to transport jobs.
  3. An element to execute tasks
  4. An element for packaging.
See the figure below.

And of course we need a generator element. This leads to 5 process descriptions. They are given below in a kind of pseudo Delphi code. You can find a syntactically correct and working model in the examples section.

Procedure Generator.Process
Begin
  • While TRUE Do
  • Begin
    • Hold(Exponential(1/3).Sample);
    • NewJob:=Job.Create('Job');
    • NrOfTasks:=Round(Normal(5,1).Sample);
    • While NrOfTasks > 0 Do
    • Begin
      • NewTask:=Task.Create('Task');
      • NewTask.Duration:=Uniform(1,7).Sample;
      • Put NewTask to tail of NewJob.TaskList;
      • Dec(NrOfTasks);
    • End;
    • Put NewJob to tail of Prepare.JobList;
  • End;
End;

Procedure Prepare.Process
Begin

  • While TRUE Do
  • Begin
    • While Length of JobList = 0 StandBy;
    • Job:=First of JobList;
    • Hold(ArrivalTime of Job in JobList + 1 - Now);
    • Remove Job from JobList;
    • Put Job to tail Of Transport.JobList;
  • End;
End;

Procedure Transport.Process
Begin

  • While TRUE Do
  • Begin
    • While Length of JobList = 0 StandBy;
    • Job:=First of JobList;
    • Hold(ArrivalTime of Job in JobList + 0.5 - Now);
    • Remove Job from JobList
    • If Length Of Job.TaskList = 0 Then
      • Put Job to tail of Package.JobList
    • Else
    • Begin
      • Task:=First Of Job.TaskList
      • Put Job in Execute.JobList sorted on Now + Task.Duration;
      • If Job is First of Execute.JobList Then
      • Begin
        • Cancel Execute;
        • Start Execute;
      • End;
    • End;
  • End;
End;

Procedure Execute.Process
Begin

  • While TRUE Do
  • Begin
    • While Length of JobList = 0 StandBy;
    • Job:=First of JobList;
    • Task:=First of Job.TaskList;
    • Hold(ArrivalTime of Job in JobList + Task.Duration - Now);
    • Remove Task From TaskList;
    • Free Task;
    • Remove Job from JobList;
    • Put Job to tail Of Transport.JobList;
  • End;
End;

Procedure Package.Process
Begin

  • While TRUE Do
  • Begin
    • While Length of JobList = 0 StandBy;
    • Job:=First of JobList;
    • Hold(ArrivalTime of Job in JobList + 2 - Now);
    • Remove Job from JobList;
    • "Deliver" Job
  • End;
End;