home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Reference Guide / C-C++ Interactive Reference Guide.iso / c_ref / csource5 / 349_01 / sss.arc / MANUAL.SSS < prev    next >
Encoding:
Text File  |  1991-04-17  |  67.3 KB  |  1,513 lines

  1.  
  2.  
  3.                        REFERENCE MANUAL OF
  4.                  SSS - Simulation Subroutine Set.
  5.                           Version 1.00
  6.  
  7.               Copyright (C) M. A. Pollatschek 1990.
  8.                       All rights reserved.
  9.  
  10.  
  11.  
  12.  
  13.                          ╔════════════╗
  14.                          ║  CONTENTS  ║
  15.                          ╚════════════╝
  16.                                                           Page
  17.  
  18.     HOW TO BENEFIT FROM THIS DOCUMENTATION..  ...  ...  ... 2
  19.     ALPHABETIC LIST OF ROUTINES...  ...  ...  ...  ...  ... 2
  20.     TERMINOLOGY ...  ...  ...  ...  ...  ...  ...  ...  ... 2
  21.     SIMULATION ROUTINE..  ...  ...  ...  ...  ...  ...  ... 4
  22.     ERROR MASSAGES.  ...  ...  ...  ...  ...  ...  ...  ... 5
  23.     CLARIFICATION OF ENTRIES IN DESCRIPTION.  ...  ...  ... 6
  24.     NOTES FOR EXAMPLES..  ...  ...  ...  ...  ...  ...  ... 6
  25.     A(n), IDE(), SETA(n,v) SETIDE(i)...  ...  ...  ...  ... 7
  26.     AIC(r,n), IDIC(r), NEIC(r), TIC(r).  ...  ...  ...  ... 8
  27.     AIQ(m,r,n), IDIQ(m,r), PRIQ(m,r)...  ...  ...  ...  ... 9
  28.     BE(W,U)...  ...  ...  ...  ...  ...  ...  ...  ...  ...10
  29.     BI(N,P), NP(M).  ...  ...  ...  ...  ...  ...  ...  ...10
  30.     CD(X,V,N), DP(V,N)..  ...  ...  ...  ...  ...  ...  ...11
  31.     CLEARQ(m), QAVG(m), QMAX(m), QMIN(m), QNUM(m), QSTD(m).12
  32.     CLEARS(j), TALLY(j,v) ...  ...  ...  ...  ...  ...  ...13
  33.     CREATE(g,i) ...  ...  ...  ...  ...  ...  ...  ...  ...14
  34.     DISPOS()..  ...  ...  ...  ...  ...  ...  ...  ...  ...15
  35.     ER(M,K), EX(M), GA(M,K)  WE(M,U)...  ...  ...  ...  ...15
  36.     INIQUE(q,b,s)..  ...  ...  ...  ...  ...  ...  ...  ...16
  37.     INISTA(j,h,k,l,f,w).  ...  ...  ...  ...  ...  ...  ...16
  38.     NC(), NQ(m) ...  ...  ...  ...  ...  ...  ...  ...  ...18
  39.     NCEN(), NEXTEV() ...  ...  ...  ...  ...  ...  ...  ...19
  40.     QDC(m), SETQDC(m,d).  ...  ...  ...  ...  ...  ...  ...20
  41.     QUEUE(m,p)  ...  ...  ...  ...  ...  ...  ...  ...  ...21
  42.     RA(), RL(M,S), RN(M,S), TR(I,B,C), UN(I,C)...  ...  ...22
  43.     REMVFC(r), REMVFQ(m,r)...  ...  ...  ...  ...  ...  ...23
  44.     SAVG(j), SMAX(j), SMIN(j), SNUM(j), SSTD(j)..  ...  ...24
  45.     SCHED(g,e,i)...  ...  ...  ...  ...  ...  ...  ...  ...25
  46.     SETANT(y), SETSEE(x)  ...  ...  ...  ...  ...  ...  ...26
  47.     SETDEB(o), SHOWQ(m).  ...  ...  ...  ...  ...  ...  ...27
  48.     SETT(g), T()...  ...  ...  ...  ...  ...  ...  ...  ...28
  49.     SIMEND(g).  ...  ...  ...  ...  ...  ...  ...  ...  ...29
  50.     SIMERR()..  ...  ...  ...  ...  ...  ...  ...  ...  ...30
  51.     SUMRY(u)..  ...  ...  ...  ...  ...  ...  ...  ...  ...31
  52.  
  53. SSS Reference                                            Page   2
  54.  
  55.  
  56.           ╔══════════════════════════════════════════╗
  57.           ║  HOW TO BENEFIT FROM THIS DOCUMENTATION  ║
  58.           ╚══════════════════════════════════════════╝
  59.  
  60. Use a lister/editor's search facility to find out the meaning of
  61. terms. Each term is explained somewhere. Examine also the
  62. examples in files EX_*.*.
  63.  
  64. Printed user guide with tutorials and/or source code is
  65. available. Write to: M. A. Pollatschek, Management, Technion,
  66. Haifa 32000 ISRAEL.
  67.  
  68.  
  69.                ╔════════════════════════════════╗
  70.                ║  ALPHABETIC  LIST OF ROUTINES  ║
  71.                ║  and where they are described  ║
  72.                ╚════════════════════════════════╝
  73.  
  74.   for    look     for    look     for    look     for    look
  75. routine  under  routine  under  routine  under  routine  under
  76. A.......A       IDIC....AIC     QNUM....CLEARQ  SETSEE..SETANT
  77. AIC.....AIC     IDIQ....AIQ     QSTD....CLEARQ  SETT....SETT
  78. AIQ.....AIQ     INIQUE..INIQUE  QUEUE...QUEUE   SHOWQ...SETDEB
  79. BE......BE      INISTA..INISTA  RA......RA      SIMEND..SIMEND
  80. BI......BI      NC......NC      REMVFQ..REMVFQ  SIMERR..SIMERR
  81. CD......CD      NCEN....NCEN    REMVFQ..REMVFQ  SMAX....SAVG
  82. CLEARQ..CLEARQ  NEIC....AIC     RL......RA      SMIN....SAVG
  83. CLEARS..CLEARS  NEXTEV..NCEN    RN......RA      SNUM....SAVG
  84. CREATE..CREATE  NP......BI      SAVG....SAVG    SSTD....SAVG
  85. DISPOS..DISPOS  NQ......NC      SCHED...SCHED   SUMRY...SUMRY
  86. DP......CD      PRIQ....AIQ     SETA....A       T.......SETT
  87. ER......ER      QAVG....CLEARQ  SETANT..SETANT  TALLY...CLEARS
  88. EX......ER      QDC.....QDC     SETDEB..SETDEB  TIC.....AIC
  89. GA......ER      QMAX....CLEARQ  SETIDE..A       TR......RA
  90. IDE.....A       QMIN....CLEARQ  SETQDC..QDC     UN......RA
  91.                                                 WE......ER
  92.  
  93.  
  94.                         ╔═══════════════╗
  95.                         ║  TERMINOLOGY  ║
  96.                         ╚═══════════════╝
  97.  
  98. attribute: is a numerical characteristic of the entities, e.g.
  99.         size, color code in a floating point number. Attributes
  100.         may differ among entities. They are updated/initiated for
  101.         current entity to v by SETA(v). They can be accessed by
  102.         A(n), AIC(r,n), AIQ(m,r,n).
  103.  
  104. calendar: a list of scheduled or created, entities, that is
  105.         entities whose events occure at some simulted time in the
  106.         future. The calendar is created by calling INIQUE(q,b,s).
  107.         Entities are put on the calendar by CREATE(g,i) or
  108.         SCHED(g,e,i). Entities are removed from the calendar by
  109.         NEXTEV() or REMVFC(r).
  110.  
  111. SSS Reference                                            Page   3
  112.  
  113.  
  114. current entity: the entity under present treatment. There must be
  115.         at most one such entity at each time. Its number at any
  116.         time is given by NCEN(). An entity becomes current after
  117.         calling one of: NEXTEV(), REMVFC(r),  REMVFQ(m,r)
  118.         and stops being current after
  119.         calling one of: DISPOS(), QUEUE(m,p), SCHED(g,e,i).
  120.  
  121. discipline: the ordering of entities in a queue, may be one of:
  122.         FIFO=first in first out,  LIFO=first in last out,
  123.         SVF=smallest value first, BVF=biggest value first.
  124.  
  125. entity: the basic constituent of simulation which undergoes a few
  126.         processes in time like a customer, a part, a pellet, etc.
  127.  
  128. event: an occurrence of a specific operation at a certain time,
  129.         like arrival, end of servicing, etc.
  130.  
  131. id, identity: is used to differentiate between various kinds of
  132.         entities, e.g. parts, pellets and transporters on a
  133.         factory floor as integers. They are set to i by
  134.         CREATE(g,i), SCHED(g,e,i), SETIDE(i).
  135.  
  136. priority: a number which determines the rank of an entity in a
  137.         queue having a BVF or SVF discipline - the entities are
  138.         sorted by their priorities.
  139.  
  140. returned value: the value returned by a (non void) function.
  141.  
  142. simulated time: time that the simulator's clock shows, not
  143.         related to real time or computation time.
  144.  
  145. stochastic process: is a variable which changes at some points of
  146.         time and we are interested in its time average rather
  147.         than its simple average. An example is inventory: if
  148.         first three days we have 5 units, and the fourth day only
  149.         3 then the time average is (5*3 + 3*1)/4 = 4.5 and while
  150.         the simple average is (5 + 3)/2 = 4.
  151.  
  152. subroutine: a procedure or function.
  153.  
  154. time persistent statistic: a statistic about a stochastic
  155.         process.
  156.  
  157. SSS Reference                                            Page   4
  158.  
  159.  
  160.                     ╔══════════════════════╗
  161.                     ║  SIMULATION ROUTINE  ║
  162.                     ╚══════════════════════╝
  163.  
  164. The simulation program has two parts:
  165. [1] setup - contains calls to INIQUE, INISTA, at least one call
  166.         to CREATE and other initializations;
  167. [2] event loop - what to do when an event happens.
  168.  
  169.              A skeleton event loop looks as follows:
  170.  
  171.   ╔══════════════╦════════════╦═════════════════╦═════════════╗
  172.   ║    BASIC     ║      C     ║      FORTRAN    ║    Pascal   ║
  173.   ╠══════════════╬════════════╬═════════════════╬═════════════╣
  174.   ║do            ║do {        ║9 e=NEXTEV()     ║repeat       ║
  175.   ║e=NEXTEV      ║e=NEXTEV()  ║  if(e.gt.0) then║e:=NEXTEV    ║
  176.   ║if e>0 then   ║if (e)      ║  goto(1,2,...)e ║if e>0 then  ║
  177.   ║select case e ║switch(e) { ║1 continue       ║begin        ║
  178.   ║case 1        ║case 1:     ║C new entity     ║case e of    ║
  179.   ║ 'new entity  ║/*new entity║C arrival        ║1:{new entity║
  180.   ║ 'arrival     ║  arrival */║  goto 9         ║   arrival}  ║
  181.   ║case 2        ║case 2:     ║2 continue       ║2:           ║
  182.   ║ 'etc         ║ /* etc */  ║C etc            ║  {etc}      ║
  183.   ║end select    ║}           ║  goto 9         ║end {case};  ║
  184.   ║end if        ║}           ║  ...            ║end {if};    ║
  185.   ║loop while e>0║while(e);   ║  endif          ║until e=0;   ║
  186.   ╚══════════════╩════════════╩═════════════════╩═════════════╝
  187.  
  188. (In FORTRAN the first column here is actually the 5th and the C's
  189. must be actually in the 1st column.)
  190.  
  191. The cases 1, 2, etc (in FORTRAN the goto labels) are the event
  192. codes. The significance of e is:
  193.  
  194. 0: either the calendar is empty or end of simulation, placed on
  195.         calendar by SIMEND(g).
  196. 1: a new entity's arrival caused by calling CREATE(g,i) at some
  197.         earlier simulated time.
  198. Other values (greater than 1) are non-arrival events scheduled by
  199.         SCHED(g,e,i) like end of service etc.
  200.  
  201. SSS Reference                                            Page   5
  202.  
  203.  
  204. The codes following the cases are the things to perform at each
  205. event (like entering or inspecting a queue, starting or finishing
  206. an activity, etc). We suggest the following list covering most of
  207. the cases:
  208.  
  209. ╔══════════╦════════════════════════════════════════════════════╗
  210. ║Symbol(=e)║    Things to do when this event becomes current:   ║
  211. ╠══════════╬════════════════════════════════════════════════════╣
  212. ║ARRIVL(=1)║SCHEDuling next ARRIVaL, determination of Attributes║
  213. ║          ║and IDEntity of current entity as well as its first ║
  214. ║          ║activity                                            ║
  215. ║          ║                                                    ║
  216. ║NEXTAC(=2)║preparing NEXT ACtivity: whether it can start or    ║
  217. ║          ║not, choosing of queues/servers if necessary        ║
  218. ║          ║                                                    ║
  219. ║STARTA(=3)║STARTing Activity: SCHEDuling its end               ║
  220. ║          ║                                                    ║
  221. ║ENDACT(=4)║ENDing ACTivity: determining what a server, who is  ║
  222. ║          ║freed from current entity, and the current entity   ║
  223. ║          ║should do next                                      ║
  224. ║          ║                                                    ║
  225. ║MATCH (=5)║MATCHing entities                                   ║
  226. ╚══════════╩════════════════════════════════════════════════════╝
  227.  
  228. The simulation is in a fact a proper interaction with the
  229. calendar. The important routines are: CREATE(g,i), NEXTEV() and
  230. SCHED(g,e,i).
  231.  
  232. The calendar is fed with new entities by CREATE(g,i) and depleted
  233. by NEXTEV().
  234.  
  235. SCHED(g,e,i) sends the current entity to its next event e after a
  236. delay of g units time from present simulated time. It acts as a
  237. kind of delayed "goto".
  238.  
  239.  
  240.                       ╔══════════════════╗
  241.                       ║  ERROR MASSAGES  ║
  242.                       ╚══════════════════╝
  243.  
  244. Most errors are explained under the routines that may raise them.
  245.  
  246. There are two errors not covered under the routines:
  247.  
  248. * There is no more space in memory or too many entities. Very
  249.   unlikely, but may happen inside QuickBasic or QuickC
  250.   environments. You may do one ore more of the following:
  251.   [1] create less entities (if possible)
  252.   [2] remove memory resident programs
  253.   [3] add more physical memory (if possible)
  254.   [4] in QuickBasic: consult end of SSSB.H for advice
  255.   [5] in QuickBasic or QuickC: make compilation form CQ or QCL
  256.  
  257. SSS Reference                                            Page   6
  258.  
  259.  
  260. * There is a mathematical error (like division by 0 or square
  261.   root from a negative number) inside a random number generator.
  262.   Very unlikely, but if happens, please report the exact
  263.   circumstances to the author. You can circumvent it by using an
  264.   alternative strategy of generation (via CD, for example).
  265.  
  266. See error codes and massages on page 30 as well as ways to
  267. control them.
  268.  
  269.  
  270.           ╔══════════════════════════════════════════╗
  271.           ║  CLARIFICATION OF ENTRIES IN DESCRIPTION ║
  272.           ╚══════════════════════════════════════════╝
  273.  
  274. Error: refers situations (invalid parameters or presence/absence
  275.         of current entity) which give rise to errors
  276.  
  277. Floating point number: double or real or real*8, see .H files
  278.  
  279. Forbidden predecessor: a routine which must not be called prior
  280.         to the routine under consideration unless one of the
  281.         mandatory predecessors is called between them. For
  282.         example, you cannot remove an entity from a queue (call
  283.         REMVFQ(m,r)) unless there exists no current entity. But
  284.         a current entity comes to existence as a result of
  285.         calling NEXTEV(). NEXTEV() is therefore forbidden unless
  286.         that entity is disposed (by calling DISPOS()) before
  287.         calling REMVFQ(m,r). DISPOS() is mandatory here.
  288.  
  289. Integer: 2 byte integer
  290.  
  291. Notes: aspects concerning pecularities of languages
  292.  
  293. Remarks: aspects concerning SSS or simulation or use
  294.  
  295.  
  296.                     ╔══════════════════════╗
  297.                     ║  NOTES FOR EXAMPLES  ║
  298.                     ╚══════════════════════╝
  299.  
  300. In BASIC examples:
  301.         _ signifies that following line is actually a
  302.                 continuation of present line;
  303.         sometimes closing quote (") is missing for lack of space.
  304.  
  305. In FORTRAN examples:
  306.         first FORTRAN column is actually 5th column of code;
  307.         sometimes closing quote (') is missing for lack of space.
  308.  
  309. SSS Reference                                            Page   7
  310.  
  311.  
  312.              ╔════════════════════════════════════╗
  313.              ║  A(n), IDE(), SETA(n,v) SETIDE(i)  ║
  314.              ╚════════════════════════════════════╝
  315.  
  316. Description: manages the data (attribute and identity) of the
  317.         current entity. Attributes are floating point numbers.
  318.         Identity is an integer, often set by last parameter of
  319.         CREATE(g,i) or SCHED(g,e,i) when the present entity was
  320.         CREATEd or SCHEDuled.
  321. A returns the n-th attribute (floating point number);
  322. IDE returns the identity (integer);
  323. SETA sets the n-th attribute's value to v;
  324. SETIDE sets identity to i.
  325.  
  326. Arguments:
  327. n: (integer) attribute index, n = 1,...,max_atr where max_atr is
  328.         second argument of INIQUE(q,max_atr,s).
  329. v: (floating point number) any value.
  330. i: (integer) any value.
  331.  
  332. Mandatory predecessors: INIQUE(q,max_atr,s), and one of:
  333.         NEXTEV(), REMVFC(r), REMVFQ(m,r).
  334.  
  335. Forbidden predecessors: DISPOS(), QUEUE(m,p), SCHED(g,e,i).
  336.  
  337. Recommanded predecessor for A: SETA(n,v), for IDE: one of -
  338.         SETIDE(i), CREATE(g,i) or SCHED(g,e,i).
  339.  
  340. Errors: if there is no current entity. For A and SETA also if
  341.         n < 1 or n > max_atr.
  342.  
  343. Examples:
  344. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  345. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  346. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  347. ║integer e    ║int e;        ║ integer e         ║var e:integer;║
  348. ║INIQUE 0,2,0 ║INIQUE(0,2,0);║ call INIQUE(0,2,0)║INIQUE(0,2,0);║
  349. ║CREATE 0,0   ║CREATE(0,0);  ║ call CREATE(0,0)  ║CREATE(0,0);  ║
  350. ║e = NEXTEV   ║e = NEXTEV(); ║ e = NEXTEV()      ║e = NEXTEV;   ║
  351. ║SETA 2,7     ║SETA(2,7);    ║ call SETA(2,7)    ║SETA(2,7);    ║
  352. ║SETIDE 99    ║SETIDE(99);   ║ call SETIDE(99)   ║SETIDE(99);   ║
  353. ║print A(1),_ ║printf(       ║ write (*,*)       ║writeln(      ║
  354. ║A(2),IDE     ║"%f, %f %d\n",║+A(1),A(2),IDE()   ║A(1),' ',     ║
  355. ║             ║A(1),A(2),    ║                   ║A(2),' ',IDE);║
  356. ║             ║IDE());       ║                   ║              ║
  357. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  358. Explanation: A single entity is CREATEed and made current by
  359. NEXTEV. 1st attribute is not initialized, 2nd one is initialized
  360. to 7 and the identity to 99. Then all of them are printed out.
  361.  
  362. SSS Reference                                            Page   8
  363.  
  364.  
  365.             ╔══════════════════════════════════════╗
  366.             ║  AIC(r,n), IDIC(r), NEIC(r), TIC(r)  ║
  367.             ╚══════════════════════════════════════╝
  368.  
  369. Description: returns data about the r-th entity in calendar
  370.         (Attributes are like the latest current ones just prior
  371.         SCHEDuling the entity.) -
  372. AIC returns the n-th attribute (as a floating point number);
  373. IDIC returns the identity code (last argument in CREATE or
  374.         SCHED, an integer);
  375. NEIC returns the next event code (1 for CREATE, 2nd argument in
  376.         SCHED, an integer);
  377. TIC returns the simulated time of the next event (first argument
  378.         in CREATE/SCHED + simulated time when CREATE/SCHED was
  379.         called, a floating point number).
  380.  
  381. Arguments:
  382. r (integer) is the rank of entity in calendar, r = 1,...,NC(),
  383.         where NC() is the number of entities in the calendar.
  384. n (integer) is the attribute index, n = 1,...,max_atr, where
  385.         max_atr is second argument of INIQUE(q,max_atr,s).
  386.  
  387.  
  388. Mandatory predecessors: INIQUE(q,max_atr,s) and either
  389.         CREATE(g,i) or SCHED(g,e,i).
  390.  
  391. Recommended predecessor for AIC: SETA(n,v)
  392.  
  393. Errors: if r < 1 or r > NC() or when calendar is empty or is not
  394.         yet created. For AIC also when n < 1 or n > max_atr
  395.  
  396. Examples:
  397. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  398. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  399. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  400. ║integer e    ║int e;        ║ integer e         ║var e:integer;║
  401. ║INIQUE 0,2,0 ║INIQUE(0,2,0);║ call INIQUE(0,2,0)║INIQUE(0,2,0);║
  402. ║CREATE 0,0   ║CREATE(0,0);  ║ call CREATE(0,0)  ║CREATE(0,0);  ║
  403. ║e = NEXTEV   ║e = NEXTEV(); ║ e = NEXTEV()      ║e = NEXTEV;   ║
  404. ║SETA 2,7     ║SETA(2,7);    ║ call SETA(2,7)    ║SETA(2,7);    ║
  405. ║SCHED 9,2,0  ║SCHED(9,2,0); ║ call SCHED(9,2,0) ║SCHED(9,2,0); ║
  406. ║print _      ║printf(       ║ write (*,*)       ║writeln(      ║
  407. ║AIC(1,2) _   ║"%f %f %d %d",║+AIC(1,2),TIC(1),  ║AIC(1,2),     ║
  408. ║TIC(1) _     ║AIC(1,2),     ║+NEIC(1),IDIC(1)   ║TIC(1),NEIC(1)║
  409. ║NEIC(1)      ║TIC(1),NEIC(1)║                   ║,IDIC(1));    ║
  410. ║IDIC(1)      ║,IDIC(1));    ║                   ║              ║
  411. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  412. Explanation: A single entity is CREATEed and made current by
  413. NEXTEV. 1st attribute is not initialized, 2nd one is initialized
  414. to 7. After initialization the entity is SCHEDuled, thus put to
  415. the calendar. Since this is the only entity its rank in the
  416. calendar is 1. The data of the entity are printed out from the
  417. calendar.
  418.  
  419. SSS Reference                                            Page   9
  420.  
  421.  
  422.              ╔════════════════════════════════════╗
  423.              ║  AIQ(m,r,n), IDIQ(m,r), PRIQ(m,r)  ║
  424.              ╚════════════════════════════════════╝
  425.  
  426. Description: returns data about the r-th entity in queue m.
  427.         Attributes and id are like the latest current ones just
  428.         prior placing the entity to the queue -
  429. AIQ returns the n-th attribute (as a floating point number);
  430. IDIQ returns the identity code (as an integer);
  431. PRIQ returns the priority (second argument in QUEUE which placed
  432.         this entity to queue, a floating point number)
  433.  
  434. Arguments:
  435. m (integer) is the queue index, m = 1,...,max_que, where max_que
  436.         is the first argument in INIQUE(max_que,max_atr,s).
  437. r (integer) is the rank of entity in calendar, r = 1,...,NQ(m),
  438.         where NQ(m) is the number of entities in queue m.
  439. n (integer0 is the attribute index, n = 1,...,max_atr, where
  440.         max_atr is second argument of INIQUE(max_que,max_atr,s).
  441.  
  442. Mandatory predecessors: INIQUE(max_que,max_atr,s) and QUEUE(m,p).
  443.  
  444. Recommended predecessor: for AIQ: SETA(n,v)
  445.  
  446. Errors: if m < 1 or m > max_que or r > NQ(m). For AIQ also if
  447.         n < 1 or n > max_atr.
  448.  
  449. Examples:
  450. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  451. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  452. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  453. ║integer e    ║int e;        ║ integer e         ║var e:integer;║
  454. ║INIQUE 3,2,0 ║INIQUE(3,2,0);║ call INIQUE(3,2,0)║INIQUE(3,2,0);║
  455. ║CREATE 0,0   ║CREATE(0,0);  ║ call CREATE(0,0)  ║CREATE(0,0);  ║
  456. ║e = NEXTEV   ║e = NEXTEV(); ║ e = NEXTEV()      ║e = NEXTEV;   ║
  457. ║SETA 2,7     ║SETA(2,7);    ║ call SETA(2,7)    ║SETA(2,7);    ║
  458. ║QUEUE 3,0    ║QUEUE(3,0);   ║ call QUEUE(3,0)   ║QUEUE(3,0);   ║
  459. ║print _      ║printf("%f\n",║ write (*,*)       ║writeln(      ║
  460. ║AIQ(3,1,2)   ║AIQ(3,1,2));  ║+AIQ(3,1,2)        ║AIQ(3,1,2));  ║
  461. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  462. Explanation: A single entity is CREATEed and made current by
  463. NEXTEV. 1st attribute is not initialized, 2nd one is initialized
  464. to 7. After initialization the entity is placed to queue #3.
  465. Since this is the only entity its rank in the queue is 1. The
  466. value of the attribute # 2 is printed out from the queue.
  467.  
  468. SSS Reference                                            Page  10
  469.  
  470.  
  471.                           ╔═══════════╗
  472.                           ║  BE(W,U)  ║
  473.                           ╚═══════════╝
  474.  
  475. Description: returns a continuous random beta variate (as a
  476.         floating point number) whose mean is W/(U + W)
  477.  
  478. Arguments:
  479. W (positive floating point number) is a shape parameter.
  480. U (positive floating point number) is a shape parameter.
  481.  
  482. Errors: when U or W are not positive.
  483.  
  484. Examples:
  485. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  486. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  487. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  488. ║print _      ║printf("%f\n",║ write(*,*)        ║writeln(      ║
  489. ║BE(2,1)      ║BE(2,1));     ║+BE(2,1)           ║BE(2,1);      ║
  490. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  491. Explanation: A random variate from BE(2,1) distribution is
  492. printed out. The probability density function of BE(2,1) is
  493. f(x) = 2x (0 < x < 1).
  494.  
  495.  
  496.                       ╔══════════════════╗
  497.                       ║  BI(N,P), NP(M)  ║
  498.                       ╚══════════════════╝
  499.  
  500. Description: returns a discrete random variate (as integer)
  501.         according to the distribution law -
  502. BI binomial, number of successful trials out of N
  503. NP Poisson, binomial with many trials when probability of success
  504.         in each trial is small.
  505.  
  506. Arguments:
  507. N (positive integer) is the number of trials.
  508. P (a positive floating point number less than 1) is the
  509.         probability of success in one trial.
  510. M (positive floating point number) is the mean number of
  511.         successes.
  512.  
  513. Errors: when N or P or M are not positive or P > 1.
  514.  
  515. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  516. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  517. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  518. ║print _      ║printf("%f\n",║ write(*,*)        ║writeln(      ║
  519. ║BI(4,.2)     ║BI(4,.2));    ║+BI(4,.2)          ║BI(4,.2);     ║
  520. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  521. Explanation: A random variate from BI(4,.2) distribution is
  522. printed out. This is the number of successes in 4 trials when the
  523. probability of success for each trial is 1/5.
  524.  
  525. SSS Reference                                            Page  11
  526.  
  527.  
  528.                     ╔══════════════════════╗
  529.                     ║  CD(X,V,N), DP(V,N)  ║
  530.                     ╚══════════════════════╝
  531.  
  532. Description: Returns a continuous/discrete random variate
  533.         according to user defined distribution -
  534. CD for continuous case;
  535. DP for discrete case.
  536.  
  537. Arguments:
  538. X (floating point array) is the ordinates.
  539. V (floating point array) is the cumulative probabilities.
  540. N (integer) is the number of elements in X and V.
  541.  
  542. Notes on the arguments: The elements of X and V must constitute
  543.         increasing sequences. The probability that a continuous
  544.         random variable is X[i] or less is V[i], i=1,...,N (for
  545.         FORTRAN & Pascal or i=0,...N-1 for BASIC & C). The
  546.         probability that a discrete random variable is i-1 (for
  547.         FORTRAN & Pascal or i for BASIC & C) or less is V[i].
  548.  
  549. Note on starting index: it is the index of array natural to the
  550.         language: 0 for BASIC and C, 1 for FORTRAN and Pascal.
  551.  
  552. Note on BASIC: for each array we pass TWO integers, the first
  553.         must be varptr(<array's first element>) while the second
  554.         is varseg(<array's first element>). Take care to add # to
  555.         X and V, the compiler cannot correct it as in other cases!
  556.  
  557. Note on Pascal: the array's type is user_arr. This type is
  558.         already defined in the Pascal unit or SSSP2.H.
  559.  
  560. Examples:
  561. ╔════════════════╦══════════════╦════════════════╦══════════════╗
  562. ║    BASIC       ║       C      ║     FORTRAN    ║    Pascal    ║
  563. ╠════════════════╬══════════════╬════════════════╬══════════════╣
  564. ║                ║              ║ real*8 x(3)    ║              ║
  565. ║x#(0)=0:p#(0)=0 ║double x[3],  ║ real*8 p(3)    ║var           ║
  566. ║x#(1)=3:p#(1)=.3║p[3];         ║ x(1)=0         ║x,p: user_arr;║
  567. ║x#(2)=4:p#(2)=1 ║x[0]=0;p[0]=0;║ x(2)=3         ║x[1]=0;p[1]=0;║
  568. ║ix=varptr(x#(0))║x[1]=3;       ║ x(3)=4         ║x[2]=3;       ║
  569. ║ip=varptr(p#(0))║p[1]=.3;      ║ p(1)=0         ║p[2]=.3;      ║
  570. ║sx=varseg(x#(0))║x[2]=4;p[2]=1;║ p(2)=.3        ║x[3]=4;p[3]=1;║
  571. ║sp=varseg(p#(0))║printf("%f ", ║ p(3)=1         ║writeln(      ║
  572. ║print CD(ix,_   ║CD(x,p,3));   ║ write(*,*)     ║CD(x,p,3),    ║
  573. ║sx,ip,sp,3),    ║printf("%f\n",║+CD(x,p,3),     ║DP(p,3));     ║
  574. ║DP(ip,sp,3)     ║DP(p,3));     ║+DP(p,3)        ║              ║
  575. ╚════════════════╩══════════════╩════════════════╩══════════════╝
  576. Explanation: A continuous distribution is defined for which the
  577. probability of 2 or less is 0.2, the probability of 3.5 or less
  578. is 0.65, etc. A pseudo random variate is generated and printed
  579. out for this distribution. DP reflects a distribution function
  580. for which the probability for 1 is .3 and for 2 is .7.
  581.  
  582. SSS Reference                                            Page  12
  583.  
  584.  
  585.   ╔══════════════════════════════════════════════════════════╗
  586.   ║  CLEARQ(m), QAVG(m), QMAX(m), QMIN(m), QNUM(m), QSTD(m)  ║
  587.   ╚══════════════════════════════════════════════════════════╝
  588.  
  589. Description: managing statistical information about size of queue
  590.         m. Routines starting with Q return time persistent
  591.         statistics (as floating point numbers) since the start of
  592.         simulation or latest CLEARQ, whatever is later -
  593. CLEARQ clears statistic of a queue or of all queues;
  594. QAVG returns time average;
  595. QMAX returns maximum queue size;
  596. QMIN returns minimum queue size;
  597. QNUM returns length of period for which statistic is accumulated;
  598. QSTD returns standard deviation of queue size.
  599.  
  600. Argument: (integer) is the queue index, m = 1,...,max_que, where
  601.         max_que is the first argument in INIQUE(max_que,b,s).
  602.         Only for CLEARQ m=0 is allowed, calling CLEARQ(0) clears
  603.         the statistics of all the queues while if
  604.         m = 1,...,max_que it clears statistics of queue m only.
  605.  
  606. Mandatory predecessor: INIQUE(max_que,b,s) except for CLERQ(0).
  607.  
  608. Recommanded predecessors: INIQUE(max_que,b,s), QUEUE(m,p) and
  609.         REMVFQ(m,r)
  610.  
  611. Errors: if m < 1 or m > max_que, except for CLEARQ(0).
  612.  
  613. Examples:
  614. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  615. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  616. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  617. ║integer e    ║int e;        ║ integer e         ║var e:integer;║
  618. ║INIQUE 3,0,0 ║INIQUE(3,0,0);║ call INIQUE(3,0,0)║INIQUE(3,0,0);║
  619. ║CREATE 0,0   ║CREATE(0,0);  ║ call CREATE(0,0)  ║CREATE(0,0);  ║
  620. ║e = NEXTEV   ║e = NEXTEV(); ║ e = NEXTEV()      ║e = NEXTEV;   ║
  621. ║QUEUE 3,0    ║QUEUE(3,0);   ║ call QUEUE(3,0)   ║QUEUE(3,0);   ║
  622. ║SETT(3)      ║SETT(3);      ║ call SETT(3)      ║SETT(3);      ║
  623. ║REMVFQ(3,1)  ║REMVFQ(3,1);  ║ call REMVFQ(3,1)  ║REMVFQ(3,1);  ║
  624. ║print _      ║printf("%f\n",║ write (*,*)       ║writeln(      ║
  625. ║QAVG(3)      ║QAVG(3));     ║+QAVG(3)           ║QAVG(3));     ║
  626. ║CLAERQ(3)    ║CLEARQ(3);    ║ CLEARQ(3)         ║CLEARQ(3);    ║
  627. ║print _      ║printf("%f\n",║ write(*,*)        ║writeln(      ║
  628. ║QAVG(3)      ║QAVG(3));     ║+QAVG(3)           ║QAVG(3));     ║
  629. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  630. Explanation: A single entity is CREATEed and made current by
  631. NEXTEV. An entity is placed on QUEUE #3, the simulated time is
  632. increased to 3 (from initial 0 when the QUEUEing took place) and
  633. removed from QUEUE 3. The average queue size is printed out
  634. before and after CLEARing the Queue statistics of that queue.
  635.  
  636. SSS Reference                                            Page  13
  637.  
  638.  
  639.                    ╔═════════════════════════╗
  640.                    ║  CLEARS(j), TALLY(j,v)  ║
  641.                    ╚═════════════════════════╝
  642.  
  643. Description: managing statistics j -
  644. CLEARS clears statistics of a variable or of all the variables;
  645. TALLY collects observations (for a stochastic process it has to
  646.         be called after each change of the variable).
  647.  
  648. Arguments:
  649. j (integer) the variable's index, j = 1,...,max_sta (integer)
  650.         where max_sta is the third argument in
  651.         INIQUE(q,b,max_sta). Only for CLEARS j=0 is allowed,
  652.         calling CLEARS(0) clears the all the statistics managed
  653.         by the user, while if j = 1,...,max_sta it clears
  654.         statistics of variable j only.
  655. v (floating point number) is a new observation of the variable.
  656.  
  657. Mandatory predecessors: INIQUE(q,b,max_sta) and INISTA(j,h,k,l,w)
  658.  
  659. Errors: if j < 1 or j > max_sta except for CLEARS(0).
  660.  
  661. Examples:
  662. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  663. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  664. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  665. ║x$="1st      ║              ║                   ║              ║
  666. ║INIQUE 0,0,1 ║INIQUE(0,0,1);║ call INIQUE(0,0,1)║INIQUE(0,0,1);║
  667. ║INISTA(1,_   ║INISTA(1,     ║ call INISTA(1,    ║INISTA(1,     ║
  668. ║sadd(x$),0,_ ║"1st",0,      ║+'1st              ║'1st',0,      ║
  669. ║0,0,0)       ║0,0,0)        ║+0,0,0,0)          ║0,0,0)        ║
  670. ║TALLY(1,4)   ║TALLY(1,4);   ║ call TALLY(1,4)   ║TALLY(1,4);   ║
  671. ║print _      ║printf("%f\n",║ write (*,*)       ║writeln(      ║
  672. ║SAVG(1)      ║SAVG(1));     ║+SAVG(1)           ║SAVG(1));     ║
  673. ║CLAERS(1)    ║CLEARS(1);    ║ CLEARS(1)         ║CLEARS(1);    ║
  674. ║print _      ║printf("%f\n",║ write(*,*)        ║writeln(      ║
  675. ║SAVG(1)      ║SAVG(1));     ║+SAVG(1)           ║SAVG(1));     ║
  676. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  677. Explanation: One statistic collection is initialized by INIQUE
  678. and INISTA (see there particulars). One sample of one observation
  679. is recorded. The average is printed out before and after clearing
  680. the statistic.
  681.  
  682. SSS Reference                                            Page  14
  683.  
  684.  
  685.                         ╔═══════════════╗
  686.                         ║  CREATE(g,i)  ║
  687.                         ╚═══════════════╝
  688.  
  689. Description: Creates a new entity by placing it to the calendar
  690.         with event code 1.
  691.  
  692. Arguments:
  693. g (non-negative floating point number) is the simulated time
  694.         duration between creation and entity's arrival.
  695. i (integer) is the identity code of that created entity.
  696.  
  697. Remarks: A new entity can be entered to the system only by
  698.         CREATE(g,i) and actually arrive only after NEXTEV() is
  699.         called. Then the entity becomes current. CREATE(g,i) does
  700.         not affect the current entity (if exists) in any way.
  701.         (Current entity can be placed to the calendar by
  702.         SCHED(g,e,i).) CREATE(g,i) takes care to "refill" the
  703.         calendar with new entities as opposed to NEXTEV() which
  704.         "depletes" it. It is essential to call it at least once
  705.         before the event loop, otherwise NEXTEV() finds an empty
  706.         calendar and no simulation takes place.
  707.  
  708. Mandatory predecessor: INIQUE(q,b,s).
  709.  
  710. Errors: calendar is not yet created.
  711.  
  712. Note: if g is found negative, it is corrected to 0 automatically.
  713.  
  714. Examples:
  715. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  716. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  717. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  718. ║integer e    ║int e;        ║ integer e         ║var e:integer;║
  719. ║INIQUE 0,2,0 ║INIQUE(0,2,0);║ call INIQUE(0,2,0)║INIQUE(0,2,0);║
  720. ║CREATE 0,0   ║CREATE(0,0);  ║ call CREATE(0,0)  ║CREATE(0,0);  ║
  721. ║print IDIC(1)║printf("%f\n",║ write (*,*)       ║writeln(      ║
  722. ║             ║IDIC(1));     ║+IDIC(1)           ║IDIC(1));     ║
  723. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  724. Explanation: A single entity is CREATEed and its identity is
  725. printed out.
  726.  
  727. SSS Reference                                            Page  15
  728.  
  729.  
  730.                          ╔════════════╗
  731.                          ║  DISPOS()  ║
  732.                          ╚════════════╝
  733.  
  734. Description: disposes a current entity.
  735.  
  736. Remarks: DISPOS() is called when an entity leaves the system.
  737.         If there is no current entity, DISPOS has no effect.
  738.         After DISPOS is called there is no current entity.
  739.  
  740. Examples:
  741. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  742. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  743. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  744. ║INIQUE 0,0,1 ║INIQUE(0,0,1);║ call INIQUE(0,0,1)║INIQUE(0,0,1);║
  745. ║CREATE 2,0   ║CREATE(2,0);  ║ call CREATE(2,0)  ║CREATE(2,0);  ║
  746. ║e = NEXTEV   ║e = NEXTEV(); ║ e = NEXTEV()      ║e := NEXTEV;  ║
  747. ║DISPOS       ║DISPOS();     ║ call DISPOS       ║DISPOS;       ║
  748. ║DISPOS       ║DISPOS();     ║ call DISPOS       ║DISPOS;       ║
  749. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  750. Explanation: One entity is created which arrives at simulated
  751. time 2, and is immediately disposed. The second calling of DISPOS
  752. does not cause an error, but does nothing either.
  753.  
  754.  
  755.              ╔════════════════════════════════════╗
  756.              ║  ER(M,K), EX(M), GA(M,K)  WE(M,U)  ║
  757.              ╚════════════════════════════════════╝
  758.  
  759. Description: returns a continuous random variate (as a floating
  760.         point number) according to distribution law -
  761. ER Erlang [with mean K*M]
  762. EX exponential
  763. GA gamma [with mean K*M]
  764. WE Weibull [X to power of U is exponential with mean M]
  765.  
  766. Arguments:
  767. U (positive floating point number) is a shape parameter.
  768. M (positive floating point number) is the exponential mean
  769. K for ER (positive integer): is number of stages
  770.   for GA (positive floating point number): is generalized number
  771.         of stages.
  772.  
  773. Errors: when U or K or M are not positive.
  774.  
  775. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  776. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  777. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  778. ║print _      ║printf("%f\n",║ write(*,*)        ║writeln(      ║
  779. ║WE(1,2)      ║WE(1,2));     ║+WE(1,2)           ║WE(1,2);      ║
  780. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  781. Explanation: A random variate from WE(1,2) distribution is
  782. printed out. The probability density function of WE(1,2) is
  783. f(x) = 2x * exp( - x*x).
  784.  
  785. SSS Reference                                            Page  16
  786.  
  787.  
  788.                        ╔═════════════════╗
  789.                        ║  INIQUE(q,b,s)  ║
  790.                        ╚═════════════════╝
  791.  
  792. Description: initiates the calendar, q queues, b attributes and
  793. s statistics. All the parameters are integers.
  794.  
  795. Remark: Except for the random generators or T(), SETT(g), all the
  796.         routines need INIQUE(q,b,s), so be sure to include it at
  797.         the setup stage of simulation.
  798.  
  799. Warnings: if q or b or s are higher than preset limits.
  800.  
  801. Forbidden predecessor: INIQUE(q,b,s).
  802.  
  803. Errors: if any of the parameters are negative or called more than
  804.         once.
  805.  
  806. Examples:
  807. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  808. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  809. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  810. ║INIQUE 3,2,1 ║INIQUE(3,2,1);║ call INIQUE(3,2,1)║INIQUE(3,2,1);║
  811. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  812. Explanation: maximum 3 queues, 2 attribute and one variable's
  813. statistics collection by TALLY(j,v) are possible.
  814.  
  815.  
  816.                     ╔══════════════════════╗
  817.                     ║  INISTA(j,h,k,l,f,w) ║
  818.                     ╚══════════════════════╝
  819.  
  820. Description: initialization of statistics collecting and standard
  821.         report (by calling SUMRY(u)) for a variable.
  822.  
  823. Arguments:
  824. j (integer) the variable's index, j = 1,...,max_sta (integer)
  825.         where max_sta is the third argument in
  826.         INIQUE(q,b,max_sta).
  827. h (str20, e.i. a string with 20 charcters maximum) is used as a
  828.         headline in SUMRY when printing out results. See notes
  829.         further.
  830. k (integer) is 1 for a stochastic process, 0 for an ordinary
  831.         variable.
  832. l (integer) is number of cells in the observations' histogram
  833.         printed in SUMRY(u). l=0 if no histogram is required.
  834. f (floating point number) is the lower bound of the first cell
  835.         in the histogram.
  836. w (floating point number) is the width of a cell in the
  837.         histogram.
  838.  
  839. SSS Reference                                            Page  17
  840.  
  841.  
  842. Remarks: a stochastic process is a random variable which changes
  843.         at some points of time and we are interested in its time
  844.         average rather than its simple average. An example is
  845.         inventory: if first three days we have 5 units, and the
  846.         fourth day only 3 then the time average is (5*3 + 3*1)/4
  847.         = 4.5 and while the simple average is (5 + 3)/2 = 4.
  848.         Thus, set third parameter (k) to 1 to get 4.5, while if
  849.         k is 0, the result is 4. Independent of the value of l,
  850.         no histogram is produced for a stochastic process. If no
  851.         histogram is generated (either because k=1 or l=0), f
  852.         and w can have any value.
  853.  
  854. Note for BASIC: the second argument (headline) in BASIC should be
  855.         sadd(x$) where x$ is a string defined prior to calling
  856.         INISTA with 20 characters. If the length of headline is
  857.         shorter, pad it with spaces.
  858.  
  859. Note for FORTRAN: place the second argument (headline) as a
  860.         string constant with 20 characters. If the length of
  861.         headline is shorter, pad it with spaces.
  862.  
  863. Mandatory predecessor: INIQUE(q,b,max_sta).
  864.  
  865. Forbidden predecessor for INISTA(j,...): INISTA(j,...) with the
  866.         same j.
  867.  
  868. Errors: if j < 1 or j > max_sta or calling INISTA twice with
  869.         first argument equal.
  870.  
  871. Examples:
  872. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  873. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  874. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  875. ║x$="1st      ║              ║                   ║              ║
  876. ║INIQUE 0,0,1 ║INIQUE(0,0,1);║ call INIQUE(0,0,1)║INIQUE(0,0,1);║
  877. ║INISTA(1,_   ║INISTA(1,     ║ call INISTA(1,    ║INISTA(1,     ║
  878. ║sadd(x$),0,_ ║"1st",0,      ║+'1st              ║'1st',0,      ║
  879. ║0,0,0)       ║0,0,0)        ║+0,0,0,0)          ║0,0,0)        ║
  880. ║TALLY(1,4)   ║TALLY(1,4);   ║ call TALLY(1,4)   ║TALLY(1,4);   ║
  881. ║print _      ║printf("%f\n",║ write (*,*)       ║writeln(      ║
  882. ║SAVG(1)      ║SAVG(1));     ║+SAVG(1)           ║SAVG(1));     ║
  883. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  884. Explanation: One statistic collection is initialized by INIQUE
  885. and INISTA (see there particulars). One sample of one observation
  886. is recorded. The average is printed out.
  887.  
  888. SSS Reference                                            Page  18
  889.  
  890.  
  891.                            ╔═══════════════╗
  892.                            ║  NC(), NQ(m)  ║
  893.                            ╚═══════════════╝
  894.  
  895. Description: returns number of entities (as integer) in -
  896. NC(): the calendar
  897. NQ(m): queue number m.
  898.  
  899. Argument in NQ: m (integer) is the index of queue,
  900.         m = 1,...max_que, where max_que is first argument in
  901.         INIQUE(max_que,b,s).
  902.  
  903. Mandatory predecessor: INIQUE(max_que,b,s).
  904.  
  905. Error: for NC if calendar is not yet initialized by INIQUE(), for
  906.         NQ if m < 1 or m > max_que.
  907.  
  908. Examples:
  909. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  910. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  911. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  912. ║integer e    ║int e;        ║ integer e         ║var e:integer;║
  913. ║INIQUE 1,0,1 ║INIQUE(1,0,1);║ call INIQUE(1,0,1)║INIQUE(1,0,1);║
  914. ║CREATE 2,0   ║CREATE(2,0);  ║ call CREATE(2,0)  ║CREATE(2,0);  ║
  915. ║print NC     ║printf("%d\n",║ write(*,*) NC()   ║writeln(NC);  ║
  916. ║             ║NC());        ║                   ║              ║
  917. ║e = NEXTEV   ║e = NEXTEV(); ║ e = NEXTEV()      ║e := NEXTEV;  ║
  918. ║QUEUE(1,0)   ║QUEUE(1,0.0); ║ call QUEUE(1,0)   ║QUEUE(1,0);   ║
  919. ║print NQ(1)  ║printf("%d\n",║ write(*,*) NQ(1)  ║writeln(      ║
  920. ║             ║NQ(1));       ║                   ║NQ(1));       ║
  921. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  922. Explanation: One entity is created (=placed on calendar) and
  923. number of entities in the calendar is printed out. Then the same
  924. entity is made current by NEXTEV, placed on queue #1 and the
  925. number of entities in that queue is printed out.
  926.  
  927. SSS Reference                                            Page  19
  928.  
  929.  
  930.                      ╔════════════════════╗
  931.                      ║  NCEN(), NEXTEV()  ║
  932.                      ╚════════════════════╝
  933.  
  934. Description:
  935. NCEN() returns 0 or 1 depending whether there is no current
  936.         entity (=0) or there is one (=1). There cannot be more
  937.         than one current entity. There must be a current entity
  938.         before calling one of: A, IDE, QUEUE, SCHED, SETA, SETIDE.
  939.         There must not be a current entity before calling one of:
  940.         NEXTEV, REMVFC, REMVFQ.
  941. NEXTEV() removes the first entity from the calendar, makes it
  942.         current, moves forward the simulated time if the event
  943.         time of this entity is later and returns the event code
  944.         of this entity as a non-negative integer.
  945.  
  946. Remarks: NEXTEV() is the chief driver of the simulation. It is at
  947.         the top of the event loop.
  948.  
  949. Mandatory predecessors for NEXTEV(): one of INIQUE(q,b,s),
  950.         SCHED(g,e,i), QUEUE(m,p).
  951.  
  952. Forbidden predecessors for NEXTEV(): NEXTEV(), REMVFC(r),
  953.         REMVFQ(m,r).
  954.  
  955. Recommended predecessor for NEXTEV(): CREATE(g,i).
  956.  
  957. Errors for NEXTEV(): if the calendar has not been initiated by
  958.         INIQUE or there is a current entity.
  959.  
  960. Examples:
  961. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  962. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  963. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  964. ║integer e    ║int e;        ║ integer e         ║var e:integer;║
  965. ║INIQUE 0,0,1 ║INIQUE(0,0,1);║ call INIQUE(0,0,1)║INIQUE(0,0,1);║
  966. ║print NCEN   ║printf("%d\n",║ write(*,*)NCEN()  ║writeln(NCEN);║
  967. ║             ║NCEN());      ║                   ║              ║
  968. ║e = NEXTEV   ║e = NEXTEV(); ║ e = NEXTEV()      ║e := NEXTEV;  ║
  969. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  970. Explanation: The calendar is empty after initialized by INIQUE,
  971. therefore e is 0. Also NCEN returns 0 as there is no current
  972. entity.
  973.  
  974. SSS Reference                                            Page  20
  975.  
  976.  
  977.                     ╔═══════════════════════╗
  978.                     ║  QDC(m), SETQDC(m,d)  ║
  979.                     ╚═══════════════════════╝
  980.  
  981. Description: the discipline of queue number m is -
  982. QDC: returned as a character (one of: F, L, B, S)
  983. SETQDC: set (to one of FIFO, LIFO, BVF, SVF).
  984.  
  985. Arguments:
  986. m (integer) is the index of queue, m = 1,...max_que where max_que
  987.         is the first argument in INIQUE(max_que,b,s).
  988. d (str6, e.i. a string with 6 charcters maximum) is the
  989.         discipline, one of: FIFO, LIFO, BVF, SVF. If d is any
  990.         other string (like bvs or KKK), the first character
  991.         counts. If it is L or B or S, the discipline is treated
  992.         as LIFO or BVF or SVF respectively. If it is different
  993.         (like b or K) it is treated as FIFO.
  994.  
  995. Note for BASIC: the second argument of SETQDC (discipline) in
  996.         BASIC should be sadd(x$) where x$ is a string defined
  997.         prior to calling SETQDC with 6 characters. If the length
  998.         of discipline is shorter, pad it with spaces.
  999.  
  1000. Note for FORTRAN: place the second argument of SETQDC
  1001.         (discipline) as a string constant with 6 characters. If
  1002.         the length of discipline is shorter, pad it with spaces.
  1003.  
  1004. Mandatory predecessor: INIQUE(max_que,b,s).
  1005.  
  1006. Errors: if m < 1 or m > max_que.
  1007.  
  1008. Examples:
  1009. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  1010. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  1011. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  1012. ║x$="B     "  ║              ║                   ║              ║
  1013. ║INIQUE 1,0,1 ║INIQUE(1,0,1);║ call INIQUE(1,0,1)║INIQUE(1,0,1);║
  1014. ║SETQDC(1,_   ║SETQDC(1,"B");║ call SETQDC(1,    ║SETQDC(1,'B');║
  1015. ║sadd(x$))    ║              ║+'B      ')        ║              ║
  1016. ║print QDC(1) ║printf("%c\n",║ write(*,*) QDC(1) ║writeln(      ║
  1017. ║             ║QDC(1));      ║                   ║QDC(1));      ║
  1018. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  1019. Explanation: The discipline is set to "B", printed out. This
  1020. discipline is interpreted as Biggest Value First.
  1021.  
  1022. SSS Reference                                            Page  21
  1023.  
  1024.  
  1025.                         ╔══════════════╗
  1026.                         ║  QUEUE(m,p)  ║
  1027.                         ╚══════════════╝
  1028.  
  1029. Description: places the current entity in queue number m with
  1030.         priority p. According to queue discipline FIFO/LIFO/SVF/
  1031.         BVF which has been set most recently by SETQDC. (If none
  1032.         is set the default is FIFO.) After calling QUEUE there
  1033.         is no current entity.
  1034.  
  1035. Arguments:
  1036. m (integer) is the index of queue, m = 1,...max_que where max_que
  1037.         is first argument in INIQUE(max_que,b,s).
  1038. p (floating point number) is the priority. Argument has effect
  1039.         only with disciplines SVF or BVF. The rank of the the
  1040.         entity in the queue is such that in SVF the entity with
  1041.         Smallest Value of p is First and in BVF the entity with
  1042.         Biggest Value of p is First.
  1043.  
  1044. Mandatory predecessor: INIQUE(max_que,b,s) and one of: NEXTEV(),
  1045.         REMVFC(r), REMVFQ(m,r).
  1046.  
  1047. Forbidden predecessors: DISPOS(), QUEUE(m,p), SCHED(g,e,i).
  1048.  
  1049. Errors: if there is no current entity or m < 1 or m > max_que.
  1050.  
  1051. Examples:
  1052. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  1053. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  1054. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  1055. ║integer e    ║int e;        ║ integer e         ║var e:integer;║
  1056. ║INIQUE 1,0,1 ║INIQUE(1,0,1);║ call INIQUE(1,0,1)║INIQUE(1,0,1);║
  1057. ║CREATE 2,0   ║CREATE(2,0);  ║ call CREATE(2,0)  ║CREATE(2,0);  ║
  1058. ║e = NEXTEV   ║e = NEXTEV(); ║ e = NEXTEV()      ║e := NEXTEV;  ║
  1059. ║QUEUE(1,0)   ║QUEUE(1,0.0); ║ call QUEUE(1,0)   ║QUEUE(1,0);   ║
  1060. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  1061. Explanation: One entity is created (=placed on calendar) and is
  1062. made current by NEXTEV. The current entity is placed on queue #1.
  1063.  
  1064. SSS Reference                                            Page  22
  1065.  
  1066.  
  1067.         ╔══════════════════════════════════════════════╗
  1068.         ║  RA(), RL(M,S), RN(M,S), TR(I,B,C), UN(I,C)  ║
  1069.         ╚══════════════════════════════════════════════╝
  1070.  
  1071. Description: returns a continuous random variate (as a floating
  1072.         point number) according to distribution law -
  1073. RA uniform between 0 and 1
  1074. RL log-normal, so that after taking natural logarithm, the
  1075.         resulting distribution is normal with mean M, standard
  1076.         deviation S (S > 0)
  1077. RN normal with mean M, standard deviation S (S > 0)
  1078. TR triangular between I and C with mode B
  1079. UN uniform between I and C.
  1080.  
  1081. Arguments are all floating point numbers.
  1082.  
  1083. Errors: when C < B or B < I.
  1084.  
  1085. Examples:
  1086. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  1087. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  1088. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  1089. ║print _      ║printf("%f\n",║ write(*,*)        ║writeln(      ║
  1090. ║RN(2,1)      ║RN(2,1));     ║+RN(2,1)           ║RN(2,1);      ║
  1091. ║print _      ║printf("%f\n",║ write(*,*)        ║writeln(      ║
  1092. ║TR(0,3,4)    ║TR(0,3,4));   ║+TR(0,3,4)         ║TR0,3,4));    ║
  1093. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  1094. Explanation: A random normal variate is printed from a
  1095. distribution with mean 2 and standard deviation 1. Then a
  1096. random variate from TR(0,3,4) is printed out.
  1097.  
  1098. SSS Reference                                            Page  23
  1099.  
  1100.  
  1101.  
  1102.                   ╔══════════════════════════╗
  1103.                   ║  REMVFC(r), REMVFQ(m,r)  ║
  1104.                   ╚══════════════════════════╝
  1105.  
  1106. Description: making an entity (which has had rank r) current by
  1107.         removing it from -
  1108. REMVFC: calendar;
  1109. REMVFQ: queue number m.
  1110.  
  1111. Arguments:
  1112. r (integer) is the rank of entity -
  1113.         for REMVFC: in calendar, r = 1,...,NC(), where NC() is
  1114.         number of entities in calendar;
  1115.         for REMVFQ: in queue m, r = 1,...,NQ(m), where NQ(m) is
  1116.         the number of entities in queue m.
  1117. m (integer) is the index of queue, m = 1,...max_que, where
  1118.         max_que is first argument in INIQUE(max_que,b,s).
  1119.  
  1120. Mandatory predecessors: INIQUE(q,b,s), for REMVFC also one of:
  1121.         CREATE(g,i), SCHED(g,e,i), for REMVFQ also QUEUE(m,p).
  1122.  
  1123. Forbidden predecessor: NEXTEV(), REMVFC(r), REMVFQ(m,r).
  1124.  
  1125. Errors: if prior to call there is a current entity or calendar
  1126.         is not initiated by INIQUE(max_que,b,s) or if
  1127.         m > max_queue or (for REMVFQ) r > NQ(m) or (for REMVFC)
  1128.         r > NC().
  1129.  
  1130. Examples:
  1131. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  1132. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  1133. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  1134. ║integer e    ║int e;        ║ integer e         ║var e:integer;║
  1135. ║INIQUE 1,0,1 ║INIQUE(1,0,1);║ call INIQUE(1,0,1)║INIQUE(1,0,1);║
  1136. ║CREATE 0,1   ║CREATE(0,1);  ║ call CREATE(0,1)  ║CREATE(0,1);  ║
  1137. ║CREATE 2,2   ║CREATE(2,2);  ║ call CREATE(2,2)  ║CREATE(2,2);  ║
  1138. ║e = NEXTEV   ║e = NEXTEV(); ║ e = NEXTEV()      ║e := NEXTEV;  ║
  1139. ║QUEUE 1,0    ║QUEUE(1,0.0); ║ call QUEUE(1,0)   ║QUEUE(1,0);   ║
  1140. ║REMVFQ 1,1   ║REMVFQ(1,1);  ║ call REMVFQ(1,1)  ║REMVFQ(1,1);  ║
  1141. ║DISPOS       ║DISPOS();     ║ call DISPOS       ║DISPOS;       ║
  1142. ║REMVFC 1,1   ║REMVFC(1,1);  ║ call REMVFC(1,1)  ║REMVFC(1,1);  ║
  1143. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  1144. Explanation: Two entities are created (=placed on calendar). The
  1145. first is made current and placed to queue #1. Then the remaining
  1146. one is removed from the calendar, disposed and the one in the
  1147. queue is removed next. Note that without intermingled DISPOS this
  1148. could cause an error.
  1149.  
  1150. SSS Reference                                            Page  24
  1151.  
  1152.  
  1153.         ╔═══════════════════════════════════════════════╗
  1154.         ║  SAVG(j), SMAX(j), SMIN(j), SNUM(j), SSTD(j)  ║
  1155.         ╚═══════════════════════════════════════════════╝
  1156.  
  1157. Description: returning statistics about about variable j as
  1158.         floating point numbers since the start of simulation or
  1159.         latest CLEARS, whatever is later -
  1160. SAVG average (or time average for a stochastic process);
  1161. SMAX maximum observed value;
  1162. SMIN minimum observed value;
  1163. SNUM sample size (for a stochastic process the length of period
  1164.         is returned for which statistics are accumulated);
  1165. SSTD standard deviation of observed values calculated as the
  1166.         square root of the sum of deviations from SAVG devided by
  1167.         SNUM. Note that the demoninator is the sample size rather
  1168.         than the degrees of freedom!
  1169.  
  1170. Argument:
  1171. j (integer) the variable's index, j = 1,...,max_sta (integer)
  1172.         where max_sta is the third argument in
  1173.         INIQUE(q,b,max_sta).
  1174.  
  1175. Mandatory predecessors: INIQUE(q,b,max_sta) and INISTA(j,h,k,l,w)
  1176.  
  1177. Recommended predecessor: TALLY(j,v).
  1178.  
  1179. Errors: if j < 1 or j > max_sta.
  1180.  
  1181. Examples:
  1182. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  1183. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  1184. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  1185. ║x$="1st      ║              ║                   ║              ║
  1186. ║INIQUE 0,0,1 ║INIQUE(0,0,1);║ call INIQUE(0,0,1)║INIQUE(0,0,1);║
  1187. ║INISTA(1,_   ║INISTA(1,     ║ call INISTA(1,    ║INISTA(1,     ║
  1188. ║sadd(x$),0,_ ║"1st",0,      ║+'1st              ║'1st',0,      ║
  1189. ║0,0,0)       ║0,0,0)        ║+0,0,0,0)          ║0,0,0)        ║
  1190. ║TALLY(1,4)   ║TALLY(1,4);   ║ call TALLY(1,4)   ║TALLY(1,4);   ║
  1191. ║print _      ║printf("%f\n",║ write (*,*)       ║writeln(      ║
  1192. ║SAVG(1)      ║SAVG(1));     ║+SAVG(1)           ║SAVG(1));     ║
  1193. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  1194. Explanation: One statistic collection is initialized by INIQUE
  1195. and INISTA (see there particulars). One sample of one observation
  1196. is recorded. The average is printed out.
  1197.  
  1198. SSS Reference                                            Page  25
  1199.  
  1200.  
  1201.                        ╔════════════════╗
  1202.                        ║  SCHED(g,e,i)  ║
  1203.                        ╚════════════════╝
  1204.  
  1205. Description: the current entity is placed on the calendar with
  1206. identity i, event code e to be removed from there after g units
  1207. of simulated time by NEXTEV. If the identity is to be preserved
  1208. i = IDE().
  1209.  
  1210. Arguments:
  1211. g (non-negative floating point number) is the simulated time that
  1212.         elapses between present and the time that event e is
  1213.         executed;
  1214. e (integer bigger than 1) is the event code;
  1215. i (integer) is the identity.
  1216.  
  1217. Remark: SCHED(g,e,i) "sends" the current entity to its next event
  1218.         e after a delay of g units time from present simulated
  1219.         time. It acts as a kind of delayed "goto". After calling
  1220.         SCHED(g,e,i) there will be no current entity. Therefore
  1221.         delay calling SCHED(g,e,i) to the latest moment
  1222.         consistent with your program.
  1223.  
  1224. Mandatory predecessors: NEXTEV(), REMVFC(r), REMVFQ(m,r).
  1225.  
  1226. Forbidden predecessors: DISPOS(), QUEUE(m,p), SCHED(g,e,i).
  1227.  
  1228. Errors: if prior to call there is already a current entity or e
  1229.         is 0, 1 or negative.
  1230.  
  1231. Examples:
  1232. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  1233. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  1234. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  1235. ║integer e    ║int e;        ║ integer e         ║var e:integer;║
  1236. ║INIQUE 1,0,1 ║INIQUE(1,0,1);║ call INIQUE(1,0,1)║INIQUE(1,0,1);║
  1237. ║CREATE 0,1   ║CREATE(0,1);  ║ call CREATE(0,1)  ║CREATE(0,1);  ║
  1238. ║e = NEXTEV   ║e = NEXTEV(); ║ e = NEXTEV()      ║e := NEXTEV;  ║
  1239. ║SCHED .5,2, _║SCHED(.5,2,   ║ call SCHED(.5,2,  ║SCHED(.5,2,   ║
  1240. ║IDE          ║IDE());       ║+IDE())            ║IDE);         ║
  1241. ║print NEXTEV ║printf("%d\", ║ write(*,*)NEXTEV()║writeln(      ║
  1242. ║             ║NEXTEV());    ║                   ║NEXTEV);      ║
  1243. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  1244. Explanation: An entity is created (=placed on calendar), made
  1245. current, scheduled again for time .5 and its event code is
  1246. printed out.
  1247.  
  1248. SSS Reference                                            Page  26
  1249.  
  1250.  
  1251.                    ╔════════════════════════╗
  1252.                    ║  SETANT(y), SETSEE(x)  ║
  1253.                    ╚════════════════════════╝
  1254.  
  1255. Description: routines managing the random stream -
  1256. SETANT sets(y=1)/resets(y=0) antithetic stream
  1257. SETSEE sets the random seed to x
  1258.  
  1259. Arguments:
  1260. y is 0 or 1.
  1261. x (positive odd integer) is the seed.
  1262.  
  1263. Remarks: For other than the above arguments the routines have no
  1264. effect.
  1265.  
  1266. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  1267. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  1268. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  1269. ║SETSEE 777   ║SETSEE(777);  ║ call SETSEE(777)  ║SETSEE(777);  ║
  1270. ║SETANT 0     ║SETANT(0);    ║ call SETANT(0)    ║SETANT(0);    ║
  1271. ║print EX(1),_║printf(       ║ write(*,*) EX(1), ║writeln(      ║
  1272. ║EX(1)        ║"%f %f ",     ║+EX(1)             ║EX(1),EX(2)); ║
  1273. ║             ║EX(1),EX(1)); ║                   ║              ║
  1274. ║SETSEE 777   ║SETSEE(777);  ║ call SETSEE(777)  ║SETSEE(777);  ║
  1275. ║SETANT 1     ║SETANT(1);    ║ call SETANT(1)    ║SETANT(1);    ║
  1276. ║print EX(1),_║printf(       ║ write(*,*) EX(1), ║writeln(      ║
  1277. ║EX(1)        ║"%f %f ",     ║+EX(1)             ║EX(1),EX(2)); ║
  1278. ║             ║EX(1),EX(1)); ║                   ║              ║
  1279. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  1280. Explanation: Two pairs of antithetic exponential variates are
  1281. printed. Note that the seed had to be reset to 777.
  1282.  
  1283. SSS Reference                                            Page  27
  1284.  
  1285.  
  1286.                     ╔═══════════════════════╗
  1287.                     ║  SETDEB(o), SHOWQ(m)  ║
  1288.                     ╚═══════════════════════╝
  1289.  
  1290. Description: routines for debug -
  1291. SETDEB sets switches which tell what to do after an error or when
  1292.         to print out calendar and/or queues
  1293. SHOWQ shows contents of queue m or the calendar (m=0)
  1294.  
  1295. Arguments:
  1296. o (integer between 0 and 15) with following significance (3 is
  1297.         the default; stop means immediate stop):
  1298. ╔══════════════════════════════════════════════════════════════╗
  1299. ║o =             0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15║
  1300. ║stop on error?  N  Y  N  Y  N  Y  N  Y  N  Y  N  Y  N  Y  N  Y║
  1301. ║print error?    N  N  Y  Y  N  N  Y  Y  N  N  Y  Y  N  N  Y  Y║
  1302. ║print calendar? N  N  N  N  Y  Y  Y  Y  N  N  N  N  Y  Y  Y  Y║
  1303. ║print queues?   N  N  N  N  N  N  N  N  Y  Y  Y  Y  Y  Y  Y  Y║
  1304. ╚══════════════════════════════════════════════════════════════╝
  1305. m (integer) is the index of queue, m = 1,...max_que, where
  1306.         max_que is first argument in INIQUE(max_que,b,s) or m=0
  1307.         for the calendar.
  1308.  
  1309. Remarks: calendar and queue is printed just before removing an
  1310.         entity from them. Any other value for o does not have any
  1311.         affect. See further discussion on errors under SIMERR().
  1312.  
  1313. Note for FORTRAN: If you write to screen before the calendar or
  1314.         queue, include an end of line in your write command,
  1315.         otherwise the calendar's or queues' first line will be on
  1316.         the last written line.
  1317.  
  1318. Mandatory predecessor for SHOWQ(m): INIQUE(max_que,b,s).
  1319.  
  1320. Errors  for SHOWQ: if m > max_queue or m < 0.
  1321.  
  1322. Examples:
  1323. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  1324. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  1325. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  1326. ║integer e    ║int e;        ║ integer e         ║var e:integer;║
  1327. ║INIQUE 1,0,1 ║INIQUE(1,0,1);║ call INIQUE(1,0,1)║INIQUE(1,0,1);║
  1328. ║SETDEB 15    ║SETDEB(15);   ║ call SETDEB(15)   ║SETDEB(15);   ║
  1329. ║CREATE 0,1   ║CREATE(0,1);  ║ call CREATE(0,1)  ║CREATE(0,1);  ║
  1330. ║CREATE 2,2   ║CREATE(2,2);  ║ call CREATE(2,2)  ║CREATE(2,2);  ║
  1331. ║e = NEXTEV   ║e = NEXTEV(); ║ e = NEXTEV()      ║e := NEXTEV;  ║
  1332. ║QUEUE 1,0    ║QUEUE(1,0.0); ║ call QUEUE(1,0)   ║QUEUE(1,0);   ║
  1333. ║SHOWQ 1      ║SHOWQ(1);     ║ call SHOWQ(1)     ║SHOWQ(1);     ║
  1334. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  1335. Explanation: Two entities are created (=placed on calendar). The
  1336. first is made current and placed to queue #1. Printout should
  1337. follow NEXTEV and SHOWQ.
  1338.  
  1339. SSS Reference                                            Page  28
  1340.  
  1341.  
  1342.                        ╔════════════════╗
  1343.                        ║  SETT(g), T()  ║
  1344.                        ╚════════════════╝
  1345.  
  1346. Description: managing simulated time -
  1347. SETT sets simulated time to g,
  1348. T returns current simulated time (as a floating point number).
  1349.  
  1350. g (floating point number) new absolute value of simulated time,
  1351.         g should not be less than T() prior to calling SETT.
  1352.  
  1353. Remarks: At start of simulation simulated time is set to 0. If g
  1354.         is less than T() prior to calling SETT, SETT has no
  1355.         effect. Simulated time is managed in general by NEXTEV
  1356.         when it sets the time to next event's time. Next event's
  1357.         times are the first arguments in CREATE(g,i) or
  1358.         SCHED(g,e,i).
  1359.  
  1360. Examples:
  1361. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  1362. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  1363. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  1364. ║SETT 7.4     ║SETT(7.4);    ║ call SETT(7.4)    ║SETT(7.4);    ║
  1365. ║print T      ║printf("%f\", ║ write(*,*) T()    ║writeln(T);   ║
  1366. ║             ║T());         ║                   ║              ║
  1367. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  1368. Explanation: Time is set to 7.4 and printed out.
  1369.  
  1370. SSS Reference                                            Page  29
  1371.  
  1372.  
  1373.                          ╔═════════════╗
  1374.                          ║  SIMEND(g)  ║
  1375.                          ╚═════════════╝
  1376.  
  1377. Description: Causes end of simulation at absolute simulated time
  1378.         g or immediately if g < T() prior calling SIMEND, where
  1379.         T() is the current simulated time.
  1380.  
  1381. Argument: g (floating point number) is the absolute simulated
  1382.         time to finish simulation.
  1383.  
  1384. Mandatory predecessor: INIQUE(q,b,s).
  1385.  
  1386. Error: if calendar has been not initiated by INIQUE(q,b,s).
  1387.  
  1388. Examples:
  1389. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  1390. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  1391. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  1392. ║integer e    ║int e;        ║ integer e         ║var e:integer;║
  1393. ║INIQUE 1,0,1 ║INIQUE(1,0,1);║ call INIQUE(1,0,1)║INIQUE(1,0,1);║
  1394. ║SIMEND 9.5   ║SIMEND(9.5);  ║ call SIMEND(9.5)  ║SIMEND(9.5);  ║
  1395. ║CREATE 10,0  ║CREATE(10,0); ║ call CREATE(10,0) ║CREATE(10,0); ║
  1396. ║e = NEXTEV   ║e = NEXTEV(); ║ e = NEXTEV()      ║e := NEXTEV;  ║
  1397. ║print e      ║printf("%d\n",║ write(*,*) e      ║writeln(e);   ║
  1398. ║             ║e);           ║                   ║              ║
  1399. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  1400. Explanation: Two entities are created (=placed on calendar). The
  1401. first is made current and placed to queue #1. Printout should
  1402. follow NEXTEV and SHOWQ.
  1403.  
  1404. SSS Reference                                            Page  30
  1405.  
  1406.  
  1407.                          ╔════════════╗
  1408.                          ║  SIMERR()  ║
  1409.                          ╚════════════╝
  1410.  
  1411. Description: Returns latest SSS error code as an integer and
  1412.         clears it (clear means 0).
  1413.  
  1414. Remarks: SIMERR() is in effect only when o is EVEN in SETDEB(o),
  1415.         as for odd values of o the simulation stops on an error.
  1416.         If an error occurs, o is even and SIMERR() is not called
  1417.         then NEXTEV() returns 0 upon its next call, effectively
  1418.         stopping simulation. However, when SIMERR() is called
  1419.         just before NEXTEV(), SIMERR() clears the error and
  1420.         NEXTEV() will continue if possible. This gives to the
  1421.         experianced programmer more control on errors.
  1422.  
  1423. Note on QuickBASIC v4.5 and similar integrated environments that
  1424.         exit to DOS upon an SSS error: in the beginning of the
  1425.         program include the line SETDEB(2).
  1426.  
  1427. The meaning of SSS error codes are:
  1428.  
  1429. ╔════╦══════════════════════════════════════════════════════════╗
  1430. ║Code║                       Meaning                            ║
  1431. ╠════╬══════════════════════════════════════════════════════════╣
  1432. ║  1 ║ Attempt to make more than one entity current             ║
  1433. ║  2 ║ Lack of space in memory                                  ║
  1434. ║  3 ║ Too many entities                                        ║
  1435. ║  4 ║ Queue index is too big or smaller than 1                 ║
  1436. ║  5 ║ No entity exists with specified rank and/or queue number ║
  1437. ║  6 ║ There is no current entity when one is needed            ║
  1438. ║  7 ║ INIQUE was not called                                    ║
  1439. ║  8 ║ Statistics index is too big smaller than 1               ║
  1440. ║  9 ║ INISTA is called twice with same first argument          ║
  1441. ║ 10 ║ Summary file cannot be opened                            ║
  1442. ║ 12 ║ Too large rank for queue or calendar                     ║
  1443. ║ 13 ║ Parameters should be positive                            ║
  1444. ║ 14 ║ In TR the parameters do not obay to min <= mode <= max   ║
  1445. ║ 15 ║ Attribute number is too big or smaller than 1            ║
  1446. ║ 16 ║ Event code should be greater than 1 in SCHED             ║
  1447. ╚════╩══════════════════════════════════════════════════════════╝
  1448.  
  1449. Examples:
  1450. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  1451. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  1452. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  1453. ║CREATE 10,0  ║CREATE(10,0); ║ call CREATE(10,0) ║CREATE(10,0); ║
  1454. ║print SIMERR ║printf("%d\n",║ write(*,*)SIMERR()║writeln(      ║
  1455. ║             ║SIMERR());    ║                   ║ SIMERR);     ║
  1456. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  1457. Explanation: CREATE without prior INIQUE raises error code 7
  1458. which is printed. After printing error code is cleared.
  1459.  
  1460. SSS Reference                                            Page  31
  1461.  
  1462.  
  1463.                          ╔════════════╗
  1464.                          ║  SUMRY(u)  ║
  1465.                          ╚════════════╝
  1466.  
  1467. Description: To write a standard report to screen (if u is an
  1468.         empty string) or to append to file with name u. The
  1469.         standard report is written for each call of INISTA and
  1470.         for each queue including sample size (duration of
  1471.         recording for time persistent statistics), average,
  1472.         (time average for time persistent statistics), standard
  1473.         deviation, minimum and maximum. If in INISTA(j,h,k,l,f,w)
  1474.         k = 0 and l > 0, a frequency table is also printed.
  1475.  
  1476. Argument: u (string with an appended space in BASIC & FORTRAN)
  1477.         is either empty or a legitimate file name (path names are
  1478.         OK but not wild cards). Examples for u in FORTRAN: ' '
  1479.         for screen (SPACE between quotes is mandatory!), 'OUT  '
  1480.         for file OUT (last space is mandatory!). Similar holds
  1481.         for BASIC (but notnecessary in C or Pascal).
  1482.  
  1483. Note for BASIC: u should be sadd(x$) where x$ is a string defined
  1484.         prior to calling SUMRY(sadd(x$)).
  1485.  
  1486. Note for FORTRAN: If you write on file u before calling SUMRY(u)
  1487.         place an end of line between, otherwise SUMRY will
  1488.         continue the previous line.
  1489.  
  1490. Mandatory predecessors: INIQUE(q,b,s), INISTA(j,h,k,l,w,f).
  1491.  
  1492. Recommended predecessors: QUEUE(m,p), TALLY(j,v).
  1493.  
  1494. Errors: if no closed file can be found with name u or disk is
  1495.         write protected or diskette door is not closed or not
  1496.         enough disk space space to write to file u.
  1497.  
  1498. Examples:
  1499. ╔═════════════╦══════════════╦═══════════════════╦══════════════╗
  1500. ║    BASIC    ║      C       ║      FORTRAN      ║    Pascal    ║
  1501. ╠═════════════╬══════════════╬═══════════════════╬══════════════╣
  1502. ║x$="1st      ║              ║                   ║              ║
  1503. ║INIQUE 1,0,1 ║INIQUE(1,0,1);║ call INIQUE(1,0,1)║INIQUE(1,0,1);║
  1504. ║INISTA(1,_   ║INISTA(1,     ║ call INISTA(1,    ║INISTA(1,     ║
  1505. ║sadd(x$),0,_ ║"1st",0,      ║+'1st              ║'1st',0,      ║
  1506. ║0,0,0)       ║0,0,0)        ║+0,0,0,0)          ║0,0,0)        ║
  1507. ║x$=" "       ║SUMRY("");    ║ call SUMRY(' ')   ║SUMRY('');    ║
  1508. ║SUMRY _      ║              ║                   ║              ║
  1509. ║sadd(x$)     ║              ║                   ║              ║
  1510. ╚═════════════╩══════════════╩═══════════════════╩══════════════╝
  1511. Explanation: Summary report is printed for "1st" variable and the
  1512. queue.
  1513.