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 />

2. The first of each pair is assumed to be a probability. The second is assumed to be a sample<br />

value.<br />

3. A system-defined, three-attribute entity, random.e, is created for each pair. The probability<br />

value is assigned to its first attribute, prob.a. The sample value is assigned to its second<br />

attribute, referred to as ivalue.a if the variable is integer, or rvalue.a if the<br />

variable is real.<br />

4. The entities are filed in a set having the same name as the random variable. The third attribute<br />

in each random.e record is a pointer named s.variable.<br />

5. Occupies the space declared for the random variable or attribute.<br />

Input probabilities can be cumulative or individual. If cumulative, the last probability must be 1.0.<br />

If individual, they must sum to 1.0. All random variables have their probabilities stored cumulatively.<br />

If any probability appears as less than 0 or greater than 1, the program terminates with an<br />

error message.<br />

The following examples illustrate how random variables are defined and used.<br />

Definition:<br />

the system has a RANDVAR random step variable<br />

define RANDVAR as an integer variable<br />

Input statement:<br />

Input data:<br />

read RANDVAR<br />

0.1 10 0.2 25 0.35 40 0.55 100 0.8 150 1.0 200 *<br />

The sampling probabilities are expressed cumulatively in six pairs of sampling values. These pairs<br />

are stored in six entities in a set named RANDVAR.<br />

Storage of RANDVAR sample values is shown in figure 5-8.<br />

222

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

Saved successfully!

Ooh no, something went wrong!