You are on page 1of 12

1

Chapter One
GETTING STARTED
This chapter provides quick start information. Much of the material presented here is
covered in far greater detail in the GPSS/H System Guide, which can be found in
C:\Program Files\Wolverine\GPSSH\Doc.
Unless otherwise noted, information applies to both Student GPSS/H and the
commercial versions of GPSS/H (GPSS/H Professional and Personal GPSS/H).

1.1 Installing GPSS/H


To install a commercial version of GPSS/H under Windows XP, you need to be logged on
with administrator privileges. If you do not have administrator privileges, youll have to get
assistance from an authorized system administrator.

GPSS/H is distributed on a CD-ROM. Student GPSS/H is also available for downloading on Wolverines website, www.wolverinesoftware.com. To install GPSS/H from
a CD, simply insert the CD-ROM into a CD-ROM drive on your computer. Unless you
have disabled the automatic recognition of CD insertion, Windows should automatically
begin executing the software installation procedure on the CD. If the CD is not automatically recognized, you can manually run setup.exe, contained on the CD. To
download Student GPSS/H, simply click on the appropriate link on our Downloads
page
The installation procedure will lead you through a sequence of dialogs, allowing you to
specify which software components youd like to install and where youd like to place
them on your computer. By default, files are placed into the folder named
C:\Wolverine and into Wolverine-defined subfolders of that folder. If you wish to

1-1

Getting Started with GPSS/H

choose a different base folder, you may do so; however, you should not move, remove,
or rename any subfolders created by the installation procedure. The folder architecture
we have defined provides a convenient way of installing a variety of products from
Wolverine Software.

1.2 Security Keys


Commercial versions of GPSS/H require the use of a security key (dongle) that plugs
into a USB port on your computer. Student GPSS/H does not require a security key. As
part of the installation process for the key-protected versions of GPSS/H, software
drivers are installed to enable GPSS/H to access the key.
Do not plug in a USB security key until after the GPSS/H installation procedure has
completed.

If you plug a USB key in before the installation is completed, Windows will recognize
that a new USB device has been connected, but it will have difficulty figuring out how
to handle the new device. If you plug the key in after the software installation is
complete, Windows will automatically recognize the security key and setup USB driver
software for accessing it.

1.3 Windows GPSS/H Sessions


To invoke GPSS/H, you must issue commands (described in Section 1.4.2) from a command
prompt session.

GPSS/H operates as a Windows console-mode application and must be launched from a


command line. The installation procedure creates a Wolverine folder on your desktop
and adds a Wolverine entry to your Start Menu. The Wolverine folder contains icons
for initiating command prompt sessions for the version(s) of GPSS/H you install. When
you click on the icon or invoke a shortcut in the Programs menu, a command prompt
session is initiated.
You can modify the width and height of the command prompt window from its default
80 x 25 size. We strongly recommend that you do so, since a larger window will reduce
the need to scroll debugger/output windows.

1-2

Chapter 1 Getting Started

If you change the size of the command prompt window, set the scrolling region to be the
same size as the window itself. Otherwise, confusing double scrolling will result.
(GPSS/H provides its own scrolling via function keys. If you make the scrolling region
smaller than the windows size, Windows will provide scroll bars.)

1.4 How to Run a GPSS/H Model A Quick Tutorial


1.4.1 Overview
GPSS/H models are ASCII text files that are created with a text editor or word
processor. The files are made up of GPSS/H Control Statements, Block Statements, and
comments. When you run GPSS/H, you must supply the name of the file containing the
model that you want GPSS/H to compile and execute. You may also specify the names
of options that change the way in which your model is compiled and/or executed.
1.4.2 Creating GPSS/H Model Files and Compiling & Executing Them
A. Enter the GPSS/H model into a plain (ASCII) text file using any convenient
editor. (The Windows NotePad or WordPad applets will work fine for this
purpose with small- to medium-sized files.) If you do not have an editor on your
computer, but you do have a word-processing program, you can use the wordprocessing program as an editor as long as it can save files in "text only" format.
Be sure to save a word-processed model as "text only." Beware that some editors may
insist on appending a .txt file extension to all files saved as text files. For example, the
first time you save a file under WordPad, if you try to save it as myfile.gps, WordPad will
save it as myfile.gps.txt. If this happens, you can rename the file to the desired
myfile.gps and reopen it with WordPad. WordPad does not append .txt extensions to
pre-existing files, so the double extension problem occurs only on the first attempt to
save a new file.
Earlier versions of GPSS/H required that models be entered in UPPER CASE LETTERS.
The latest versions of GPSS/H no longer impose this restriction; however, you must be
consistent in your use of user-defined names. Joe, joe, and JOE are different
names.

1-3

Getting Started with GPSS/H

B. Compile and execute the model by running the appropriate version of GPSS/H.
To compile and execute a model under Student GPSS/H, run gpssh.
To compile and execute a model under GPSS/H Professional, run hpro.
To compile and execute a model under Personal GPSS/H, run hpers32.

The format of the command line is as follows:


gpssh filename [options...] (Student GPSS/H assumed)
In the above, filename is the name of the file containing the GPSS/H model. If a file
extension is specified as part of filename (e.g., myprog.mdl), it is used by GPSS/H;
if no file extension is specified, GPSS/H will assume a file extension of ".gps."
[options...] represents a sequence of zero or more keywords (option names) that
specify the way GPSS/H compiles and/or executes a model. A complete list of all
options available under GPSS/H is given in the GPSS/H System Guide. If any
options are specified, they are processed one at a time in left-to-right sequence. If no
options are specified, all "standard" model output is placed in a listing file with the
same name as the model file, but with a file extension of ".lis". The file is created in
the directory that contains the model source file. If the type option of the GPSS/H
command is used, "standard" model output is directed to the screen and no listing
file is created.
GPSS/H contains a very powerful and easy-to-use interactive debugger. You will
want to use this debugger as you develop and test your models. You can learn it, as
needed and at your own pace, by consulting Chapter 11 of the GPSS/H Reference
Manual.
C. Examine Your Models Output. If you ran your program using default output
options, your output will be written to a .lis file, as described above.
GPSS/H assumes that 132 columns of screen and printer width are available. When
GPSS/H is running in "test" (interactive) mode, left-right scrolling is implemented
using the "" and "" keys, so that you can examine all 132 columns of output.

1-4

Chapter 1 Getting Started

We recommend using an editor that supports 132 columns (either through left-right
scrolling or through extended video modes) for viewing listing (".lis") files, and
using a printer that supports 132 columns for printing them.
1.4.3 Command Line Examples
The following examples illustrate how to run Student GPSS/H. Remember, if youre
using GPSS/H Professional, type hpro, and if youre using Personal GPSS/H, type
hpers32, rather than gpssh.
gpssh myprog

(Source, dictionary, and cross-reference listings and model output are placed in a file
named myprog.lis.)
gpssh myprog type nowarn

(Source, dictionary, and cross-reference listings are suppressed. Model output appears
directly on the screen. No listing file is created. Compiler warning messages are
suppressed.)
gpssh myprog tv

(This example invokes the windowed version of GPSS/Hs interactive debugger. At the
point at which execution ordinarily would begin, the interactive debugging system
assumes control, and a READY message is displayed on the screen. The debugger will
operate in "windowed mode", with model source code displayed. A large number of
keyboard shortcuts are provided. For details, see the GPSS/H System Guide.)
gpssh myprog tvtnw

("tvtnw" is an abbreviation for "tv type nowarn". This combination of three options is
handy for making quick debugging or model-checkout runs. Source, dictionary, and
cross-reference listings are suppressed. Compile-time warning messages are suppressed.
Model output appears directly on the screen. No listing file is created.)

1-5

Getting Started with GPSS/H

gpssh myprog nos nodict noxref nowarn

(Source, dictionary, and cross-reference listings are suppressed. Model output is placed
in a file named myprog.lis. If any compilation warning messages are issued, they are
placed only in the file myprog.lis and are not echoed on the screen.)
gpssh myprog test type source dict xref

(Source, dictionary, and cross-reference listings and all model output appear directly on
the screen. The source, dict, and xref options are needed because the type option,
which has already been processed, causes suppression of these listings. At the point at
which execution ordinarily would begin, the interactive debugging system assumes
control, and a READY message is displayed on the screen.)

1.5 What Happens When You Compile and Run a Model?


When GPSS/H begins compilation and execution, one of the messages that appears on
the screen is
Pass 1 (with source listing) ...

During this phase, GPSS/H reads your source file, checks for syntax errors and
produces a source listing. It also assigns numeric values to symbols (i.e., statement
labels, facility names, etc.) used in the model.
The message that shows on the screen next is
Pass 2 ...

During Pass 2, GPSS/H compiles the model into a form suitable for fast execution. It
also allocates memory and prepares to execute the model. If no errors are encountered,
the following message will appear:
Simulation begins.

This means that GPSS/H is running your model. When the simulation run is completed,
GPSS/H produces a standard output report. If an error occurs during execution of the
model, then an informative error message is generated both to the screen and to the
output report.

1-6

Chapter 1 Getting Started

1.6 Interrupting Model Execution and Output


When GPSS/H is running, model execution can be interrupted at any point by typing
CTRL-BREAK (holding down the CTRL key while simultaneously pressing the
BREAK key). GPSS/H will acknowledge the CTRL-BREAK interrupt by displaying an
"ATTENTION!" message on your screen, followed by a ": " prompt. The
"ATTENTION!" message will be preceded by an "Unplanned entry to DEBUG"
message if neither the test nor the tv option was specified when GPSS/H was started. In
either case, you can proceed with model execution under the GPSS/H interactive
debugger, as described in Chapter 11 of the GPSS/H Reference Manual.
CTRL-BREAK can also be used to terminate most forms of GPSS/H output. For
example, if the interactive debugging command "display cec" (Current Events Chain)
produces output on more Transactions than needed, the output can be terminated by
typing CTRL-BREAK. GPSS/H will respond with an "OUTPUT SUPPRESSED"
message, followed by an "ATTENTION!" message. At that point, you can get the
information on the specific Transactions of interest using other debugging commands.
The SCROLL LOCK key can sometimes be used as an alternative to CTRL-BREAK
within the debugger. By hitting the SCROLL LOCK key, you can freeze the scrolling of
output on the screen. Once you have looked at the section of output on the screen, you
can resume scrolling by hitting the SCROLL LOCK key again.

1.7 User Interaction and File Access


1.7.1 User Interaction
GPSS/H has built-in facilities that allow a running model to write text to the screen, or
read from the keyboard:
GPSS/H provides for routing model output to the screen by using an extended I/O statement
with FILE=SCREEN, or with no FILE= operand (SCREEN is the default). Before
GPSS/H Release 3, the special name SERCOM was used in place of SCREEN.
GPSS/H provides for a model to accept input from the keyboard by using an extended I/O
statement with FILE=KEYBOARD, or with no FILE= operand (KEYBOARD is the
default). Before GPSS/H Release 3, the special name GUSER was used in place of
KEYBOARD.

1-7

Getting Started with GPSS/H

1.7.2 File Access


If you want a GPSS/H model to read or write data files while running, you may need to
take special steps so that GPSS/H can access or create the appropriate file(s):
GPSS/H provides for routing model output to the listing (".lis") file by using an extended
I/O statement with FILE=LISTING. Note that if a model using such a statement is run with
the type option of the command used to invoke GPSS/H, the output that would normally go
into the listing file will be written to the screen instead. Before GPSS/H release 3, the
special name SYSPRINT was used in place of LISTING.
A model can also perform input from, or output to, a user-defined disk file. This is
accomplished by using a GPSS/H extended I/O statement in which the FILE= operand uses
a GPSS/H filename other than LISTING, SCREEN, or KEYBOARD (SYSPRINT,
SERCOM or GUSER before GPSS/H Release 3). No further action is needed if GPSS/H
can use the FILE= operand directly as the name of a disk file in the user's current directory.
This will work if the name of the file has no extension (does not contain a period), and
either exists, or will be created, in the directory in which the user is positioned when
GPSS/H is invoked. For example, if an extended I/O statement specified "FILE=MYFILE",
GPSS/H would look for or create a file named MYFILE in the directory from which
GPSS/H is started.
If the file has a name that includes an extension, or requires specification of a pathname,
then a GPSS/H FILEDEF Control Statement (or an equivalent BFILEDEF Block) must be
used. These allow you to equate a GPSS/H internal file name, which cannot contain special
characters such as periods, to the actual text string that should be passed to the operating
system when GPSS/H attempts to open or create the file. Please see Table 5.2 (BFILEDEF
Block) and Section 6.15 (FILEDEF Control Statement) of the GPSS/H Reference Manual
for more information.
Although GPSS/H has no internal limits on how many files can be in use at the same time
in a model, such limits may be imposed by the operating system

1.8 Size Limitations of Student GPSS/H


The most common run-time errors that occur when using Student GPSS/H involve the set limits of
the Student software. The Student version of GPSS/H, has the following model size limitations:

1000 lines of source code


125 GPSS/H Blocks

1-8

Chapter 1 Getting Started

250 total statements (this includes Blocks and Control Statements but does not
include comments or the extra lines in multi-line statements)
Up to 32720 bytes of COMMON storage.
If a model is run that exceeds any of these limits, a general error message will appear on the
screen stating that the limits have been exceeded. The error message will also
specifically tell you which of the three limits have been overrun. For example, if a
model is run that contains over 125 Blocks, the following message will appear on the
screen:
ERROR: STUDENT-VERSION IS LIMITED TO 125 BLOCKS LIMITS OF STUDENTVERSION EXCEEDED RUN TERMINATED

If the COMMON storage limit is reached, Error 411 will appear on the screen:
Error 411 - Out of COMMON - Add/change REALLOCATE Stmt?

Out of COMMON means that your model has depleted the default memory pool that
every model uses when executing. Student GPSS/H by default will access 10000 bytes
of COMMON, which is enough to accommodate up to about 100 simultaneous
Transactions. A Transaction is the unit of traffic in your model. If too many
Transactions pile up in the model, you will see Error 411. The piling up of Transactions
can be due to a logic error or due to the complexity of your model.
Some models just need more than 10000 bytes of COMMON to run to completion. If
more COMMON is needed, you can use the MAXCOM option or the REALLOCATE
Statement. Whether you use MAXCOM or REALLOCATE depends mostly on personal
preference. MAXCOM overrides REALLOCATE if both are used. The MAXCOM
option is used on the command line that invokes GPSS/H:
GPSSH JOEBARB MAXCOM

MAXCOM will cause GPSS/H to grab as much COMMON as it can, up to 32720 bytes
for the Student version. The actual amount of COMMON that MAXCOM will be able to

1-9

Getting Started with GPSS/H

grab depends only on the complexity of your model. It does not depend on the
configuration of your computer hardware or any other software you have installed.
REALLOCATE can be used in the model itself to increase COMMON.
REALLOCATE requires that you specify an exact amount. The syntax of
REALLOCATE is:
REALLOCATE COM,bytes

The A-operand contains COM which is the GPSS/H code for COMMON, and the Boperand specifies the number of bytes that you want in the COMMON memory pool.
The REALLOCATE Statement can be placed anywhere before the end of your model,
but placing it near the beginning of your model makes it much easier to access if
changes are needed. If REALLOCATE cannot get the amount of COMMON requested,
model compilation fails with a message telling you exactly how much COMMON you
could have gotten. This lets you quickly try again. For example,
REALLOCATE COM,20000

will double the default value for COMMON. If your model failed to run to completion
with 10000 bytes of COMMON, it should run about twice as long if you double the
amount of COMMON.

1-10

Chapter 1 Getting Started

1.9 Overview of the Remaining Chapters


In Chapter 2, we give an overview of GPSS/H, including the GPSS/H world view and
the main elements of a GPSS/H model. A world view is a stylized view of a system.
In the most common GPSS/H world view, entities (called Transactions) move through a
system, competing for resources. A GPSS/H model consists of Block Statements,
Control Statements, and Compiler Directives. Block Statements, or more simply
Blocks, provide a way to describe and define the system being simulated. The collection
of Blocks defines how the Transaction entities are processed by the system. Control
Statements manage the execution of the Block Statements and of entire simulation
experiments, and also define certain GPSS/H entities. Compiler Directives convey
information that helps GPSS/H compile the model successfully.
Chapters 3 through 6 introduce the basic Blocks and Control Statements used in
GPSS/H modeling. Chapter 3 discusses Blocks for creating and destroying Transaction
entities, Blocks for modeling a single server resource, and the Control Statements needed in
every model. Chapter 4 discusses the interactive debugging facility of GPSS/H. Chapter 5
introduces GPSS/H Blocks that collect statistics on waiting lines. Chapter 6 discusses how to
model a group of parallel servers or other multiple unit resources.
Chapters 7 through 16 discuss GPSS/H Blocks and Control Statements that are needed
to write more complex GPSS/H models. Chapter 7 shows how the GPSS/H Blocks in a
model can be executed in a non-sequential manner. Chapter 8 discusses the meaning
and use of Ampervariables (FORTRAN-like variables of types INTEGER, REAL and
CHARACTER). Chapter 9 illustrates how to read data from external files or the
keyboard and how to write formatted output reports to external files or to the screen.
Chapter 10 explores the meaning and use of Transaction Parameters. Chapter 11
discusses the Control Statements for making multiple simulation runs from within a
single GPSS/H model. Chapter 12 describes the additional Control Statements (DOENDDO loops, IF-ELSEIF-ELSE-ENDIF constructs) for repeated and conditional
execution of a simulation model. Except for the lack of a true subroutine capability, these
Control Statements give GPSS/H the power of a general-purpose programming
language.
Chapter 13 shows how random numbers are generated in GPSS/H and describes the different
types of Functions that GPSS/H supports. Chapter 14 discusses how sample statistics

1-11

Getting Started with GPSS/H

can be tabulated into a histogram-like entity called a Table. Chapter 15 illustrates how
to declare and use a two-dimensional array of variables. Chapter 16 gives a brief
description of other features of GPSS/H not covered in this text. Appendix A gives an
overview of other new features.
If you are a new user of GPSS/H, we strongly recommend that you read Chapters 2 through
13. If you have prior GPSS experience, we strongly recommend that you start by studying
the interactive debugging facility of GPSS/H described in Chapter 4. You will find this
facility extremely helpful, especially if you are developing a large simulation model.
We then recommend that you read at least Chapters 8, 9, 12 and 13 to understand the
power and flexibility of GPSS/H.

1-12