1 simulation using gpss/h - introduction to gpss/h march 2009

66
1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

Upload: bertram-atkinson

Post on 19-Jan-2016

297 views

Category:

Documents


12 download

TRANSCRIPT

Page 1: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

1

Simulation using GPSS/H -

Introduction to GPSS/H

March 2009

Page 2: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

2

THE GPSS/H WORLD VIEW

The system is modeled from the viewpoint of entities moving through the system.

These dynamic moving entities are called Transactions.

Envisioned as moving through the system by moving from Block to Block.

Collection of Blocks representing the whole system is called a Block Diagram

Page 3: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

3

Block Command in GPSS/H

Page 4: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

4

Example

TRANSACTION REPRESENTATION IN GPPS/H Block

arrival of a customer at the checkout counter

GENERATE

checkout time of a customer ADVANCE

departure of a customer TERMINATE

Page 5: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

5

BASIC ELEMENTS OF GPSS/H

Transaction Resources and other entities Blocks Control Statements Compiler Directives Standard Numerical Attributes

Page 6: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

6

TRANSACTIONS Transactions is abbreviated as XACTs Created to perform certain task in the model After completing their task, Transaction leave the system and are

destroyed. These Transactions are temporary entities (Note: Transactions m

ay never leave the system, called permanent entities) A transaction represent an objec (person in ATM system, car in a

ssembly system, etc) A transaction has one or more attributes (an attribute of car is col

or or type) In complex model, there are several type transaction

Garment production system T-shirt, Jeans, Jacket, etc Toll highway system truck, van, sedan, etc Commuter trains passenger and trains

Page 7: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

7

RESOURCES

Static, permanent entities in a GPSS/H model.

They do not leave the system and cannot be destroyed.

Used to perform a certain task (e.g., to serve a customer at the checkout counter)

Resources may be people or objects (e.g., the clerk in the checkout line, assembly stations, machine, etc)

Page 8: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

8

RESOURCES

Two types of resources: Facilities and Storages Facilities are used to model single unit

resources Storages are used to model multiple, parallel

resources

Page 9: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

9

GPSS/H BLOCKS

Describe how a transaction moves through a system

A Block represents a specific action or event A combination of Blocks represent the

processing of a Transaction as it moves through the system (called “logic” of a simulation model)

Page 10: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

10

Example : Joe Barbershop

Konsumen datang untuk merapikan rambut dengan interval waktu antara 12 – 24 menit (distribusi uniform).Melepas jaket dan meletakkan pada gantungan 0.5 menitJika tukang potong rambut JOE sedang sibuk , konsumen menunggu. Jika tidak, konsumen akan dilayani dalam waktu 12 – 18 menit (distribusi uniform).Setekah selesi dipotong konsomen akan meninggalkan tempat barbershop.

Page 11: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

11

GENERATE18,6

ADVANCE0.5

SEIZE

JOE

ADVANCE15,3

RELEASE JOE

1

TERMINATE

Kedatangan konsumen U(18,6) menit

Waktu melepas dan merapikan jaket 0.5 menit

Konsumen berusaha mendapatkan layanan (“capture”) dari JOE

Waktu pelayanan merapikan rambut U(15,3)

Konsumen melepaskan layanan (“freeing”) dari JOE

Konsumen meninggalkan sistem 1 orang

PENGEMBANGAN DIAGRAM BLOK GPSS/H : JOE’S BARBERSHOP

Page 12: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

12

Page 13: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

13

CONTROL STATEMENTS

SIMULATESTART 100END

SIMULATE control statement indicates to GPSS/H that the model is to be executed after successful compilation.

START control statement defines simulation run length and initiates the execution of the Block diagram

END control statement indicates the end of the source file.

Page 14: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

14

Input Format

Fixed format Free format For better readability, we recommend that

you use fixed format A statement is divided into 4 fields –the line

label; the operation code; the operands; for comments –See Fig. 3.4

Page 15: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

15

Input Format

Page 16: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

16

STANDARD OUTPUT REPORT

The standard out put report is divided into two parts The GPSS/H model listing and information about

the GPSS/H model in general The simulation results

Page 17: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

17

A Recommended Organization of A GPSS/H Model

Page 18: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

18

Getting Started

Marc 2009

Page 19: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

19

Install GPSS/H program

Copy program GPSS/H pada satu folder di hardisk atau di flashdisk.

Program GPSS/H dapat diinstal dengan perintah A:\install jika masih berupa souce code.

Page 20: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

20

Running a GPSS/H model

Program simulasi GPSSH disimpan dalam file text dengan penamaan <namafile.gps>

Aktifkan command prompt Pada window command prompt, pindahkan direktori aktif

ke direktori program GPSSH Pada window command prompt, gpssh <namafile> enter

contoh gpssh joebarb

Page 21: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

21

Screen Capture of GPSS-H program

Page 22: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

22

Results of GPSS/H

Hasil simulasi akan disimpan <namafile.lis>. Cara melihat hasil simulasi

Dari windows command prompt, ketik type <namafile.lis> <enter>

Atau dengan menggunakan aplikasi notepad dengan membuka file <namafile.lis>

Page 23: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

23

Output dari command prompt

Page 24: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

24

Output dengan Notepad

Page 25: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

25

BASIC GPSS/H BLOCKS AND

CONTROL STATEMENTS

Lecture Notes - Chapter 3

Page 26: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

26

Introduction

A GPSS/H source file consists of Blocks

Represent an action or event that can affect one or more transaction or change system state

Sequence of blocks structure of system being simulated A picture of Sequence of blocks is called a Block Diagram

Control Statements Define entities, read input data files, perform

calculation, initiate execution of a simulation run, or print customized report

Compiler Directives

Page 27: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

27

Introduction

The most commonly used GPSS/H Blocks and Control Statements

GENERATE and TERMINATE, for creating and destroying Transaction

ADVANCE for holding a Transaction for a specified period of time

SEIZE and RELEASE, for capturing and freeing a Facility

SIMULATE, START and END for control statements of a simulation run

Page 28: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

28

EXAMPLE 3-1

One bundle of cloth material is needed to make one dozen T=shirts. Bundles are delivered to the dock between 3 and 5 minutes apart.

It takes 2 minutes for the line feeder to transport a bundle from the dock to the staging area.

In the staging area, one line server arranges the cloth into separate T-shirt components and loads them onto a cart –takes between 2.75 and 4.75 minutes.

Page 29: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

29

EXAMPLE 3-1

Questions: How much time does it take for the line

server to prepare 100 bundles? How busy is the line server during this period

of time?

Page 30: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

30

TRANSCTION IDENTIFICATION

TRANSCATION BLOCK REPRESENTATION

Kedatangan budle kain dengan interval waktu 3 s/d 5 menit

GENERATE 4,1

Page 31: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

31

Page 32: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

32

Page 33: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

33

GPSS/H Blocks

The GENERATE block models the arrival of a Transaction into the system

The TERMINATE Block models the exit of a Transaction from the system

The GENERATE block has 8 operands –we will discuss only the first four and please see the others in the later Chapter.

Page 34: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

34

GENERATE block

Page 35: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

35

GENERATE block

A: specifies the mean inter arrival time for Transactions to be created

B: is numeric value (in a uniform distribution), that specifies the spread

C: specifies the time at which the first Transactions arrives

D: specifies the limit count of the number of Transactions to be created

Page 36: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

36

GENERATE block

Examples: GENERATE 4.1 GENERATE 4.1, ,3 GENERATE4.1,2.1, ,10 GENERATE , , ,1 GENERATE RVEXPO (2,8.5)

Page 37: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

37

TERMINATE block

TERMINATE block has one operand TERMINATE 1

Whenever a Transaction enters this block, the Transaction is destroyed and the value of the termination counter will be decremented by 1

TERMINATE The operand is 0, so that the termination counter

will not decrease even though a Transaction is destroyed.

Page 38: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

38

TERMINATE block

Page 39: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

39

ADVANCE block

ADVANCE block holds a Transaction for a specified length of time –commonly used to represent the processing time or the traveling time

The block has two operands, A and B In a Uniform Distribution:

A: specifies the mean time for a Transactions to be held in this block

B: specifies the spread above and below the mean holding time

Page 40: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

40

ADVANCE block

Page 41: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

41

ADVANCE block

ADVANCE 2.1 ADVANCE 3.75,1 ADVANCE RVTRI(4,6.0,7.5,15.0)

Page 42: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

42

SEIZE and RELEASE Blocks

SEIZE and RELEASE Blocks model the capture and release of a Facility, respectively.

SEIZE Block has one operand, specifying the name of Facility or the Facility number

RELEASE Block frees the specified Facility from capture.

The block has one operand, specifying the name of Facility or the Facility number to be released

Page 43: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

43

SEIZE and RELEASE Blocks

Page 44: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

44

SEIZE and RELEASE Blocks

Page 45: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

45

SEIZE and RELEASE Blocks

SEIZE SERVER SEIZE 1 RELEASE SERVER RELEASE 1

Page 46: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

46

CONTROL STATEMENT

SIMULATE control statement indicates to GPSS/H that the model is to be executed after successful compilation.

START control statement defines simulation run length and initiates the execution of the Block diagram

END control statement indicates the end of the source file.

Page 47: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

47

START control statement

The START control statement has four operands A-operand, (A>0), establishes an initial value of the

simulation termination counter, TG1 Operands B, C & D will not be used in this text. EX-1.3:

START 100, (TG1=100) TERMINATE 1, (TG1 is decremented by 1, and as soon

as TG1 =0 or <1, GPSS/H stops the simulation)

Page 48: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

48

GPSS/H Model Listing of EX-1.3

Page 49: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

49

RUNNING A GPSS/H Model

The GPSS/H model for Example 3-1 (EX3-1), The Filename of the source code: EX3-1.GPS

Two ways to run a GPSS/H model: Type GPSSH and press RETURN, GPSS/H will

prompt you to enter the name of the model Or Type GPSSH filename (e.g., GPSSH EX3-1.GPS

or GPSSH EX3-1) and press RETURN.

Page 50: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

50

RUNNING A GPSS/H Model

If compilation is successful, GPSS/H will automatically execute the model.

The standard simulation output will be written to a file with the same filename, except it has the “.LIS” (e.g., EX3-1.LIS).

Page 51: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

51

The Standard Simulation Output File

Divided into two parts: The GPSS/H model summary The Simulation results.

Page 52: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

52

Simulation results

Page 53: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

53

Simulation Results

Can be separated into four sections: Clock section Block count section Entity summary Random number stream section

Page 54: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

54

Simulation Results

Page 55: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

55

Entity Summary:[the Facilities Report] The FACILITY column gives the name or number of a Facility. The ‑AVG‑UTIL‑DURING‑ TOTAL TIME column shows the fraction of

the total time that the Facility was in a state of capture. A Facility is always in one of two states, available or unavailable. These

two states (and their corresponding Blocks, FAVAIL and FUNAVAIL) will be discussed briefly in Chapter 16. If the FUNAVAIL Block is never used, then a Facility is available 100% of the time. The ‑AVG‑UTTL‑DURING‑ AVAIL TIME and UNAVL TRAE columns refer to the fraction of the time the Facility was held in a state of capture while the Facility was available and unavailable, respectively. If the Facility was always available, these columns will be blank.

The ENTRIES column shows the total number of instances the Facility was captured.

Page 56: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

56

Entity Summary:[the Facilities Report] The AVERAGE TIME/XACT column shows the average holding time pe

r capture. The CURRENT STATUS column shows whether the Facility is currently

available or unavailable. For the simple models used in this book, the status is always AVAIL. Note that AVAIL is independent of a Facility's busy or idle status.

The PERCENT AVAIL column shows the fraction of the total time the Facility was available. Blank means 100%.

The SEIZING XACT column shows the Transaction number that is currently in control of the Facility. If the Facility is free, this column remains blank.

A Facility can be preempted. Preemption will be discussed briefly in Chapter 16. The PREEMPTING XACT column shows the number of the PREEMPTing Transaction.

Page 57: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

57

Random number stream section

Shows information about the random number streams used in the model.

In Example 3.1, 202 random number were used to simulate the arrival and processing of 100 bundles of cloth.

Why not 200?

Page 58: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

58

Answers to Questions in EX-3.1

(1) Look at the value of the relative clock at the end of the simulation (399.2730 minutes)

(2) The line server was utilized 0.956 of the total time

Page 59: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

59

Setting Up A Program File

Create a model file using the DOS editor (Type EDIT at the

command prompt in the GPSSH directory). Notepad Use capitals for all code

Page 60: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

60

Create a model file

Recommended that the following fixed column format be used.

Col. 1 * (only used for a comment line) Col. 2‑9 Label Col. 10 blank Col.11‑20 Operation (Control Statement or Block

Statement) Col. 21 blank Col. 22‑72 Operands

Page 61: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

61

Running A program File

Running a program file GPSSH> gpssh fn.gps (return) or GPSSH> gpssh fn (return)

Page 62: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

62

Exercises using the GENERATE, TERMINATE and ADVANCE blocks

Objective : to use an editor or word processor to create a

GPSSH model file, to run the simulation, to answer questions on the automatically

produced post simulation report. Procedure: Type in the file listed below and run

it. New Blocks: GENERATE, TERMINATE New Control statements: SIMULATE, START, END Additional statement type : Comment statement *

Page 63: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

63

Model File:

SIMULATE* The SIMULATE control statement indicates to the compiler

to * compile and run the support system to run the simulation

model GENERATE 2* Create an arrival every two time units beginning at time

2 units TERMINATE 1* Remove each arrival,one by one* START 5 ** Simulate until 5 arrivals have been removed* END indicates to the compiler the end of model file* END

Page 64: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

64

Questions

At what simulated time was the post simulation report produced?

What is the number of the GENERATE BLOCK ? What is the number of the TERMINATE BLOCK ? What is the total number of arrivals? Hint:

Look at the TOTAL count at the GENERATE BLOCK.

What is the CURRENT number of arrivals at each BLOCK ?

Modify and execute a model to determine the time of the 13th arrival.

Page 65: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

65

Model File:

SIMULATE

* The SIMULATE control statement indicates to the support system

* compiler to compile and run the simulation model

GENERATE RVEXPO(1,12), ,0

* Create arrivals randomly with mean time between arrivals 12

* units using random number generator 1 beginning at time 0 units

*

TERMINATE 1

* Remove each arrival, one by one

*

START 1000

*

* Simulate until 1000 arrivals have been removed

*

* END indicates to the compiler the end of model file

*

END

Page 66: 1 Simulation using GPSS/H - Introduction to GPSS/H March 2009

66

Questions At what simulated time was the post

simulation report produced? What is the number of the GENERATE BLOCK ? What is the number of the TERMINATE BLOCK ? What is the total number of arrivals? Hint:

Look at the TOTAL count at the GENERATE BLOCK.

What is the CURRENT number of arrivals at each BLOCK ?

Repeat the simulation using random number generator 2 and answer questions 1‑5. (Hint: use RVEXPO (2, 12)). What are the differences if any between the two simulations ?