18.10.2014 Views

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SIMSCRIPT II.5 Programming Language

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>SIMSCRIPT</strong> <strong>II.5</strong> <strong>Programming</strong> <strong>Language</strong><br />

Table 5-9. Accumulate Computations<br />

N.QUEUE<br />

(1)<br />

Time Value<br />

Began<br />

(2)<br />

Time Value<br />

Ended<br />

(3)<br />

Increment<br />

(4)=(3)-(2)<br />

Area<br />

(5)=(1)*(4)<br />

Sum<br />

(5)<br />

0 0 1.2 1.2 0 0<br />

1 1.2 3.0 1.8 1.8 1.8<br />

3 3.0 4.6 1.6 4.8 6.6<br />

2 4.6 6.1 1.5 3.0 9.6<br />

3 6.1 8.0 1.9 5.7 15.3<br />

4 8.0 8.3 0.3 1.2 16.5<br />

5 8.3 11.2 2.9 14.5 31.0<br />

2 11.2 12.4 1.2 2.4 33.4<br />

1 12.4 14.1 1.7 1.7 35.1<br />

0 14.1 17.1 3.0 0 35.1<br />

1 17.1 18.0 0.9 0.9 36.0<br />

The sums in table 5-9 are maintained for the computation of AVG.QUEUE(1). If, at simulated time<br />

11.2 (time.v=11.2), AVG.QUEUE(1) appears in a statement such as list AVG.QUEUE(1),<br />

it is computed from table 5-9 data as 31.0/11.2=2.77. That is, the average number of jobs in<br />

QUEUE(1) from time.v=0 to time.v=11.2 is 2.77. If at some time between changes in<br />

N.QUEUE(1), say at time.v=0, a value for AVG.QUEUE(1) is requested, it is computed as<br />

[16.5+5(10-8.3)]/10=2.5 by the function AVG.QUEUE.<br />

More complete information on the values attained by tallied global variables, system attributes, and<br />

attributes of permanent entities can be obtained by requesting a frequency count of the number of<br />

times a variable takes on specified ranges of values. Statements of the form:<br />

tally name1 (r1 to r2 by r3) as the histogram of name2<br />

define an array name1 with (r2 - r1)/r3 + 1 elements, one for each element of name2, plus an additional<br />

element for overflows. If name2 is the name of a permanent attribute, an array of histograms<br />

will be defined. The interval between r2 and r1 is divided into classes r3 units wide. If a<br />

sample falls between r1 and r1 + r3, the value of the element name1(1) is incremented by 1. If<br />

it falls between r1 + r3 and r1 + 2r3, name1(2) is incremented, and so forth.<br />

Thus, the average value of a variable, and the distribution of values it takes at different times, over<br />

the duration of a simulation run, may be requested by preamble statements such as:<br />

228

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!