Gpss (General Purpose Simulation System)



Yüklə 68,13 Kb.
tarix11.10.2017
ölçüsü68,13 Kb.

GPSS (General Purpose Simulation System)


A package to simulate discrete event system. A Client-server system. A general queuing system. Developed by Jeff Gordon of IBM around 1961, 1962.
GPSS is not a programming system like Simscript; one doesn’t “write” program here, but design a network of Blocks through which percolating simulation objects collectively alludes to a sense of process.

A discrete event simulator that basically sees system dynamics via change of states of queues, storages, facilities (servers), switch, etc.


Another possibility


The clients (processes) are called transactions. GPSS is a transaction-based simulation system.


The program is a collection of steps (or blocks) which do something. Minimally

GENERATE

Generates transactions


On a timeline, they would appear as

As these transactions percolate through blocks, the system state changes by their behavior. Ultimately each transaction would be

terminated as they hit the TERMINATION block.
An example of a single queuing system follows.
Client-server1.gps
10 generate 12,8 ; transactions generated

15 queue CPUQ ; generated transaction enters CPUQ

20 seize CPU ; try to get the server CPU from CPUQ

25 depart CPUQ ; leave queue if server is seized

30 advance 8,3 ; spend time between 5 and 11 units now

35 release CPU ; abandon server

40 terminate 1 ; get terminated
start 250


  • Every block has a number.

  • The numbers are in ascending order.

  • The simulation is controlled by a counter which has a value 250

  • When a transaction hits the terminate block, the counter is reduced by 1.

  • When the counter value reduces to zero, simulation stops.

  • The generate block produces transaction whose average interarrival time is between (12-8) and (12+8)

  • At an advance block, a transaction waits. It is the service time received from the server. In this case it is between (8-3) and (8+3)

  • Anything followed by a ; is a comment.

OUTPUT


GPSS World Simulation Report - client_server1.2.1

Tuesday, January 28, 2014 12:52:19
START TIME END TIME BLOCKS FACILITIES STORAGES

0.000 3012.819 7 1 0

NAME VALUE

CPU 10001.000

CPUQ 10000.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY

1 GENERATE 251 0 0

2 QUEUE 251 0 0

3 SEIZE 251 1 0

4 DEPART 250 0 0

5 ADVANCE 250 0 0

6 RELEASE 250 0 0

7 TERMINATE 250 0 0

FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY DELAY

CPU 251 0.666 7.990 1 251 0 0 0 0

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

CPUQ 2 1 251 175 0.081 0.975 3.219 0

CEC XN PRI M1 ASSEM CURRENT NEXT PARAMETER VALUE

251 0 3004.780 251 3 4


  • Start time of simulation: 0. End time: 3012

  • Every server is called a Facility. The facility used here is CPU. It served 251 transactions (customers). Its utilization rate is very low, only 66.7%. Therefore, idle time: 23.3%

  • Average time spent by a transaction is 7.99 units. No transaction retried to get the server.

  • Maximum queue count was 2. At the time simulation ended, queue count was 1. 175 out of 251 transactions found the queue empty. Average time spent in the queue is 0.975, average count of the queue is 0.081. Average time spent in the queue by those who entered a non-empty queue is 3.219.

Model 2. Generate transactions at a faster rate.


Change line 10 to
10 generate 8,5
Output:
GPSS World Simulation Report - Untitled Model 3.1.1

Tuesday, January 28, 2014 13:31:51
START TIME END TIME BLOCKS FACILITIES STORAGES

0.000 2031.824 7 1 0

NAME VALUE

CPU 10001.000

CPUQ 10000.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY

1 GENERATE 254 0 0

2 QUEUE 254 3 0

3 SEIZE 251 1 0

4 DEPART 250 0 0

5 ADVANCE 250 0 0

6 RELEASE 250 0 0

7 TERMINATE 250 0 0

FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY DELAY

CPU 251 0.987 7.992 1 251 0 0 0 3

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

CPUQ 8 4 254 8 4.673 37.385 38.600 0

CEC XN PRI M1 ASSEM CURRENT NEXT PARAMETER VALUE

251 0 2001.614 251 3 4

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE

255 0 2033.846 255 0 1


  • Note the changes. The server is working at a rate of 98.7% now.

  • At the time simulation ended, there were 3 transactions in the queue, 1 transaction still receiving service. Max, queue count increases to 8, average queue count to 4.7

Using a finite buffer as a storage.



10 buff storage 8 ; buff is a stroage with 8 slots here

12 generate 12,8

15 transfer both,,drop ; try enter the nextblock; else to drop

17 enter buff,1 ; enter the storage occupy one slot

18 seize router ; try to get the router

20 leave buff,1 ; leave storage since you are in router

25 advance 15 ; delay by a constant amount of time

30 release router ; router releases the xact

35 drop terminate 1 ; terminate the xact
start 250

OUTPUT
GPSS World Simulation Report - Untitled Model 2.8.1



Tuesday, January 28, 2014 21:16:19
START TIME END TIME BLOCKS FACILITIES STORAGES

0.000 3127.017 8 1 1

NAME VALUE

BUFF 10000.000

DROP 8.000

ROUTER 10001.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY

1 GENERATE 258 0 0

2 TRANSFER 258 0 0

3 ENTER 215 7 0

4 SEIZE 208 1 0

5 LEAVE 207 0 0

6 ADVANCE 207 0 0

7 RELEASE 207 0 0

DROP 8 TERMINATE 250 0 0

FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY DELAY

ROUTER 208 0.993 14.928 1 249 0 0 0 7

STORAGE CAP. REM. MIN. MAX. ENTRIES AVL. AVE.C. UTIL. RETRY DELAY

BUFF 8 0 0 8 215 1 6.766 0.846 0 0

CEC XN PRI M1 ASSEM CURRENT NEXT PARAMETER VALUE

249 0 3014.821 249 4 5

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE

259 0 3128.848 259 0 1


  • If a xact enters a storage, it must leave a storage

  • If a xact enqueues a queue, it must depart a queue

  • A queue never refuses an entering xact

  • A storage once full will not accept any xact

  • No xact may enter a generate block

  • Every storage must be initialized before xacts are generated

Multiple parallel streams

10********************************************************

11* *

12* Generating multiple streams of transactions *

13* *

14********************************************************

15*

20 term1 generate 15,6

21 assign 1,1 ; P1 receives value 1

22 transfer ,there ; unconditionally to there

30 term2 generate 18,9

31 assign 1,2 ; P1 receives value 2

32 transfer ,there ; unconditionally to there

40 term3 generate 12,9

41 assign 1,3

42 there queue CPUQ

43 seize CPU

44 depart CPUQ

45 advance 15,9

46 release CPU

47 queue *1

48 depart *1

49 transfer ,next

50 next terminate 1
start 230
OUTPUT

GPSS World Simulation Report - Untitled Model 2.11.1

Tuesday, January 28, 2014 21:53:36
START TIME END TIME BLOCKS FACILITIES STORAGES

0.000 3445.254 17 1 0

NAME VALUE

CPU 10001.000

CPUQ 10000.000

NEXT 17.000

TERM1 1.000

TERM2 4.000

TERM3 7.000

THERE 9.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY

TERM1 1 GENERATE 226 0 0

2 ASSIGN 226 0 0

3 TRANSFER 226 0 0

TERM2 4 GENERATE 191 0 0

5 ASSIGN 191 0 0

6 TRANSFER 191 0 0

TERM3 7 GENERATE 296 0 0

8 ASSIGN 296 0 0

THERE 9 QUEUE 713 482 0

10 SEIZE 231 1 0

11 DEPART 230 0 0

12 ADVANCE 230 0 0

13 RELEASE 230 0 0

14 QUEUE 230 0 0

15 DEPART 230 0 0

16 TRANSFER 230 0 0

NEXT 17 TERMINATE 230 0 0

FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY DELAY

CPU 231 0.995 14.833 1 232 0 0 0 482

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

1 1 0 76 76 0.000 0.000 0.000 0

2 1 0 60 60 0.000 0.000 0.000 0

3 1 0 94 94 0.000 0.000 0.000 0

CPUQ 483 483 713 1 241.648 1167.654 1169.294 0

CEC XN PRI M1 ASSEM CURRENT NEXT PARAMETER VALUE

232 0 1127.951 232 10 11 1 3.000

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE

714 0 3448.025 714 0 7

715 0 3458.985 715 0 4

716 0 3462.196 716 0 1

GENERATE BLOCK

GENERATE creates transactions for future entry into

the simulation.

GENERATE A,B,C,D,E

A: Mean interarrival time B: Interarrival time modifier. Optional

C: Start delay time. Time increment for the 1st transaction. Optional

D: Creation limit. Optional

E: Priority. Zero is the default. Optional

All transactions are generated with interarrival time

uniformly distributed between A-B and A+B, A must be

greater than B. Examples:

GENERATE 60

Generate a priority 0 transaction every 60 units of time.

GENERATE 40,8,12,250,5

First transaction will be ready at time 12. After that the

interarrival time between transactions will be a uniformly distributed between (40-8) and (40+8) units of time. This

block will create at most 250 transactions, all with priority 5.


If we want to suppress output from the first set of

run, we need to change it in the following way:
START 250, NP ;NP stands for no printing

RESET


START 100

To repeat simulation with a different set of customers we use a CLEAR card followed be a different START card.


When a server starts, we want it to find customers already

in its queue. This could be done in the following way:


10************************************

11*** Start with a non-empty queue ***

12************************************

13*

20 generate ,,,10 ; 10 xacts are generated

21 transfer ,here ; unconditionally go to here

22 generate 25,10

25 here queue waitingline

27 seize nurse

30 depart waitingline

35 advance 15,3

40 release nurse

45 terminate

50 generate 480 ; End of the day signal

51 terminate 1 ; Outpatient closes
start 1
OUTPUT


GPSS World Simulation Report - Untitled Model 4.8.1

Wednesday, January 29, 2014 11:33:08
START TIME END TIME BLOCKS FACILITIES STORAGES

0.000 480.000 11 1 0

NAME VALUE

HERE 4.000

NURSE 10001.000

WAITINGLINE 10000.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY

1 GENERATE 10 0 0

2 TRANSFER 10 0 0

3 GENERATE 19 0 0

HERE 4 QUEUE 29 0 0

5 SEIZE 29 0 0

6 DEPART 29 0 0

7 ADVANCE 29 1 0

8 RELEASE 28 0 0

9 TERMINATE 28 0 0

10 GENERATE 1 0 0

11 TERMINATE 1 0 0

FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY DELAY

NURSE 29 0.906 15.003 1 30 0 0 0 0

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

WAITINGLINE 9 0 29 6 3.529 58.407 73.644 0

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE

30 0 481.926 30 7 8

31 0 485.888 31 0 3

32 0 960.000 32 0 10

What if we replace one nurse with two nurses? How do we facilitate the service?


10************************************

11*** Start with a non-empty queue ***

12************************************

13*

20 generate ,,,10 ; 10 xacts are generated

21 transfer ,here ; unconditionally go to here

22 generate 25,10

25 here transfer 0.52,,second ;52% xact heads for second

26 queue nurse1

27 seize nurse1

30 depart nurse1

35 advance 15,3

40 release nurse1

45 terminate

46 second queue nurse2

47 seize nurse2

48 depart nurse2

49 advance 15,3

50 release nurse2

51 terminate

52 generate 480 ; End of the day signal

53 terminate 1 ; Outpatient closes
start 1
OUTOUT


GPSS World Simulation Report - Untitled Model 4.10.1

Wednesday, January 29, 2014 11:48:33
START TIME END TIME BLOCKS FACILITIES STORAGES

0.000 480.000 18 2 0

NAME VALUE

HERE 4.000

NURSE1 10001.000

NURSE2 10000.000

SECOND 11.000

LABEL LOC BLOCK TYPE ENTRY COUNT CURRENT COUNT RETRY

1 GENERATE 10 0 0

2 TRANSFER 10 0 0

3 GENERATE 17 0 0

HERE 4 TRANSFER 27 0 0

5 QUEUE 12 0 0

6 SEIZE 12 0 0

7 DEPART 12 0 0

8 ADVANCE 12 0 0

9 RELEASE 12 0 0

10 TERMINATE 12 0 0

SECOND 11 QUEUE 15 0 0

12 SEIZE 15 0 0

13 DEPART 15 0 0

14 ADVANCE 15 1 0

15 RELEASE 14 0 0

16 TERMINATE 14 0 0

17 GENERATE 1 0 0

18 TERMINATE 1 0 0

FACILITY ENTRIES UTIL. AVE. TIME AVAIL. OWNER PEND INTER RETRY DELAY

NURSE2 15 0.467 14.936 1 28 0 0 0 0

NURSE1 12 0.367 14.699 1 0 0 0 0 0

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

NURSE2 6 0 15 9 0.605 19.364 48.410 0

NURSE1 2 0 12 8 0.126 5.045 15.135 0

FEC XN PRI BDT ASSEM CURRENT NEXT PARAMETER VALUE

28 0 486.259 28 14 15

29 0 486.356 29 0 3

30 0 960.000 30 0 17

Dostları ilə paylaş:


Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2019
rəhbərliyinə müraciət

    Ana səhifə