Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

gpss_manual

.pdf
Скачиваний:
49
Добавлен:
05.06.2015
Размер:
1.88 Mб
Скачать

argument is evaluated and used as the ordinal number (X value) of the list member. The Y value with that position within the list is returned as the result. If the argument is too large or less than 1, an Error Stop occurs. X values must begin with 1 and be incremented by 1 for each successive data pair. X values may not be omitted in Function Follower Statements.

Example

Listtype FUNCTION Q$Barber,L5 1,PAR1/2,PAR2/3,PAR3/4,PAR4/5,PAR5

Type M Functions

Type M - Attribute list valued function. The argument value is used to determine the list position of the SNA to be evaluated and returned as the result.

In Function Follower Statements of M type Functions, the X

Values must be Expression, and the Y Values must be Integer,

Real, Name, SNA, or ParenthesizedExpression.

A type M Function is evaluated in the same way as a type L Function, except that a type M Function requires one more step. After the list position is chosen, the associated SNA is evaluated and returned as the Y value.

Example

Mlist FUNCTION X$Name1,M5 1,Q$Nnam1/2,Q$NamX/3,Q$Nam4/4,Q$Nam6/5,F$Tan1

Rules For Functions

You must obey several rules when you create a Function. They apply to both FUNCTION Commands and/or Function Follower

Statements.

The X values of Function Follower

Statements must be non decreasing.

Function Follower Statements are

NEVER line numbered.

A Function which has a random argument must describe a valid cumulative probability distribution in the Function Follower Statements.

All fields in a Function Command are required.

All X values and Y values in Function Follower Statements are required.

The number of data pairs stated in the B Operand of the FUNCTION

Commands must correspond to pairs separated by slashes, [/], in the Function Follower Statements.

· X1, the first probability value

specifying a random continuous Function must be 0. CDF values must be nonnegative, nondecreasing, and may not exceed 1.

Function Follower Statements have no comments field.

In a Function Follower Statement, an X value is followed by [,], [,] is followed by a Y value, a Y value is followed by [/] or [CR], and [/] is followed by an X value.

CDFs must be nondecreasing between 0 and 1, inclusively. Any missing probability in C type

Functions is given to the rightmost interval, otherwise missing probability is an error.

C,D, and L type Functions cannot have SNAs for Y values.

E and M type Functions must have SNAs, or parenthesized Expressions, for Y values.

L and M type Functions may not have random arguments.

The Function Follower Statements of L and M type Functions must have sequential X values starting with 1.

The special rules applied when running in GPSS/PC

Compatibility Mode are discussed in Chapter 3.

Related SNA

FNEntnum - Function. Result of evaluating

Function Entnum.

FVARIABLE

An FVARIABLE Command defines a "floating point arithmetic" Variable Entity.

NAME FVARIABLE X Label / Operand

NAME - Entity Label for this entity. Required. The field must be

Name.

X - Expression. Required. Expressions are discussed in Section 3.4.

Example

VAR1 FVARIABLE 5#LOG(Q$WAITINGLINE)

This Command defines a "floating point" type Variable Entity which is to be evaluated when a V$VAR1 is encountered. Variables defined by both VARIABLE and FVARIABLE

Commands are accessed by SNAs of class V. When the V$VAR1 SNA is evaluated, the Expression defining the

Variable Entity named VAR1 must be evaluated. It begins with the evaluation of the Q$WAITINGLINE SNA. The logarithm of the double precision result is calculated and multiplied by 5.

The result is truncated and returned as the value of the SNA.

Action

The FVARIABLE Command is a Queued Command. When the

Simulation Object receives one, it places it at the end of the simulation’s Command Queue.

When an FVARIABLE Command is performed, the Simulation Object creates or redefines a GPSS Variable Entity. The

Variable Entity so created is evaluated when a System

Numerical Attribute in the V class, referring to this particular entity, is encountered by the Simulation Object.

The Expression contained in an FVARIABLE Command is evaluated according to the rules in Chapter 3, and may include calls to PLUS Procedures or to Library Procedures. The evaluation proceeds differently in GPSS/PC Compatibility Mode.

Expressions must be well-formed according to the rules of elementary algebra. A formal definition can be found in the Appendix. You may use any of the arithmetic and logic operators listed in Section 3.4. If SNAs are used in the Expression field, they are evaluated with respect to the Active

Transaction. A Named Value which has not been explicitly assigned a value cannot be used as an item in an Expression.

To do so, you must assign a value to it before the Expression is evaluated. Assignments to User Variables are done by EQU Commands or in PLUS Procedures.

Once a Variable Entity is created in a simulation, it is never destroyed. However, it may be redefined later by an interactive FVARIABLE Command.

If the simulation is not run in GPSS/PC Compatibility Mode, FVARIABLE and VARIABLE Commands are treated the same.

GPSS/PC Compatibility

All SNAs are truncated in GPSS/PC Compatibility Mode.

Related SNA

· VEntnum - Result of evaluating a Variable Entity

Entnum.

HALT

A HALT Command interrupts the simulation and purges the Command Queue.

HALT

Operands

None

Action

A HALT Command is an Immediate Command, and therefore is not placed on the Command Queue by the Simulation Object. Instead, it is performed immediately, causing the simulation to be placed in the Halted State, and removing any remaining Commands from the Command Queue. The simulation may be resumed by a later CONTINUE Command.

Example

HALT

This in the only way to use the GROUPS Command.

Hot Key

A HALT Command can be sent to the simulation by pressing

the b + a + H key combination. A GPSS World simulation window must have the input focus.

INCLUDE

The INCLUDE Command Translates a file of Model Statements.

INCLUDE A

Operand

A - Filespec. A string representing the file specification of the

Secondary Model File or Command List to be Translated.

Required. Operand must be String.

Example

INCLUDE "SAMPLE1.GPS"

In this example, when the Translator encounters the INCLUDE Command, it will include the statements from the SAMPLE1.GPS Model File in the created simulation. Since no file path is given, GPSS World assumes the file is in the Project’s Model Directory.

Action

The INCLUDE Command is an Immediate Command.

Operand A is used as the file specification of a Command List or a Secondary Model File. If a path is not included in the filespec, the location of the model file that contains the INCLUDE command will be used.

When an INCLUDE Command is Translated, it causes the GPSS World Translator to replace it with a Model File, and to

Translate that in place of the INCLUDE Command. The Translator opens the Secondary Model File and Translates each Model Statement one at a time.

Model Statements in a Command File or Secondary Model File are treated as if they occurred in line, in place of the INCLUDE

Command. Nesting is allowed to a depth of 5. When all Model Statements have been Translated, they are sent to the

Simulation Object for processing.

If any errors are detected, GPSS World sounds an audio signal, generates a syntax error message and attempts to find additional errors. The error message contains the offending line number in the Secondary Model File. Handling errors is discussed in Chapter 2. Audio sounds can be suppressed by selecting Silence in the Options page of the Configuration

Notebook.

For testing purposes, it may be more convenient to Translate each Secondary Model File by itself, before using it in an

INCLUDE Command. Here’s how:

1.Read the Secondary Model File in a Model Window.

2.Translate the partial model represented in the Model Window.

3.Correct Syntax Errors.

4.Save the Secondary Model File.

INCLUDE Commands can be entered interactively, or loaded into Function Keys, just like any other GPSS Statement. This is discussed in Chapter 2.

Model File Numbers

Model File Numbers are used in the Blocks Window and in

Error Stop messages to identify the Block Statement that created a given Block Entity.

As the Translator encounters Model Files, it assigns an integer to be used later to identify the file. The Model Object is assigned the number 0, and succeeding INCLUDE Files are assigned succeeding integers as they are encountered by the Translator. Thereafter, Block Entities can be associated to the appropriate text line in the Model File.

Each occurrence of a file causes a distinct Model File Number to be assigned. Multiple occurrences of a single file are also assigned distinct numbers. Since each occurrence causes a distinct set of Blocks to be created, distinct Model File Numbers are required for unique identification.

Special Restrictions

You may use INCLUDE Commands to nest Model Files to a maximum depth of 5.

You cannot place an INCLUDE Command inside a PLUS Procedure.

INITIAL

An INITIAL Command initializes a Logicswitch Entity, Savevalue Entity, or an element of a Matrix Entity.

INITIAL A,B

Operands

A - Logicswitch, Savevalue, or Matrix element specified as

SNA. Operand A must have the form of an LS, X, or MX class

SNA. Required. The operand must be LSPosInteger,

LS$Name, XPosInteger, X$Name, MXPosInteger(m,n) or

MX$Name(m,n). Coordinates (m,n) must be Name or

PosInteger.

B - Value to be assigned. The default is 1. Optional. The operand must be Null, Number, String or Name.

Action

The INITIAL Command is a Queued Command. When the Simulation Object receives one, it places it at the end of the simulation’s Command Queue.

The INITIAL Command causes a value, specified by Operand B, to be assigned to the Logicswitch, Savevalue, or Matrix Entity as specified by the LS, X, or MX class SNA in Operand A. If Operand B is not used, a value of 1 is assigned to the entity, or element.

If Operand A specifies a Logicswitch Entity, only the value of 0 or 1 is assigned. If Operand B is explicitly specified as 0, the value of 0 is assigned. Otherwise, the value 1 is assigned.

The INITIAL Command can be used when there is no Active Transaction, or when Transaction Parameter contents cannot be relied upon. However, a fuller range of operands are available using LOGICSWITCH, SAVEVALUE, and

MSAVEVALUE Block Statements interactively.

Example

INITIAL X$Quote,"Now is the time ... "

This Command assigns a string constant to the Savevalue

Entity, QUOTE.

INITIAL MX$Inventory(Part_39,Stocklevel),200

This Command assigns the value 200 to the element of Matrix

Entity named Inventory with row number of Part_39, and column number of Stocklevel. The names Part_39 and

Stocklevel must have previously been assigned the appropriate integers in EQU Commands.

Special Restrictions

Operand A must have the form of an LS, X, or

MX class SNA.

You cannot use Transaction Parameters in any part of Operand A.

Related SNAs

LSEntnum - Logicswitch. The value of

Logicswitch Entity Entnum is returned.

MXEntnum(m,n) - Matrix element value. The value in row m, column n of Matrix Entity Entnum is returned.

XEntnum - Savevalue. the value of Savevalue

Entity Entnum is returned.

Related Blocks

LOGIC - assign a value to a Logicswitch Entity.

MSAVEVALUE - assign a value to or increment an element of a Matrix Entity.

SAVEVALUE - assign a value to or increment a Savevalue Entity.

INTEGRATE

An INTEGRATE Command sets up the integration and thresholds of a continuous variable.

NAME INTEGRATE A,B,C,D,E

Operands

NAME - User Variable. Required. The field must be Name.

A - Derivative. Required. The operand must be Name, Number,

String, ParenthesizedExpression, or SNA.

B - Threshold 1. Optional. The operand must be Null, Name,

Number, String, ParenthesizedExpression, or SNA.

C - Arrival Block 1. Optional. The operand must be Null, Name,

PosInteger, ParenthesizedExpression, or SNA.

D - Threshold 2. Optional. The operand must be Null, Name,

Number, String, ParenthesizedExpression, or SNA.

E - Arrival Block 2. Optional. The operand must be Null, Name,

PosInteger, ParenthesizedExpression, or SNA.

Examples

Rabbits INTEGRATE (a_ # Rabbits)

- ( b_ # Rabbits # Foxes)

Foxes INTEGRATE ( - c_ # Foxes) +

( d_ # Rabbits # Foxes)

Rabbits EQU 10000

Foxes EQU 1500

a_ EQU 0.9

b_ EQU 0.4

c_ EQU 0.2

d_ EQU 0.1

This example defines a "Predator-Prey" model relating a rabbit population to a fox population. The Expressions in the INTEGRATE Commands are used as the derivatives with respect to time. The values of the constants in the Expressions, and the initial values of the populations are set by the EQU Commands. When the simulation runs, the integrations are performed automatically when the clock advances.

X_ INTEGRATE (Y_),0.707,Wake_Up

Y_ INTEGRATE (-X_)

X_ EQU 1.0

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]