- •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
SELECT OK
and
CHOOSE Command / START
and in the dialog box, replace the 1.
TYPE 10000,NP
SELECT OK
When you are satisfied that the simulated result is converging toward the theoretical value (750), interrupt the simulation. Incidentally, the PLOT Window is useful for observing convergence, and for determining when startup transient effects are no longer significant. In your simulation projects, you will often want to exclude startup effects. Normally, you would enter a RESET Command to start the measurement period after startup effects had subsided.
If the simulation is still running, halt it now.
PRESS o
If you wish to go on to the next lesson, close all windows related to this model.
CLICK ON The X-Upper Right of Each Window
Otherwise, to end the session
CLICK ON The X-Upper Right of Main Window.
20. SUPERMRK.GPS
Simulation of a supermarket.
Problem Statement
Customers arrive by car to shop at a supermarket. The parking lot has space for 650 parked cars. If a customer fails to find a parking space, that customer leaves immediately without shopping. On average a customer can walk to the supermarket from the parking lot in 60 seconds. Shoppers purchase between 5 and 100 items, uniformly distributed. A customer buying 10 items or less, will generally use a basket (70 provided). A customer buying more than 10 items will generally use a cart (650 provided).
Shopping time per customer depends on the number of items purchased (10 seconds per item). Customers select items and then join the shortest queue at one of 17 checkouts. Customers purchasing less than 10 items may choose the express checkout. Checkout time takes 2 seconds per item purchased, plus a time of 25, 30, or 35 seconds. This time depends on the method of payment (cash, check or credit card which are assumed equally likely or probable). After checking out a customer walks to the car (60 seconds), loads goods and leaves the parking lot.
The arrival rate of customers is exponentially distributed, starting at 600 per hour for half an hour, 900 per hour for one hour, 450 per hour for one hour and 300 per hour thereafter.
1.Run the simulation for 3 hours.
2.Determine the transit time of customers.
3.Determine the utilization of the parking lot, carts, baskets and checkouts.
4.Tabulate the number of customers in the supermarket at one minute intervals.
Listing
;GPSS World Sample File - SUPERMRK.GPS, by Gerard F. Cummings
***********************************************************************
* *
* Supermarket Simulation Model * * Time Unit = 1/10 Of a Second *
***********************************************************************
RMULT 1187 First EQU 2 Last EQU 18
Qty VARIABLE (RN1@96+5)
Finance VARIABLE (RN1@3+1)#50+200
Transit TABLE M1,10000,10000,7 ;Time in system
Items TABLE P$Quantity,10,10,10 ;No. of items bought Shoppers TABLE X$Customers,100,50,12 ;No. of shoppers Baskt STORAGE 70
Cart STORAGE 650 Park STORAGE 650
Checkout VARIABLE (P$Quantity)#20+P$Payment Tshop VARIABLE P$Quantity#100
INITIAL X$Customers,0
***********************************************************************
Beg TRANSFER Both,,Los ;Tries to park or leaves ENTER Park ;Park in parking lot
ADVANCE 600 ;Time to walk from car SAVEVALUE Customers+,1 ;One more customer ASSIGN Quantity,V$Qty ;Param quantity = No.
;items bought
ASSIGN Payment,V$Finance ;Param payment = Method ; payment
TEST LE P$Quantity,10,Qcart ;Items >10 Get cart GATE SNF Baskt,Qcart ;Check basket available QUEUE Basket ;Queue for a basket
ENTER Baskt ;Get a basket DEPART Basket ;Leave queue
ASSIGN Carrier,Baskt ;Param carrier assigned ; baskt
TRANSFER ,Shop ;OK to shop
***********************************************************************
Qcart QUEUE Carts ;Queue for a cart
ENTER Cart ;Get a cart
DEPART Carts ;Depart carts queue
ASSIGN Carrier,Cart ;Param carrier assigned ; cart
Shop ADVANCE V$Tshop ;Shopping time elapses
TEST LE P$Quantity,10,Norm ;Items < 10 go to express COUNT L Where,First,Last,1,Q ;Any empty checkouts? TEST E P$Where,0,Norm ;Some empty checkouts?
QUEUE Xpress ;Queue at express SEIZE Xpres ;Get express checkout DEPART Xpress ;Depart express queue ADVANCE V$Checkout ;Checkout time RELEASE Xpres ;Free express checkout LEAVE P$Carrier ;Leave the basket TRANSFER ,Fin
***********************************************************************
Norm SELECT MIN Minque,First,Last,,Q ;Find minimum queue QUEUE P$Minque ;Join the min queue
SEIZE P$Minque ;Get the checkout DEPART P$Minque ;Depart the queue ADVANCE V$Checkout ;Checkout time RELEASE P$Minque ;Free the checkout LEAVE P$Carrier ;Leave the cart
Fin TABULATE Transit ;Record transit time TABULATE Items ;Record items bought SAVEVALUE Customers-,1 ;One customer leaves ADVANCE 600 ;Walk to the car
LEAVE Park ;Leave the car park TERMINATE
Lost TERMINATE ;One customer lost
***********************************************************************
* Arrivals for 0 - 30 min.
GENERATE (Exponential(1,0,60)),,,300 ;A Customer
;arrives TRANSFER ,Beg
* Arrivals for 30 - 90 min.
GENERATE (Exponential(1,0,40)),,18000,900 ;Arrival rate
;after .5 hours
TRANSFER ,Beg
* Arrivals for 90 - 150 min.
GENERATE (Exponential(1,0,80)),,54000,450 ;Arrival rate ; after 1.5 hrs
TRANSFER ,Beg
* Arrivals for 150 min +
GENERATE (Exponential(1,0,120)),,90000 ;Arrival after ; 2.5 hours
TRANSFER ,Beg
***********************************************************************
GENERATE 600 ;Xact each minute
TABULATE Shoppers ;Record number of customers TERMINATE 1
***********************************************************************
The model is organized into several segments. After the Variable Entities and Storage Entities are defined and Savevalues initialized, there are three more model segments.
Transactions in the top segment represent customers who have arrived at the parking lot. If a Transaction finds that the Storage Entity named Park is full, the Transaction leaves the simulation. This represents a customer leaving without entering the store. Customers who enter the store acquire a cart or basket and proceed to shop. If the customer has more than 10 items, he/she joins the smallest checkout queue. The TEST Block in the third model segment performs this test, and sends any such Transactions to the Block labeled Normal. The minimum queue is determined by the SELECT Block in the fourth model segment, which puts the appropriate Queue Entity number into the Transaction’s parameter named Minque.
For those Transactions with 10 items, or less, the COUNT Block in the third model segment checks GPSS Queue Entities numbered 4 through 20 for an empty checkout station. If none is found, the Transaction gets into line for the express checkout station.
The next to last segment contains several GENERATE Blocks which turn on and off at the appropriate times to vary the arrival rate. One could also use a single GENERATE Block with a function modifier which depends on the system clock. The Transactions in the bottom segment time the simulation; tabulate the number of customers at the end of each minute; and decrement the Termination Count.
Running the Simulation
To run the simulation and create a Standard Report,
CHOOSE File / Open
and in the dialog box
SELECT SUPERMRK
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 180
SELECT OK
The simulation will end when 180 Transactions have entered the TERMINATE 1 Block. This represents 3 hours of operation.
When the simulation ends, GPSS World writes a report to the default report file, Supermrk.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
From the Table Transit, we see that the average shopping time was 23640 seconds, or 394 minutes. From the Storage Entity subreport we see that the max content never reached the available capacity. Therefore, there were always enough parking places, baskets, and carts. However, a very large number of customers (397) are waiting in the checkout lines. They are, on average, spending more time waiting in line than they are shopping.
The Table Shoppers gives a histogram of customers in the supermarket, sampled at the end of every minute. There were, on average, 398.7 shoppers. Nearly all of these were waiting to check out.
Inside the Simulation
Let us 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.
Let’s use the SHOW Command to look at some System Numeric Attributes. These will be expressed in parts per thousand. First, the average utilization of baskets.
CHOOSE Command / SHOW
and in the dialog box
TYPE SR$Baskt
Next, the utilization of carts.
CHOOSE Command / SHOW
and in the dialog box
TYPE SR$Cart
Next, the utilization of parking places.
CHOOSE Command / SHOW
and in the dialog box
TYPE SR$Park
The easiest way to view these utilizations is to open the Storages Window.
CHOOSE Window / Simulation Window / Storages
This shows the Storage Entities representing the carts, baskets, and parking places. From the maximum in use, we see that none of these resources were exhausted during the simulation. The histogram of shopping times can be viewed next.
CHOOSE Window / Simulation Window / Table Window and in the drop-down box in the dialog box
CLICK ON The Down Arrow at the Right End of the Box
CLICK ON Transit
SELECT OK
You can also view the histograms of items purchased and shoppers in the supermarket. Those Tables are named Shoppers and Items.
Let’s take a look at where Transactions are.
CHOOSE Window / Simulation Window / Blocks Window
Notice that many Transactions are in the QUEUE Block (Block 30) following the SELECT Block, waiting to enter a SEIZE Block. Transactions here represent customers trying to check out.
Let’s turn now to the checkout lines.
CHOOSE Window / Simulation Window / Facilities Window
Use the slide bar on the side of the window to move to the Facility representing the express checkout line or make the window full screen.
Figure 20—1. The Facilities Window showing the express checkout
Notice that all checkout stations are heavily utilized and have large queues except for the express checkout. Clearly, this situation must be avoided by the management of the supermarket. Before we go on let’s close up the graphics windows that we have opened up until now.
CLICK ON The X-Upper Right of Each Window
Let’s see if adding 10 more checkout stations will solve the problem. Go ahead and change the value of Last to 28. This increases the number of checkout lines from 17 to 27.
CHOOSE Command / Custom
and in the dialog box
TYPE Last EQU 28
SELECT OK
and
CHOOSE Command / Clear
SELECT OK
Now, start the simulation running with the new number of lanes.
CHOOSE Command / START
and in the dialog box, replace the 1.
TYPE 180
SELECT OK
When the simulation ends, look at the important statistics as before. Do you think 10 more checkout lines will suffice? Perhaps fewer would do. Management decisions such as the configuration of checkout lines are complex tradeoffs involving costs, revenues, and customer satisfaction.
Please feel free to modify the parameters and Blocks of this simulation.
If you wish to go on to the next lesson, close all windows related to this model.
CLICK ON The X-Upper Right of Each Window
Otherwise, to end the session
CLICK ON The X-Upper Right of Main Window.