- •Table of Contents
- •Chapter 1. Using GPSS World
- •Lesson 1 - The GPSS World Program
- •Lesson 2 - Running a Simulation
- •Lesson 3 - Problems
- •Lesson 4 - The Text Editor
- •Lesson 6 - The ADVANCE Block
- •Lesson 9 - GPSS World Commands
- •Lesson 10 - Manual Simulation
- •Lesson 11 - The Graphics Windows
- •Lesson 12 - Reading from and Writing to External Files
- •Lesson 14 - Reports
- •Lesson 15 - Session Journaling
- •Lesson 16 - Continuous Modeling
- •Lesson 17 - PLUS
- •Lesson 19 - Experiments
- •Chapter 2. Applications
- •1. TURNSTIL.GPS
- •2. TELEPHON.GPS
- •3. PERIODIC.GPS
- •4. TVREPAIR.GPS
- •5. QCONTROL.GPS
- •6. ORDERPNT.GPS
- •7. MANUFACT.GPS
- •8. TEXTILE.GPS
- •9. OILDEPOT.GPS
- •10. ASSEMBLY.GPS
- •11. ROBOTFMS.GPS
- •12. BICYCLE.GPS
- •13. STOCKCTL.GPS
- •14. LOCKSIMN.GPS
- •15. FOUNDRY.GPS
- •16. TAPEPREP.GPS
- •17. TRAFFIC.GPS
- •18. POWDER.GPS
- •19. QTHEORY.GPS
- •20. SUPERMRK.GPS
- •21. SHIPPORT.GPS
- •22. EXCHANGE.GPS
- •23. FMSMODEL.GPS
- •24. ETHERNET.GPS
- •25. PREDATOR.GPS
or
PRESS o
or
PRESS b + a + H
When the simulation is halted
CHOOSE Command / Custom
In the dialog box
TYPE Report ,Now
SELECT OK
This causes a Standard Report to be created immediately, even if the simulation has not ended.
The name of the report that you have just created is probably Sample1.1.2, but the sequence number could be different if you have other Sample1 reports on your disk.
You may now examine the report or print it using Print from the File menu. Reports are generated automatically at the end of a simulation. When you attempt to close a Report Window, you will be given the opportunity to save the report to a file. We’ll address reports in greater detail later in this tutorial. Also, you may wish to read Chapter 11 in the GPSS World Reference Manual where the report output is discussed in detail. However, for now, our next step is to end the GPSS World Session.
CLICK ON The X-Upper Right of the Windows Currently Open
This returns us to the GPSS World Main Window. Close the window to return to the Windows Desktop.
In this lesson we have started a simulation, set up a plot, watched several important simulation state variables change during a simulation, interrupted a running simulation, viewed a running simulation through two graphics windows, set up Expressions in the Expressions Window, TRACEd a Transaction, suppressed the automatic writing of the Standard Report, created the Standard Report on demand using the REPORT ,NOW Command, and examined the report in the Report Window.
In the next lesson we will examine what happens when things go wrong. We’ll also take a look at the On-line Help Facility and some other assorted useful tidbits. See you next time.
Lesson 3 - Problems
Sooner or later you’re bound to run into problems. The first thing to know is that the l key
retrieves help immediately. This simple action will open a context sensitive help panel no matter where you are in GPSS World. In addition, some dialogs have a Help Button, as well.
Let’s try it. Start GPSS World as you did in Lesson 1.
CLICK ON Start / Program / GPSS World ...
Now, open up the Help Panel.
PRESS l
or from the Main Menu
CHOOSE Help
You should see a standard Windows Help Panel, with controls for searching, moving from panel to panel, and using the index. All these are at your disposal. Feel free to explore the Help Subsystem until you feel comfortable using it, because it can save you a lot of time.
Now, close the Help Panel.
CLICK ON The X in the Upper Right-Help Window
or
CLICK ON The X-Upper Right-Help Window
Before leaving the Help Subsystem, let’s get help for a menu item. Drag down a menu with mouse button 1, but do not release the button. This highlights one of the drop down menu
items. (You can do the with the a and arrow keys, also). Before you release the mouse button, press l .
You should see context sensitive help specifically for the menu item
Again, close the Help Panel.
CLICK ON The X in the Upper Right-Help Window
So much for On-line Help. During the lessons in this tutorial, you should use it just to get used to it. Feel free to press l at any time. For now, let’s move on to some other things.
Here’s something that’s really handy. It’s especially useful when you’re interacting with a running simulation. It’s the Assignable Function Key feature. To assign a Command to a function key, you should do the following.
Open the SAMPLE10 model
CHOOSE File / Open
SELECT SAMPLE10
and
CHOOSE Open
Let's take a look how to quickly get into the GPSS World Language Reference in the Help system. Double click on the word GENERATE so that it becomes selected. Now,
PRESS l
The Help system responds by showing you occurrences of GENERATE in the Reference Manual. Select the Block Statements line item to view the definition of a GPSS Block Statement. Great! Scroll down to view all the details. But this is only the beginning. You can research all the GPSS World Command, Blocks, Procedures, SNA Classes, Probability Distributions, and other keywords. All you have to do is find some Text Window where you can select it and then open the Help System. If you can't find the keyword anywhere, just type it in temporarily and delete it when you no longer need it.
Now lets look at some features provided by Model Settings. Incidentally, when you create a Simulation Object, it inherits its Settings from the Model Object. Well, anyway, for now
CHOOSE Edit / Settings
In the Settings notebook, choose Function Keys. When you are on the Functions Keys page, you will see that you can enter any command next to a function key. Each model can be set to
use its own unique function keys. Let’s load key t with "SHOW Q$Barber". Position the cursor in the box next to F9 and
TYPE SHOW Q$Barber
in the space next to the F9. Then close the notebook.
SELECT OK
Figure 3—1. The Function Keys Page of the Model Settings Notebook
Create a simulation with the new settings.
CHOOSE Command / Create Simulation
Now start the simulation.
CHOOSE Command / START
and in the dialog box, replace the 1.
TYPE 10000
and
SELECT OK
Interrupt the simulation
PRESS b + a+ H
or
PRESS o
and then
PRESS t
You’ll see the queue for the Barber in the Status Line of the Main Window. Since this model has a Barber who can’t keep up, don’t be surprised if you see an unreasonable queue.
Figure 3—2. Journal Window with Show Command displayed.
Take a moment to think about the uses of the Function Keys. When you have a single Command such as STEP 1 that you will use repeatedly to step through a simulation, you can load it into a Function Key. Even INCLUDE Commands can be assigned to Function Keys. An INCLUDE command could call in an existing file with many GPSS World Commands.
A file containing a sequence of Model Statements is called a Model File. You may recall from Lesson 2 that a Model Statement is either a Block Statement, a Command, or a Procedure Definition. Model Files read into the Model Window are called Primary Model Files, any other Model Files, including Command Files, are called Secondary Model Files. You can create secondary Model Files using the GPSS World Model Window, or using your favorite word processor and saving them as txt files. You can read a whole Command File using the INCLUDE Command, and as we just discovered, you can load an INCLUDE Command into a Function Key.
Each of your models can use a unique set of Function Keys. The following function keys are preset to the values listed below when your software was shipped to you. Of course, you can override these values if you wish.
l = Help
m = CONTINUE
n = Exit to Windows o = HALT
p = STEP 1 q = STOP
r = STOP ,,Off
The Model Settings Notebook is discussed in more detail in the GPSS World Reference Manual.
Let’s now turn our attention to the SHOW Command. You can use it as a sophisticated calculator. Stop for a moment and take a look at the mathematical functions listed in Chapter 8 of the GPSS World Reference Manual. You can combine these in complex Expressions with SNAs in a SHOW command, and GPSS World will write the double precision result in the Status Line and in the Journal Window. Try it. First, some simple arithmetic.
CHOOSE Command / SHOW
in the dialog box after show
TYPE 1234+5678/345#(64+94)
Notice that # is used to represent multiplication, not *, which is reserved for SNA indirect addressing. Now check the result on a calculator. Does it agree with the result on the screen?
GPSS World evaluates Expressions according to a hierarchy of operators listed in Section 3.3 of the GPSS World Reference Manual. If there is any doubt in your mind, you should fully parenthesize Expressions.
Next, we intentionally cause an event called an Error Stop. You will see a description of the error in the Journal Window. The Error will also be displayed in the Status Line of the Main
Window.
CHOOSE Command / SHOW
and
TYPE 2/0
then
SELECT OK
Well, we certainly knew that that wasn’t going to work. However, take a look at the message written in the Journal Window. Each such message is explained in Chapter 13 of the GPSS World Reference Manual. The messages are in alphabetical order. Please take the time to look up this message. Although this error is obvious, it’s a good idea to look up any error message that you don’t understand in lucky Chapter 13 of The GPSS World Reference Manual.
First Close Sample10. You will have to close the Journal / Simulation Window and the Model Window.
CLICK ON The X-Upper Right of each Window
CHOOSE No
when asked if you want to save changes for each Window. Now let’s create a two line model with an obvious error.
CHOOSE File / New
and in the dialog box since Model for the file type is already selected.
SELECT OK
In the Model Window
TYPE Henerate 10
TYPE Terminate 1
CHOOSE Command / Create Simulation
Did the Journal / Simulation Window open with a message to indicate an invalid number? You can immediately go to the Model Window and fix the problem by making the H into a G and when you attempt again, the model should translate successfully.
CHOOSE Command / Retranslate
Figure 3—3. Error Message in a Journal Window
Now close the Journal and Model Windows.
CHOOSE No
in both save dialog boxes.
There are several menu items in the Search menu of the Model Window that take you directly to the error. Search / Go to Line, Search / Next Error, or Search / Previous Error
can be used to scroll through errors in a larger model. The cursor will be positioned where the error occurred, so you can fix the problem easily.
Now, let’s talk about Expressions in GPSS World. They are discussed in Chapter 3 of the
GPSS World Reference Manual. We can mix SNAs right into our Expressions. Let’s run a short simulation and then explore the results with the SHOW Command.
First, open the Program File. SAMPLE1.GPS
CHOOSE File / Open
From the Open Model Dialog selection box
SELECT SAMPLE1
in the Files list box, then
SELECT Open
GPSS World will read in the Model File. Let’s create a simulation and open the Facilities Window to watch it run.
CHOOSE Command / Create Simulation
then
CHOOSE Window / Simulation Window / Facilities Window
Size the window to a comfortable viewing size. O.K. Now start the simulation.
CHOOSE Command / START
and in the dialog box, replace the 1.
TYPE 11111
and
SELECT OK
in the dialog box. Notice that the Facility Entity was not created until it was referenced in the simulation. Other entity types, like Storage and Table Entities, which require a special declaration, are created when they are defined.
Let’s use the Expressions Window.
CHOOSE Window / Simulation Window / Expressions Window
Now we will mix in state variables from the simulation. Let’s try a fancy one, the natural logarithm of the relative system clock plus the square of the maximum queue length in the barber shop.
In the Label field
TYPE Fancy one
and in the Expression field
TYPE LOG(C1)+(QM$BARBER)^2
CLICK ON View
You can create logical Expressions using the operators ‘AND’, ‘OR’, and ‘NOT’. These yield 1 (true) or 0 (false) as a result of the operation, and they can be mixed in with arithmetic Expressions as well. When you use logical operators, don’t forget to include single quotes and don’t allow intervening blanks between operator and operand(s). Let’s try an additional one. In the Expressions Window dialog box, in the Label field
TYPE <6 Waiting?
then position the cursor in the Expression box and
TYPE 1+99#((Q$BARBER)’GE’6)
CLICK ON View
SELECT OK