Simulation Toolboxes
for Computer Science 301a
Simulation Techniques
adapted by Lin Jensen, Bishop's University and students from
System simulation; programming styles and languages, Wolfgang Kreutzer, 1986
Index
Documentation:
The following are Pascal Units, they are ASCII text files:
- CLOCK object - needed by all simulations.
- QUEUE: General lists: fifo, stack, ordered
You declare type of list elements, and virtual methods to determine ordering and equality.
- SIMOBJ: Simulation objects -
when initialized, they link themselves into a list. After that,
global reset and report can be done. - used by all the other units.
- MCOBJ:
Monte Carlo objects -
Random number generators
- STATOBJ: Statistical instrumentation ..as objects
- QNETOBJ: Queueing network scenarios
Sources, sinks, transactions, and servers
Servers can now be "Unavailable" with
corresponding statistics.
- DIS_EV: Discrete event systems - event-based library.
An event list,
ordered by time, is maintained, and a monitor calls the appropriate event procedures.
(this unit uses some type declarations in QNET.)
- COPROC: Co-procedures
Context switching between "processes"
- some tricky assembly language code, each process has
it's own life cycle implemented as a procedure, and
this code switches control and stacks between them.
- PROC_MAN: Process manager
Allows processes to suspend themselves, go to sleep,
wait in (semaphore) queues,
and go to sleep (ultimately causing the clock to advance).
- MESSAGE: Synchronization by
Message passing, a higher level built upon semaphores, allows
processes to communicate with one another.
- RESOURCE: Synchronization by
resource acquisition. Waiting for the resource (a
server) is implicit, using a semaphore queue. A resource can also
be made unavailable.
- ANIMATOR: Animating simulations.
Provides animator object, which maintains a list of AnimationObj's
and displays them on the screen at regular (real) time slices.
In particular, a queue is shown as a variable length bar.
USEBIOS: Screen stuff, not a simulation
toolbox, but a general purpose unit for Clearing screen, positioning cursor,
writing Prompts for user input, and waiting for a keypress,
without losing output file redirection capability.
USES heirachy:
SIMOBJ QUEUE CLOCK
\ | /
QNETOBJ ------ COPROC ---- STATOBJ ---- MCOBJ
| |
PROC_MAN
/ | \
MESSAGE RESOURCE ANIMATOR
all the toolboxes assume a global variable TheClock, declared as one of the types
in CLOCK.
Ordering of units: SIMOBJ must appear in the USES statement before
PROC_MAN, because the Reporter global object must be initialized before Monitor.
Main program examples:
Please note:
- The file COPROC.PAS is incompatible with Turbo Pascal 6.0, the proper
version for it is named coproc.v60
Last updated 17 November 1996 corrected 22 November 2002
Up to top of this document
Back to Simulation notes.
Comments, etc, send to
ljensen at ubishops.ca