Simulation Programming Notes

Survey of simulation programming languages

Lin Jensen, Bishop's University
Computer Science 301a, Simulation Techniques, Fall 1996

SIMULA

Developed in Sweden specifically for simulation, SIMULA has the honour of being the first object-oriented language. The syntax is based on ALGOL 60, more closely than Pascal is. The language is designed to be extendable by classes, providing programming tools for specific needs, for example: simulation, discrete-event systems, and combined simulations.

All SIMULA programs work by coroutines, resume transfers control from one coroutine to another. Detach makes an object independent of, and returns control to its creator.

Class simset adds list processing facilities.

Class simulation adds queues and adgendas, random number generators, a clock, statistics gathering, and other utilities. Processes are the simulation coroutines. There are statements to activate, reactivate, hold, passivate, wait, or cancel processes.

Class miniQNcontext has many of the features also found in Kreutzer's toolboxes. (With more flexibility than allowed by standard Pascal, of course.)

Class DEMOS (Discrete Event Modeling On Simula) has many useful and convenient methods for process synchronization. Statistics are automatically collected and written. See more on patterns of process synchronization including how to do it with the Pascal toolboxes in the next file.


GPSS

"General Purpose Simulation System", one of the oldest simulation languages, is still in widespread use, just like Fortran, out of which it arose. It features automatic report generation, and a large number of "blocks" and entities tailored to discrete-event, queuing network scenarios.

In GPSS, transactions are the basic units being manipulated. They are created in GENERATE blocks, flow from block to block in the model, and are removed by TERMINATE blocks. Along the way they may be forced to wait for resources, wait for gates to open, put themselves into chains (true queues, to us), transfer to blocks other than the normal next block in the model (in effect, a GO TO).

With each kind of block there is an associated symbol, and GPSS models are often drawn as flowcharts using these symbols (as was popular with early Fortran programmers.) Most blocks occur in pairs, relating a single entity, for example, a single server is called a facility, and a transaction can seize and then release a named facility. A storage models a server with multiple capacity. A transaction can enter and leave a storage. The advance block is not paired, it holds a transaction for a period of time (advance the clock).

While simple GPSS models are quick and easy to build, there are no facilities for program structuring. Any transaction can transfer to any block in the model, and diagrams of complex models tend to look like a plate of spaghetti. Anything not forseen by the developers is ackward to incorporate (Fortran subroutines can be called.) The developers did forsee quite a lot, leading to a large community of satisfied, if not happy, habitual users.


And now the NEW stuff!

SmallTalk


Prolog & Trilogy


Last updated 17 November 1996

Up to top of this document
Back to Simulation notes
To Toolbox index
Back to Lin Jensen's home page. Comments, etc, send to

ljensenn at ubishops.ca