Sie sind auf Seite 1von 15

Simulation and modeling

GPSS
Mathematical Modeling and Simulation
Tribhuvan University Kathmandu
14 pag.

Document shared on www.docsity.com


Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
GPSS
General Purpose Simulation System (GPSS) is a discrete time simulation general-purpose programming
language, where a simulation clock advances in discrete steps. In GPSS, a system is modelled as transactions that
enter the system and are passed from one service to another.
This Language is particularly well-suited for simulation of queuing models such as a facility station or factory.
GPSS features a software package that is designed to simplify matters for the user:
• The world is simulated with entities moving through the model.
• These entities, called Transactions, are visualized as moving from Block to Block, where a Block is a line
of code and represents unit actions that affects the Transaction itself or other entities. The transaction is a
process that represents the real-world system being modelled.
• The blocks are chosen by the modeller for specific functions to imitate a particular system.
• Entities can be broadly classified in Resources, Computational entities and Statistical entities.
- Resources, like Facilities and Storages represent limited capacity resources.
- Computational entities, like variables, Functions and random generators are used to represent the
state of Transactions or elements of their environment.
GPSS is used as:
• User translates his problem into a conceptual model, which is a block diagram. Then GPSS software
package processes this block diagram, executes the simulation run, and produces statistics.
• Blocks could be facility-oriented (such as machines in a job shop) or transaction-oriented (such parts of
work-in-process, signals in electronic components or documents in a bureaucratic procedure).
• GPSS automatically keep track of statistics which brings in fixed form at the end of a simulation as
standard report.
Some Blocks of GPSS:
• GENERATE
• TERMINATE
• SEIZE
• RELEASE
• QUEUE
• DEPART
• ADVANCE
• ASSIGN
• START
GENERATE Block:
• This block creates transactions with inter-arrival times determined by the attribute values. This birth
block.
• SYNTAX:
line number label GENERATE A, B, C, D, E

Document shared on www.docsity.com


Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
• ATTRIBUTES:
A = average value of inter arrival time
B = modifier time B <= A
C = start delay time, before first transaction is generated
D = maximum number of transactions generated
E = priority allocated to transactions
• The label is optional. The distribution of inter-arrival times follows a uniform probability distribution with
A B.
• EXAMPLE: GENERATE 15.0, 4.5
• SYMBOL:

TERMINATE Block:
• This block destroys any transaction entering it and removes it from computer memory. It is death block.
Each time a transaction enters this block it decrements a counter by an amount equal to its attribute value.
The counter is set by the user upon starting the simulation.
• SYNTAX:
line number label TERMINATE A
• ATTRIBUTES:
A = Termination count decrement
• The Termination Count of the simulation is set by a prior START Command.When the counter, set at the
beginning of the simulation, reaches zero then the simulation is complete and a statistical report is
produced on the outcome of the simulation.
• EXAMPLE: TERMINATE;
• SYMBOL:

ADVANCE BLOCK
• This block represents the servicing of a transaction.
• The servicing times follow a uniform probability distribution.
• A transaction entering this block will be delayed by a time interval chosen at random from the specified
probability distribution.
• The label is optional.
• SYNTAX:
line number label ADVANCE A, B
• ATTRIBUTES:
A = average value of uniform distribution
B = half-width of uniform distribution

Document shared on www.docsity.com


Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
• The delay amount is uniformly distributed in A + B.
• EXAMPLE:
ADVANCE 100;
ADVANCE 100,50
• SYMBOL:

SEIZE BLOCK
• This blocks allows the transaction to seize a facility if it is free.
• A facility is a resource that can be used by only one transaction at a time.
• Thus it may be a car “seizing” a “facility” such as a petrol pump or a customer in a supermarket “seizing”
a “facility” such as the checkout assistant. When the car or customer is being serviced by the facility, then
it is said to “own the facility”.
• SYNTAX:
line number label SEIZE A
• ATTRIBUTES:
A = name of facility (for example: pump)
• A transaction can only seize a facility if it is free or else wait until the owning transaction releases it. This
is called blocking.
• EXAMPLE:
SEIZE Barber; //Own or wait for barber.
• SYMBOL:

RELEASE BLOCK
• A transaction entering this block informs GPSS that it is giving up ownership of the facility named in its
attribute value.
• The label is optional.
• SYNTAX:
line number label RELEASE A
• ATTRIBUTES:
A = name of facility (for example: runway)
• By giving up ownership of the facility, the transaction makes it available for another transaction that may
be waiting to use it.
• EXAMPLE:
RELEASE Barber; // Haircut done. Give up the barber.
• SYMBOL:

Document shared on www.docsity.com


Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
QUEUE BLOCK
• This block will instruct GPSS to start gathering queuing statistics on the queue named in its attribute
value.
• Program measures average/maximum queue lengths, distribution of waiting time, etc.
• The label is optional but may be necessary if you have to refer to this line from somewhere else in the
program.
• QUEUE increases queue.
• SYNTAX:
line number label QUEUE A
• ATTRIBUTES:
A = name of queue (for example: garage)
• EXAMPLE:
QUEUE Barber; // Begin queue time.
• SYMBOL:

DEPART BLOCK
• This block instructs GPSS that a transaction is leaving the queue named in it’s attribute value.
• This is necessary in order to compile the statistics on the queue.
• The label is optional.
• DEPART decreases queue.
• SYNTAX:
line number label DEPART A
• ATTRIBUTES:
A = name of the queue (for example: checkout)
• EXAMPLE:
DEPART Barber; //Begin queue time.
• SYMBOL:

TRANSFER BLOCK
• This block will take transactions entering it and transfer them to each of two different destinations
according to laid down proportions.
• SYNTAX:
line number label TRANSFER A, B, C
• ATTRIBUTES:
A = probability value (0 to 1)

Document shared on www.docsity.com


Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
B = proportion of (1-A) transactions transferred to this labelled location
C = proportion A transactions transferred to this labelled location
• EXAMPLE:
200 TRANSFER 0.95, EXIT, REPAIR
• In this case 95% of all transactions entering the TRANSFER block will go to the program line labelled
REPAIR and 5% will go to the program line labelled EXIT. If the second attribute "EXIT" is replaced by
a "comma", then the 5% will go to the next block in the program
• SYMBOL:

LAB 14:
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.
Answer:
GENERATE 5
ADVANCE 4,3
TRANSFER 0.1, ACC, REJ
ACC TERMINATE 1
REJ TERMINATE 1

Document shared on www.docsity.com


Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
Output:

Document shared on www.docsity.com


Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
LAB 15:
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.
Answer:
GENERATE 300 200
QUEUE MECHANIC
SEIZE MECHANIC
DEPART MECHANIC
ADVANCE 200 50
RELEASE MECHANIC
TERMINATE 1

Output:

Document shared on www.docsity.com


Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
Document shared on www.docsity.com
Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
LAB 16:
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.
Answer:
GENERATE 300, 100
QUEUE BARBER
SEIZE BARBER
DEPART BARBER
ADVANCE 400,200
RELEASE BARBER
TERMINATE 1

Output:

Document shared on www.docsity.com


Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
Document shared on www.docsity.com
Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
LAB 17:
Customers arrive at barber shop at the rate of 18 ± 6. Mechanic serves each customer at the rate of 16 ± 4
minutes. Simulate system for queue of customer and measure of waiting time for 1000 customers for one
day (i.e. 8 hours).
Answer:
* Model segment 1
*
GENERATE 18, 6 //Customer arrive every 18±6 min
QUEUE Chairs // Enter the line
SEIZE Joe //Capture the barber
DEPART Chairs //Leave the line
ADVANCE 16, 4 //Get a haircut in 16±4 min
RELEASE Joe //Free the barber
TERMINATE //Leave the shop
* Model segment 2
*
GENERATE 480 //Timer arrives at time = 480 min
TERMINATE 1 //Shut off the run
START 1 // Start one run

Output:

Document shared on www.docsity.com


Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
Document shared on www.docsity.com
Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
LAB 18:

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.
Answer:
GENERATE 7, 7
QUEUE Turn
SEIZE Turn
DEPART Turn
ADVANCE 5, 3
RELEASE Turn
TERMINATE 1

Output:

Document shared on www.docsity.com


Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)
Document shared on www.docsity.com
Downloaded by: ritu-bhurat (ritubhurat18@gmail.com)

Das könnte Ihnen auch gefallen