- •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
CLICK ON The X-Upper Right of Each Window
Otherwise, to end the session
CLICK ON The X-Upper Right of Main Window.
14. LOCKSIMN.GPS
Lock and Canal Simulation.
Problem Statement
A single lock and narrow canal system joins two navigable waterways. The barge traffic is heavy between the two waterways, and the canal system can take only one barge at a time. The first barge in a particular direction takes 58 minutes, and subsequent barges in the same direction take 46 minutes.
The lock operator has a policy of one-up barge followed by one-down barge.
It has been suggested that a policy of up to six up, followed by up to six down might be more efficient.
Simulate the operation of the lock and canal with the new policy.
Listing
; GPSS World Sample File - LOCKSIMN.GPS, by Gerard F. Cummings
**********************************************************************
*Lock Simulation *
*Time in Hours *
**********************************************************************
*X$Uplimit = Number of barges to go up
*X$Downlimit = Number of barges to go down
*X$Upcount = Number of barges which have passed up
*X$Downcount = Number of barges which have passed down
RMULT 94521
Upbarge FUNCTION X$Upcount,D6
1,.967/2,.767/3,.767/4,.767/5,.767/6,.767
Downbarge FUNCTION X$Downcount,D6 1,.967/2,.767/3,.767/4,.767/5,.767/6,.767 Upq QTABLE Upq,.25,.25,20
Downq QTABLE Dnq,.25,.25,20 Upcount TABLE X$Upcount,2,2,20 Dncount TABLE X$Downcount,2,2,20
INITIAL X$Uplimit,6 ;No. of barges to go up INITIAL X$Downlimit,6 ;No. of barges to go ; down
**********************************************************************
GENERATE 1.67,.5,.67 ;Up barge arrives QUEUE UPQ ;Join queue
GATE LR Lock ;Gate for the lock SEIZE Lock ;Get the lock
SAVEVALUE Upcount+,1 ;Accumulate up number DEPART Upq ;Depart the queue
ADVANCE FN$Upbarge ;Time to service barge
TEST GE X$Uplimit,X$Upcount,Swh1 ;Have enough passed? TEST NE Q$Upq,0,Swh1 ;Check if Upq is zero
RELEASE Lock ;Free the lock TERMINATE
**********************************************************************
Swh1 LOGIC S Lock ;Set lock the other way RELEASE Lock ;Free the lock
TABULATE Upcount ;Record no. passed up SAVEVALUE Upcount,0 ;Set count to zero TERMINATE
**********************************************************************
GENERATE 1.67,.5,1 ;Arrival of down barge QUEUE Dnq ;Enter queue
GATE LS Lock ;Is lock set? SEIZE Lock ;Get the lock
SAVEVALUEDowncount+,1 ;Accumulate down count DEPART Dnq ;Depart the queue
ADVANCE FN$Downbarge ;Time for down barge
TEST GE X$Downlimit,X$Downcount,Swh2;Down count reached? TEST NE Q$Dnq,0,Swh2 ;Any down barges left?
RELEASE Lock ;Free the lock TERMINATE
**********************************************************************
Swh2 LOGIC R Lock ;Set lock for other way RELEASE Lock ;Free the lock
TABULATE Dncount ;Record down count
The model is organized into several segments. After the Tables are defined and Savevalues initialized, there are three more model segments. Transactions in the top segment represent barges moving in the upward direction, Transactions in the second segment represent barges moving in the downward direction, and bottom segment times the simulation by decrementing the Termination Count once per simulated day.
The direction of movement is controlled by the GPSS Logicswitch Lock. When it is reset (off), the direction of movement is upward. When it is set (on), the movement is downward. Each Transaction representing a barge tests to see if the direction should be changed. If the barge count limit has been reached, or if there are no more barges, the Transaction changes the Logicswitch Lock so that traffic may begin in the other direction. This model shows a scheduling policy allowing a maximum of 6 barges to pass in either direction. The Savevalues Uplimit and Downlimit are therefore set to 6. These can be altered interactively.
Running the Simulation
To run the simulation and create a Standard Report,
CHOOSE File / Open and in the dialog box
SELECT LOCKSIMN
and then
SELECT Open
Next, create the simulation.
CHOOSE Command / Create Simulation
then
CHOOSE Command / START
and in the dialog box, replace the 1.
TYPE 7
SELECT OK
The simulation will end when 7 Transactions have entered the
TERMINATE 1 Block. This represents 7 days of operation.
When the simulation ends, GPSS World writes a report to the default report file, Locksimn.1.1. As discussed in Chapter 1, the
Report extension will vary depending on saved simulations and previously existing reports. For our purposes, we will assume that this is the first time the simulation has been created and run giving an extension of 1.1.
This report will be automatically displayed in a window. If you close the window, you can reopen it by using the GPSS World
File / Open in the Main Menu. Then you should choose Report
in the "Files of type" drop down box at the bottom of the window. GPSS World reports are written in a special format. If you wish to edit the report, you will have to copy its contents to the clipboard and from there into a word processor. You will not be able to open the file directly in a word processor.
Discussion of Results
The distributions of barge delays for each direction are given in the GPSS Tables Upq and Downq. In both cases, the average delay was about 1.3 hours.
The utilization of the lock was nearly 100%. This is evident from the statistics associated with the Facility Lock.
The actual number of barges which pass in each direction is tabulated in the Tables Upcount and Downcount.
Inside the Simulation
Let’s now explore the ending condition of the simulation which generated the Standard Report above. If you are not at the end of the simulation, please Retranslate the model and run it again.
Now let’s open some graphics windows.
CHOOSE Window / Simulation Window / Table Window and in the drop-down box in the dialog box
CLICK ON The Down Arrow at the end of the Table Name Box
and
CLICK ON Upcount
SELECT OK
This is the Tables Window for the Table Upcount. This table shows the distribution of counts of consecutive barges passing in the upward direction. Now look at the Table Upq.
CHOOSE Window / Simulation Window / Table Window and in the drop-down box in the dialog box
CLICK ON The Down Arrow at the end of the Table Name Box
and
CLICK ON Upq
SELECT OK
This Table shows the distribution of delay times of barges moving in the upward direction.
CHOOSE Window / Simulation Window / Table Window and in the drop-down box in the dialog box
CLICK ON The Down Arrow at the end of the Table Name Box
and
CLICK ON Downq
SELECT OK
This Table shows the distribution of delay times of barges moving in the downward direction.
CHOOSE Window / Simulation Window / Table Window
and in the drop-down box you will see that Dncount is already selected.
SELECT OK
This Table shows the distribution of counts of consecutive barges passing in the downward direction.
Please feel free to modify the parameters and Blocks of this simulation. To change the maximum barge counts,
CHOOSE Command / Clear
SELECT OK
and then use INITIAL Commands in the Command / Blank
menu option to set X$Uplimit and X$Downlimit to the upward and downward limits, respectively. Don’t forget that the CLEAR
Command zeroes all Savevalues and Matrices unless you use
Off as the A operand of CLEAR.