2/22/2016
1
• General Purpose Simulation System (IBM - 1961)
• is a highly structured, special-purpose simulation language
that is designed for simulating queueing systems
• GPSS uses the process interaction approach of discrete
simulation
• a process is a series of events and activities that describes
the behavior of a customer as it makes its way through the
system
• process interaction is the technique of modelling a system by
a number of possibly overlapping processes
• GPSS is transaction oriented (it treats customers like
transactions)
GPSS
• the basic structure of a GPSS program is a routine that
describes the behavior of a transaction from arrival to
departure
• there is no need to write the event handling routines as these
are provided by GPSS
GPSS
2/22/2016
2
• since its inception, GPSS has undergone a number of
changes to the point that there are several
implementations
• we will concentrate of GPSS/H developed by Wolverine
Software Corporation
• statements in GPSS can be roughly divided into 3
categories:
1) blocks
2) definition statements
3) control statements
• the majority of statements are blocks
Statements in GPSS
• the general format of a GPSS statement is:
Col 2 Col 11 Col 22
label statement type parameters (A,B,C,D,E,F,G)
• introduce the different type of GPSS statements and
the techniques for writing programs with examples
Statements in GPSS
2/22/2016
3
SIMULATE
* Define Ampervariables
INTEGER &LIMIT
LET &LIMIT=1000
* Block Statements
GENERATE 10,5
QUEUE LINE
SEIZE CHECKOUT
ADVANCE 7,5
RELEASE CHECKOUT
DEPART LINE
TABULATE RES
TERMINATE 1
RES TABLE M1,2,5,10
* START &LIMIT
END
Example 1: Single Server Queue
SIMULATE:
- is a control statement specifying that a simulation run is to be
run
- it can be placed anywhere in the program
- if not present, the program is compiled and not executed
Ampervariable:
- as with many programming languages, GPSS allows the
declaration of variables (called ampervariables as they are
preceded by an &)
- ampervariables can be either INTEGER or REAL
- value of ampervariables can be changed using the LET and
BLET (block LET) statements
2/22/2016
4
this blocks creates transactions and sends them into
the system at random intervals
- it supports five parameters (of interest to us)
A: specifies the mean length of the generation interval
- can be replaced by functions such as RVEXPO, or
RVNORM
B: for a uniform distribution, gives a plus or minus value about
the mean
C: offset interval for generation of the first transaction
D: maximum number of transactions to be generated
E: priority of transaction
- for our example: GENERATE 10,5
- specifies that the intercreation time of transactions is
uniformly distributed between 5 and 15 (10 ± 5) units
GENERATE:
- these are blocks which are simply related to the
gathering of statistics
- the parameter (in our case LINE), specifies an address of
where to store the statistics (could be a number)
- QUEUE marks the beginning of the statistics gathering
for the block while DEPART marks the end
- all transactions entering the QUEUE/DEPART block
cause the appropriate data collection to occur
- the QUEUE/DEPART block has a zero-delay effect on
transactions
QUEUE/DEPART:
2/22/2016
5
- the actual formation of queues (or line-ups) is as a result of
the
SEIZE/RELEASE block
- the SEIZE block governs the admission of transactions to a
facility (server)
- the name (address) of the facility is given as a parameter (in
our case SEIZE CHECKOUT)
- could be a number
- at each instant of time, the facility can be in one of two states
(busy or idle)
- a transaction can only enter the SEIZE block if the specified
facility is idle
- if the specified facility is busy, the transaction joins a delay
chain (FCFS - within Priority levels)
SEIZE/RELEASE:
- when the facility becomes idle (as a result of the
corresponding RELEASE block), the first transaction on the
delay chain enters the SEIZE block
- the time spent in the delay chain corresponds to the waiting
time of the customer
SEIZE/RELEASE:
2/22/2016
6
- the ADVANCE block is the only block in GPSS that can
delay a transaction for a specified amount of time
- it models the service provided to a transaction
- it has two parameter:
A: specifies the mean length of holding time
- can be replaced by functions such as RVEXPO, or
RVNORM
B: for a uniform distribution, gives a plus or minus value
about the mean
- for our example: ADVANCE 7,5
- specifies that the service time of transactions is
uniformly distributed between 7 and 12 (7 ± 5) units
ADVANCE:
- the TABULATE block is used to collect histogram data for
a particular performance measure
- Parameter A of this block contains the address of the
TABLE definition
- the placement of the TABULATE is used to mark the time
- the TABLE block has the following parameters:
A: which standard numerical attribute (SNA) to tabulate
B: upper limit of the first interval
C: width of each interval
D: number of intervals
TABULATE/TABLE:
2/22/2016
7
- for our example:
-TABULATE RES is placed after ADVANCE so we are
considering the entire time in system
- RES TABLE M1,5,5,10 implies we are tabulating SNA
M1 (which is transit time = current clock - arrival time)
in a table where the upper limit of first interval is 5,
width of intervals is 5 and there are 10 intervals
- this leads to a table which has the following structure
Interval Range
1 val < 5
2 5 # val < 10
3 10 # val < 15
4 15 # val < 20
5 20 # val < 25
6 25 # val < 30
7 30 # val < 35
8 35 # val < 40
9 40 # val < 45
10 val $ 45
- other interesting SNA’s include
Please note the when symbolic names are used instead of
numerical addresses, j should be replace by $name
RNj - uniform random deviate from stream j
Pj - transaction parameter j
M1 - transit time = Current clock - mark time
MPj - parameter transit time = current clock – Pj
Fj - current status of facility j (busy = 1, idle = 0)
Sj - current number of busy servers in storage j
Qj - current length of delay chain j
Xj - value in savevalue j
FNj - computed value of function j
Vj - computed value of variable j
2/22/2016
8
- the terminate block acts as a sink for transactions
- the parameter specifies the number of units to be
deducted from the termination count (specified by
the START block) each time a transaction enters the
block
- if the parameter is left blank, the termination count is
not changed but the transaction is deleted
- when the termination count reaches 0, the simulation
is terminated
START:
- specifies the termination count as a parameter
TERMINATE:
Output Results
• in GPSS, statistics are automatically generated during the
simulation run
• these statistics are as follows:
1) For each facility
a) utilization factor
b) mean service time
2) for each QUEUE
a) maximum queue length
b) mean queue length
c) mean waiting time
d) % of transactions with zero waiting time
e) mean waiting time of those transactions that had to wait
3) for each table
a) observed frequencies
b) relative frequencies
c) mean
d) standard deviations
2/22/2016
9
• from our example, statistics for queue LINE, facility
CHECKOUT, and table RES are automatically collected and
printed
Example 2: Bank Model
- Consider a bank which contains tables for filling out slips, etc.
and
tellers. Assume we have 6 tables and 3 tellers and 40% of the
time, a
customer can head directly to a teller.
SIMULATE
* Define Ampervariables
INTEGER &LIMIT
REAL &IAT,&ST1,&ST2
LET &LIMIT=5000
LET &IAT=50
LET &ST1=10
LET &ST2=30
* Block Statements
GENERATE RVEXPO(1,&IAT)
TRANSFER .4,TAB,TEL
TAB QUEUE OVER
ENTER 1,1
ADVANCE RVEXPO(2,&ST1)
DEPART OVER
LEAVE 1,1
TEL QUEUE TELLER
ENTER 2,1
ADVANCE RVEXPO(2,&ST2)
DEPART TELLER
LEAVE 2,1
TERMINATE
*
STORAGE
S1,6/S2,3
*
GENERATE &LIMIT
TERMINATE 1
START 1
END
• several new statements
are introduced in this
program
2/22/2016
10
- the TRANSFER block moves transactions to different parts of
the
program based an uniform random variate
- TRANSFER prob, label1, label2
- a uniform random variate is generated and if its value is less
than
prob, the program branches to label2; otherwise the program
branches to label1
- for our example: TRANSFER .4, TAB, TEL
- specifies that a transaction entering this block is to be
transferred to statement with labels TAB and TEL with
probability 60% and 40% respectively
- this is a probabilistic transfer and not a conditional transfer
(like an
IF statement)
- the TRANSFER block can also be used for an unconditional
transfer (i.e. TRANSFER ,label)
TRANSFER:
- similar to SEIZE/RELEASE except that the service facility
may have multiple servers
- the first parameter in both the ENTER and LEAVE blocks
refers to the address of the storage facility while the
second indicates the number of servers required by the
transaction
- a transaction is allowed to enter the ENTER block only if
the number of servers it requires is less than or equal to
the number of servers in that storage facility that are idle
- otherwise, the transaction is blocked and forced to join a
delay chain
- thus the ENTER/LEAVE implements a single queue,
multiple server model
ENTER/LEAVE:
2/22/2016
11
- the STORAGE definition statement specifies the total
number of servers for each storage facility
- for our example: STORAGE S1,6/S2,3
- indicates that storage 1 (SNA is S1) has 6 servers and storage
2
(SNA is S2) has 3 servers
STORAGE:
- this example also shows how a simulation can be
terminated after a pre-specified amount of time (instead of
after a pre-specified number of customers)
- the first TERMINATE block does not contain a parameter
implying the transaction is deleted but the termination
count is not decrement
- the second GENERATE block generates a transaction at
5000 time units
- this transaction immediately enters a TERMINATE 1 block
- since the START block specifies a termination count of 1,
the simulation will terminate
End of Simulation:
2/22/2016
12
- this model consists of n (n>1) single server queues in
series. Customers arriving to the system always queue for
server 1 and then visit servers 2, 3, 4, ..., n in a sequential
manner
- this is essentially Example 1, n times
Example 3: Queues in Series
SIMULATE
INITIAL X1,20/X2,25/X3,30
* Define Ampervariables
INTEGER &LIMIT
REAL &IAT
LET &LIMIT=5000
LET &IAT=50
* Block Statements
GENERATE RVEXPO(1,&IAT)
ASSIGN 1,3
NEXT ASSIGN 2+,1
QUEUE *2
SEIZE *2
DEPART *2
ADVANCE RVEXPO(2,X*2)
RELEASE *2
LOOP 1,NEXT
TABULATE RES
RES TABLE M1,10,10,10
TERMINATE 1
*
START &LIMIT
END
2/22/2016
13
Assign
- the ASSIGN block is used to modify the value stored in a
transaction
parameter
- these parameters can be used to store information such as the
transaction’s arrival time, service time, etc.
- the total number of transaction parameters can be specified by
the F
parameter of the GENERATE block (the default is 12)
- GENERATE 10,5,,,,30 would generate transactions at intervals
uniformly distributed between 5 and 15 and each transaction
would
have 30 parameters
- the SNA reference to the jth parameter is Pj
- all transaction parameters are intialized to 0
- variations of the ASSIGN block
ASSIGN 1,3 stores 3 into P1
ASSIGN 1+,3 increments P1 by 3
ASSIGN 1-,3 decrements P1 by 3
ASSIGN 1,RVEXPO(1,20)
- stores exponential variate with mean 20 into P1
Indirect Addressing:
- from our example, transaction parameter P1 contains the
number of servers in the series that have to be visited
- transaction parameter P2 contains the numeric address of the
server to visit next
- a newly created transaction has its P1 set to 3 and its P2 set to
1 prior to entering the QUEUE block
- the QUEUE block uses indirect addressing to specify the
queue address
- the “*2” in the statement results in the value stored in P2
being
used
- thus, the QUEUE block updates the statistics for queue 1
- the same indirect address is used in the SEIZE, DEPART, and
RELEASE blocks
2/22/2016
14
Savevalues:
- storage locations accessible to all transactions
- SNA for the jth savevalue is Xj
- the INITIAL statement is used to initialize the value of the
savevalues
- from our example, ADVANCE RVEXPO(1,X*2) generates an
exponential variate based on the service time stored in
savevalue stored in P2
- the value of a savevalue can be modified by a SAVEVALUE
block
- SAVEVALUE is analogous to the ASSIGN block in terms of
modifying the value of a transaction parameter
SAVEVALUE 1,3 stores 3 into X1
SAVEVALUE 1+,3 increments X1 by 3
SAVEVALUE 1-,3 decrements X1 by 3
SAVEVALUE 1,RVEXPO(1,20)
- stores exponential variate with mean 20 into X1
LOOP:
- the LOOP block implements a do-loop
- when a transaction enters the LOOP block, the
contents of P1 (as specified by parameter A) is
decremented by 1
- if P1 > 0, the transaction is moved to the block
specified in parameter B (NEXT in our case)
- otherwise the transaction is moved to the next
sequential block
- from our example, as P2 is incremented to select the
next server while P1 is decremented to count down
the loop
2/22/2016
15
Example 4: Round Robin Model
- with this model, an arrival from the outside of the system
joins
the end of a single queue. Customers in the queue are served
in FCFS order for a quantum of service time. If a customers
service requirement is satisfied before the quantum, they simply
leave. Otherwise, they release the server and rejoin the end of
the queue
SIMULATE
GENERATE RVEXPO(1,50)
ASSIGN 1,RVEXPO(1,30)
NEXT QUEUE 1
SEIZE 1
DEPART 1
TEST G P1,20,LAST
ASSIGN 1,V1
1 VARIABLE P1-20
ADVANCE 20
RELEASE 1
* Explain the Buffer block later
BUFFER
TRANSFER ,NEXT
LAST ADVANCE *1
RELEASE 1
TERMINATE 1
*
START 1000
END
2/22/2016
16
TEST:
- this is like an IF statement
- the condition is tested and if it is met, the transaction moves
to the next
sequential block
- if the condition is not met, it moves to the block specified in
parameter
C
- for our case, TEST G P1,20,LAST
- compares transaction parameter P1 to 20 and if it is greater
than
(G), it moves to the next block
- if P1 is less than or equal to 20, the transaction moves to the
block
with label LAST
- the other TEST operators are GE, E, NE, LE, and L
Variables:
- variables are used to compute arithmetic expressions
- the SNA for the jth variable is Vj
- ASSIGN is used to assign a value to a variable
- associated with each variable is a definition statement
(1 VARIABLE P1-20) which specifies a arithmetic expression
composed of SNA’s
- when a variable is referenced (ASSIGN 1,V1), the
corresponding arithmetic expression is evaluated
2/22/2016
17
Internal Structure of GPSS
• the basic data structure used by GPSS:
1) Future Event Chain - contains transactions whose
scheduled departure time from a block is greater than the
current clock
- ordered in ascending values of event time
- usually as a result of GENERATE and ADVANCE
2) Current Event Chain - contains transactions that are
scheduled to move at the current time and as well,
transactions that are blocked
3) Status Change Flag - a switch used by GPSS for scanning
the CEC
4) Scan Status Indicator - indicates whether a transaction in
the CEC is blocked or active
Algorithm for Moving Transactions
1) Update clock to the time of the next event (this is the time of
the first
event in the FEC)
2) Move all transactions with this time from the FEC to the
CEC. These
transactions are added to the end of the CEC with their scan
status
marked as active.
3) Scan the CEC
a) set Status Change Flag to 0
b) examine first transaction in CEC
c) if scan status is active, goto (f)
d) if no more transactions in the CEC, stop
e) examine the next transaction in the CEC and goto (c)
f) move transaction as far as possible through the GPSS
program
(the scan status of other transactions and/or the Status Change
Flag may be changed)
g) if the Status Change Flag is 1, restart the scan by going
to Step (a); otherwise continue with the current scan and
goto (e)
4) Goto (1)
2/22/2016
18
Algorithm for Moving Transactions
• need more detail on Step (f) of the CEC scan
• an active transaction is moved through blocks with zero delay
until one of the following occurs:
1) the transaction becomes blocked -- it remains in the CEC
2) the transaction enters an ADVANCE block -- it is removed
from
the CEC and added to the FEC
3) the transaction enters a TERMINATE block -- it is removed
from the system
Algorithm for Moving Transactions
• it should be noted that this move does not alter the position of
transactions in the CEC
- it might change the scan status of these transactions
- for example, a transaction moving through a RELEASE block
causes all transaction in the CEC that are blocked on that
facility will have their scan status changed to active
- the Status Change Flag is also set to 1 to allow the CEC to
start again allowing a previously blocked transaction to seize
this facility
- another example is a transaction moving through the SEIZE
block causing all transactions that are trying to seize the same
facility having their scan status changed to blocked (Status
Change Flag is set to 1)
2/22/2016
19
BUFFER:
- when a transaction enters a BUFFER block it will not be
moved any
further
- the natural algorithm is to move a transaction as far as
possible
before it blocks (or completes)
- this philosophy is detrimental to a Round Robin scheduling
discipline
- consider a situation where a transaction is blocked on the CEC
waiting for a facility
- the next item off the FEC is the completion of the transaction
which
currently holds the facility
- since the first transaction is blocked, the second transaction is
moved as far as possible
- if it requires an additional quantum and the BUFFER block is
not
present, the transaction will eventually SEIZE the facility again
even
though the other transaction was in line a head of it
- the BUFFER block serves to hold the transaction and allow the
CEC
scan to start at the beginning and pick the other transaction
- the BUFFERed transaction remains in the CEC
Other GPSS Features:
MARK Block:
- we have already introduced the SNA M1 which is the transit
time of a transaction
- M1 is defined to be current time - mark time
- mark time is initially given by creation time
- mark time can be changed by sending a transaction through a
MARK block which will set mark time to the current clock
2/22/2016
20
Other GPSS Features:
SELECT Block:
- this block is used to find a GPSS entity (e.g. queue, facility,
storage, etc.) that satisfies a specific condition
- it can be used with three types of operations:
1) Logical
1) Conditional
L, LE, E, NE, GE, G
3) Special
MIN, MAX
U - facility in use
SE - storage empty
SF - storage full
NU - facility not in use
SNE - storage not empty
SNF - storage not full
Examples:
SELECT NU 5,1,3,,,NEXT
- facilities 1 to 3 are tested and the address of the first not in
use facility
is stored in P5
- the transaction is moved to the next sequential block
- if all facilities used, transaction moved to label NEXT
SELECT E 5,1,3,X1,Q,NEXT
- length of queues 1 to 3 are tested and the address of the first
queue
with length equal to X1 is stored in P5
- the transaction is moved to the next sequential block
- if no queue with length = X1 is found, transaction moved to
label
NEXT
SELECT MIN 5,1,3,,Q
- queues 1 to 3 are examined and address of the queue with
minimum
length is stored in P5
2/22/2016
21
Example Program:
- this program implements a much more realistic grocery store
system
consisting of four servers, each with its own queue. Arriving
customers
always join the shortest queue (ties broken by address)
SIMULATE
GENERATE 10,5
SELECT MIN 3,1,4,,Q
QUEUE *3
SEIZE *3
DEPART *3
ADVANCE 15,3
RELEASE *3
TABULATE RES
RES TABLE M1,10,10,10
TERMINATE 1
*
START 1000
END
User Chains:
- when transactions are moved from the FEC to the CEC, they
are entered at the end of their priority levels
- the default queueing discipline is therefore FCFS within
priority
levels
- other types of queueing disciplines can be implemented by
User
Chains
- User Chains are chains that the user can implement
- transactions can be moved from the User Chains to the CEC
and vice-versa
- the status of transactions in User Chain is always inactive
- LINK and UNLINK blocks are used to manipulate
- instead of giving a detailed description of these blocks, try to
illustrate the important features using an example
2/22/2016
22
SIMULATE
GENERATE 10,5
QUEUE 1
LINK 5,FIFO,NEXT
NEXT SEIZE 1
DEPART 1
ADVANCE 7,2
RELEASE 1
UNLINK 5,NEXT,1
TERMINATE 1
*
START 1000
END
- each User Chain has a link indicator which is initially off
- when a transaction enters LINK 5,FIFO,NEXT
- the link indicator for User Chain 5 is checked and if the
indicator is
on, the transaction is removed from CEC and entered in User
Chain
5 is the specified order (FIFO, LIFO, or user defined)
- if the indicator is off, it is turned on and the transaction is
moved to
block specified by label (NEXT)
- when a transaction enters UNLINK 5,NEXT,1
- User Chain 5 is checked and if it is not empty, one transaction
(specified by parameter C) is removed from the chain and
entered
into the CEC
- this transaction is then moved to the block specified by the
label
(NEXT)
- if the User Chain is empty, its link indicator is turned off
2/22/2016
23
- in either case, the transaction that entered the UNLINK block
is
moved to the next sequential block
- the above example does implement a single server queue with
FCFS discipline so LINK/UNLINK unnecessary
- another method to arrange transactions in a User Chain is to
use a
transaction parameter
- the statement LINK 5,1,NEXT
- would link transactions in User Chain 5 in ascending order of
the
value stored in P1
- if service time of the transaction had been determined
immediately
after it had left the GENERATE block then this would be
Shortest-
Job First
- one final comment UNLINK 5,NEXT,1,BACK
- this would unlink a transaction from the back of User Chain 5
and
send it to the block labelled NEXT
Control Statements:
START 1000,,100
- would cause the data statistics to be printed each time the
termination
count is decremented by 100
RESET
- initializes all internal variables for data collection
CLEAR
- initializes the status of queues, facilities, storages, etc. as well
as
variables for data collection
BPUTPIC FILE=OUT,LINES=2,(P2,X1)
Transaction Parameter 2 = ***.**
Savevalue 1 = ***.**
- allows you to print out variables from within GPSS (into file
OUT)
2/22/2016
24
DO/ENDDO:
- allows a loop to be executed (rerun the simulation)
DO &I=1,5,1
...
ENDDO
- implies “...” will be repeated 5 times (I=1 to 5 step 1)
- redo EXAMPLE 1 (MM1), this time re-running it 5 times
SIMULATE
INTEGER &I
GENERATE 10,5
QUEUE LINE
SEIZE CHECKOUT
ADVANCE 7,5
RELEASE CHECKOUT
DEPART LINE
TERMINATE 1
*
DO &I=1,5,1
START &LIMIT
CLEAR
ENDDO
END
Trent University
COIS4470H
Winter 2016
Assignment 2: GPSS
due: March 15, 2016
1) You have been hired by a bank to design a simulation to
determine the amount of time customers spend
waiting in line. Assume initially, that you have 1 teller who can
process on average 1 customer every 3
minutes (exponentially distributed). Also assume that
customers arrive to the bank with a mean rate of 0.2
customers per minute (also exponentially distributed).
a) Simulate the above system in GPSS for 1000 customers for
mean waiting time (time customer arrives
until they reach the teller) and the teller's idle time. Make sure
you use different random number
generators for each experiment (or you will get the same result
each time!).
b) What would happen to the above system if the arrival rate of
customers increased to 0.25 customers per
minute. What about 0.3? Explain the results.
c) What would happen to the system in Part (a) if the arrival
rate of customers decreased to 0.15 customers
per minute. What about 0.1? Explain the results.
d) What would happen to the system in Part (a) if we added a
second teller but each teller now can only
process on average 1 customer every 4 minutes. Explain the
results.
2) Write a GPSS program to simulate the activity is a hair salon
which employs three people (Rico works only
with males, and Fred and Ginger work only with females).
Customers arrive to the salon with an interarrival
time which is exponentially distributed with mean 15 minutes.
Of the customers, 70% are female and 30%
are male. Once they arrive, they must go to the appropriate
hairdresser: the males wait for Rico and the
females wait for either Fred or Ginger. The time to cut a male’s
hair is uniformly distributed with mean
8 ± 2 minutes. The time to cut a female’s hair is uniformly
distributed with mean 10 ± 3 minutes. Simulate
the system for a 10 hour day and collect statistics for the
waiting times for males and females. Please
utilize an ampervariable and a savevalue in your solution.
3) You have been hired as a consultant by Minute Lube who
advertise that they can do a filter, lube and oil in
15 minutes total (no appointment necessary) or its free. Their
service has proved so popular that they are
unable to meet this restriction and as a result are giving away
too many free services.
Upon your examination of the garage, you notice that it consists
of three hoists (where a car must first be
put on a hoist to do the filter, lube and oil) and three mechanics.
The garage is open 5 days a week, 8 am
to 6 pm. You also observe that on average, a mechanic can do a
filter, lube and oil in 10 minutes and cars
arrive at an average rate of 15 per hour.
a) You first decide to model this system by assuming both the
interarrival and service times are uniformly
distributed with means stated above and standard deviations of
1 minute for the interarrival time and
2 minutes for the service time.
i) Simulate this model for 5000 customers and give the average
time a car spends at the garage, the
utilization of the mechanics (i.e. hoists), and the percentage of
time a customers has to wait over
15 minutes. Hand in the listing of this program. Please only do
1 simulation run. Comment on
your results.
ii) Instead of using 5000 customers, rerun this simulation
(producing the same performance measures)
using a time period corresponding to 6 working weeks. How
many customers went through the
system in this time period?
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Not For Public Release
DrGari909
Highlight
b) You determine that your results from your model in Part (a)
are flawed because the interarrival and
service times are not uniformly distributed by exponentially
distributed with means 4 and 10
respectively.
i) Redo Part (a) (i) assuming an exponential distribution. Why
did the results change?
ii) What does the mean service time have to be in order to that
less than 20% of customers have to
spend more than 15 minutes at the garage (use 0.5 minute
granularity).
Note: You made need to increase the amount of common
memory. If required, place the statement
REALLOCATE COM,20000
at the top of your program to get access to more common
memory (maximum value is 32720).
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
Highlight
DrGari909
HighlightPage 1Page 2

22220161• General Purpose Simulation System (IBM - 1.docx

  • 1.
    2/22/2016 1 • General PurposeSimulation System (IBM - 1961) • is a highly structured, special-purpose simulation language that is designed for simulating queueing systems • GPSS uses the process interaction approach of discrete simulation • a process is a series of events and activities that describes the behavior of a customer as it makes its way through the system • process interaction is the technique of modelling a system by a number of possibly overlapping processes • GPSS is transaction oriented (it treats customers like transactions) GPSS • the basic structure of a GPSS program is a routine that describes the behavior of a transaction from arrival to departure • there is no need to write the event handling routines as these are provided by GPSS GPSS
  • 2.
    2/22/2016 2 • since itsinception, GPSS has undergone a number of changes to the point that there are several implementations • we will concentrate of GPSS/H developed by Wolverine Software Corporation • statements in GPSS can be roughly divided into 3 categories: 1) blocks 2) definition statements 3) control statements • the majority of statements are blocks Statements in GPSS • the general format of a GPSS statement is: Col 2 Col 11 Col 22 label statement type parameters (A,B,C,D,E,F,G) • introduce the different type of GPSS statements and the techniques for writing programs with examples
  • 3.
    Statements in GPSS 2/22/2016 3 SIMULATE *Define Ampervariables INTEGER &LIMIT LET &LIMIT=1000 * Block Statements GENERATE 10,5 QUEUE LINE SEIZE CHECKOUT ADVANCE 7,5 RELEASE CHECKOUT DEPART LINE TABULATE RES TERMINATE 1 RES TABLE M1,2,5,10
  • 4.
    * START &LIMIT END Example1: Single Server Queue SIMULATE: - is a control statement specifying that a simulation run is to be run - it can be placed anywhere in the program - if not present, the program is compiled and not executed Ampervariable: - as with many programming languages, GPSS allows the declaration of variables (called ampervariables as they are preceded by an &) - ampervariables can be either INTEGER or REAL - value of ampervariables can be changed using the LET and BLET (block LET) statements 2/22/2016 4 this blocks creates transactions and sends them into the system at random intervals
  • 5.
    - it supportsfive parameters (of interest to us) A: specifies the mean length of the generation interval - can be replaced by functions such as RVEXPO, or RVNORM B: for a uniform distribution, gives a plus or minus value about the mean C: offset interval for generation of the first transaction D: maximum number of transactions to be generated E: priority of transaction - for our example: GENERATE 10,5 - specifies that the intercreation time of transactions is uniformly distributed between 5 and 15 (10 ± 5) units GENERATE: - these are blocks which are simply related to the gathering of statistics - the parameter (in our case LINE), specifies an address of where to store the statistics (could be a number) - QUEUE marks the beginning of the statistics gathering for the block while DEPART marks the end - all transactions entering the QUEUE/DEPART block cause the appropriate data collection to occur
  • 6.
    - the QUEUE/DEPARTblock has a zero-delay effect on transactions QUEUE/DEPART: 2/22/2016 5 - the actual formation of queues (or line-ups) is as a result of the SEIZE/RELEASE block - the SEIZE block governs the admission of transactions to a facility (server) - the name (address) of the facility is given as a parameter (in our case SEIZE CHECKOUT) - could be a number - at each instant of time, the facility can be in one of two states (busy or idle) - a transaction can only enter the SEIZE block if the specified facility is idle - if the specified facility is busy, the transaction joins a delay chain (FCFS - within Priority levels) SEIZE/RELEASE: - when the facility becomes idle (as a result of the
  • 7.
    corresponding RELEASE block),the first transaction on the delay chain enters the SEIZE block - the time spent in the delay chain corresponds to the waiting time of the customer SEIZE/RELEASE: 2/22/2016 6 - the ADVANCE block is the only block in GPSS that can delay a transaction for a specified amount of time - it models the service provided to a transaction - it has two parameter: A: specifies the mean length of holding time - can be replaced by functions such as RVEXPO, or RVNORM B: for a uniform distribution, gives a plus or minus value about the mean - for our example: ADVANCE 7,5 - specifies that the service time of transactions is uniformly distributed between 7 and 12 (7 ± 5) units
  • 8.
    ADVANCE: - the TABULATEblock is used to collect histogram data for a particular performance measure - Parameter A of this block contains the address of the TABLE definition - the placement of the TABULATE is used to mark the time - the TABLE block has the following parameters: A: which standard numerical attribute (SNA) to tabulate B: upper limit of the first interval C: width of each interval D: number of intervals TABULATE/TABLE: 2/22/2016 7 - for our example: -TABULATE RES is placed after ADVANCE so we are considering the entire time in system - RES TABLE M1,5,5,10 implies we are tabulating SNA M1 (which is transit time = current clock - arrival time)
  • 9.
    in a tablewhere the upper limit of first interval is 5, width of intervals is 5 and there are 10 intervals - this leads to a table which has the following structure Interval Range 1 val < 5 2 5 # val < 10 3 10 # val < 15 4 15 # val < 20 5 20 # val < 25 6 25 # val < 30 7 30 # val < 35 8 35 # val < 40 9 40 # val < 45 10 val $ 45 - other interesting SNA’s include Please note the when symbolic names are used instead of numerical addresses, j should be replace by $name RNj - uniform random deviate from stream j Pj - transaction parameter j
  • 10.
    M1 - transittime = Current clock - mark time MPj - parameter transit time = current clock – Pj Fj - current status of facility j (busy = 1, idle = 0) Sj - current number of busy servers in storage j Qj - current length of delay chain j Xj - value in savevalue j FNj - computed value of function j Vj - computed value of variable j 2/22/2016 8 - the terminate block acts as a sink for transactions - the parameter specifies the number of units to be deducted from the termination count (specified by the START block) each time a transaction enters the block - if the parameter is left blank, the termination count is not changed but the transaction is deleted - when the termination count reaches 0, the simulation is terminated
  • 11.
    START: - specifies thetermination count as a parameter TERMINATE: Output Results • in GPSS, statistics are automatically generated during the simulation run • these statistics are as follows: 1) For each facility a) utilization factor b) mean service time 2) for each QUEUE a) maximum queue length b) mean queue length c) mean waiting time d) % of transactions with zero waiting time e) mean waiting time of those transactions that had to wait 3) for each table a) observed frequencies b) relative frequencies
  • 12.
    c) mean d) standarddeviations 2/22/2016 9 • from our example, statistics for queue LINE, facility CHECKOUT, and table RES are automatically collected and printed Example 2: Bank Model - Consider a bank which contains tables for filling out slips, etc. and tellers. Assume we have 6 tables and 3 tellers and 40% of the time, a customer can head directly to a teller. SIMULATE * Define Ampervariables INTEGER &LIMIT REAL &IAT,&ST1,&ST2 LET &LIMIT=5000 LET &IAT=50
  • 13.
    LET &ST1=10 LET &ST2=30 *Block Statements GENERATE RVEXPO(1,&IAT) TRANSFER .4,TAB,TEL TAB QUEUE OVER ENTER 1,1 ADVANCE RVEXPO(2,&ST1) DEPART OVER LEAVE 1,1 TEL QUEUE TELLER ENTER 2,1 ADVANCE RVEXPO(2,&ST2) DEPART TELLER LEAVE 2,1 TERMINATE * STORAGE
  • 14.
    S1,6/S2,3 * GENERATE &LIMIT TERMINATE 1 START1 END • several new statements are introduced in this program 2/22/2016 10 - the TRANSFER block moves transactions to different parts of the program based an uniform random variate - TRANSFER prob, label1, label2 - a uniform random variate is generated and if its value is less than prob, the program branches to label2; otherwise the program branches to label1 - for our example: TRANSFER .4, TAB, TEL
  • 15.
    - specifies thata transaction entering this block is to be transferred to statement with labels TAB and TEL with probability 60% and 40% respectively - this is a probabilistic transfer and not a conditional transfer (like an IF statement) - the TRANSFER block can also be used for an unconditional transfer (i.e. TRANSFER ,label) TRANSFER: - similar to SEIZE/RELEASE except that the service facility may have multiple servers - the first parameter in both the ENTER and LEAVE blocks refers to the address of the storage facility while the second indicates the number of servers required by the transaction - a transaction is allowed to enter the ENTER block only if the number of servers it requires is less than or equal to the number of servers in that storage facility that are idle - otherwise, the transaction is blocked and forced to join a delay chain - thus the ENTER/LEAVE implements a single queue, multiple server model ENTER/LEAVE:
  • 16.
    2/22/2016 11 - the STORAGEdefinition statement specifies the total number of servers for each storage facility - for our example: STORAGE S1,6/S2,3 - indicates that storage 1 (SNA is S1) has 6 servers and storage 2 (SNA is S2) has 3 servers STORAGE: - this example also shows how a simulation can be terminated after a pre-specified amount of time (instead of after a pre-specified number of customers) - the first TERMINATE block does not contain a parameter implying the transaction is deleted but the termination count is not decrement - the second GENERATE block generates a transaction at 5000 time units - this transaction immediately enters a TERMINATE 1 block - since the START block specifies a termination count of 1, the simulation will terminate End of Simulation:
  • 17.
    2/22/2016 12 - this modelconsists of n (n>1) single server queues in series. Customers arriving to the system always queue for server 1 and then visit servers 2, 3, 4, ..., n in a sequential manner - this is essentially Example 1, n times Example 3: Queues in Series SIMULATE INITIAL X1,20/X2,25/X3,30 * Define Ampervariables INTEGER &LIMIT REAL &IAT LET &LIMIT=5000 LET &IAT=50 * Block Statements GENERATE RVEXPO(1,&IAT) ASSIGN 1,3
  • 18.
    NEXT ASSIGN 2+,1 QUEUE*2 SEIZE *2 DEPART *2 ADVANCE RVEXPO(2,X*2) RELEASE *2 LOOP 1,NEXT TABULATE RES RES TABLE M1,10,10,10 TERMINATE 1 * START &LIMIT END 2/22/2016 13 Assign - the ASSIGN block is used to modify the value stored in a transaction
  • 19.
    parameter - these parameterscan be used to store information such as the transaction’s arrival time, service time, etc. - the total number of transaction parameters can be specified by the F parameter of the GENERATE block (the default is 12) - GENERATE 10,5,,,,30 would generate transactions at intervals uniformly distributed between 5 and 15 and each transaction would have 30 parameters - the SNA reference to the jth parameter is Pj - all transaction parameters are intialized to 0 - variations of the ASSIGN block ASSIGN 1,3 stores 3 into P1 ASSIGN 1+,3 increments P1 by 3 ASSIGN 1-,3 decrements P1 by 3 ASSIGN 1,RVEXPO(1,20) - stores exponential variate with mean 20 into P1 Indirect Addressing: - from our example, transaction parameter P1 contains the
  • 20.
    number of serversin the series that have to be visited - transaction parameter P2 contains the numeric address of the server to visit next - a newly created transaction has its P1 set to 3 and its P2 set to 1 prior to entering the QUEUE block - the QUEUE block uses indirect addressing to specify the queue address - the “*2” in the statement results in the value stored in P2 being used - thus, the QUEUE block updates the statistics for queue 1 - the same indirect address is used in the SEIZE, DEPART, and RELEASE blocks 2/22/2016 14 Savevalues: - storage locations accessible to all transactions - SNA for the jth savevalue is Xj - the INITIAL statement is used to initialize the value of the savevalues
  • 21.
    - from ourexample, ADVANCE RVEXPO(1,X*2) generates an exponential variate based on the service time stored in savevalue stored in P2 - the value of a savevalue can be modified by a SAVEVALUE block - SAVEVALUE is analogous to the ASSIGN block in terms of modifying the value of a transaction parameter SAVEVALUE 1,3 stores 3 into X1 SAVEVALUE 1+,3 increments X1 by 3 SAVEVALUE 1-,3 decrements X1 by 3 SAVEVALUE 1,RVEXPO(1,20) - stores exponential variate with mean 20 into X1 LOOP: - the LOOP block implements a do-loop - when a transaction enters the LOOP block, the contents of P1 (as specified by parameter A) is decremented by 1 - if P1 > 0, the transaction is moved to the block
  • 22.
    specified in parameterB (NEXT in our case) - otherwise the transaction is moved to the next sequential block - from our example, as P2 is incremented to select the next server while P1 is decremented to count down the loop 2/22/2016 15 Example 4: Round Robin Model - with this model, an arrival from the outside of the system joins the end of a single queue. Customers in the queue are served in FCFS order for a quantum of service time. If a customers service requirement is satisfied before the quantum, they simply leave. Otherwise, they release the server and rejoin the end of the queue SIMULATE GENERATE RVEXPO(1,50)
  • 23.
    ASSIGN 1,RVEXPO(1,30) NEXT QUEUE1 SEIZE 1 DEPART 1 TEST G P1,20,LAST ASSIGN 1,V1 1 VARIABLE P1-20 ADVANCE 20 RELEASE 1 * Explain the Buffer block later BUFFER TRANSFER ,NEXT LAST ADVANCE *1 RELEASE 1 TERMINATE 1 * START 1000 END
  • 24.
    2/22/2016 16 TEST: - this islike an IF statement - the condition is tested and if it is met, the transaction moves to the next sequential block - if the condition is not met, it moves to the block specified in parameter C - for our case, TEST G P1,20,LAST - compares transaction parameter P1 to 20 and if it is greater than (G), it moves to the next block - if P1 is less than or equal to 20, the transaction moves to the block with label LAST - the other TEST operators are GE, E, NE, LE, and L Variables:
  • 25.
    - variables areused to compute arithmetic expressions - the SNA for the jth variable is Vj - ASSIGN is used to assign a value to a variable - associated with each variable is a definition statement (1 VARIABLE P1-20) which specifies a arithmetic expression composed of SNA’s - when a variable is referenced (ASSIGN 1,V1), the corresponding arithmetic expression is evaluated 2/22/2016 17 Internal Structure of GPSS • the basic data structure used by GPSS: 1) Future Event Chain - contains transactions whose scheduled departure time from a block is greater than the current clock - ordered in ascending values of event time - usually as a result of GENERATE and ADVANCE 2) Current Event Chain - contains transactions that are scheduled to move at the current time and as well,
  • 26.
    transactions that areblocked 3) Status Change Flag - a switch used by GPSS for scanning the CEC 4) Scan Status Indicator - indicates whether a transaction in the CEC is blocked or active Algorithm for Moving Transactions 1) Update clock to the time of the next event (this is the time of the first event in the FEC) 2) Move all transactions with this time from the FEC to the CEC. These transactions are added to the end of the CEC with their scan status marked as active. 3) Scan the CEC a) set Status Change Flag to 0 b) examine first transaction in CEC c) if scan status is active, goto (f) d) if no more transactions in the CEC, stop e) examine the next transaction in the CEC and goto (c) f) move transaction as far as possible through the GPSS
  • 27.
    program (the scan statusof other transactions and/or the Status Change Flag may be changed) g) if the Status Change Flag is 1, restart the scan by going to Step (a); otherwise continue with the current scan and goto (e) 4) Goto (1) 2/22/2016 18 Algorithm for Moving Transactions • need more detail on Step (f) of the CEC scan • an active transaction is moved through blocks with zero delay until one of the following occurs: 1) the transaction becomes blocked -- it remains in the CEC 2) the transaction enters an ADVANCE block -- it is removed from the CEC and added to the FEC 3) the transaction enters a TERMINATE block -- it is removed
  • 28.
    from the system Algorithmfor Moving Transactions • it should be noted that this move does not alter the position of transactions in the CEC - it might change the scan status of these transactions - for example, a transaction moving through a RELEASE block causes all transaction in the CEC that are blocked on that facility will have their scan status changed to active - the Status Change Flag is also set to 1 to allow the CEC to start again allowing a previously blocked transaction to seize this facility - another example is a transaction moving through the SEIZE block causing all transactions that are trying to seize the same facility having their scan status changed to blocked (Status Change Flag is set to 1) 2/22/2016 19
  • 29.
    BUFFER: - when atransaction enters a BUFFER block it will not be moved any further - the natural algorithm is to move a transaction as far as possible before it blocks (or completes) - this philosophy is detrimental to a Round Robin scheduling discipline - consider a situation where a transaction is blocked on the CEC waiting for a facility - the next item off the FEC is the completion of the transaction which currently holds the facility - since the first transaction is blocked, the second transaction is moved as far as possible - if it requires an additional quantum and the BUFFER block is not present, the transaction will eventually SEIZE the facility again even though the other transaction was in line a head of it
  • 30.
    - the BUFFERblock serves to hold the transaction and allow the CEC scan to start at the beginning and pick the other transaction - the BUFFERed transaction remains in the CEC Other GPSS Features: MARK Block: - we have already introduced the SNA M1 which is the transit time of a transaction - M1 is defined to be current time - mark time - mark time is initially given by creation time - mark time can be changed by sending a transaction through a MARK block which will set mark time to the current clock 2/22/2016 20 Other GPSS Features: SELECT Block: - this block is used to find a GPSS entity (e.g. queue, facility, storage, etc.) that satisfies a specific condition
  • 31.
    - it canbe used with three types of operations: 1) Logical 1) Conditional L, LE, E, NE, GE, G 3) Special MIN, MAX U - facility in use SE - storage empty SF - storage full NU - facility not in use SNE - storage not empty SNF - storage not full Examples: SELECT NU 5,1,3,,,NEXT - facilities 1 to 3 are tested and the address of the first not in use facility is stored in P5 - the transaction is moved to the next sequential block
  • 32.
    - if allfacilities used, transaction moved to label NEXT SELECT E 5,1,3,X1,Q,NEXT - length of queues 1 to 3 are tested and the address of the first queue with length equal to X1 is stored in P5 - the transaction is moved to the next sequential block - if no queue with length = X1 is found, transaction moved to label NEXT SELECT MIN 5,1,3,,Q - queues 1 to 3 are examined and address of the queue with minimum length is stored in P5 2/22/2016 21 Example Program: - this program implements a much more realistic grocery store system consisting of four servers, each with its own queue. Arriving customers always join the shortest queue (ties broken by address)
  • 33.
    SIMULATE GENERATE 10,5 SELECT MIN3,1,4,,Q QUEUE *3 SEIZE *3 DEPART *3 ADVANCE 15,3 RELEASE *3 TABULATE RES RES TABLE M1,10,10,10 TERMINATE 1 * START 1000 END User Chains: - when transactions are moved from the FEC to the CEC, they are entered at the end of their priority levels - the default queueing discipline is therefore FCFS within priority
  • 34.
    levels - other typesof queueing disciplines can be implemented by User Chains - User Chains are chains that the user can implement - transactions can be moved from the User Chains to the CEC and vice-versa - the status of transactions in User Chain is always inactive - LINK and UNLINK blocks are used to manipulate - instead of giving a detailed description of these blocks, try to illustrate the important features using an example 2/22/2016 22 SIMULATE GENERATE 10,5 QUEUE 1 LINK 5,FIFO,NEXT NEXT SEIZE 1
  • 35.
    DEPART 1 ADVANCE 7,2 RELEASE1 UNLINK 5,NEXT,1 TERMINATE 1 * START 1000 END - each User Chain has a link indicator which is initially off - when a transaction enters LINK 5,FIFO,NEXT - the link indicator for User Chain 5 is checked and if the indicator is on, the transaction is removed from CEC and entered in User Chain 5 is the specified order (FIFO, LIFO, or user defined) - if the indicator is off, it is turned on and the transaction is moved to block specified by label (NEXT) - when a transaction enters UNLINK 5,NEXT,1
  • 36.
    - User Chain5 is checked and if it is not empty, one transaction (specified by parameter C) is removed from the chain and entered into the CEC - this transaction is then moved to the block specified by the label (NEXT) - if the User Chain is empty, its link indicator is turned off 2/22/2016 23 - in either case, the transaction that entered the UNLINK block is moved to the next sequential block - the above example does implement a single server queue with FCFS discipline so LINK/UNLINK unnecessary - another method to arrange transactions in a User Chain is to use a transaction parameter - the statement LINK 5,1,NEXT
  • 37.
    - would linktransactions in User Chain 5 in ascending order of the value stored in P1 - if service time of the transaction had been determined immediately after it had left the GENERATE block then this would be Shortest- Job First - one final comment UNLINK 5,NEXT,1,BACK - this would unlink a transaction from the back of User Chain 5 and send it to the block labelled NEXT Control Statements: START 1000,,100 - would cause the data statistics to be printed each time the termination count is decremented by 100 RESET - initializes all internal variables for data collection CLEAR - initializes the status of queues, facilities, storages, etc. as well as
  • 38.
    variables for datacollection BPUTPIC FILE=OUT,LINES=2,(P2,X1) Transaction Parameter 2 = ***.** Savevalue 1 = ***.** - allows you to print out variables from within GPSS (into file OUT) 2/22/2016 24 DO/ENDDO: - allows a loop to be executed (rerun the simulation) DO &I=1,5,1 ... ENDDO - implies “...” will be repeated 5 times (I=1 to 5 step 1) - redo EXAMPLE 1 (MM1), this time re-running it 5 times SIMULATE INTEGER &I GENERATE 10,5
  • 39.
    QUEUE LINE SEIZE CHECKOUT ADVANCE7,5 RELEASE CHECKOUT DEPART LINE TERMINATE 1 * DO &I=1,5,1 START &LIMIT CLEAR ENDDO END Trent University COIS4470H Winter 2016 Assignment 2: GPSS due: March 15, 2016
  • 40.
    1) You havebeen hired by a bank to design a simulation to determine the amount of time customers spend waiting in line. Assume initially, that you have 1 teller who can process on average 1 customer every 3 minutes (exponentially distributed). Also assume that customers arrive to the bank with a mean rate of 0.2 customers per minute (also exponentially distributed). a) Simulate the above system in GPSS for 1000 customers for mean waiting time (time customer arrives until they reach the teller) and the teller's idle time. Make sure you use different random number generators for each experiment (or you will get the same result each time!). b) What would happen to the above system if the arrival rate of customers increased to 0.25 customers per minute. What about 0.3? Explain the results. c) What would happen to the system in Part (a) if the arrival rate of customers decreased to 0.15 customers per minute. What about 0.1? Explain the results. d) What would happen to the system in Part (a) if we added a second teller but each teller now can only process on average 1 customer every 4 minutes. Explain the results.
  • 41.
    2) Write aGPSS program to simulate the activity is a hair salon which employs three people (Rico works only with males, and Fred and Ginger work only with females). Customers arrive to the salon with an interarrival time which is exponentially distributed with mean 15 minutes. Of the customers, 70% are female and 30% are male. Once they arrive, they must go to the appropriate hairdresser: the males wait for Rico and the females wait for either Fred or Ginger. The time to cut a male’s hair is uniformly distributed with mean 8 ± 2 minutes. The time to cut a female’s hair is uniformly distributed with mean 10 ± 3 minutes. Simulate the system for a 10 hour day and collect statistics for the waiting times for males and females. Please utilize an ampervariable and a savevalue in your solution. 3) You have been hired as a consultant by Minute Lube who advertise that they can do a filter, lube and oil in 15 minutes total (no appointment necessary) or its free. Their service has proved so popular that they are unable to meet this restriction and as a result are giving away too many free services. Upon your examination of the garage, you notice that it consists of three hoists (where a car must first be put on a hoist to do the filter, lube and oil) and three mechanics.
  • 42.
    The garage isopen 5 days a week, 8 am to 6 pm. You also observe that on average, a mechanic can do a filter, lube and oil in 10 minutes and cars arrive at an average rate of 15 per hour. a) You first decide to model this system by assuming both the interarrival and service times are uniformly distributed with means stated above and standard deviations of 1 minute for the interarrival time and 2 minutes for the service time. i) Simulate this model for 5000 customers and give the average time a car spends at the garage, the utilization of the mechanics (i.e. hoists), and the percentage of time a customers has to wait over 15 minutes. Hand in the listing of this program. Please only do 1 simulation run. Comment on your results. ii) Instead of using 5000 customers, rerun this simulation (producing the same performance measures) using a time period corresponding to 6 working weeks. How many customers went through the system in this time period? DrGari909
  • 43.
  • 44.
  • 45.
  • 46.
    Highlight DrGari909 Highlight DrGari909 Highlight DrGari909 Highlight DrGari909 Highlight DrGari909 Highlight DrGari909 Not For PublicRelease DrGari909 Highlight b) You determine that your results from your model in Part (a) are flawed because the interarrival and service times are not uniformly distributed by exponentially distributed with means 4 and 10 respectively. i) Redo Part (a) (i) assuming an exponential distribution. Why did the results change? ii) What does the mean service time have to be in order to that
  • 47.
    less than 20%of customers have to spend more than 15 minutes at the garage (use 0.5 minute granularity). Note: You made need to increase the amount of common memory. If required, place the statement REALLOCATE COM,20000 at the top of your program to get access to more common memory (maximum value is 32720). DrGari909 Highlight DrGari909 Highlight DrGari909 Highlight DrGari909 Highlight DrGari909 Highlight DrGari909 Highlight DrGari909 Highlight DrGari909
  • 48.