18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Discrete Simulation Concepts<br />

5.3 The Simulation Mechanism<br />

A <strong>SIMSCRIPT</strong> <strong>II.5</strong> simulation is controlled by the timing routine that organizes the execution of<br />

event and process routines in simulated time. Every simulation program must contain the statement:<br />

start simulation<br />

which passes control of further program execution to this timing routine. In order to set the system<br />

in motion, the model must have been initialized by previously executed statements, defining the initial<br />

state of the system and scheduling one or more initial events or process activities. The overall<br />

outline of a <strong>SIMSCRIPT</strong> <strong>II.5</strong> simulation model will generally have the form:<br />

declarations<br />

initialization of system variables, entities and sets<br />

scheduling of initializing processes and events<br />

start simulation<br />

terminating control statements<br />

The statement start simulation passes control to the simulation timing mechanism. For the<br />

purpose of explaining the simulation mechanism, events and event notices are considered. The timing<br />

mechanism for a process behaves in the same way, but a process may be considered to comprise<br />

a sequence of events occurring over a period of time. The timing mechanism removes the most imminent<br />

event notice from the future events set, updates the simulation time to the event time indicated,<br />

and passes control to the routine for this event. Upon completion of this event, the timing<br />

routine again turns to the future events set to determine the next event routine to be executed. This<br />

sequencing continues until all event notices in the future events set are exhausted. When this happens,<br />

control is returned to the statement directly after the start simulation statement. It must<br />

be remembered that statements executed during event and process routines may be continually interacting<br />

with the future events set, dynamically scheduling further events.<br />

As long as there are events to be executed, the timing routine, initiated by the start simulation<br />

statement, is in control. The common way to end a simulation is to cease scheduling future events<br />

and let the timing mechanism exhaust the contents of the future events set. Another method, of<br />

course, is to halt all execution, using a stop statement within some scheduled event or process routine.<br />

The future events set, shown in figure 5-5, in which event and process notices are filed, is in fact a<br />

singly subscripted set. Each subscript value denotes a different process or event class. In a simulation<br />

declared to have six different event classes, there are six "parallel" event sets. Each event<br />

class has a global variable, i.event, associated with it, denoting the subscript value of the event<br />

class. These values are assigned, usually, by order of declaration of event classes, but may be altered<br />

by priority statements.<br />

193

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!