# SLAM II

## Network Elements

### Transactions

• Definition - units of traffic flowing through the system
• Attributes are numerical values carried along with a transaction to specify its characteristics:
• ATRIB(I), 1 < = I < = 100

### Activities

• Activities (Branches) represent time delays in transaction movement
• Regular activity has unlimited capacity
• Service activity has finite number of parallel servers; must start on a queue node

### Nodes

• Nodes mark the start and finish of each activity
• Used to modify transaction flow and the values of network status variables
• The arrival of a transaction at a node defines the only event type in the underlying discrete-event model

### Resources

• Resources are finite-capacity system facilities similar to service activities
• Their use is not tied to the traversal of a single branch in the network
• May be allocated and deallocated in any integer amounts
• May be preempted

### Gates

• Gates control transaction flow

### Global Network Variables

• TNOW = current reading of clock
• XX(I) = global variable I
• SS(I) = state variable I
• DD(I) = time derivative of SS(I)
• NNACT(I) = # of transactions now in activity with label I
• NNCNT(I) = # of transactions that have finished activity I
• NNQ(I) = # of transactions in file I
• NNRSC(I) = unused capacity of resource I
• NNGAT(I) = status of gate I; O if open, 1 if closed

### Random Variate Generators

• DRAND - a random number
• UNFRM (a, b) - uniform distribution on [a, b]
• TRIAG (a, m, b) - triangular distribution with minimum = a, mode = m, and maximum = b
• RNORM (u, o) - normal distribution with mean = u and standard deviation = s
• RLOGN (u, o) - lognormal distribution with mean = u and standard deviation = s
• EXPON (u) - exponential distribution with mean = u
• ERLNG (b, a) - Erlang distribution; the sum over a random sample of size a from EXPON ( b )
• GAMA (b , a) - Gamma distribution with shape parameter = a and scale parameter = b
• BETA (h, f) - Beta distribution on the interval [O, I] with shape parameters h and f
• NPSSN (u) - Poisson distribution with mean = u
• WEIBL (b, a) - Weibull distribution with scale parameter = b and shape parameter = a

## Activities

Branches are used to model activities. Only at branches are explicit time delays prescribed for entities flowing through the network. Activities emanating from QUEUE nodes are referred to as service activities. Service activities restrict the number of concurrent entities flowing through them to be equal to the number of servers represented by the activity.
1. Branches starting on a QUEUE node are service activities
```Symbol

ACTIVITY (N)/A,DUR,PROB;
DUR = activity duration; any network variable or random variate
PROB = probability that transaction will move along this branch
N = number of parallel servers
A = integer label , 1 < = A < = 100
```

```
Elevator Example

Column:  1	7

NETWORK;
CREATE, 10, 7;
ACTIVITY, 3;
QUEUE (1);
ACTIVITY (1)/3, 9, 0.75, EXIT;
ACTIVITY (1)/3, 8.5, 0.25;
EXIT	TERMINATE, 100;
ENDNETWORK;

```

2. Branches not starting on a QUEUE node are regular activities

```Symbol

ACTIVITY (N)/A,DUR,PROB COND;
PROB COND = Fortran-like logical condition involving network variables;
transaction will move along this branch if condition is true
```

## Basic nodes for traffic generation and control

1. Create node - creates entities and routes them into the system over activities that emanate from the CREATE node

```CREATE, TBC, TF, MA, MC, M;

TF          time of first creation     0.0
TBC         time between creations   infinity
can be any network variable
MA          mark attribute             None
MC          maximum number of        infinity
transactions created
M           M-number
```
The M-number on the output side of a non-queue node specifies the maximum number of emanating activities which are taken
1. If there are any probabilistic branches, draw a random number to select a single probabilistic branch
2. Test conditional branches in the order that they occur and select additional activities to start until the M-number is exhausted
2. Terminate node - terminates (destroys) entities (reclaims disk space used to store information about the entity terminated). The TERMINATE node is used to destry or delte entities from the network.

```TERMINATE, TC;

TC    termination counter for this exit point    infinity

```
3. Queue node - queue in which entities wait (are queued) A QUEUE is a location in the network where entities wait for service. When an entity arrives at a QUEUE node, its disposition depends on the status of the server that follows the QUEUE node. If the server is idle, the entity passes through the QUEUE node and goes immediately into the service activity. If no server is available, the entity waits in the QUEUE node until a server can process it. When a server becomes available, the entity will automatically be taken out of the queue and service will be initiated.

When an entity arrives at a QUEUE node which is at its capacity, its disposition must be determined. This decision is based on a specification at the QUEUE node as to whether the entity should balk or be blocked. In the case of balking, the entity can be routed to another node of the network. When an entity is blocked by a QUEUE node, it waits until a free space is available in the queue. The activity which just served the entity that is blocked is also considered as blocked. A blocked entity will join the queue when a space is available.

```QUEUE(IFL), IQ, QC;

IQ          initial # in queue                      0
QC          queue capacity                       infinity
IFL         file #, 1 < = IFL < = 100
```
4. Accumulate node - entities accumulate at this node; once the specified number have accumulated, an entity is released that represents the group of entities that "accumulated"

```ACCUMULATE, FR, SR, SAVE, M;

FR          number of accumulated                   1
transactions for first release of node
SR          transaction count required on           1
subsequent releases
SAVE        save criterion : FIRST                 LAST
LAST, HIGH(I), LOW(I),
SUM, MULT
```
5. Goon node - node used to connect activity branches; provides linkage for activities in series. The GOON node is used in the modeling of sequential activities since 2 consecutive activity statements are used to model parallel activities. Also probabilities and/or deterministic branching can occur following GOON nodes.

```GOON, M;

```

## Operations on network variables

1. Assign node - assigns values to entity or network variables. The ASSIGN node is used to prescribe values to the attributes of an entity passing through the ASSIGN node or to the prescribed values to the system variables that pertain to the network in general.

```ASSIGN, VARI = EXP1, VAR2 = EXP2, ..., M;

VAR1, VAR2, ...    One of the SLAM network variables:
ATRIB(I), XX(I), SS(I), DD(I), II
EXP1, EXP2, ...    Arithmetic expression involving at most 10 of
the following:  Network variables, random variables,
constants; No parentheses
```
2. COLCT node - tabulate statistics on observations taken during the simulation. The COLCT (collect) node is used to collect statistics on five types of variables: 1) time of all arrivals, 2) time of first arrival, 3) time between arrivals, 4) interval statistics, and 5) a SLAM II variable. For each of the above 5 types of variables, estimates for the mean and standard deviation of the variable are obtained. In addition, a histogram of the values collected at a COLCT node can be obtained.

```COLCT, TYPE, ID, NCEL/HLOW/HWID, M;

TYPE       observation to be recorded:
FIRST
LAST      node arrival times
BETWEEN
INTERVAL - time in system
SLAM network variable
ID         16 character output label         BLANK
NCEL       number of interior cells in         0
histogram to be printed
HLOW       upper limit of unbounded           0.0
cell on the left
HWID       width of interior cells; class     1.0
interval for empirical frequency
distribution
```
3. Select node - used to provide branching into a set of queues; determines which queue an entity will enter based on the queue selection rule being used

```SLBL	SELECT, QSR,, BALK(NLBL), QLB1, ... ;

QSR        Queue selection rule looking forward    POR
to destination-queues
BLOCK      Block the service activity ending at  no blocking;
node SLBL if all destination queues   transaction destroyed
are full
BALK(NLBL) Balk to node NLBL if all destination  no balking;
queues are full	                 transaction destroyed
QLB1,
QLB2, ...  Labels of queue nodes to which          ERROR
transactions are to be routed
QSR options
POR      Priority given in preferred order
CYC      Cyclic priority
RAN      Random priority
LAV      priority given to Queue which has had the
largest average number of entities in it to date
SAV      priority given to queue which has had the
smallest average number of entities to date
LNQ      priority to queue with largest number of entities in queue
SNQ      priority given to queue with smallest number
of entities in queue
```

## Simulation control statements

1. GEN statement -
```GEN, NAME, PROJECT, MO/DA/YE, NNRNS, ILIST, IECHO
IXQT, IPIRH, ISMRY, IPR;

mnemonic    definition       options                  default

NAME      Analyst's name  20 alphanumeric characters   Blanks
PROJECT   Project name    20 characters                Blanks
MONTH     Month number                                   1
DAY       Day number                                     1
YEAR      Year number                                   2001
NNRNS     Number of runs                                 1
ILIST     Request for       Y or N                       Y
input listing
IECHO     Request for echo  Y or N                       Y
summary report
IXQT      Request for       Y or N                       Y
execution
IPIRH     Request for       Y or N                       Y
ISMRY     Request for       Y or N                       Y
summary reports
IPR       Print option      72, 130                     130
```
2. LIMITS statement - defines the maximum number of entities and entity attributes (used to assign memory required)
```LIM, MFIL, MATR, MNTRY

mnemonic   definition                        default

MFIL       largest file #                       1
MATR       maximum # of attributes per entity   0
MNTRY      maximum # of entries in all files    0
```
3. PRIORITY statement - defines the queue priority rule to be used
```PRIORITY/IFL, RNK/;

mnemonic   definition                        default

IFL        file number                        None
RNK        file ranking: LVF(I);              FIFO
HVF(I); FIFO; LIFO
```
4. Seeds statement - assigns a starting seed for a random number stream
```SEEDS, ISEED(ISTRM)/R;

mnemonic   definition                             default

ISEED      integer seed; negative seed yields
complimentary sequence of random numbers
ISTRM      Stream number
R          reinitialization option (Y or N)          N
```
5. Initialize statement - defines when the simulation begins and stops
```INITIALIZE, TTBEG, TTFIN;

mnemonic   definition                    default

TTBEG      beginning time of run           0.0
TTFIN      finishing time of run         10 sup 20
```
6. Monitor statement - defines when "monitoring" information is collected; useful for debugging and better understanding a simulation
```MONTR, OPT, TFRST, TBTWN;

mnemonic   definition         options                      default

OPT        monitor option     SUMRY - print summary report  None
FILES - list contents of files
STATES - list SS(.), DD(.) vars
CLEAR - clear statistical arrays
TRACE - trace transaction flow
TFRST      time of 1st report                                0.0
TBTWN      time between reports                            10 sup 20
```
7. Simulate statement - indicates that network simulation statements follow
```SIMULATE;
```
8. FIN - signals end of SLAM statements
```FIN;
```