0% found this document useful (0 votes)
67 views25 pages

Gpss

The General Purpose Simulation System (GPSS) is a simulation language developed by IBM, first published in 1961, with its latest version being GPSS V. The system utilizes block diagrams to represent activities and their sequences, where transactions move through blocks based on defined action times and conditions. GPSS allows for the simulation of various systems by creating and managing transactions, with specific blocks for generating, processing, and terminating these transactions.

Uploaded by

RajKumarThakur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
67 views25 pages

Gpss

The General Purpose Simulation System (GPSS) is a simulation language developed by IBM, first published in 1961, with its latest version being GPSS V. The system utilizes block diagrams to represent activities and their sequences, where transactions move through blocks based on defined action times and conditions. GPSS allows for the simulation of various systems by creating and managing transactions, with specific blocks for generating, processing, and terminating these transactions.

Uploaded by

RajKumarThakur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

9

INTRODUCTION
TO GPSS

9-1
GPSS Programs

The General Purpose Simulation System language' has been developed over
many years. principally by the IBM Corporation. Originally published in 1961 (2),
it has evolved through sEveral versions (I), 5),(4), to the latest version, (3). It has
been implemented on several different manufacturers machines, and there
are
variations in the different implementations. With regard to the successive IBM
versions of the language, all but GPSS/360 and GPSS V, are obsolete. Of the two
current versions, GPSS/360 models can operate with GPSS V, with some minor
exceptions and modiñcations. GPSS V, however, is more powerful and has more
language statements and facilities. The differences are described in Appendix 7 of
3). If these extensions are avoided, GPSS V models will run under
The description given in this and the next GPSS/360.
chapter will be of GPSS V as imple
ented by the IBM
Corporation, (6), (, (8). Some of the more significant differ
ences between GPSS/360 and GPSS V will be noted. For simplicity, the language
will be called GPSS, except where comparisons are being made.
in earlier ersions of the
program, GPSS stood for General Purpose System Simulation.

197

i iuiasska
Introduction to GPSS | Ch.9
198

9-2
General Description
described as a block diagram in which
The system to be simulated in GPSS is
the blocks indicate the sequence
the blocks represent the activities, and lines joining
there is a choice ofl activities, more
in which the activities can be executed. Where
for the choice is stated at the block.
than one line leaves a block and the condition
is, of course, very familiar.
The use of block diagrams to describe systems
However, the form taken by a block diagram
description usually depends upon the
on this
person drawing the block diagram.
To base a programming language
meaning. The approach
descriptive method, each block must be given precise
a

taken in GPSS is to define a set of 48 specific block types,


eachof which representsa
user must draw a block diagram of
characteristic action of systems. The program
the system using only these block types.
of the block action and is
Each block type is given a name that is descriptive
9-1 shows the symbols used for the
represented by a particular symbol. Figure
block types that will be described in this and the next chapter. To assist the reader,

the block diagrams drawn in this chapterwill name the block types, although thisis
not usually done by a programmer familiar
with GPSS. Coding instructions for all
in Table 9-1. Table 9-2
the described block types are similarly brought together
number of data fields. As
describes the control statements. Each block type has a
the blocks are described, the fields will be referred to as field A, B, C, and so on,
reflecting the order in which they are specified.
Moving through the system being simulated are entities that depend upon the
nature of the system. For example, a communication system is concerned with the
movement of messages, a road transportation system with motor vehicles, a data

processing system with records, and so on. In the simulation, these entities are
called transactions. The sequence of events in real time is reflected in the movement
of transactions from block to block in simulated time.
Transactions are created at one or more GENERATE blocks and are removed
from the simulation at TERMINATE blocks. There can be many transactions
simultaneously moving through the block diagram. Each transaction is always
posiioned at a block and most blocks can hold many transactions simultaneously.
The dransfer of a transaction from one block to another occurs instantaneously at a
specific time or when some change of system condition occurs.
A GPSS block diagram can consist of many blocks up to some limit prescribed
by the program (usually set to 1,000). An identification number called a location is
given to each block, and the movement of transactions is usually from one block to
the block with the next highest location. The locations are assigned automatically
by an assembly program within GPSS so that, when a problem is coded, the blocks
A. B

ADVANCE
A
LINK
SEIZE

A, B. C, D
X
B

ASSIGN LOGIC NIV


TABULATE
SAR EPAL
B NG&TECH
EPAL
DEPART
MARK TERMINATE

ENTER PRIORITYY TEST

B See
Table 10-2
GATE QUEUE TRANSFER

A, B
D
c. D.E
GENERATE RELEASE UNLINK

A. B.C
LEAVE SAVEVALUE

Flgure 9-1. GPSS block-dliagramsymbols

199
PSS
Operation C D F

ADVANCE Mean Modifier


ASSIGN Param. No. (+) Source
DEPART
(Funct. No.) Param. type
Queue No. (Units)
ENTER Storage No. (Units)
GATEt ltem No. (Next block B)
GENERATTE Mean Modifier
LEAVE
(Offset) (Cou (Priority) (Params.)
Storage No. (Units)
LINK Chain No. Order (Next block B)
LOGIC
Switch No.
MARK (Param. No.)
PRIORITY Priority
QUEUE Queue No.
RELEASE
(Units)
Facility No.
SAVEVALUE S.V. No. (A) SNA
SEIZE Facility No.
TABULATE Table No. (Units)
TERMINATE (Units)
TEST Arg. 1 Arg. 2 (Next block B)
TRANSFER Sclect. Factor Next block A Next block B
UNLINK Chain No. Next block A Count (Param. No.) (Arg.) (Next block B)
tColumns 13 and 14. See Sec. 10-7 for codes.
indicates optional field.
Sec. 9-3 Action Times

201
TABLE1 GPSS Centrol
Location Operation A
B D

CLEAR
END

Function No. FUNCTION


Argument No. of
Points
INITIAL Entity Value
JOB
RESET
SIMULATE
START Run Count
Storage NNo. (NP)
STORAGE Capacity
Table No. TABLE
Argument Lower limit Interval No. of
intervals

are listed in sequential order. Blocks that need to be identified in the programming
of problems (for example, as points to which a transfer is to be made) are given a
symbolic name. The assembly program will associate the name with the appropriate
location. Symbolic names of blocks and other entities of the program must be from
three to five non-blank characters of which the first three must be letters.

9-3
Action Times

Clock time is represented by an integral number, with the interval of real time
corresponding to a unit of time chosen by the program user. The unit of time is not
specifically stated but is implied by giving all times in terms of the same unit. One
block type called ADVANCE is concerned with representing the expenditure oftime.
The program computes an interval of time called an action time for each transaction
as it enters an ADVANCE block, and the transaction remains at the block for this
interval of simulated time before attempting to proceed. The only other block type
that employs action time is the GENERATE block, which creates transactions. The
action time at the GENERATE block controls the interval betweensucessivearrivals
of transactions.
The action time may be a fîxed interval (including zero) or a random variable,
and it caa be made to depend upon conditions in the system in various ways. An

ribed in detail, is the only other block


A block type called SPLIT, which will not be de
It creates copies of transactions that enter the block.
type that can create transactions.
Introductionto GPSS Ch. 9
202

and modifier as the A and B fields for the


action time is defined by giving a mean
constant equal to the mean. If the
block. If the modifier is zero, the action time is a

action time is an integer random


modifier is a positive number (S mean), the
with equal probabilities given to
variable chosen from the range mean t modifier,
uniform distribution is an acurate
each number in the range. Sometimes, this
but the principal purpose in
representation of a random process in the system,
for cases where
random time is to allow
providing this way of representing a available on the
randomness is known to exist but no
detailed information is
probability distribution.
It is possible to introduce numbera functions, which are tables of numbers
of
variable. Details of the functions are given
relating an input variable to an output
ADVANCE or GENERATE block to be
in Sec. 10-3. By specifying the modifier at an
a function, the value of the function
controls the action time. The action time is
the function. Various types of input
derived by multiplying the mean by the value of
can be used for the functions, allowing
the functions to introduce a variety of
by making the function
relationships among the variables of a system. In particular, as
an inverse cumulative probability distribution,
and using input a random
function can provide a stochastic
number which is uniformly distributed, the
variable with a particular nonuniform distribution
in the manner described in
Sec. 6-10.
The GENERATE block normally begins creating transactions from zero time,
and continues to generate them throughout the simulation. The C field, however,
as the time when the first transaction will
can be used to specify an offset time
number of transactions
arrive. If the D field is used, it specifies a limit to the total
that will come from the block.
explained in Sec. 10-1, transactions have a priority level and they
can
As will be
E field determines the of thepriority
carry items of data called parameters. The
transactions at the time of creation. If it is not used, the priority is of the lowest
level.
Parameters can exist in four formats. They can be signed integers of fullword.
halfword, or byte size, or they can be signed floating-point numbers. If no speciñc
assignment of parameter type is made, the program creates transactions with 12
halfword parameters. Any number of parameters (including zero) of any type, up
to a limit of 255, can be specified by using ficlds F, G, H, and I of the GENERAT
block. The symbol nPx will call for n parameters of type x, where x takes the value
F, H, B, or L for fullword, halfword, byte size, and floating-point, respectively.
For the examples used here, there are no spcial requirements for
parameter
types. The default case.of 12 halfword parameters, therefore, will be used. The C
D, and E fields, also, will not be needed. In such cases, where only the A and B

GPSS/360 allows up to 100 parameters of either halfword or fullword size (but not both)
to be specified. If no speciñic assignment is made, 12 halfword parameters are assumed
Sec. 9-5 /Choice of Paths
203

fields are needed, the flag attached to the symbol for the GENERATE block, shown
in Fig. 9-1, is dropped.

9-4
Succession of Events

The program maintains records of when each transaction in the system is due to
move. It proceeds by completing all movements that are scheduled for execution
at a particular instant of time and that can logically be performed. Where there is
more than one transaction due to move, the program processes transactions in the
order of their priority class, and on a first-come, first-served basis within priority
class.
Normally, a transaction spends no time at a block other than at an ADVANCE
block. Once the program has begun moving a transaction, therefore, it continues to
move the transaction through the block diagram until one of several circumstances
arises. The transaction may enter an ADVANCE block with a non-zero action time,
in which case, the program will turn its attention to other transactions in the system
and return to that transaction when the action time has been expended. Secondly,
the conditions in the system may be such that the action the transaction is attempt-
ing to execute by entering a block cannot be performed at the current time. The
transaction is said to be blocked and it remains at the block it last entered. The
program will automatically detect when the blocking condition has been removed
and will start to move the transaction again at that time. A third possibility is that
the transaction enters a TERMINATE block, in which case it is removed from the

simulation A fourth posibility is that a transaction may be put on a chain. his


concept will be explained in the next chapter.
When the program has moved one transaction as far as it can go, it turns its
attention to any other transactions due to move at the same time instant. If all such
movements are complete, the program advances the clock to the time of the next
most imminent event and repeats the process of executing events

9-5
Choice of Paths
The TRANSFER block allows some location other than the next sequential
location to be selected. The choice is normally between two blocks referred to as
next blocks A and B (the terms exits I and 2 are also used). The method used for

The only other block type that can destroy a transaction is the ASSEM8LE block, which
waits for a specified number of transaction copies that were created at a SPLIT block to arrive
before allowing one copy to proceed while the rest are destroyed. See footnote 2, this chapter.

itigitit
Introduction to GPSS Ch.9
204

of the TRANSFER block. It can


choosing is indicated by a selection factor in field
A
and B are placed in fields B
be set to indicate one of nine choices. Next blocks A
selection factor is left blank.
If choice is to be made, the
and C, respectively. no
block A.
An unconditional transfer is then made to next
here. Others will be
will be described
Of the other modes of choice, only two
be made by setting
A random choice can
described in Sec. 10-5 (see also Table 10-2).
fraction. The probability of going to
the selection factor, S, to a three-digit decimal
is S. A conditional mode,
next block A is then 1- S, and to
the next block B it
select an alternate
allows a transaction to
indicated by setting field A to BOTH,
to next block A if
conditions. The transaction goes
path depending upon existing moves are impossibie,
this move is possible, and to next block
B if it is not. If both
to A in the
the transaction waits for the first to
become possible, giving preference

event of simultaneity.

9-6
Simulation of a Manufacturing Shop
described so far, consider the foilowing
To illustrate the features of the program
is turning out parts at
example. A machine tool in a manufacturing shop
simple to an inspector,
are finished, the parts go
the rate of one every 5 minutes. As they
about 10% of the parts.
who takes 4 3 minutes to examine each one and rejects
and the time unit selected for the
Each part will be represented by one transaction,
problem will be 1 minute.
is shown in Fig. 9-2. The usual
A block diagram representing the system

GENERATE 5. 0

ADVANCE 4.3

TRANSFER 0.

ACC REJ

TERMINATE

Figure9-2. Manufacturing shop model 1.


Sec. 9-6 Simutation of a Manufacturing ShopP
205

convention used in
drawing blocks is to place the block
the top of the block; the action time is indicated
location (where needed) at
in the center in the form T= a,
where a is the mean and b is the modifier; and the b
bottom of the block. selection factor is placed at the
A GENERATE Block is used to
represent the output of the machine by
one transaction
every five units of time. An creating
ADVANCE block with a mean of 4 and
modifier of 3 is used to represent inspection. The time spent on inspection will
therefore be any one of the values 1, 2, 3, 4, 5, 6, or 7, with
to cach vaiue. Upon completion of the
equal probability given
inspection, transactions go to a TRANSFER
block with a selection factor of 0.1, so that 90%
of the parts go to the next location
(exit 1) calied ACC, to represent accepted parts and 10% go to another location
(exit 2) called REJ to represent rejects. Since there is no further interest in
following
the history of the parts in this simulation, both locations reached from the
TRANSFER block are TERMINATE blocks.
The problem can be coded in a fixed format, as shown in Fig. 9-3. Column I iss
only used for a comment card. An in column i results in the statement being
printed in the output only. A field from columns 2 to 6 contains the location of the
block where it is necessary for it to be specified. The GPSS program will automat-
ically assign sequential location numbers as it reads the statements, so it is not

0CATO L AON 1c0

AMEASNRIMAsMorMoDEL
GENERAT ATEPART
ADvANCE
RANSFER AAGCE 5ELECT REJECTS
ACC.TERMINATE ACCEPTEO PARTS
REJTE,RMIAATE, . REJECTED PARTS
S.TART g0

Figure 9-3. Coding of model 1.


Introduction to GPSS Ch.9
206

The TRANSFER block, however


usually for the user to assign locations.
will neednecessary
to make reference to the TERMINATE blocks to which it sendstransac
names ACC and REJ.
tions, so given symbolic location
these blocks have been
contains the block type
columns 8 to 18,
The second section of the coding, from
at column 19, a series
of fields may
name, which must begin in column 8. Beginning
no embedded blanks. Anything
be present, each separated by commas and having
The meaning of the fields depends
following the first blank is treated as a comment.
summarizes the information
for all the block types
upon the block type. Table 9-1
references to some block types that will
that will be described. The table includes
be described in the next chapter.
in which the location field, if
The program also accepts input in a free format,
other fields has a fixed starting position.
used. begins in column 1; but none of the
location field to the operation
Instead a marks the transition from the
single blank
If no location is specified, an
field, and from the operation field to the operands.
convenient when entering input from a
initial blank is used. The free format is very
characters that have to be entered. The
terminal, since it minimizes the number of
therefore it will be used for the
fixed format, however, is much easier to read,
examples given here.
Codingfor the GENERATE and ADVANCE blocks was explained
in Sec. 9-3
selection factor, and the B and C
For the TRANSFER block, the first field is the
fields are exits 1 and 2, respectively. In this case, exit 1 is the next sequential block,
and it would be permissible the name ACC in both the TRANSFER ffeld B
to omit
and the location field of the first TERMINATE block. Both commas must, however,
be punched to show that field B is missing, so that the TRANSFER block would
then be coded:TRANSFER.1,REJ.Itshould also be noted that when a TRANSFER
block is used in an unconditional mode, so that field A is not specified, a comma
must still be included te indicate the field. Thus an unconditional transfer to REJ
would be coded as follows, TRANSFER ,REJ.
The program runs until a certain count is reached as a result of transactions
terminating. Field A of the TERMINATE block carries a number indicating by how
much the termination count should be incremented when a transaction terminates
at that block. The number must be positive and it can be zero, but there must be at
least one TERMINATE block that has a non-zero field A. In this case, both
TERMINATE blocks have 1; so the terminating counter will add up the total
number of transactions that terminate, in other words, the total number of both
good and bad parts inspected.
st line shown in Fig. 9.3 is for a control statement called START, which
indicates the end of the problem definition and contains, in field A, the value the
terminating counter is to reach to end the simulation. In this case the START
tement is set to stop the simulation ata count of I,000. Upon reading a STAR
statement, the program begins executing the simulation.
Sec, 9-6 / Simulation of a
Manufacturing Shop
207
When the simulation is
completed,
the
report, in a
prearranged format, unless it hasprogram automatically prints an output
been instructed
automatically generated for the problem just programmed isotherwise.
shown in
The output
9-4. Fig.
BLOCK

NUMBER LOC OPBRATION A,B,C,D, E,F,G,8,I STATEMZT


SIMULATE COMDENTs NUMBER
MANUFACTURING SHOP MODEL
GENERATE CREATE PARTS
ADVANCE INSPECTT
TRANSFER 1,ACCREJ SELECT REJBCTS
ACC TERMINATE 1
ACCEPTED PARTS
REJ TERMINATE REJECTED PARTts
START 1000 RUN 1000 PARTS

CROSS-REF ER ENCE
BLOCKS
SYMBOL NUMBER REFERENCES
ACC
REJ

SIMULATE

MANUFACTURING SHOP MoDEL 1

GENERATE
ADVANCE ,3
TRANSFER 100,4,5
TERMINATE 1
TERMINATE 1

START 1000

RELATIVE CLOCKK 5005 ABSOLUTE CLOCK 5005


BLOCK CoUNTS
BLOCK CURRENT TOTAL
1001
1001
1000
888
112

Figure 9-4. Output for model 1.

The problem input is printed first, with the locations assigned by the program
isted to the left, and a sequential statement number on the right. A table of
symbolic locations is then given showing the locations assigned to each symbol. To
help the user, the number of the statements that refer to that symbol are also given.
A listing of the assembled problem then follows with all symbolic references
Teplaced by numbers.
The first line of output following the listings gives the timo at waich the simula-
tion stopped. The meaning of the absolute and relative times, which in this case
have the same value, will be explained in Sec. 9-10. The time is followed by a listing
of block counts. Two numbers are shown for each block of the model. On the left
Introduction to GPSS Ch. 9
208

Is a count of how many transactions were in the block at the time the simulation
stopped, and on the right is a figure showing the total number of transactions that
entered the block during the simulation. The results show that the total counts at
blocks 4 and 5 were 888 and 112 respectively, showing that of the 1,000 parts
inspected, 88.8 were accepted and 11.2% were rejected. In the present example,
this is the only output given. Other types of output will be described as more details

of the program are explained.


The symbol tables and the assembled form of the input can be suppressed, and

defined. It is also possible to


usually are, once a problem has been correctly
suppress the entire automatic output, and
substitute a report defined by the user
with an output editor. This allows any item of information that normally appears in
the automatic output to be selected, together with any of the items of data called
SNA's, which will be described in Chap. 10. These items of data can be arranged in
and headings supplied by the user. It is also
any format, along with comments
possible to produce graphic output in the form of printed graphs.
For the examples used here, the standard output will be used, with the symbo
tables and assembled forms suppressed. To save space, the statement numbers will
also be dropped.

9-7
Facilities and Storages

Associated with the system being simulated are many permanent entities, such
as items of equipment, which operate on the transactions. Two types of permanent
entities are defined in GPSS to represent system equipment.
A facility is defined as an entity that can be engaged by a single transaction at a
time. A storage is defined as an entity that can be occupied by many transactions at
a time, up to some predetermined limit. A transaction controlling a facility, how
ever, can be interrupted or preempted by another transaction. In addition, both
facilities and storages can be made unavailable, as would occur if the equipment
they represent breaks down, and can be made available again, as occurs when a
repair has been made.
There can be many instances of each type of entity to a limit set by the program
(usually 300). Individual entities are identified by number, a separate number
sequence being used for each type. The number 0 for these, and all other GPSS
entities, is illegal. The user may assign the numbers, in any order, or he may use
symbolie names and let the assembly program assign the numbers. Some examples
of how the system entities might be interpreted in different systems are:
Sec. 9-7 / Facilities and Storages 209

Type of System Transaction Facility Storage


Communications Message Switch Trunk
Transportation Car Toll booth Road
Data processing Record Key punc Computer
memory

A trunk means a cable, consisting of many wires, which can carry several messages
simultaneously and is therefore represented by a storage. A switch in this case is
assumed to pass only one message at a time and is represented by a facility.
Figure 9-1 shows four block types, SEIZE, RELEASE, ENTER, and LEAVE,
concerned with using facilities and storages. Field A in each case indicates which
facility or storage is intended, and the choice is usually marked in the fag attached
to the symbols of the blocks. The SEIZE block allows a transaction to engage a

facility if it is available. The RELEASE block allows the transaction to disengage


the facility. In an analogous manner, an ENTER block allows a transaction to
occupy space in a storage, if it is available, and the LEAVE block allows it to give up
the space. If the fields B of the ENTER and LEAVE blocks are blank, the storage
contents are changed by 1. Ifthere is a number (21), then the contents change by
that value. Any number of blocks may be placed between the points at which a

and released to simulate the actions that would be taken whilee a


facility is seized
transaction has control of a facility. Similar arrangements apply for making use of

storages.
To illustrate the use of these block types, consider again the manufacturing8
inspection time is 4 minutes and the
shop discussed before. Since the average
average generation rate of parts is one every 5 minutes, there will normally be only
one part inspected at a time. Occasionally, however, a new part can arrive before
the previous part has completed its inspection. With the diagram of Fig. 9-2, this
situation will result in more than one transaction being at the ADVANCE block at
one time, and the simulation must be interpreted as meaning that more than one
inspector is available.
inspector, it is necessary to represent the
Assuming that there is only one
inspector by a facility, to simulate the fact that only one part at a time can be
inspected. The block diagram will then appear as shown in Fig. 9-5. A SEIZE
block and a RELEASE block have been added to simulate the engaging and
disengaging of the inspector.
Coding and results for this model are given in Fig. 9-6. A line of output is given
for each facility, showing how many times it was seized, the average utilization
made of the facility, and the average time transactions held the facility. In this case,
ne results show that the inspector was busy for 73.5% of his time.
GENERATE s.0

SEIZE

ADVANCE 4,3

RELEASE

TRANSFER

ACC REJ

TERMINATE

Figure 9-5. Manufacturing shop model 2.

MANUPACTURING SHOP MODEL 2


GENERATE CREATE PARTS
SEIZE GET INSPECTOR
ADVANCE
3 INSPECT
RELEASE FREE INSPECTOR
TRANSFER 1,ACC REJ SELECT REJECTS
ACC TERMINATE ACCEPTED PARTS
REJ TERMINATE 1 REJECTED PARTS
START 1000 RUN 1000 PARTS
RELATIVE CLOCK S435 ABSOLUTE CILOCK 5435
BLOCK COUNTS
BLOCK CURRENT TOTAL
1001
1000
1000
1000
1000
900
100

PACILITIS

-AVERAGB UTLIZATION DURING


PACILITY NUMBER AVBRGE TOTAL AVA UNAVAIL. CURRENT PERCENT
ENTRIES TIME/TRAN TIME TIME TINE 8TATUS AVAILABILITY
1 1000 3,995 735 100.

Figure 9-6. Coding and results for model 2.


Sec. 9-7 l Facilities and
Storages
211
If more than one
inspector is available,
storage with a
capacity equal to the they can be represented as a group by a
RELEASE blocks of Fig. 9-5 number of
would then be inspectors.
The SEIZE and
block, Suppose, for example, thereplaced by an ENTER and a LEAVE
respectively.
long as before; three inspectors inspection time were three times as
would be justified
listed in Fig.9-7. Note that a control and the modci wouid be coded as
In the location field, it identifies
the storage, and
statement called
STORAGE has been added.
the A field
the storage (S 2, 147, 483,
647). Results for this model are carries the capacity of
A line of output appears for also shown in Fig. 9-1.
each storage,
headings. It shows, for example, that, on thegiving the information indicated in the
busy at any time. average, 2.256 of the inspectors were
The case of a
single inspector, shown in Fig. 9-5, could
using storage
a with have been modeled by
capacity 1 instead of a facility. An
between the two possible important logical difference
representations
that seized the facility can release
is that, for a
facility, only the transaction
it, whereas, for a storage,
can be separate actions carried out independently by different entering and leaving
was made of this property in these transactions. No use
models, but the difference is of importance in
many models.

MANUFACTURING SHOP MODEL 3


GENERATE 5 CREATE PARTS
ENTER GET AN INSPECTOR
ADVANCE
LEAVE
12,9
1
INSPECT
FREE INSPECTOR
TRANSFER 1,ACC, REJ SELECT REJECTS
ACC TERMINATE ACCEPTED PARTSS
REJ TERMINATE REJECTED PARTS

STORAGE 3 NUMBER OF INSPECTORS


START 1000 RUN 1000 PARTS

RELATIVE COCK 5355 ABSOLUTE CLOCK 5355


BLOCK COUNTS
BLOCK CURRENT TOTAL
1003
1002
1002
0 1000
1000
893
107

STORAGESs

S7ORAGE CAPACITY AVERAGE


-AVERAGE
TOTAL
UTILIZATION
AVAIL.
DURING
AVERAGE ENTRIES CURRENTT MAXTMUM
CONTENTS TIME/UNIT TIME TIME CONTENTS
2.256 1002 12.059 752
CONTENTTS

Figure 9-7. Coding and results for model 3.


212 Introduction to GPSS Ch.9

9-8
Gathering Statistics
Certain block types in GPSS are constructed for the purpose of gathering
statistics about the system performance, rather than of representing system actions.
The QUEUE, DEPART, MARK, and TABULATE blocks shown in Fig. 9-1 serve
this purpose. They introduce two other entities of the GPSS program, queues and
tables. As with facilities and storages, there can be many such entities up to a
tables) and they indi-
queues and 100 for
are
prescribed limit (usually, 300 for
vidually identified by a number or symbolic name.
When the conditions for advancing a transaction are not satisfied, several
transactions may be kept waiting at a block. When the conditions are favorable,
first
they are allowed to move on, according to priority and usually by first-in,
a

out rule. No informatior. about the queue of transactions is gathered, however,


unless they have been entered into a queue entity. The QUEUE block increases and
the DEPART block decreases the queue numbered in field A. If field B is blank, the
change is a unit change; otherwise the value of field B (2 1) is used. The program
measures the average and maximum queue lengths and, if required, the distribution
of time spent on the queue.
It is also desirable to measure the length of time taken by transactions to move
through the system or parts of the system, and this can be done with the MARK
and TABULATE blocks. Each of these block types notes the time a transaction
arrives at the block. The MARK block simply notes the time of arrival on the
transaction. (If field A is blank, a special word is used. With nPx in field A, the nth
parameter of type x is used.)" The TABULATE block subtracts the time noted by a
MARK block from the time of arrival at the TABULATE block. The time, referred
to as transit time, is entered in a table whose number or name is indicated in field
A of the TABULATE block. If the transaction entering a TABULATE biock has not
passed through a MARK block, the transit time is derived by using as a base the
time at which the transaction was created. In effect, the transit time ofa transaction
can be regarded as the time the transaction has been in the system, and the action
of the MARK block is to reset the transit time to zero.
To illustrate the use of these blocks, we return to the model of a manufacturing
shop having three inspectors. The properties of the GENERATE block are such
that, if a transaction 1s unable to leave the block at the time it is created, no further
creations are made until the block is cleared. The situation simulated in Fig. 9-4
therefore assumes that if one part arrives when all inspectors are busy, the
machining of further parts stops until the machine is cleared.

In GPSS/360, only the parameter number is given. With parameters, more than one mar
timecan be carried, allowing transit times for
overlapping periods to be carried.
Sec.9-8/ Gathering Statistics
213
A more realistic situation is that parts will
hench if inspectiondoes not finish accumulate on the inspectors'
work
quickly enough. In that case, it would be of
interest to measure the size of the queue of
work that occurs. This can be done as
shown in Fig. 9-8, which expands
upon model 3. A
number 1 is placed immediately before the ENTER QUEUE block using queue
placed immediately after the ENTER block to removeblock, and a DEPART block
the part from the queue when

GENERATE 5.0

Pou
QUEUE

Po OF ENoH
ENTER

ATNAGAR EB
DEPART

MARK

ADVANCE 12.9

LEAVE

TA3ULATE

TRANSFER

ACC REJ

TERMINATE D

Figure 98. Manuacturing shop model 4.


214
Introduction to GPSS |
Ch.3
MODSL 4
MAMUFACTURING
SiIOP

CREATE PARTS
GENERATE 5
QUEUE FOR AN INSPECTOR
EUE GET AN I:NSPECTOR
LNTER LEAVE QUEUE
DEPAR?
MARK 1NS FECT
12,9
ADVANCE FREE INSPECTOR
LEAVE 1EASURE TRANSIT TIME
TADULATE 1
1,ACC,PEEJ SELECT REJECTS
7RANSFER NCCEPTED PARTTS
'TER1INATE 1
ACC REJECTED PARTS
"'RIINATE 1
REJ
:UMBER OF INSPECTORS
SORAGE 3 TADULATION INTERVALS
TABLE 41,5,5,1
UN FOR 1000 PARTS
START 1000
s005 AbsoLUTC CLOCK 5005
RELATIVL CLOCK
BLOCK OOu.*TS BLOCK CURRENT TOTAL
TOTAL
sLOCK CURRENT
1000
108
1Uu
1 000
1000
1000
100
1000
1000
10v
892

STORAGES

-AVERAGE UTILIZATION DURI:-


STORAGE CAPACITY VERAGC EITRIES AVERAGE TTAL AVAIL. CURRENT AXIT"
CONTENTS T/UNIT TI'1E TII cOuTENTS CONTETS
2.394 1 uo 11.982 798

9UEUES

QUEUE AAXIMUN AVLRAGE TOTAL 2ERO PERCET? AVERAGE SAVERAGE CURREYT


CoXTeuTS cONTENTs ENTRIESs ENTRIES 2EROs TIME/TRAVS MNTEN*S
132 1000 758 75,7
TIME/TR\.s
.664 2.747
AVERAGE TIME/TRANS AVERAGE TIME/TRANS EXCLUDING ZER° cTRIES

TABLES

NTRIES IN TABLL MEA ARCUMCNT S'TADARD DEV IATION SUM QP ARGU4ENTS


1,91 5.429 11982.090

5RUD
PREQUENCY
PRCENT
OF TOTAL CUNULATIVE CUMU LATIVE ULTIPLE DEVTATN
F R EA"
PERCENThGL REAINDER OF MEAN
54 15.39 ,235
15.3 4.5 417
60 35.99 363
41,. 58. 6 4
2v 25.09 67.0 32. 1.251 555
9,49 96.5 1.669 1,47
J, 39 2.397
kiMAINIG 100,0 2.os6
PRLgULNCIES ARE ALLL ZERO

Figure 9-9. Coding and results for model 4.


$ec. 9-9 Conditional Transfers
216

acnection begins. Any transaction that does not have to wait for an inspector to
hecome available will move through the queue without delay. Those that must wait
will do so in the OUEUE block," and the program will automatically measure the
length of stay in the queue. Figure 9-8 also shows a MARK and a TABULATE block
nlaced so that they will measure how long the parts take to be inspected. excluding
their waiting time in the queue. If the MARK block is omitted, the tabulated time
is the time since the transactions first entered the system.
Coding for this model, together with results, is shown in Fig. 9-9. Note that
another control statement, called TABLE, has been introduced. In the location
field, it identifies a table; and, in the A field, it indicates the quantity to be tabulated.
In the B, C, and D fields of the TABLE statement are the lower limit of the table, the
tabulation interval size, and the number of intervals, respectively. The definitions
of these terms are the same as those introduced in Sec. 8-10 and illustrated in Fig.
8-13. The symbol M1 in field A of the TABLE card indicates transit time tabulation
It will be seen in Fig. 9-9 that a line of output occurs for each queue, and a
table is printed in accordance with the speciñcations of the TABLE statement. The
TABULATE blocks can be used to gather a variety of other statistics, as will be
explained in Sec. 10-2.

9-9
Conditional Transfers

As a last example in this chapter, we illustrate the use of bth the conditional
and unconditional transfer modes of the TRANSFER block. Consider again the
case of three inspectors but suppose that the manufactured parts are put on a
conveyor, which carries the parts past inspectors, placed at intervals along the
conveyor. It takes 2 minutes for a part to reach the first inspeçtor; if he is free at the
time the part arrives, he takes it for inspection. If he is busy at that uime, the part
takes a further 2 minutes to reach the second inspector who will take the part if he
is not busy. Parts that pass the second inspector may get picked up by the third
inspector, who is a further 2 minutes along the conveyor belt; otherwise. they are
lost. To keep the model small, only the transit time of the parts will be recorded
and the possibility of the inspectors rejecting parts will be ignared.
A block diagram for the system is shown in Fig. 9-10. The movement of pirts
along the conveyor is represented by ADVANCE blocks. cach with an action time
of 2 minutes. As a transaction leaves an ADVANCE block, it tests whether an
nspector is available by entering a TRANSFER block with a selection factor set

The transaction does not have to s , in the QUEUE block in order to stay tn the queue.
ntroduction to GP$S I Ch.g
216
TRANSFER
blocks leads to a SEIZE bloeb
each of these
8OTH. Exit 1 of is free at the time thetran
of the inspectors.
If the inspector
take over the
exit 1 to tak
nsaction
senting one
t r a n s a c t i o n will
leave by way of facility. the
enters, the to the nextstage of
processine
the transaction will pass ay of
inspector is busy,
exit 2. to a single TABULATEblock
inspection, the transactions go
When parts finish Because of the rule by which transacti
ns
time is recorded.
where the transit

5,0

2.0

CONV2 CONV3
CONV1 20 BOTH
BOTH 20

12.
29
129

TAB

Figure 9-10. Manufacturing shop model 5.


Sec. 9-10/ Program Control Statements
217

normally pass from one block to the next higher numbered block, only one of the
three RELEASE blocks that complete the inspection phase is able to pass the
transactions directly to the TABULATE block. The others pass the transactions to
TRANSFER blocks that send the transactions unconditionally to the TABULATE
block. It would be possible to have three separate TABULATE bioeks at
the exitof
each RELEASE bloCk, making the unconditional TRANSFER blocks unnecessary.
Fach TABULATE block can refer to the same table number, so that the two alterna-
tive ways of drawing the block diagram will lead to exactly the same statistics. This
principle-allowing the same GPSS entity to be referred to in more than one place
-applies to all entities.
Coding and results for the problem are shown in Fig. 9-11. An explanation of
the extra START statement shown in the coding will be given in the next section.
Note how the rule for normally moving transactions to successively mumbered
blocks causes the coding to be broken into several parts. Breaks are caused by both
the unconditional TRANSFER and the conditional TRANSFER blocks. A way of
simplifying block diagrams, such as this one, that have repetitive segments will be
discussed in Sec. 10-8.

9-10
Program Control Statements

The first statement of the GPSS input is a control statement with the word
SIMULATE in the operation field. Without this statement, the problem will be
assembled but not executed.
It is desirable to be able to stop and restart a simulation run and also repeat a
Simulation run with changes to some of the values in the model. When a GPSS
simuiation run is finished, therefore, the program does not immediately destroy the
model. Instead, it looks for more input following the START Statement, keeping
the model exactly as it was at the completion of the run. input following the
START statement can change the model. For example, a storage capacity could be
redefined by inserting a STORAGE statement that refers to the number of a
previously defined storage and gives the new value. The model could also be modi-
fed by changing existing blocks or addingg new blocks. When all such modifications
been read and the model is ready for rerunning another START statement will
nave
instruct the program to begin simulation again.
Certain control statements can be included between START statements to set
the conditions under which the rerun is made. A statement with the singie word

ESET in the operation field will wipe out all the statistics gathered so tar, but will
leave the system loaded with transactions. The purpose is to gather statistics in the
second run with the initial build-up period excluded. The output of the first run is
MODEL 5
MANUPACTURING SHOP
GENERATE CREATE PARTS
P1ACE ON CONVEYOR
ADVANCE MOVE TO PIRST INS PRCTOR
TRANSFER aOTH,,CONV1 G E T P I R S T INSPECTOR
SEIZE
ADVANCE 12,9 INSPECT
PREE INSPECTOR
RELEASE MEASURE TRANSIT TIME
TA TABULATE
TERMINATE 1
PLACR ON CONVEYOR
cOwV1 ADVANCE 2
SECOND IMSPECTOR
10 TRANSFER BOTH,,CONV2 MOVE TO ND INB PECTOR
SEI ZE 2 SECO
GET
INS PECT
ADVANCB 12,9 FREB INSPBCTOR
RELEASE
TRANSFER TAR
PLACE ON CONVEYOR
cONV2 ADVANCE 2
TRANSFEER BOTH,,CONV2 MOWE TO THIRD INBPECTOR
GET THID INSPECTOR
7 J
SBIZE
ADVANCE 12,9 INSPEC
FREE INSPPC TOR
9 RELEASE 3
20 TRANSFER TAB
21 cONV3 TERMI NATE
TABULATION INTERVALS
TABLE M1,5,5,100
INITIALIZE WITH TEN PARTS
START 10,NP
RESET
START 1000 MAIN RUN

RELATIVE CLOCK 5588 ABsoLUTE CLOCK 5660


BIOCK COUNTS
BLOCK cURRENT
1117
TAL BLOCK CURRENT TOTAL
343
BLOCK CURRENT
21
TOPAL
1117 12 0 343
7178 13 344
406 14 344
406 15 369
406 6 368
1000 17 250
1000 18 250
712 19 250
712 20 250

FACILITIES

-AVERAGE UTILI ZATION DURING


FACILITYY NUMBER AVERAGE TOTAL AVAIL UNAVAZL. CURRENT PERCENT
ENTRIES TIME/TRAN TIME TIME TINE STATUS AVAILABILITY
407. 11.885 .865 100.0
2 344 11,956 36 100.0
250 12.244 547 100.0

CABLES

TABLE
ESTRIES IN TABLE MEAN ARGUMENT sTANDARD
100 DEVIATION SUN OF ARGUMENES
15.693 5.757 13694.000
UPPER OBSERVED PER CENT CUMULATIVE CUMULATIVE MULTIPLE D2VIATION
LIHIT PREQUEMCY OP TOTAl
PERCENTAGE REMAINDER NEAN FROM NEAN
27
97.2 318
20.19 988
69 6.9 4.7
248 50.2 -.12
24,79 97.3 1.6
. 59 190,0 2.6 1.592
1,911 2.484
AEMAIAIG FREQU ENCIES ARE AL ERO

Figure 9-11. Coding and resuts for model 5.

218
Sec.9-10/ Program Control Statements 219

not then of interest and is usually suppressed by putting the letters NP in the B field
of the START statement. This procedure has been followed in the simulation shown
in Fig. 9-11. One START statement has run the model for a total of 10 completed
transactions, and the output of this run has been suppressed. A RESET statem. *nt
has wiped out the statistics gathered in that run; the second START statement has
restarted the simulation from the point at which the tenth transaction finished and
has continued for a further 1,000 transactions. The results shown are the statistics
gathered during the second run.
The RESET statement also sets to zero a relative clock. When the run is com
pleted, the output marked ABSOLUTE CLOCK gives the time since the run
last RESET
began; the output marked RELATIVE CLOCK gives the time since the
statement. Ifthe RESET statement is not used. the two times are the same.
Another control statement, CLEAR, would not only wipe out the statistics of
but would also that,
wipe out the transactions in the system; so
the preceding run,
the rerun does in fact start the simulation from the beginning. This procedure
in
would be followed when the objective is to repeat the problem with change
a

some value. Although the CLEAR statement returns


the model to its initial state,
The following sequence of
it does not reset the random number generator seeds.
statements

START
CLEAR

START

run would use a different set of


would run the same problem twice but the second
When there are stochastic processes
in the model, the second run
random numbers.
that could arise.
will be a second sample of the possible outputs
runs of the same model,
GPSS allows any
As well as controlling different
run successively with
a single loading of the
number of different problems to be
field instructs
with the word JoB in the operation
program. A control statement and proceed with
model preceding the statement
the program to wipe out the entire
as many times as desired. All five
the following problem. This can be repeated
a JO8 statement
run at one time by placing
described in this chapter were
models is not needed in front of the first problem.
between the runs. A JOB statement random number
JOB statement does reset the
Unlike the CLEAR statement, the
in exactly the same form as does the
Seeds so that each problem finds the program
first problem. when it completes a run, a
always anticipates
further input
Since the program must be placed at the
with the word END in the operation field
control statement terminate all simulation. The
end of all problems, even if
there is only one, to
220 Introduction to GPSS/ Ch.9

SIMULATE statement appears only once, at the beginning of the input deck, even

if there are multiple jobs.

Exereises
Give GPSS block diagrams and write programs for the following problems:
9-1 In the manufacturing shop model of Fig. 9-2, suppose that parts rejected by
the inspector are sent back for further work. Reworking takes 153
minutes and does not involve the machine that originally made the parts.
After correction, the parts are resubmitted for inspection. Simulate for 1.000
parts to be completed.
9-2 Parts are being made at the rate of one every 6 minutes. They are of two
types, A and B, and are mixed randomiy, with about 10% being type B. A
separate inspector is assigned to examine each type of part. The inspection of
A parts takes 4+2 minutes and B
parts take 20 + 10 mmutes. Both
inspectors reject about 10% of the parts they inspect. Simulate for a total of
1,000 typeA parts accepted.
9-3 Workers come to a supply store at the rate of one every 5 2 minutes. Their
requisitions are processed by one of two clerks who take 8 t 4 minutes for
each requisition. 1 he requisitions are then passed to a single storekeeper who
fills them one at a time, taking 4 3 minutes for each request. Simalatethe
queue of workers and measure the distribution of time taken for 1,000
requisitions to be filled.
9-4 People arrive at an exhibition at the rate of one every 3 t 2 minutes. There
are four galeries, All visitors go to gallery A. Eighty percent then go to
gallery B, the remainder go to galery C. All visitors to galleryC move on
gallery D and then leave. None of the visitors to gallery B goes to gallery C:
bowever, about 10% of them do go to gallery D before leaving. Tabulate the
distribution of the time it takes 1,000 visitors to pass through when the
average times spent in the galleries are as follows:

A, 15 5; B, 30 10; C, 20 10; D, 155

9-6 People arrive at the rate of one every 10 Sminutes to usea single telephone
If the telephone is busy, 50% of the peopls come back 5 minutes later to try
again. Therest give up. Assuming a call takes 6 t3 minutes, count how
many people will have given up by the time 1,000 calls have been completed.
9-6 People arrive at a cafeteria with an inter-arrival time of 10+5 seconds.
There are two serving areas, one for hot food and the other for sandwiches.
221
Ch.9 Bibliography

6
of the customers and it has servers.
The hot food area is selected by 80% and
area has only one server. Hot food takes
1 minute to serve
The sandwich
the customers
sandwiches take minute. When they have been served, The
which has seating capacity for 200 people.
move into the cafeteria, sandwich,
to eat a hot meal is 30 t 10 minutes and for a
average time distribution of time
for service and the
1 5 5 minutes. Measure the queues people to finish
to finish
from the time of arrival. Simulate for 1,000
eating,
their meal. are six
1 t t hours. There
arrive at a harbor at the rate of one every crane for
9-7 Ships need the services of a
to accommodate them. They also
berths of the ships stay
five cranes. After unloading, 10%
unloading and there are do not need the
the others leave immediately. Ships
to refuel before leaving; assuming it
Simulate the queues for berths and cranes
cranes for refueling. Simulate for 100
3 hours to unload and 1 hours to refuel.
takes 7 t
ships to clear the harbor.

Bibliography Simulator and


General Purpose Digital
G. GoRDON, "A IBM
1 EFRON, R., AND
of the Simulator,"
Part 1-Description
Examples of its Application:
21-34.
Syst. J., I1, no. 1 (1964), Simulation Program," in
"A General Purpose
Systems
2 GORDON, GBOFFREY, New York:
Macmillan Publishing
Proc. EJCC, Washington,
D.C., Pp. 87-104,
Co., Inc., 1961.
Simulation, Englewood
Vto Discrete System
T h e Application of GPSS
Inc., 1975.
Cliffs, N.J.: Prentice-Hall, Simulator,"
"GPSS/360-An Improved General Purpose
4 GouLD, R. L.,
IBM Syst. J., VIII, no. 1 (1969), 16-27.
IlI-An Expanded General
T. SCHNEIDER, "GPSS
5 HERSCovITCH, H., AND
3 (1965), 174-183.
J., IV, no.
Purpose Simulator," IBM Syst. Manual (Form SH
Simulation System V, User's
6 IBM Corp., General Purpose
20-0851), White Plains, N.Y. Card- Block State
Simulation System V, Reference
General Purpose
ment Formnats (Form GX20 1828).
C a r d - Control State-
General Purpose Simulation
System VReference
ment Formats (Form GX20 1928).

You might also like