# Description

REWORK1.MOD models a system where parts sometimes need to be reworked after they are processed. This situation is most common when layers of material are applied to a part, as in a painting operation. The main changes needed in the carwash model to create this new model are to add a feedback loop in the form of an edge going from LEAVE to a new vertex called REWORK and another edge from REWORK back to START as shown in the Event Relationship Graph.

This model illustrates problems that may occur when two events are scheduled at the same time, see the Comments section. Several popular professional simulation languages have no mechanism for breaking ties in the times that simultaneous events are scheduled. This is a bigger problem than one might think at first glance, since in a "balanced" system, time ties are intentionally designed into the system. The so-called Just In Time production systems invented in Japan are examples.

# State Variables

State Variables in REWORK1.MOD
Variable Name Abbreviation Variable Description
QUEUE Q Number of jobs in line 1 Integer
SERVERS S Number of servers available 1 Integer
P P probability of a part needing rework 1 Real

# Vertices

Vertices in REWORK1.MOD
Vertex Name Vertex Description State Changes
RUN The simulation is started None
ENTER Arrival of a job Q=Q+1
START Service starts S=S-1, Q=Q-1
LEAVE Service ends S=S+1
REWORK Reworking of a part Q=Q+1

# Initialization Conditions

Initialization Conditions in REWORK1.MOD
Variable Description
QUEUE Initial number of jobs in line
P Probability of a part needing rework

# English Translation

An English translation is a verbal description of a model, automatically generated by SIGMA.

```The SIGMA Model, REWORK1.MOD, is a discrete event simulation.
It models A DETERMINISTIC QUEUE WITH POSSIBLE REWORK.
```
```I. STATE VARIABLE DEFINITIONS.
```
```For this simulation, the following state variables are defined:
```
```  QUEUE: THE NUMBER OF JOBS WAITING IN LINE   (integer valued)
SERVER: SERVER STATUS (IDLE/BUSY=1/0)   (integer valued)
P: PROBABILITY OF A PART NEEDING REWORK  (real valued)
```
```II. EVENT DEFINITIONS.
```
```Simulation state changes are represented by event vertices (nodes or balls) in a SIGMA graph.
Event vertex parameters, if any, are given in parentheses. Logical and dynamic relationships
between pairs of events are represented in a SIGMA graph by edges (arrows) between event vertices.
Unless otherwise stated, vertex execution priorities, to break time ties, are equal to 5.
```
```1. The RUN(QUEUE,P) event occurs when START OF THE RUN.
Initial values for, QUEUE,P, are needed for each run.
This event causes the following state change(s):
SERVER=1
After every occurrence of the RUN event:
Unconditionally, INITIATE THE FIRST JOB ARRIVAL;
that is, schedule the ENTER() event to occur without delay.
```
```2. The ENTER() event occurs when ARRIVAL OF A JOB.
This event causes the following state change(s):
QUEUE=QUEUE+1
After every occurrence of the ENTER event:
Unconditionally, SCHEDULE THE NEXT ARRIVAL;
that is, schedule the ENTER() event to occur in 3+5*RND time units.
(Time ties are broken by an execution priority of 6.)
If SERVER>0, then START SERVICE;
that is, schedule the START() event to occur without delay.
```
```3. The START() event occurs when START OF SERVICE.
This event causes the following state change(s):
SERVER=0
QUEUE=QUEUE-1
After every occurrence of the START event:
Unconditionally, THE JOB IS PROCESSED FOR 5 MINUTES;
that is, schedule the LEAVE() event to occur in 3 time units.
(Time ties are broken by an execution priority of 6.)
```
```4. The LEAVE() event occurs when END OF SERVICE.
This event causes the following state change(s):
SERVER=1
After every occurrence of the LEAVE event:
If QUEUE>0, then START PROCESSING THE WAITING JOB;
that is, schedule the START() event to occur without delay.
If RND < P, then REWORK IS NEEDED, THE JOB RE-ENTERS THE QUEUE;
that is, schedule the REWRK() event to occur without delay.
(Time ties are broken by an execution priority of 6.)
```
```5. The REWRK() event occurs when REWORKING OF A PART.
This event causes the following state change(s):
QUEUE=QUEUE+1
After every occurrence of the REWRK event:
If SERVER>0, then START REWORKING THE PART;
that is, schedule the START() event to occur without delay.
```