General Purpose Simulation System (GPSS) is a discrete time simulation general-purpose programming language, where a simulation clock advances in discrete steps. A system is modelled as transactions enter the system and are passed from one service (represented by blocks) to another. It is used primarily as a process flow oriented simulation language; this is particularly well-suited for problems such as a factory.

History

GPSS was developed by IBM's Geoffrey Gordon at the beginning of the 1960s. He named it Gordon's Programmable Simulation System. The name was changed when IBM decided to release it as a product.

GPSS

GPSS was influenced by Gordon's experience simulating with analog computers. The "General Purpose" part of the new name was to create a standard in waiting-line simulations.

GPSS

The original releases were for IBM's 7044 & 7090 mainframes. Subsequently, there were releases for IBM 360, Univac 1108 and CDC.

GPSS

Over time, other implementations, in other languages and targeted at different size systems, were developed, including DEC's VAX, a specialized APL version for large-scale Univac systems, and Macintosh, among others.

JGPSS

GPSS (Java General Purpose Simulation System) is a Java-based tool that was developed to teach the GPSS simulation language.

Language description

GPSS resembles a LEGO structure where blocks are chosen by the modeller for specific functions to imitate a particular system.

The language is neither procedural, object-oriented or functional programming. The world is simulated with entities moving through the model. These entities, called Transactions, are envisioned as moving from Block to Block, where a Block is a line of code and represents unit actions that affects the Transaction itself or other entities.

Blocks can be facility-oriented (such as machines in a job shop) or transaction-oriented (such parts of work-in-process, signals in electronic components or documents in a bureaucratic procedure). GPSS automatically keep track of statistics which brings in fixed form at the end of a simulation as standard report. GPSS is one of the oldest language candidate of first object-oriented approach because while transactions are truly instances of model objects, blocks are methods in the modern concept of OOP.

Entities can be broadly classified in Resources, Computational entities and Statistical entities. Resources, like Facilities and Storages represent limited capacity resources. Computational entities, like Ampervariables (variables), Functions and random generators are used to represent the state of Transactions or elements of their environment. Statistical entities, like Queues or Tables (histograms) collect statistical information of interest.

Sample code

The following example, taken from Simulation using GPSS, is the "Hello world!" of GPSS and will illustrate the main concepts.

The aim is to simulate one day of operation of a barber shop. Customers arrive in a random constant flow, enter the shop, queue if the barber is busy, get their hair cut on a first-come first-served basis, and then leave the shop. We wish to know the average and maximum waiting line, as well as the number of customers. SIMULATE ; Define model * * Model segment 1 * GENERATE 18,6 ; Customer arrive every 18±6 mn QUEUE Chairs ; Enter the line SEIZE Joe ; Capture the barber DEPART Chairs ; Leave the line ADVANCE 16,4 ; Get a hair cut in 16±4 mn RELEASE Joe ; Free the barber TERMINATE ; Leave the shop * * Model segment 2 * GENERATE 480 ; Timer arrives at time = 480 mn TERMINATE 1 ; Shut off the run * * Control cards * START 1 ; Start one run END ; End model The "program" is comprised between the SIMULATE and END statements, and is divided into "model segments" and "control cards".

The first segment models customers. The GENERATE block creates a flow of Transactions and schedules them to enter the model with an inter-arrival time uniformly distributed over the range 18±6. It is the programmer's responsibility to interpret these transaction as customers and to understand that the time is to be counted in minutes. The Transactions start their existence in the GENERATE block and progress from Block to Block, according to certain rules, until they reach a TERMINATE which remove them from the model.