0% found this document useful (0 votes)
87 views

Lab-5 CSC 317 Simulation & Modelling

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
87 views

Lab-5 CSC 317 Simulation & Modelling

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

GPSS (General Purpose Simulation System)

Lab-5 CSC 317 Simulation & Modelling (B.Sc. CSIT 5th Semester)

1. Open GPSS Software

2. Create a New File

3. File-> New-> Model-> OK

4. Save the program the extension. gps

5. Write the GPSS code

6. Save

7. Now Simulation Window is Ready to Run the Program.

8. Click on Command -> Create Simulation

9. Simulation Journal Window will appear-> it displays the date & time also say the Ready.

10. Click on Command-> START -> OK

Then we have to set the Start other than value 1.

or START value can be included at the last line of code.

(For Example, START 500) (Entry Count Setup)

11. Then the final Report appears generated by GPSS Simulation.

For Display Block Window

Window -> Simulation Window-> Block Window.

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
Lab-5

5. Simulation of single server queue system using GPSS.


i. Barber Shop simulation to simulate one day of operation of a barber.
Problem:

Customers arrive at barber shop at the rate of 18 ± 6. Barbar serves each customer at the rate of 16 ± 4

minutes. Simulate system for queue of customer for one day (i.e. 8 hours).=480min

GENERATE 18,6 ; Customer arrive every 18±6 mn


QUEUE Chairs ; Enter the line
SEIZE Joe ; Capture the barber
DEPART Chairs ; Leave the line
ADVANCE 16,4 ; Get a hair cut in 16±4 mn
RELEASE Joe ; Free the barber
TERMINATE ; Leave the shop
*Simulating system for queue of customer for one day ( i.e. 8 hours).
GENERATE 480 ; Timer arrives at time = 480 mn
TERMINATE 1 ; Shut off the run; Ends the simulation run after 8 hours.
START 1 ; Start one run

Output:

GPSS World Simulation Report - Lab 5(i) Barber1DayOperation.1.1

Tuesday, August 13, 2024 12:34:18

START TIME END TIME BLOCKS FACILITIES STORAGES


0.000 480.000 9 1 0

NAME VALUE
UNSPECIFIED
CHAIRS 10000.000
JOE 10001.000
Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY
1 GENERATE 26 0 0
2 QUEUE 26 0 0
3 SEIZE 26 0 0
4 DEPART 26 0 0
5 ADVANCE 26 1 0
6 RELEASE 25 0 0
7 TERMINATE 25 0 0
8 GENERATE 1 0 0
9 TERMINATE 1 0 0

FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY
DELAY
JOE 26 0.863 15.926 1 27 0 0 0
0

QUEUE MAX CONT. ENTRY ENTRY(0) AVE.CONT. AVE.TIME AVE.(-0)


RETRY
CHAIRS 1 0 26 15 0.078 1.441 3.407 0

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE


27 0 482.664 27 5 6
28 0 482.707 28 0 1
29 0 960.000 29 0 8

Block Entities:

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
ii. Barber Shop simulation (simple).

Problem: Customers arrive at barber shop at the rate of 300 ± 100. Mechanic serves each
customer at the rate of 400 ± 200 minutes. Simulate system for queue of customer and measure
of waiting time for 1000 customers.

Model:

GENERATE 300,100 ; Create next customer


QUEUE Barber ; Begin queue time
SEIZE Barber ; Own or wait for barber
DEPART Barber ; End queue time
ADVANCE 400,200 ; Haircut takes a few minutes
RELEASE Barber ; Haircut done. Give up the barber.
TERMINATE 1 ; Customer leaves
START 1000; for 1000 customers OR it can be provided from user instead of writing this line of code

Output:

GPSS World Simulation Report - Lab5(ii) Barbar Shop Simulation(Simple).1.1

Tuesday, August 13, 2024 15:21:40

START TIME END TIME BLOCKS FACILITIES STORAGES


0.000 401931.114 7 1 0

NAME VALUE
BARBER 10000.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY


1 GENERATE 1347 0 0
2 QUEUE 1347 346 0
3 SEIZE 1001 1 0
4 DEPART 1000 0 0
5 ADVANCE 1000 0 0
6 RELEASE 1000 0 0
7 TERMINATE 1000 0 0
Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY
DELAY
BARBER 1001 0.999 401.161 1 1001 0 0 0
346

QUEUE MAX CONT. ENTRY ENTRY(0) AVE.CONT. AVE.TIME AVE.(-0)


RETRY
BARBER 347 347 1347 1 174.888 52184.845 52223.615 0

CEC XN PRI M1 ASSEM CURRENT NEXT PARAMETER VALUE


1001 0 298909.662 1001 3 4

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE


1348 0 402257.310 1348 0 1

Block Entities:

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
iii. Mechanic Shop simulation

Problem: Customers arrive at mechanic shop at the rate of 300 ± 200. Mechanic serves each
customer at the rate of 200 ± 50 minutes. Simulate system for queue of customer and
measure of waiting time for 1000 customers.

Model:

GENERATE 300 200 ;Create next customer


QUEUE MECHANIC
SEIZE MECHANIC ;Own mechanic(resource)
DEPART MECHANIC
ADVANCE 200 50 ;Mechanic Takes some Time
RELEASE MECHANIC ;Release the resource
TERMINATE 1 ;End simulation
START 1000

Output:

GPSS World Simulation Report - Lab5(iii) Machine Shop


Simulation.1.1

Tuesday, August 13, 2024 15:54:01

START TIME END TIME BLOCKS FACILITIES STORAGES


0.000 302200.785 7 1 0

NAME VALUE
MECHANIC 10000.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY


1 GENERATE 1000 0 0
2 QUEUE 1000 0 0
3 SEIZE 1000 0 0
4 DEPART 1000 0 0
5 ADVANCE 1000 0 0
6 RELEASE 1000 0 0
7 TERMINATE 1000 0 0

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY
DELAY
MECHANIC 1000 0.660 199.321 1 0 0 0 0
0

QUEUE MAX CONT. ENTRY ENTRY(0) AVE.CONT. AVE.TIME AVE.(-0)


RETRY
MECHANIC 2 0 1000 727 0.061 18.521 67.841 0

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE


1001 0 302264.348 1001 0 1

Block Entities:

iv. Telephone System Simulation.

Problem: Construct a GPSS simulation model to represent a basic telephone system with the following
characteristics: Calls are generated randomly, arriving on average every 100 time units with a standard
deviation of 20. The system has one phone line to process calls. If the line is available, calls are handled
immediately; otherwise, they join a queue. Each call takes an average of 50 time units to process, with a
standard deviation of 10. Once a call is completed, the line becomes available for the next queued call. The
simulation concludes after each call is processed.

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
Model:

GENERATE 100,20 ; Generate calls every 100 units with a 20 unit standard deviation

QUEUE Callqueue ; Queue for incoming calls

SEIZE Phone ; Attempt to seize a phone line

DEPART Callqueue; Depart from the queue

ADVANCE 50,10 ; Call duration with a mean of 50 units and a 10 unit standard deviation

RELEASE Phone; Release the phone line

TERMINATE 1 ; Terminate the entity (call)

Output:

GPSS World Simulation Report - Lab5(IV)Telephone.3.1

Tuesday, August 13, 2024 07:51:44

START TIME END TIME BLOCKS FACILITIES STORAGES


0.000 5124.246 7 1 0

NAME VALUE
CALLQUEUE 10000.000
PHONE 10001.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY


1 GENERATE 50 0 0
2 QUEUE 50 0 0
3 SEIZE 50 0 0
4 DEPART 50 0 0
5 ADVANCE 50 0 0
6 RELEASE 50 0 0
7 TERMINATE 50 0 0

FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY
DELAY
PHONE 50 0.485 49.741 1 0 0 0 0
0

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
QUEUE MAX CONT. ENTRY ENTRY(0) AVE.CONT. AVE.TIME AVE.(-0)
RETRY
CALLQUEUE 1 0 50 50 0.000 0.000 0.000 0

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE


51 0 5189.874 51 0 1

v. Turnstile of Football Stadium.


Problem: Spectators arrive at a turnstile of a football stadium every 7±7 seconds and queue for
admittance. The time to pass through is evenly distributed at 5±3 seconds. A model is required
to determine the time taken by 300 people to pass through the turnstile.

Model:

GENERATE 7,7 ;People arrive


QUEUE Turn ;Enter queue
SEIZE Turn ;Acquire turnstile
DEPART Turn ;Depart the queue
ADVANCE 5,3 ;Use tulrnstile
RELEASE Turn ; Leave turnstile
TERMINATE 1 ;One Spectator Enters

Output:

GPSS World Simulation Report - Lab 5(V)Turnstile of Football


Stadium.2.1

Wednesday, August 14, 2024 11:20:15

START TIME END TIME BLOCKS FACILITIES STORAGES


0.000 2134.023 7 1 0

NAME VALUE
TURN 10000.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY


1 GENERATE 300 0 0
Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
2 QUEUE 300 0 0
3 SEIZE 300 0 0
4 DEPART 300 0 0
5 ADVANCE 300 0 0
6 RELEASE 300 0 0
7 TERMINATE 300 0 0

FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY
DELAY
TURN 300 0.690 4.906 1 0 0 0 0
0

QUEUE MAX CONT. ENTRY ENTRY(0) AVE.CONT. AVE.TIME AVE.(-0)


RETRY
TURN 3 0 300 150 0.319 2.270 4.540 0

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE


301 0 2135.381 301 0 1

Block Entities:

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
vi. Manufacturing Shop.

Problem: A machine tool in a manufacturing shop is turning out parts at the rate of every 5
minutes. As they are finished, the parts are turned over to an inspector who takes 4±3 minutes to
examine each one and rejects about 10% of the parts as faulty. Each part will be represented by a
transaction and the base time unit for the system is chosen as 1 minute. Simulate for 100 parts to
leave the system.

Model-1

GENERATE 5

ADVANCE 4, 3

TRANSFER 0.1, ACC, REJ

ACC TERMINATE 1

REJ TERMIMATE 1

START 100

Output:

GPSS World Simulation Report - Untitled Model 1.6.1

Thursday, August 15, 2024 13:39:51

START TIME END TIME BLOCKS FACILITIES STORAGES


0.000 501.514 5 0 0

NAME VALUE
ACC 4.000
REJ 5.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY


1 GENERATE 100 0 0
2 ADVANCE 100 0 0
3 TRANSFER 100 0 0
ACC 4 TERMINATE 86 0 0
REJ 5 TERMINATE 14 0 0

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE


101 0 505.000 101 0 1

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
Block Entities:

Model-2

Modify the previous examples using facilities: (SEIZE &RELEASE)

There is only one inspector

GENERATE 5
SEIZE Insp
ADVANCE 4, 3
RELEASE Insp
TRANSFER 0.1 Acc, Rej
Acc TERMINATE 1
Rej TERMINATE 1
START 1000

Output:
GPSS World Simulation Report - Untitled Model 1.3.1

Thursday, August 15, 2024 13:33:29

START TIME END TIME BLOCKS FACILITIES STORAGES


0.000 5006.992 7 1 0

NAME VALUE
ACC 6.000
INSP 10000.000
REJ 7.000

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY
1 GENERATE 1001 0 0
2 SEIZE 1001 1 0
3 ADVANCE 1000 0 0
4 RELEASE 1000 0 0
5 TRANSFER 1000 0 0
ACC 6 TERMINATE 906 0 0
REJ 7 TERMINATE 94 0 0

FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY
DELAY
INSP 1001 0.782 3.911 1 1001 0 0 0
0

CEC XN PRI M1 ASSEM CURRENT NEXT PARAMETER VALUE


1001 0 5005.000 1001 2 3

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE


1002 0 5010.000 1002 0 1

Block Entities:

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
Model -3
Modify the previous example using storages. (ENTER & LEAVE)
There are 3 inspectors

GENERATE 5
ENTER Ins,1
ADVANCE 4,3
LEAVE Ins, 1
TRANSFER 0.1, Acc, Rej
Acc TERMINATE 1
Rej TERMINATE 1
Ins STORAGE 3
START 1000

Output:

GPSS World Simulation Report - Untitled Model 1.8.1

Thursday, August 15, 2024 13:49:38

START TIME END TIME BLOCKS FACILITIES STORAGES


0.000 5004.024 7 0 1

NAME VALUE
ACC 6.000
INS 10000.000
REJ 7.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY


1 GENERATE 1000 0 0
2 ENTER 1000 0 0
3 ADVANCE 1000 0 0
4 LEAVE 1000 0 0
5 TRANSFER 1000 0 0
ACC 6 TERMINATE 896 0 0
REJ 7 TERMINATE 104 0 0

STORAGE CAP. REM. MIN. MAX. ENTRIES AVL. AVE.C. UTIL. RETRY
DELAY
Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
INS 3 3 0 2 1000 1 0.796 0.265 0 0

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE


1001 0 5005.000 1001 0 1

Block Entities:

Model-4
Modifying the previous example using storage & keeping queue statistics: There are 3 inspectors.
GENERATE 5
QUEUE Insq
ENTER Ins,1
DEPART Insq
ADVANCE 4,3
LEAVE Ins, 1
TRANSFER 0.1, Acc, Rej
Acc TERMINATE 1
Rej TERMINATE 1
Ins STORAGE 3
START 1000

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
Output:

GPSS World Simulation Report - Untitled Model 1.9.1

Thursday, August 15, 2024 13:54:59

START TIME END TIME BLOCKS FACILITIES STORAGES


0.000 5004.024 9 0 1

NAME VALUE
ACC 8.000
INS 10000.000
INSQ 10001.000
REJ 9.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY


1 GENERATE 1000 0 0
2 QUEUE 1000 0 0
3 ENTER 1000 0 0
4 DEPART 1000 0 0
5 ADVANCE 1000 0 0
6 LEAVE 1000 0 0
7 TRANSFER 1000 0 0
ACC 8 TERMINATE 896 0 0
REJ 9 TERMINATE 104 0 0

QUEUE MAX CONT. ENTRY ENTRY(0) AVE.CONT. AVE.TIME AVE.(-0)


RETRY
INSQ 1 0 1000 1000 0.000 0.000 0.000 0

STORAGE CAP. REM. MIN. MAX. ENTRIES AVL. AVE.C. UTIL. RETRY
DELAY
INS 3 3 0 2 1000 1 0.796 0.265 0 0

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE


1001 0 5005.000 1001 0 1

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
Block Entities:

Model-5

Simulate system for T time units and not for k Xacts to finish a service,

• This line states the objective of the simulation. It aims to run for a specific duration (T time
units) rather than until a certain number of transactions (Xacts) complete a service.

For example, simulate for 8 hours (base time unit is 1 minute)

• This provides an example of the simulation duration: 8 hours, where each time unit
represents 1 minute.

GENERATE 5
QUEUE Insq
ENTER Ins,1
DEPART Insq
ADVANCE 4,3
LEAVE Ins, 1
TRANSFER 0.1, Acc, Rej
Acc TERMINATE 0
Rej TERMINATE 0
GENERATE 480
TERMINATE 1
Ins STORAGE 3
START 1

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
Output:

GPSS World Simulation Report - Untitled Model 2.4.1

Thursday, August 15, 2024 14:07:53

START TIME END TIME BLOCKS FACILITIES STORAGES


0.000 480.000 11 0 1

NAME VALUE
ACC 8.000
INS 10000.000
INSQ 10001.000
REJ 9.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY


1 GENERATE 95 0 0
2 QUEUE 95 0 0
3 ENTER 95 0 0
4 DEPART 95 0 0
5 ADVANCE 95 0 0
6 LEAVE 95 0 0
7 TRANSFER 95 0 0
ACC 8 TERMINATE 81 0 0
REJ 9 TERMINATE 14 0 0
10 GENERATE 1 0 0
11 TERMINATE 1 0 0

QUEUE MAX CONT. ENTRY ENTRY(0) AVE.CONT. AVE.TIME AVE.(-0)


RETRY
INSQ 1 0 95 95 0.000 0.000 0.000 0

STORAGE CAP. REM. MIN. MAX. ENTRIES AVL. AVE.C. UTIL. RETRY
DELAY
INS 3 3 0 2 95 1 0.779 0.260 0 0

CEC XN PRI M1 ASSEM CURRENT NEXT PARAMETER VALUE


97 0 480.000 97 0 1

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE


98 0 960.000 98 0 10

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)
Block Entities:

Santosh Sharma
Department of Computer Science & IT(CAB-Tech.)

You might also like