Page 33 - DCAP601_SIMULATION_AND_MODELING
P. 33

Unit 1: Introduction to System Simulation



            an order (to be delivered three days hence), by stating the amount ordered and the day it is due  Notes
            to be received. We repeat this procedure for 180 days’. Initially we set day number i = 1, stock
            S = 115, number of units due UD = 0 (because there is no outstanding order), and the day they are
            due DD=0.
            The demand, DEM, for each day is not a fixed quantity but a random variable. It could assume
            any integral value from 00 to 99 and each with equal probability. We will use a special subroutine,
            which generates a 2-digit random integer, and will use the numbers thus produced as the daily
            demands.
            The following Fortran program (format free) implements the flowchart for evaluating the total
            cost for a given replenishment policy (P, Q) for 180 days. Statement No. 110 in the program
            makes  use  of the  subprogram RNDY1  (DUM) which  is  a  subprogram  to  generate  a  real
            pseudorandom number between zero and one. The argument of this function can be any dummy
            number or  variable.
            Notice how condition 6, that there is no more than one reorder outstanding, has been taken care
            of. In Statement 130, we add the number of units due (if any) UD to the current stock S to get the
            equivalent stock, ES. It is this number which is compared to P before an order is placed. Since
            UD> P if we already have a replenishment order outstanding another order will not be placed.
            This is an extremely simple model of an inventory-control system.
                  INTEGER P, Q, S, ES, UD, DD. DEM
                  READ, P, Q
                  C = 0.0
                  S = 115
                  I = 1
                  UD = O
                  DD = O
            100   IF (DD .NE. I) GO TO 110
                  S = S + Q
                  UD = 0
            110   DEM = RNDY1 (DUM)* 100.0
                  IF (DEM .LE. S) GO TO 120
                  C = C + (FLOAT (DEM) – FLOAT (S))*18.0
                  S = 0
                  GO TO 130
            120   S = S – DEM
                  C = C + FLOAT (S)*.75
            130   ES =  S + UD
                  IF (ES .GT. P) GO TO 140
                  UD = Q
                  DD = I + 3
                  C = C + 75.0
            140   I = 1 + 1
                  IF (I .LE. 180) GO TO 100
                  PRINT, P, Q, C
                  STOP
                  END





                                             LOVELY PROFESSIONAL UNIVERSITY                                   27
   28   29   30   31   32   33   34   35   36   37   38