Discrete Event Simulation • In discrete systems, the changes in the system state are discontinuous and each change in the state of the system is called an event. • The model used in a discrete system simulation has a set of numbers to represent the state of the system, called as a state descriptor.
Fig 1: Graphical representation of the behavior of a discrete system
simulation Continuous Simulation • Continuous simulation is a type of simulation in which state variables change continuously with respect to time.
Fig 2: Graphical representation of Continuous simulation
behavior. Example: Queuing System Simulation • A queuing system is described by its calling population, the nature of the arrivals, the service mechanism, the system capacity, and the queuing discipline. • A single-channel queuing system is portrayed in the following figure. Characteristics of Queuing Systems • The key elements, of a queuing system are the customers and servers. • term "customer" can refer to people, machines, trucks, mechanics, patients—anything that arrives at a facility and requires service. • The term "server" might refer to receptionists, repairpersons, CPUs in a computer, or washing machines…any resource (person, machine)etc. which provides the requested service. The Elements of a Queuing System i. The Calling Population: The population of potential customers, referred to as the calling population, may be assumed to be finite or infinite.
ii. System Capacity:-In many queuing systems there is a limit to the
number of customers that may be in the waiting line or system. An arriving customer who finds the system full does not enter but returns immediately to the calling population.
iii. The Arrival Process:-Arrival process for infinite-population
models is usually characterized in terms of inter-arrival times of successive customers. Arrivals may occur at scheduled times or at random times. When at random times, the inter-arrival times are usually characterized by a probability distribution. Queuing System 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. Arrivals for service occur one at a time in a random fashion; once they join the waiting line, they are eventually served. Service times are of some random length according to a probability distribution The system capacity; has no limit, meaning that any number of units can wait in line. The state of the system is the number of units in the system and the status of the server, busy or idle. An event is a set of circumstances that cause an instantaneous change in the state of the system In a single –channel queuing 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 completion of service on a unit. The queuing system includes the server, the unit being serviced, and units in the queue. If a unit has just completed service, the simulation proceeds in the manner shown in the flow diagram. Note that the server has only two possible states: it is either busy or idle. The unit may find the server either idle or busy; therefore, either the unit begins service immediately, or it enters the queue for the server. The unit follows the course of action shown If the server is busy, the unit enters the queue. If the server is idle and the queue is empty, the unit begins service. It is not possible for the server to be idle and the queue to be nonempty If the server is busy, the unit enters the queue. If the server is idle and the queue is empty, the unit begins service. It is not possible for the server to be idle and the queue to be nonempty. After the completion of a service the service may become idle or remain busy with the next unit. • In a single-channel queuing system, interarrival times and service times are generated from the distributions of these random variables. • Table 1 contains a set of five interarrival times are used to compute the arrival times of six customers at the queuing system
• Arrival time on clock is obtained by the incremental adding of
interarrival time. • Time service begins= max(Arrival time on clock, Time service ends) • Time service ends= Time service begins + Service Time • Table 2 was designed specifically for a single-channel queue which serves customers on a first-in, first-out (FIFO) basis.
• Average time of customer=
Cont.. Example 2 • 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. • The service times vary from 1 to 6 minutes with the probabilities shown in table next. • The problem is to analyze the system by simulating the arrival and service of 20 customers. Table 5: Service Time Distribution Exercise • Generate a manual event list for customers arriving at a single-queue, single-server system. Calculate average waiting time, probability of waiting time, probability of idle time of server, average system time, average time b/n arrivals, and others. • Interarrival times in minutes for 10 arrivals: 2, 1, 3, 1, 3, 2, 4, 2, 1, 1 • Service times in minutes for 10 arrivals: 2, 3, 1, 3, 2, 2, 1, 3, 2, 2 Random-Number Generation • Random numbers are a necessary basic ingredient in the simulation of almost all discrete systems. • Most computer languages have a subroutine, object, or function that will generate a random number. • Similarly simulation languages generate random numbers that arc used to generate event limes and other random variables. Techniques for Generating Random Numbers There are different methods 1. Congruence methods 1.1 Linear congruence generation (LCG) 1.2 Additive congruence generation 1.3 Multiplicative congruence generation 1.4 Mixed congruence generation 2. Mixed Square Method 3. Inverse transformational Method 4. Rejection Method 1. Linear congruence generation • It produces the sequence of integer x1, x2 - - - - - between 0 and m-1 may following by recursive relationship Xi+1= (axi+c) mod m ,i=0,1,2,.......... m-1. And to convert each integer to relative random number we will use R1=X1/m, R2=X2/m, R3=X3/m ......... • The initial value x0 is called the seed. a is called as multiplier, c is called increment and m is modulus. – If c≠0 then the form is called mixed congruential generator. – If c=0 , then the form is called multiplicative congruential generator. – If a=1 , then the form is called additive congruential generator. Example Cont..
• Example 2: Generate 5 random numbers using
additive congruential method with X0=5, c=7, m=64. • Example 3: Generate 5 random number using multiplicative congruential method with X0=63, a=19, m=100. • Example 4: Use the mixed congruential method to generate a sequence of three 2-digit random number with X0=37, a=7, c=29 2. MID-SQUARE METHOD
• This method was proposed by Von Neumann
and metropolis. • The technique starts with an initial no. or seed. • This number is squared and the middle digit of the square becomes the random number after placement of the decimal. • Again the middle digits are squared to generate the second random number and so on Example • X0= 5497 (X0)2= (5497)2 =30217009 X1=2170 R1= X1/m= 2170/104= 0.2170 (X1)2= (2170)2 = 04708900 X2= 7089 R2= X2/m= 0.7089 .......... Q&A