home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol266 / arrvl3.for < prev    next >
Encoding:
Text File  |  1986-05-19  |  3.4 KB  |  89 lines

  1.         SUBROUTINE      ARRVL(NSET)
  2. C////////////////////////////////////////////////////////////////
  3. C/                                                              /
  4. C/      Program-id.     ARRVL                                   /
  5. C/      Date-written.   Jan. 23rd 1984                          /
  6. C/      File-name.      ARRVL3.FOR                              /
  7. C/      Remarks.        Subroutine ARRVL page 123               /
  8. C/                      The arrival of items to the system is   /
  9. C/                      described in terms of the time between  /
  10. C/                      the arrivals, every arrival event must  /
  11. C/                      cause the next arrival event to occur.  /
  12. C/            This is for Example-3 version.        /
  13. C/                                                              /
  14. C////////////////////////////////////////////////////////////////
  15. C
  16. C    * Default size of INTEGR = 2 bytes in F80
  17. C       
  18.         INTEGER*4       NSET(6,1)
  19. C
  20.       COMMON /C1/ID,IM,INIT,JEVNT,JMNIT,MFA,MSTOP,MX,MXC,NCLCT,NHIST,
  21.      1           NOQ,NORPT,NOT,NPRMS,NRUN,NRUNS,NSTAT,OUT,SCALE,ISEED,
  22.      2           TNOW,TBEG,TFIN,MXX,NPRNT,NCRDR,NEP,VNQ(4)
  23. C
  24.       COMMON /C2/ATRIB(4),ENQ(4),INN(4),JCELS(5,22),KRANK(4),MAXNQ(4),
  25.      1           MFE(4),MLC(4),MLE(4),NCELS(5),NQ(4),PARAM(20,4),
  26.      2           QTIME(4),SSUMA(10,5),SUMA(10,5),NAME(6),NPROJ,MON,
  27.      3         NDAY,NYR,JCLR
  28. C
  29. C       --- Since ARRVL is an endogenous event schedule the next 
  30. C           arrival. At TNOW plus number drawn from an exponential
  31. C           distribution. The arrival time is stored in ATRIB(1).
  32. C           The event code for an ARRVL is 1. Set ATRIB(2)
  33. C           equal to 1.
  34. C
  35.         CALL    DRAND(ISEED,RNUM)
  36.         ATRIB(1) = TNOW - PARAM(1,1) * ALOG(RNUM)
  37.         ATRIB(2) = 1.0
  38.         CALL FILEM(1,NSET)
  39. C
  40. C       --- Collect the statistics on the number in the system since
  41. C           an arrival causes number in the system to change.
  42. C
  43.         CALL    TMST(XISYS,TNOW,1,NSET)
  44.         IF (XISYS) 7,8,9
  45.     7   CALL    ERROR(31,NSET)
  46.         RETURN
  47. C
  48. C       --- Increment the number in the system. Since the number in
  49. C           the system was zero the server was not busy.
  50. C           The server status will change due to the new arrival
  51. C           therefore statistics on the time the server was busy
  52. C           must be collected.
  53. C
  54.     8   XISYS = XISYS + 1.0
  55.         CALL    TMST(BUS,TNOW,2,NSET)
  56. C
  57. C       --- Change the status of the server to busy. Collect 
  58. C           statistics on the waitting time of current arrival which
  59. C           is zero since the server was not busy at his time of 
  60. C           arrival.
  61. C
  62.         BUS = 1.0
  63.         CALL    COLCT(0.0,2,NSET)
  64. C
  65. C       --- Since the new arrival goes directly into service cause an 
  66. C           end of service event. Set ATRIB(2) equal to indicate an end
  67. C           of service event. Set ATRIB(3) equal to TNOW the arrival
  68. C           time of the customer.
  69. C
  70.         CALL    DRAND(ISEED,RNUM)
  71.         ATRIB(1) = TNOW - PARAM(2,1) * ALOG(RNUM)
  72.         ATRIB(2) = 2.0
  73.         ATRIB(3) = TNOW
  74.         CALL    FILEM(1,NSET)
  75.         RETURN
  76. C
  77. C       --- Increment the number in the system.
  78. C
  79.     9   XISYS = XISYS + 1.0
  80. C
  81. C       --- Put new arrival in the queue waiting for the server to 
  82. C           become free. Set ATRIB(3) equal to the arrival time of
  83. C           the customer.
  84. C
  85.         ATRIB(3) = TNOW
  86.         CALL    FILEM(2,NSET)
  87.         RETURN
  88.         END
  89.