You are on page 1of 16

EXPERIMENT NO.

01

Title: Study of Single server system.


Theory & concept:
 Simulation of Queueing Systems
A queueing system is described by its calling population, the nature of the arrivals, the service
mechanism, the system capacity, and the queueing discipline. A simple single-channel queueing system
is portrayed in Figure 2.1.

1. Calling Population: In the single-channel queue, the calling population is infinite; that is, if a
Unit leaves the calling population and joins the waiting line or enters service; there is no change in the
arrival rate of other units that may need service.
2. The Arrival process: Arrivals for service occur one at a time in a random fashion; once they join
the Waiting line, they are eventually served.
3. The Service Mechanism: The service times are of some random length according to a
probability distribution which does not change over time.
4. The system capacity: The system capacity has no limit, meaning that any number of units can
wait in line.
5. Queueing Discipline: units are served in the order of their arrival (often called FIFO: first in, first
out) by a single server or channel.
Arrivals and services are defined by the distribution of the time between arrivals and the
distribution of service times, respectively. For any simple single or multi-channel queue, the overall
effective arrival rate must be less than the total service rate, or the waiting line will grow without bound.
When queues grow without bound, they are termed as explosive or unstable.

Prior to introducing several simulations of queueing systems, it is neces- sary to understand the concepts
of system state, events, and simulation clock.
1. System state: The collection of variables describes the system at any time.The state of the system is
no.of units in the system and the status of the server, busy or idle.
2. Event: An event is a set of circumstances that cause an instantaneous change in the state of the
system.
In a single-channel queueing system there are only two possible events that can affect the state of the
system.
-They are the entry of a unit into the system (the arrival event).
-The completion of service on a unit (the departure event).
The queueing system includes the server, the unit being serviced (if one is being serviced), and units in
the queue (if any are waiting). The simulation clock is used to track simulated time.
If a unit has just completed service, the simulation proceeds in the manner
shown in the diagram of Figure 2.2. Note that the server has only two
possible states: it is either busy or idle.

The arrival event occurs when a unit enters the system. The diagram For the arrival event is shown in
Figure 2.3.

Problem Statement:
 Single-Channel Queue
A small grocery store has only one checkout counter. Customers arrive at this checkout counter at
random from 1 to 8 minutes apart. Each possible value of interarrival time has the same probability of
occurrence, as shown in Table.1.
The service times vary from 1 to 6 minutes with the probabilities shown in Table 2. The problem is to
analyze the system by simulating the arrival and service of 20 customers.
EXPERIMENT NO. 02

Title: Study of Multi-server system

Theory & concept:


The Multi-Channel Queueing System:

The Simulation proceeds in accordance with the following set of steps.

Step1. For customer K generate an interarrival time Ak . Add it to the previous


arrival time Tk-1 to get the arrival time of caller K as Tk=Tk-1+Ak.

Step2.If Able is idle; customer K begins service with Able at the current time Tnow.
Able’s service completion time, Tfin, A is given by Tfin, A=Tnow+Tsvc, A where Tsvc, A is
the service time generated from Able’s Service time distribution.
Customer’s K’s time in system, Tsys is given by Tsys=Tfin, A-Tk.
Because Able was idle, Caller K’s delay, Twait, is given by Twait=0.
If Able is busy, but Baker is idle, Customer K begin service with Baker at the
current time Tnow. Baker’s Service completion time, Tfin, B is given by Tfin,
B=Tnow+Tsrc, B where Tsrc, B is the service time generated from Baker’s Service time

distribution.
Customer’s K’s time in system, Tsys is given by Tsys=Tfin, B-Tk.
Because Baker was idle, Customer K’s delay, Twait, is given by T=0.

Step3. If Able & Baker are both busy, then calculate the time at which the first one
become available, as follows:
Tbeg=Min (Tfin, A, Tfin, B).
Customer K begins service at Tbeg.when service for caller K begins, set Tnow=Tbeg.
Then compute Tfin, A and Tfin, B as in step2.
Customer K’s time in sytem, Tsys, is given by Tsys=Tfin, A-Tk or Tsys=Tfin,B-Tk as
appropriate.

Problem Statement:
The Able Baker Carhop Problem
This example illustrates the simulation procedure when there is more than one service channel.
Consider a drive-in restaurant where carhops take orders and bring food to the car. Cars arrive in the
manner shown in Table.1
There are two carhops.Able and Baker. Able is better able to do the job and works a bit faster than Baker.
EXPERIMENT NO. 03

Title: Study of Simulation of Simple Inventory System.

Theory & Concept:


An important class of simulation problems involves inventory systems. A simple
inventory system is shown inFigure. This inventory system has a periodic review of length N, at
which time the inventory level is checked. An order is made to bring the inventory up to the level
M. At the end of the first review period, an order quantity, Q1, is placed. In this inventory system
the lead time (i.e., the length of time between the placement and receipt of an order) is zero.
Since demands are not usually known with certainty, the order quantities are probabilistic.
Demand is shown as being uniform over the time period in Figure. In actuality, demands are not
usually uniform and do fluctuate over time. One possibility is that demands all occur at the
beginning of the cycle. Another is that the lead time is random of some positive length.

Notice that in the second cycle, the amount in inventory drops below zero, indicating a shortage.
In Figure, these units are backordered; when the order arrives, the demand for the backordered
items is satisfied first. To avoid shortages, a buffer, or safety, stock would need to be carried.
Carrying stock in inventory has an associated cost attributed to the interest paid on the
funds borrowed to buy the items (this also could be considered as the loss from not having the
funds available for other investment purposes).
Other costs can be placed in the carrying or holding cost column: renting of storage space,
hiring guards, and so on.
An alternative to carrying high inventory is to make more frequent reviews, and consequently,
more frequent purchases or replenishments. This has an associated cost: the ordering cost.
Also, there is a cost in being short. Customers may get angry, with a subsequent loss of good
will. Larger inventories decrease the possibilities of shortages. These costs must be traded off in
order to minimize the total cost of an inventory system.
The total cost (or total profit) of an inventory system is the measure of Performance.
In M-N inventory system, the events that may occur are:
1. The demand for items in the inventory
2. The review of the inventory position
3. The receipt of an order at the end of each review period.
When the lead time is zero, as in Figure, the last two events occur simultaneously.

Problem Statement:

The Newspaper Seller's Problem:


A classical inventory problem concerns the purchase and sale of newspapers.The paper seller
buys the papers for 33 cents each and sells them for 50 cents each. Newspapers not sold at the
end of the day are sold as scrap for 5 cents each. Newspapers can be purchased in bundles of
10. Thus, the paper seller can buy 50, 60, and so on. There are three types of newsdays good,
fair, and poor with probabilities of 0.35, 0.45, and 0.20, respectively. The distribution of papers
demanded on each of these days is given in Table 1. The problem is to determine the optimal
number of papers the newspaper seller should purchase. This will be accomplished by
simulating demands for 20 days and recording profits from sales each day.
EXPERIMENT NO. 04

Title: Study of Simulation of M-N Inventory System

Theory & concept:

Simulation of an (M-N) Inventory System:


The example follows the pattern of the probabilistic order-level inventory system shown in
Figure 1, Suppose that the maximum inventory level, M, is 11 units and the review period, N, is 5
days.
The problem is to estimate, by simulation, the average ending units in inventory and the number
of days when a shortage condition occurs.
The distribution of the number of units demanded per day is shown in Table1. In this example,
lead time is a random variable, as shown in Table 2.1. Assume that orders are placed at the
close of business and are received for inventory at the beginning of business as determined by
the lead time.

Probabilistic order level Inventory System


EXPERIMENT No. 05
Title: Study of Simulation on Reliability Model (Current & Proposed method).

Problem Statement:
A large milling machine has three different bearings that fail in service. The cumulative
distribution function of the life of each bearing is identical, as shown in Table 1.
When a bearing fails, the mill stops, a repairperson is called, and a new bearing is installed.
The delay time of the repairperson's arriving at the milling machine is also a random
variable, with the distribution given in Table 2.
Downtime for the mill is estimated at $5 per minute. The direct on-site cost of the
repairperson is $15 per hour. It takes 20 minutes to change one bearing, 30 minutes to
change two bearings, and 40 minutes to change three bearings. The bearings cost $16
each. A proposal has been made to replace all three bearings whenever a bearing fails.
Management needs an evaluation of this proposal. The total cost per 10000 bearing-hours
use as the measure of performance.
Simulate the problem for life of machine is upto 20000 hours under the current and
proposed method.
EXPERIMENT NO. 06

Title: Study of Simulation of Lead Time Demand.

Theory & Concept:


Lead-time demand may occur in an inventory systemwhenthe lead time is other than
instantaneous. The lead time is the time from placement of an order until the order is received.
In a realistic situation, lead time is a random variable.During the lead time, demands also
occur at random. Lead-time demand is thus a random variable defined as the sum of the
demands over the lead time,or where i is the time period of the lead time, i= 0,1,2..;
Di is the demand during the ith time period; and T is the lead time. The distribution of lead-time
demand is determined by simulating many cycles of lead time and building a histogram based
on the result.

Problem Statement:
Lead Time Demand:
A firm sells bulk rolls of newsprint. The daily demand is given by the following probability
distribution:
EXPERIMENT No. 07
Title: Study of Project Simulation (An activity network).
Theory & concept:
Any project that requires the completion of a number of activities, some activities must
be carried out sequentially; others can be done in parallel. The project can be represented by
network of activities, as shown in figure below:

U(2,4) B
A
U(2,4)

U(2,4)

Start Finish
U(3,6) C U(3,6)

U(6,12)
There are three paths through the network, each path representing a sequence of activities that
must be completed in order. The activities on two different paths can be carried out in parallel.
In the activity network the arcs represent activities and the nodes represent the start and
end of an activity.The time to complete all activities on a path is the sum of the activity times
along the path. To complete the entire project, all activities must be completd; therefore, project
completion time is the maximum over all path completion times.
The Time to accomplish each of the activities in project is variable and can be represented
by a uniform distribution between a lower and upper limit as shown in the figure.
The activity times are shown on the arcs of the activity network, the activity time from start
A is assumed to be uniformly distributed between 2 and 4 minutes.that means that all times
between 2 and 4 are equally likely to occur. The Expected value or mean time for this activity is
the midpoint, three minutes.
Applying that logic, the expected value along the topmost path is 9 minutes which is
determined by adding the three expected values (3+3+3). The shortest possible completion
time, which is determined by adding the smallest values, is 6 minute (2+2+2). The largest
possible time along the top path is 12 minute (4+4+4).
Activity times are to have some random variability; the times through the path are not
constant.project analyzed with simulation independent replications of the activity time. For a
uniform distribution, a simulated activity time is given by
Simulated activity time= lower limit + (Upper limit-Lower limit) * random number.
The critical path is the path that takes the longest time; that is; its time is the project completion
time.
EXPERIMENT NO. 08
Title: Write a program to perform the K-S Test

Theory & Concept:


The desirable properties of the random numbers-Uniformity and Independence.To check
on wheather these desirable properties have been achieved, a number of tests can be
performed. The test can be placed in two categories, according to the properties of interest:
Uniformity and Independence.
Frequency Test: Uses the kolmogorov-Smirnov or the Chi-Square Test to compare the
distribution of the set of numbers generated to a uniform distribution.
1. The kolmogorov-smirnov test:
This test measures the degree of agreement between the distribution of sample of
generated random numbers and the theoretical uniform distribution. Test is based on the
null hypothesis of no significant difference between the sample distribution and the
theoretical distribution.
This test compares the continuous CDF F(x), of the uniform distribution, with the empirical
cdf, SN(x), of the sample of N observation, by definition,
F(x) = x, 0<=x<=1
If the sample from the random number generator is R1, R2, ….. RN then the empirical CDF,
SN(x), is defined by
SN(x) = number of R1, R2 …RN which are<=x

N
As N become larger, SN(x) should become approximate to F(x), provided that the null
hypothesis is true.
The K-S Test is based on the largest absolute deviation between F(x) and SN(x) over the
range of the random variable i.e. it is based on the statistic
D = max F (x)-SN(x)
The sampling distribution of D is known, for testing against the uniform CDF, the test
procedure follows these steps:

Step 1. Rank the data from smallest to largest. Let R(i) denote the ith smallest
observation, so that R(1)<=R(2)<=……<=R(N)

Step 2. Compute {
D+=MAX (i/N)-R(i) }
1<=i<=N

{
D-=MAX R(i)-(i-1)/N }
1<=i<=N
Step 3. Compute D=max (D+, D-)
Step 4. Locate the critical value, Da for the specified significance of level a and the given
sample size N.
Step 5. If the sample statistic D is greater than the critical value, Da, the null hypothesis
that the data are a sample from a uniform distribution is rejected. If D<=Da, conclude that no
difference has been detected between the true distribution of {R1, R2, … RN} and the
uniform distribution.
Problem Statement:

For the given five numbers 0.44, 0.81, 0.14, 0.05, 0.93. Determine whether the number are
uniformly distributed or not with the level of significance alpha=0.05 by using K-S test.
[Dα=0.565]
EXPERIMENT No. 09

Title: Write a program to perform the Chi-Square test.


Theory:
The Chi-Square test uses the sample statistic
2 N
X0 = (Oi-Ei)/Ei
i =1

Where O is the observed number in the ith class, E is the expected number in the ith class and
n is the number of classes. For the uniform distribution, E, the expected number in each class is
given by
Ei=N/n
For equally spaced classes, where N is the total number of observations. It can be shown that
the sampling distribution of Chi-square is approximately the chi-square distribution with n-1
degree of freedom.

Problem Statement:

For the given 100 numbers determine whether the numbers are uniformly
distributed or not with the level of significance =0.05 .
Given:
n (Number of classes)=10
N (Total Number of observations) =100

0.34 0.90 0.25 0.18 0.89 0.87 0.44 0.12 0.21 0.46
0.67 0.83 0.76 0.79 0.64 0.70 0.81 0.94 0.74 0.22
0.74 0.96 0.99 0.77 0.67 0.56 0.41 0.52 0.73 0.99
0.02 0.47 0.30 0.17 0.82 0.56 0.05 0.45 0.31 0.78
0.05 0.79 0.71 0.23 0.19 0.82 0.93 0.65 0.37 0.39
0.42 0.99 0.17 0.99 0.46 0.05 0.66 0.10 0.42 0.18
0.49 0.37 0.51 0.54 0.01 0.81 0.28 0.69 0.72 0.30
0.73 0.84 0.40 0.78 0.34 0.43 0.94 0.05 0.24 0.19
0.29 0.75 0.56 0.96 0.06 0.40 0.79 0.11 0.49 0.97
0.58 0.39 0.64 0.62 0.60 0.47 0.64 0.88 0.97 0.26
EXPERIMENT No. 10

Title: Case Study on GPSS/H simulation Package.

Theory & Concept:


GPSS world is based on the seminal language of computer simulation, GPSS stand for
General purpose simulation system.This language was developed primarily by Geoffrey Gordon
at IBM around 1960, and has contributed important concepts to every commercial discrete
event computer simulation language developed ever since.
GPSS world is designed to deliver answer quickly and reliably, with the least effort and
achieving the highest reliability of result. GPSS World is object oriented.
Gpss world is populated by 4 kinds of objects. Model Object, Simulation Object and
Report objets that are used in all GPSS World simulations.
1. Model Object: It used to create simulation object.
2. Simulation Object: It used to play out simulation and create Report objects.
3. Text Object: It used as Include-files to support code sharing and a user source code
library and they are often used as files which can read from or written to by the
simulation.
Steps of Simulation Project:
1. The model Building and Data Collection
2. Testing and verification
3. Simulation
4. Experimentation
5. The analysis of the result.

GPSS World is sequence of model statements. A Model Statement may be a GPSS Statement
or a PLUS Procedure definition. A GPSS Statement is either a Command or a Block Statement.

PLUS is an acronym for the Programming Language under Simulation, GPSS World’s
embedded programming language. PLUS Experiments are a kind of Procedure.

GPSS statement:

There are two kinds of GPSS Statements:


Block Statements, which cause a GPSS Block Entity to be created, and Commands, which do
not. Commands either define a non-Block Entity or cause an action to occur.GPSS Statements
are composed of parts called fields. A field is a variable number of printable characters
terminated by white space or a delimiter.
GPSS Commands:
Commands used to define entities and to control the running of simulations. Commands
may be part of the Initial Model Translation, or they may be sent as Interactive Statements to an
existing simulation.
The Commands are:

1. BVARIABLE - Define a Boolean Variable Entity.


2. CLEAR - Reset statistics and remove Transaction.
3. CONTINUE - Resume the simulation.
4. EQU - Assign a value to a User Variable.
5. EXIT - End the GPSS World Session.
6. FUNCTION - Define a Function Entity.
7. FVARIABLE - Define an Fvariable Entity.
8. HALT - Stop the simulation and delete all Queued Commands.
9. INCLUDE - Read and Translate a secondary Model File.
10. INITIAL - Initialize or modify a Logicswitch, Savevalue, or Matrix Entity.
11. INTEGRATE - Automatically integrate a time differential in a User Variable.
12. MATRIX - Define a Matrix Entity.
13. QTABLE - Define a Qtable Entity.
14. REPORT - Set the name of the Report File or request an immediate report.
15. RESET - Reset the statistics of the simulation.
16. RMULT - Set the seeds of the first 7 Random Number Generators
17. SHOW - Evaluate and display Expression.
18. START - Set the Termination Count and begin a simulation.
19. STEP - Attempt a limited number of Block entries.
20. STOP - Set a Stop Condition based on Block entry attempts.
21. STORAGE - Define a Storage Entity.
22. TABLE - Define a Table Entity.
23. VARIABLE - Define a Variable Entity.

Operands
Statements usually have one or more operands which you must fill in. Most operands have
several different forms which are valid. In the descriptions which follow, a valid class of operands
may be described by an italicized word. You must choose a member of the class and type it into
the Operand field. For example, if one of the valid forms of an operand is given as PosInteger,
you could type:

21

Windows
A wide variety of windows are available for you to observe the effects of Commands on
your simulations. In general, windows are specialized by the entity type.

1. Model Window - Text View — full screen textual model editor.


2. Journal Window - Record session events.
3. Blocks Window - Online view of Block dynamics.
4. Expressions Window - Online view of values of Expressions.
5. Facilities Window - Online view of Facility Entity dynamics.
6. Logicswitches Window - Online view of Logicswitch Entity dynamics.
7. Matrix Window - Online view of the dynamics of a Matrix cross-section.
8. Plot Window - Online view of a plot of up to 8 Expressions.
9. Queues Window - Online view of Queue Entity dynamics.
10. Savevalues Window - Online view of Savevalue Entity dynamics.
11. Storages Window - Online view of Storage Entity dynamics.
12. Table Window - Online view of Table Entity dynamics.
13. Transaction Snapshot - Picture of the state of a Transaction in the simulation.
14. CEC Snapshot - Picture of the state of the Current Events Chain in the simulation.
15. FEC Snapshot - Picture of the state of the Future Events Chain in the simulation.
16. Numeric Groups Snapshot - Picture of the state of the Numeric Groups in the
simulation.
17. Userchains Snapshot - Picture of the state of the Userchain Entities in the
simulation.
18. Transaction Groups Snapshot - Picture of the state of the Transaction Groups in
the simulation.

GPSS Block Statements:


You use Block Statements to create GPSS Block Entities. Block Statements which are part
of the Initial Model Translation create permanent Blocks in the simulation. A Block
Statement sent to an existing simulation creates a one-time temporary Block to be used in a
mode called Manual Simulation.
A model is simply a sequence of Model Statements. A GPSS World Model Statement is
either a GPSS Statement or a PLUS Procedure definition. The GPSS Statements, in turn,
are either Block Statements, which cause a Block to be created, or Commands, which do
not. Any Model Statement can be sent to an existing simulation as an Interactive Statement.

The GPSS Block statements are:


1. ADOPT - Change Assembly Set.
2. ADVANCE - Place Transaction on Future Events Chain.
3. ALTER - Test and modify Transactions in a Group.
4. ASSEMBLE - Wait for and destroy related Transactions.
5. ASSIGN - Modify Transaction Parameter.
6. BUFFER - Place Transaction at end of the Current Events Chain.
7. CLOSE - End the Data Stream.
8. COUNT - Place count of entities into a Transaction Parameter.
9. DEPART - Decrement content of a Queue Entity.
10. DISPLACE - Change the Next Sequential Block of a Transaction.
11. ENTER - Occupy or wait for storage units in a Storage Entity.
12. EXAMINE - Test group membership.
13. EXECUTE - Perform action specified by a different Block.
14. FAVAIL - Change status of a Facility Entity to "available".
15. FUNAVAIL - Change status of a Facility Entity to "not available".
16. GATE - Test entity and modify Transaction flow.
17. GATHER - Wait for related Transactions.
18. GENERATE - Create Transaction and place on Future Events Chain.
19. INDEX - Modify Transaction Parameter.
20. INTEGRATION - Turn the integration of a User Variable On or Off.
21. JOIN - Place a member into a Numeric or Transaction Group.
22. LEAVE - Release storage units of a Storage Entity.
23. LINK - Move Transaction to Userchain Entity.
24. LOGIC - Modify Logicswitch Entity.
25. LOOP - Decrement Parameter, jump to different Block if result is nonzero.
26. MARK - Place value of system clock into Transaction Parameter.
27. MATCH - Wait for related Transaction to reach conjugate MATCH Block.
28. MSAVEVALUE - Assign value to Matrix Entity element.
29. OPEN - Initialize a Data Stream.
30. PLUS - Evaluate PLUS Expression and save result in Parameter.
31. PREEMPT - Displace Facility owner.
32. PRIORITY - Modify Transaction priority.
33. QUEUE - Increment content of a Queue Entity.
34. READ - Bring the next line of data from a Data Stream.
35. RELEASE - Free Facility Entity.
36. REMOVE - Take a member out of Numeric or Transaction Group.
37. RETURN - Free Facility Entity.
38. SAVAIL - Change status of Storage Entity to "available".
39. SAVEVALUE - Assign a value to Savevalue Entity.
40. SCAN - Test Transaction group, place value in Parameter.
41. SEEK - Change the line pointer in a Data Stream.
42. SEIZE - Assume ownership of or wait for a Facility Entity.
43. SELECT - Place selected entity number into Transaction Parameter.
44. SPLIT - Create related Transaction.
45. SUNAVAIL - Change status of Storage Entity to "not available".
46. TABULATE - Update Table Entity.
47. TERMINATE - Destroy Transaction, decrement Termination Count.
48. TEST - Test arithmetic condition and modify Transaction flow.
49. TRACE - Set Trace Indicator of the Active Transaction.
50. TRANSFER - Move to specified Block.
51. UNLINK - Remove Transaction from Userchain Entity.
52. UNTRACE - Turn off Trace Indicator in the Active Transaction.
53. WRITE - Send a value to a Data Stream.

Conclusion: Thus we have studied the GPSS/H simulation Package.

You might also like