- •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
TYPE 100,NP
SELECT OK
Each row in the matrix represents transitions out of any single state. Use the slide bar, if necessary, to see additional columns. Each column represents transitions into any single state. Every state change causes a cell in the transition matrix to be incremented.
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.
19. QTHEORY.GPS
Simulation of a solvable queuing network.
Problem Statement
When feasible, an analytical solution to queuing systems provides a useful means of estimating the performance of simple systems.
This program simulates a system for which the queuing parameters are calculated using the appropriate Pollaczek and Khintchin (P-K) equations. The objective is to verify the results obtained by simulation using GPSS World.
The program simulates an interarrival time of 5 seconds( 500 time units), exponentially distributed, and a single service channel. The mean service time is 3 seconds( 300 time units). The average utilization of the server is consequently 60%.
Three modes of service times are investigated.
1.Constant service time.
2.Exponentially distributed service time.
3.Erlang (k=2) service time.
1.Run the simulation for 500 minutes.
2.Determine the queue statistics for each type of service.
3.Compare the simulation results with the predictions of queuing theory.
Listing
; GPSS World Sample File - QTHEORY.GPS, by Gerard F. Cummings
**********************************************************************
*Queuing Theory Verification *
*Time Unit Is 1/100 Of a Second *
**********************************************************************
Transit TABLE M1,250,250,20
Number TABLE Q$Expon,0,1,20
Qconstant QTABLE Constant,200,200,20 Qexpon QTABLE Expon,200,200,20 Qerlang QTABLE Erlang,200,200,20
**********************************************************************
GENERATE (Exponential(1,0,500)) ;Interarrival 5 seconds QUEUE Constant
SEIZE Facility1
ADVANCE 300 ;Service constant 3 secs RELEASE Facility1
DEPART Constant TERMINATE
**********************************************************************
GENERATE (Exponential(1,0,500)) ;Interarrival 5 seconds QUEUE Expon
SEIZE Facility2
ADVANCE (Exponential(1,0,300)) ;Service time 3 secs Expon RELEASE Facility2
DEPART Expon TABULATE Transit TERMINATE
***********************************************************************
GENERATE (Exponential(1,0,500)) ;Interarrival time 5 secs QUEUE Erlang
SEIZE Facility3
ADVANCE (Exponential(1,0,150)) ;Erlang K=2 Service 3 secs ADVANCE (Exponential(1,0,150))
RELEASE Facility3 DEPART Erlang TERMINATE
***********************************************************************
GENERATE (Exponential(1,0,6000)) ;Random sample, ; Ave. 1 per minute
TABULATE Number TERMINATE 1
***********************************************************************
The model is organized into several segments. After the Storage Entities are defined and Savevalues initialized, there are three model segments for Transactions encountering Constant, Exponential and Erlang-2 service times, respectively.
Transactions in the bottom segment take random samples of the number of "exponential" Transactions in the system. These Transactions time the simulation and decrement the Termination Count once per simulated hour, on average.
Running the Simulation
To run the simulation and create a Standard Report,
CHOOSE File / Open
and in the dialog box
SELECT QTHEORY
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 500
SELECT OK
The simulation will end when 500 Transactions have entered the TERMINATE 1 Block. This represents 500 minutes of operation.
When the simulation ends, GPSS World writes a report to the default report file, Qtheory.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 mean and standard deviations of queue time, queue length, and waiting time are calculated using the P-K formulae and tabulated below in table 1. Queue time is the sum of waiting time and service time. Results from GPSS World model QTHEORY.GPS are shown in parentheses.
Solutions Using Pollaczek and Khintchin Formulae
Constant Exponential Erlang Service Service Service
Mean Queue Time 525 750 637.5 (526.7) (757.5) (649.4)
Mean Queue Length 1.05 1.50 1.275 (1.05) (1.50) (1.29)
Mean Waiting Time 225 450 337.5
(Mean Queue Time - (226.7) (453.5) (349.7) Mean Service Time)
(Facility Ave. Time)
Std Dev Queue Time 319 750 415
(287) (739.9) (595)
Std Dev Queue Length 1.43 1.94 1.57 Std Dev Wait Time 130 276 195
For exponentially distributed service times, the probability of the number of Transactions in the system is calculated using the formula
P(n)=(1-λ/μ)(λ/μ)^n
where λ is the mean arrival rate, and μ is the mean service rate. These probabilities are tabulated in Table 2. Results from the GPSS World model QTHEORY.GPS are shown in parentheses.
Table 2. Cumulative Probability of N Transactions
in System
Number in System Cumulative QTHEORY.GPS Probability
0 .4000 (.4060)
1 .6400 (.6320)
2 .7840 (.7740)
3 .8704 (.8660)
4 .9222 (.9160)
Number in System Cumulative QTHEORY.GPS Probability
5 .9533 (.9560)
6 .9720 (.9660)
7 .9787 (.9820)
8 .9828 (.9840)
9 .9852 (.9960)
As the length of the simulation increases, the simulated values tend to approach the theoretical values. In the present case, we would normally run the simulation much longer to obtain more precision. This would cause our simulated results to converge to the theoretical values.
Let’s observe the convergence to the average queue time for the exponential service time distribution. The theoretical value is 750 (7.50 seconds).
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 Qexpon
SELECT OK
and
CHOOSE Command / Clear