Page 120 - DCAP601_SIMULATION_AND_MODELING
P. 120

Simulation and Modelling



                      Notes                   Therefore x=–1/  ln u. x is a random number obeying negative index distribution.

                                              With this method, as long as producing a random number obeying even distribution,
                                              we could get a random number x obeying the negative index number distribution
                                              with parameter .
                                         (b)  Creating the algorithm of  obeying normal distribution with discarding-selecting
                                              method
                                              (i)  Create two random number R  and R  in (0, 1)
                                                                           1     2
                                              (ii)  With R , create a  random number in [a,b]: x=a+(b –  a)R , and calculate  the
                                                         1                                       1
                                                   value of f(x)
                                              (iii)  when R <=f(x)/M, select x as, and M is the max value of f(X)
                                                         2
                                         Simulating the model with event step-length method. In some degree, the process of the
                                         simulation is considered as a series of event point. In terms of the sequence of event, the
                                         system arranges the sequence of event executing with a table called “event table”. Event
                                         table has three properties, ID, event style and time.

                                         The simulation algorithm as below:
                                         Step 1: Initiation (clear simulation clock
                                                Configuring the state of the system

                                                Clear accumulation statistic
                                                creating initiating event table)
                                         Step 2: Do
                                         {
                                         Find most recent event from event table
                                         Simulation clock increase
                                         If (Customers arrive)
                                          Add the time of next customer arriving into event table
                                         If (cashier is busy/ S=1)
                                          LQ++ //queue increment
                                         Else
                                          S=1 //cashier turn to busy
                                          Add the time of the customer finishing into event
                                          Table
                                         Else
                                          Delete the customer from event table //service ends
                                         If (the queue is not empty/ LQ>0)
                                          LQ— //the length of queue decrease
                                          Add the time of the customer finishing into event table
                                         Else
                                          S=0 // cashier is idle
                                         } While (event table is not null)
                                         Output result






            114                              LOVELY PROFESSIONAL UNIVERSITY
   115   116   117   118   119   120   121   122   123   124   125