Chapter 6 - GPSS Commands

You use Commands to define entities and to control the running of simulations. Commands may be part of the Initial Model Translation, or they may be sent as Interactive Statements to an existing simulation.

As part of the Initial Model Translation, Commands are sent to the Simulation Object as a group, after all the Blocks have been sent. Otherwise, they are sent when you enter them. These are called Interactive Commands.

To send a Command to an existing simulation use the Command menu in the Model Window. This will Translate a Command and send it to the Simulation Object for execution.

Every simulation has a Command Queue associated with it. The Simulation Object performs each Command on the queue one after the other, until it is HALTed or until it runs out of things to do. Even Commands in the Model File, other than HALT and SHOW, are placed on the Command Queue before they are performed.

Commands are either Immediate or Queued. Immediate Commands, such as HALT and SHOW, are performed as soon as they are received by the Simulation Object Other Commands are queued. They are placed at the end of a list of Commands which have not yet been completed. When a Simulation Object has no more Immediate Commands to do on behalf of a simulation, it performs the next Command on the simulationís Command Queue. If a simulation is running when an Immediate Command is received, the simulation is temporarily suspended while the Immediate Command is performed.

The HALT Command is a special case. Not only is it an Immediate Command, but it also deletes any remaining Commands still on the Command Queue. After a HALT Command is performed, the Simulation Object has nothing more to do on behalf of that simulation.

It is often convenient to put a list of frequently used Commands in a small text file. You can then use an INCLUDE Command to send the whole sequence to the Simulation Object. Even easier, you can load a function key with an INCLUDE Command, and have the whole Command list performed by a single keystroke. Chapter 2 shows you how to do this.

 

The Commands are:

BVARIABLE - Define a Boolean Variable Entity.

CLEAR - Reset statistics and remove Transaction.

CONTINUE - Resume the simulation.

EQU - Assign a value to a User Variable.

EXIT - End the GPSS World Session.

FUNCTION - Define a Function Entity.

FVARIABLE - Define an Fvariable Entity.

HALT - Stop the simulation and delete all Queued Commands.

INCLUDE - Read and Translate a secondary Model File.

INITIAL - Initialize or modify a Logicswitch, Savevalue, or Matrix Entity.

INTEGRATE - Automatically integrate a time differential in a User Variable.

MATRIX - Define a Matrix Entity.

QTABLE - Define a Qtable Entity.

REPORT - Set the name of the Report File or request an immediate report.

RESET - Reset the statistics of the simulation.

RMULT - Set the seeds of the first 7 Random Number Generators

SHOW - Evaluate and display Expression.

START - Set the Termination Count and begin a simulation.

STEP - Attempt a limited number of Block entries.

STOP - Set a Stop Condition based on Block entry attempts.

STORAGE - Define a Storage Entity.

TABLE - Define a Table Entity.

VARIABLE - Define a Variable Entity.

 

Operands

Statements usually have one or more operands which you must fill in. Most operands have several different forms which are valid. In the descriptions which follow, a valid class of operands may be described by an italicized word. You must choose a member of the class and type it into the Operand field. For example, if one of the valid forms of an operand is given as PosInteger, you could type:

21

The italicized words are usually suggestive, but you may need to refer to the formal definition in the Appendix.

Windows

A wide variety of windows are available for you to observe the effects of Commands on your simulations. In general, windows are specialized by the entity type.

 Model Window - Text View ó Full screen textual model editor.

 Journal Window - Record session events.

 Blocks Window - Online view of Block dynamics.

 Expressions Window - Online view of values of Expressions.

 Facilities Window - Online view of Facility Entity dynamics.

 Logicswitches Window - Online view of Logicswitch Entity dynamics.

 Matrix Window - Online view of the dynamics of a Matrix cross-section.

 Plot Window - Online view of a plot of up to 8 Expressions.

 Queues Window - Online view of Queue Entity dynamics.

 Savevalues Window - Online view of Savevalue Entity dynamics.

 Storages Window - Online view of Storage Entity dynamics.

 Table Window - Online view of Table Entity dynamics.

 Transaction Snapshot - Picture of the state of a Transaction in the simulation.

 CEC Snapshot - Picture of the state of the Current Events Chain in the simulation.

 FEC Snapshot - Picture of the state of the Future Events Chain in the simulation.

 Numeric Groups Snapshot - Picture of the state of the Numeric Groups in the simulation.

 Userchains Snapshot - Picture of the state of the Userchain Entities in the simulation.

 Transaction Groups Snapshot - Picture of the state of the Transaction Groups in the simulation.

 

 

 

BVARIABLE

A BVARIABLE Command defines a Bvariable Entity.

NAME BVARIABLE X

Label/Operand

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

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

 

Example

LINE11 BVARIABLE (BV$CLKíANDíBV$PHASE2)

This example defines a Bvariable Entity which is to be evaluated when a BV$LINE11 SNA is encountered. When it is evaluated, the result is 1 ("TRUE") if the CLK and the PHASE2 Bvariable Entities are TRUE when evaluated. Otherwise, the LINE11 Bvariable returns a 0 ("FALSE").

Action

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

When a BVARIABLE Command is performed, the Simulation Object creates or redefines a GPSS Bvariable Entity. The Bvariable Entity so created is evaluated when a System Numerical Attribute in the BV class, referring to this particular entity, is encountered by the Simulation Object.

The Expression contained in a BVARIABLE Command is evaluated according to the rules in Chapter 3, and may include calls to PLUS Procedures or to Library Procedures. The final result is converted to integer 0, if 0, or to integer 1 if the result was not zero. 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.

Expressions in BVARIABLE Command are not limited to logical operators. They may include arithmetic operators and calls to Library Procedures. The truth values of TRUE and FALSE are treated internally as integer 1 and 0, respectively.

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

GPSS/PC Compatibility

 All SNAs are truncated in GPSS/PC Compatibility Mode.

 In Bvariable Entity evaluation in GPSS/PC Compatibility Mode, the intermediate results are truncated.

Related SNA

 BVEntnum - Result of evaluating Bvariable Entity Entnum.

 

CLEAR

A CLEAR Command returns the simulation to the unused state.

CLEAR A

Operand

A - ON or OFF. If the A Operand is omitted, ON is assumed. Optional. The operand must be ON, OFF or Null.

 

Action

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

The CLEAR Command resets all statistics accumulators, clears all Transactions from the simulation, then primes each GENERATE Block with its first Transaction.

The state of all Facility Entities and Storage Entities is reset to show an unoccupied condition. The contents of all Blocks become 0.

When a CLEAR or CLEAR ON Command is performed:

 All Transactions are removed from the simulation.

 Current counts are set to 0.

 System clock is set to 0.

 Facilities are made idle and available.

 Tables are set to 0.

 Storages are set to full availability.

 Space-time products of Facilities, Storages, Queues, and User Chains are set to 0.

 Total counts are set equal to 0.

 Minimum and maximum values are set equal to current content in Queues Entities, Userchain Entities, and Storage Entities.

 Random number generators are not reset.

 The local count of generated Transactions in a GENERATE Block is set to 0.

 Members are removed from all numeric Groups.

 Savevalue Entities are set to zero.

 Logicswitch Entities are reset.

 Matrix elements are set to 0.

If a CLEAR OFF is used, all of the above occur except the last three items. When Operand A is off, Savevalue Entities, Logicswitch Entities, and Matrix Elements are left unchanged.

Special Restrictions

None.

 

Related SNAs

None.

 

CONDUCT

A CONDUCT Command begins an experiment.

CONDUCT A

Operands

A - PLUS Experiment Procedure Call. Optional. The operand must be ProcedureCall.

Action

The CONDUCT Command is an Immediate Command.that can only be sent to a HALTed Simulation Object.

The CONDUCT Command begins and passes arguments to a pre-registered PLUS Experiment in a Simulation Object. If the Simulation Object has only a a single Experiment with no arguments, operand A is not required in the CONDUCT Command.

 

Example

CONDUCT MyExperiment( NumberOfTellers, StartingReplicateNumber )

In this example, the PLUS Experiment MyExperiment is started just like any other Procedure. The global User Variables NumberOfTellers and StartingReplicateNumber are used to tell the experiment where to begin or resume the simulation runs. The arguments are evaluated in the global context and passed to the invoked Experiment.

Once you have begun an Experiment with a CONDUCT Command, your ability to interact with the simulation is limited. You can always display the running Simulation System Clock ( View / Clock ), but generally you will have to HALT the Experiment in order to interact with the Simulation Object.

Special Restrictions

A CONDUCT Command cannot be issued by a DoCommand invocation.

Only HALT Commands are available during an Experiment.

The DoCommand Library Procedure can be invoked only during an Experiment.

 

Related SNAs

None.

 

CONTINUE

A CONTINUE Command causes a halted simulation to resume.

CONTINUE

Operands

None.

 

Example

CONTINUE

This Command is used to resume the execution of a simulation.

 

Action

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

The CONTINUE Command causes a halted simulation to resume. A simulation is halted when it encounters a Stop Condition, is issued a HALT Command, encounters an Error Stop. Stop, or ends normally. Conditions can be set by a STOP or STEP Command.

If the simulation had encountered a Stop Condition, the CONTINUE Command skips the original Stop Condition but does not remove it. If the same condition occurs again, the simulation will stop again. Stop Conditions must be removed explicitly by the OFF option in a STOP Command, or in the Blocks Window. When a model is Translated, all Stop Conditions are removed. This is discussed in Chapter 2 in the Section, Setting Stop Conditions.

A CONTINUE can be used when a simulation has been interrupted by a HALT Command. Since a HALT command removes all Commands from the simulationís Command Queue, only the simulation, and not succeeding Commands, will be resumed.

When the Simulation Object processes a CONTINUE Command, it first determines if a positive Termination Count exists. This means that a previous START Command has not been completed. If the Termination Count is not strictly positive, CONTINUE causes the optional standard report to be written but does not schedule any Transactions. Otherwise, the Simulation Object calls the Transaction scheduler to begin processing Transactions again.

Hot Key

A CONTINUE Command can be sent to the simulation by pressing the [Ctrl] + [Alt] + [C] key combination. A GPSS World window must have the input focus.

 

 

EQU

An EQU Command evaluates an Expression and assigns the result to a Named Value.

NAME EQU X

Label/Operand

NAME - Named Value to receive a value. Required. The field must be Name.

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

 

Examples

Price EQU 19.95

This Command defines the name Price and assigns the value 19.95 to it. Future references to the Named Value Price will use a numeric value of 19.95.

 

Action

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

When the Simulation Object processes an EQU Command, it creates or redefines a Named Variable and evaluates the Expression in the Command. The name so created is associated with a value equal to the result of the evaluated Expression. This value replaces references to the defined name when an operand or Expression is evaluated later.

Named Values may be used for their intrinsic value as User Variables, or they may be used as entity specifiers as Entity Labels. Normally, you will not assign a value to a name used as an Entity Label. System defined names, i.e. names which have not yet appeared in an EQU Command, are not valid by themselves in Expressions or operands. However, they may be used as an entity specifier in an SNA. The Simulation Object will automatically assign a distinct value to such a name.

The Expression contained in a EQU Command is evaluated according to the rules in Chapter 3, and may include calls to PLUS Procedures or to Library Procedures. 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 Named Value is created in a simulation, it is never destroyed. However, User Variables may change values as a result of later EQU Commands, assignments in PLUS Procedures, or integration. The numerical integration of User Variables is discussed in Chapter 1, and below under the INTEGRATE Command.

 

Special Restrictions

 The values of Block labels may not be changed in an EQU Command.

 SNAs are evaluated with respect to the Active Transaction.

 If a name used as an entity specifier is changed after the entity is defined, you will not be able to access the original entity by using that name.

 FVARIABLE and BVARIABLE entities share the same name space.

 If you wish to assign a numeric value to an entity name for use in a SELECT Block, make sure the name/number assignments in the EQU Commands precede the entity definitions. For example:

100 Stor1 EQU 1

200 Stor1 STORAGE 10000

In SNAs and operands, this STORAGE may now be referred to by the number 1 or the name Stor1.

Related SNAs

None.

 

 

EXIT

An EXIT Command concludes the GPSS World Session.

EXIT

Operands

A - Exit Code. Optional. The operand must be -1, 0, 1, or Null.

 

Action

The EXIT Command ends the session immediately.

The A Operand can be used to control the writing of Model Objects and Simulation Objects to files. If Operand a is 0 or not specified, all modified files bring up a message box inquiring as to whether or not each object should be saved. If Operand A is 1, all Objects are saved. If Operand A is -1, no Objects are saved.

The EXIT Command can be used in Batch Mode, so that an "invisible Session" can be run and terminated without window operations. Batch Mode is discussed in Section 2.3.2.

The Exit Operation is also available as a library procedure and can therefore be initiated in a PLUS Procedure.

Special Restrictions

None.

Related SNAs

None.

 

FUNCTION

A FUNCTION Command defines the rules for a table lookup.

There are several types of Function Entities. Each has its own rules pertaining to the table lookup. For each, the lookup table is specified in one or more Function Follower Statements. Type C Functions are a special case. They use a table lookup, followed by a linear interpolation.

The use of Function Commands to define probability distributions has been largely supplanted by the built-in distributions in the Procedure Library. This is discussed in Chapter 8. The old Function Types are still supported by GPSS World.

 

NAME FUNCTION A,B

Label / Operands

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

A - Function argument. Required. The operand must be Name, PosInteger, String, ParenthesizedExpression, SNA, or SNA*Parameter.

B - Function type (one letter) followed immediately by the number of data pairs in the Function Follower Statements. Required.

 

Action

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

A FUNCTION Command together with one or more Function Follower Statements defines a GPSS Function Entity. Later references to an SNA of the class FN can evaluate the Function and return the result. Operand A of the FUNCTION Command is evaluated numerically. There are several types of Functions which must be considered individually. The type is specified in Operand B of the FUNCTION Command.

Each FUNCTION Command must be followed immediately by a list of data pairs, separated by slashes, which define a table. The text lines that contain the list are called Function Follower Statements. Each data pair has an X value and a Y value (or SNA) separated by a comma. Function Follower Statements create tables in the simulation which allow a mathematical function of one variable to be evaluated. When the Simulation Object encounters a reference to an FNEntnum SNA, it evaluates the Function Entity and returns the result. The tables and the manner in which they are referenced depends on the Function type.

Function Modifiers

FN class SNAs used in Operand B of GENERATE or ADVANCE Statements are called Function Modifiers. When a Transaction enters a GENERATE or ADVANCE Block with a Function Modifier, the result of the Function is multiplied by Operand A of the Block and used as the time increment.

Operand C of an ASSIGN Statements is also called a Function Modifier, although it is specified differently. In this case, only the entity specifier, not the FN class SNA, is used in the ASSIGN Statement. When a Transaction enters an ASSIGN Block with a Function Modifier, Operand C is used to determine the Function Entity number. Then the result of evaluating that Function is multiplied by Operand B of the ASSIGN Block and the result is used as the ASSIGN value.

 

Function Types

There are 5 different type of Function Entities:

Type C Functions

Type C - "Continuous" valued Function. Given an X value, after a linear interpolation, the Function returns a Y value. A random argument is a special case.

In Function Follower Statements of C type Functions, the X and Y Values must be Integer, or Real.

In a C type Function, without a random argument, the data pairs in the Function Follower Statements define a piecewise linear Function of the argument. The first data pair defines the left end point and the last data pair defines the rightmost end point. The X and Y values are stored as double precision floating point numbers.

The Function evaluation begins with the evaluation of the argument. The result is used to identify the line segment of the Function. The argument is then used in a double precision linear interpolation to arrive at the double precision result of the Function. If the argument falls outside the end points of the Function definition, the value at the nearest end point is returned.

When Operand A of the FUNCTION Command is an RN class SNA, the Function is said to have a random argument. A type C Function with a random argument is used to define a "continuous" probability distribution. This is a special case. The Function is specified as the cumulative distribution function (CDF) with 0 as the value of the left end point and 1 the value of the right end point. As before, the CDF is specified as a piece wise linear function. A random number between 0 and .999999, inclusively, is taken from the random number stream and is used in a linear interpolation to arrive at the double precision value of the Function.

Example

Output FUNCTION V$Input,C3
1.1,10.1/20.5,98.7/33.3,889.2

This example defines a piece wise linear function with two line segments. When the Function Entity is evaluated for a FN$Output SNA, first the Function argument V$Input is evaluated. If the argument result is outside the defined range, 1.1 to 33.3, the nearest endpoint is returned. For example, if V$Input returns 1 or less, FN$Output returns 10.1.

If the argument result falls within a defined line segment, a linear interpolation is performed. For example, if V$Input returns 25, then FN$Output returns the result of the following calculation:

98.7 + (889.2-98.7) # (25-20.5)/(33.3-20.5)

Therefore, FN$Output returns 376.6101563.

Example

 

Xpdis FUNCTION RN200,C24
0,0/.1,.104/.2,.222/.3,.355/.4,.509/.5,.69/.6,.915/.7,1.2/.75,1.38
.8,1.6/.84,1.83/.88,2.12/.9,2.3/.92,2.52/.94,2.81/.95,2.99/.96,3.2
.97,3.5/.98,3.9/.99,4.6/.995,5.3/.998,6.2/.999,7/.9998,8

 

In this example we define the Function Entity named Xpdis. The FUNCTION Command names the Function, used random number generator 200, and tells GPSS World that it is to be a type C Function Entity with 24 data pairs to follow in one or more Function Follower Statements.

This is an example of an approximation to a negative exponential distribution with mean of 1. You can use a built in probability distribution from the Procedure Library, which is slightly more accurate, but Function Entities are generally more efficient.

Type D Functions

Type  D - Discrete valued function. Each argument value or probability mass is assigned an numeric value. A random argument is a special case.

In Function Follower Statements of D type Functions, the X Values must be Expression, and the Y Values must be Integer, Real, or Name.

In a D type Function, without a random argument, the data pairs in the Function Follower Statements define a set of argument values which are associated with specific Function values. The X values in the Function Follower Statements must be non decreasing. They are stored internally in double precision. When the Function is evaluated, the X values from the Function Follower Statements are searched from lowest to highest value. When an X value is found which is greater than or equal to the argument value, the corresponding Y value is returned. If there is no such X value, the Y value or named value associated with the largest X value is returned.

Example

DIis1 FUNCTION X$A2,D5
1.1,6.9/2.1,7/6.33,9.4/7,10/9.9,12.01

A D type Function with a random argument is used to define a discrete probability distribution. The Function is specified as a cumulative distribution function (CDF) with 0 as the value of the left end point and 1 the value of the right end point. When such a Function is evaluated, a random number between 0 and .999999 is taken from the random number stream and is used. The smallest X value in the Function Follower Statement that is greater than or equal to the random number is selected. The associated Y value is returned as the value of the Function.

Example

Ran1 FUNCTION RN1,D5
0,0/.2,7.2/.4,6.667/.8,9.92/1.0,10

Type E Functions

Type E - Discrete, "attribute valued" function. Each argument value or probability mass is assigned an SNA to be evaluated. A random argument is a special case.

In Function Follower Statements of E type Functions, the X Values must be Expression, and the Y Values must be Integer, Real, Name, SNA, or ParenthesizedExpression.

A type E Function is evaluated in the same way as a type D Function, except that a type E Function requires one more step. After the appropriate X value is chosen, the associated SNA (Y value) is evaluated and returned as the result of the Function.

Example

Edisc FUNCTION X$QRA,E5
1,S$Stor1/3,S$Stor2/5,S$Stor3/9,S$Stor5/10,S$Stor6

Type L Functions

Type L - List valued function. The argument value is used to determine the list position of the value to be returned.

In Function Follower Statements of L type Functions, the X Values must be Integer, and the Y Values must be Integer, Real, or Name.

The Function Follower Statements define a list of values from which the result is chosen. When the Function is evaluated, the 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 [Ctrl] + [Alt] + [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.TXT"

In this example, when the Translator encounters the INCLUDE Command, it will include the statements from the SAMPLE1.TXT Text Object in the created simulation. Since no file path is given, GPSS World assumes the file is in the Model Directory.

Action

The INCLUDE Command is an Immediate Command. It causes statements from a Text Object to be retrieved and Translated. Text Objects are plain text files. When they are used in an INCLUDE Statement they are also called Secondary Model Files.

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 Text Object, 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 Matrix Entity, Logicswitch Entity, Savevalue Entity, or an element of a Matrix Entity.

INITIAL A,B

Operands

A - Logicswitch, Savevalue, or Matrix element specified as SNA, or the name of a Matrix Entity. Operand A must have the form of an LS, X, or MX class SNA or a Matrix Name. Required. The operand must be Name, 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, or "UNSPECIFIED". The default is 0. Optional. The operand must be Null, Number, String, Name, or UNSPECIFIED.

 

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 Operand A. If Operand B is not used, a value of 1 is assigned to the entity, or element. 

If Operand B is the keyword UNSPECIFIED, the Savevalue or Matrix, or Matrix element is placed in the unassigned "Unspecified" state. This can be used to indicate missing data in a Results Matrix which is to be analyzed by the ANOVA Library Subroutine. 

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 UNSPECIFIED option cannot be used with an LS class SNA, because Logicswitch Entities do not have an unspecified state.

If Operand A specifies the name of a Matrix Entity, all elements in the matrix are placed in the state indicated by the B operand. The default is a value of 0. The MX SNA can be used in Operand A to assign elements in 2 dimensional matrices, but you will need to use a PLUS Language assignment for matrices of more than 2 dimensions. To place such elements in the UNSPECIFIED state, you can INITIALize a Savevalue Entity to UNSPECIFIED and use PLUS to complete the assignment.

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.

Examples

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.

INITIAL MainResult,UNSPECIFIED

This Command prepares the previously defined Matrix Entity named MainResult for use in an experiment which may have missing data.

 

Special Restrictions

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

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

 You cannot use UNSPECIFIED to initialize a Logicswitch.

 

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

Y_ EQU 0.0

This example defines a coupled system of ordinary differential equations (ODEs) whose solution is X_=cos(Y_VAR) and Y_=-sin(X_VAR). The expressiions in the INTEGRATE Commands are used as the derivatives with respect to time. The initial values of the continuous variables are set by the EQU Commands. When the simulation runs, the integrations are performed automatically between discrete time instants.

A threshold is used for the User Variable X_. When this variable crosses the value 0.707, from either direction, a new Transaction is created and scheduled for the Block labeled WAKE_UP.

X is an SNA Class, and therefore cannot be used as a Named Value. Here we use X_. Itís always safe to create names if they include an underscore character.

 

Action

The INTEGRATE 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 INTEGRATE Command is performed, the data structures are set up so that a User Variable will be integrated automatically when the system clock advances. Integrations are done using a modified fifth order Runge Kutta Fehlberg method (RK4(5)), with a variable step size.

All User Variables involved in an integration must be given initial values before the simulation runs. You can do this with EQU Commands or by Assignment Statements in PLUS Procedures.

Operand A of the INTEGRATE Command is used for the derivative of the User Variable with respect to time. It can be very simple or quite complex. In the latter case you may want to define a PLUS Procedure and place a Procedure Call in the parenthesized Expression used for Operand A.

Each INTEGRATE Command may have zero, one, or two numeric thresholds. Operands B and C can be used to specify threshold 1, and/or operands D and E can be used to specify threshold 2. In either case, the first operand of the pair determines the value of the threshold, the second indicates the Block which will receive generated Transactions.

During the integration, if the value of the integrated variable crosses the value of a threshold, from either direction, a new Transaction is created. It is given a priority of 0, and is scheduled to enter the Block associated with that threshold in the INTEGRATE Command. The Transactionís time of entry into the model is estimated by a linear interpolation. To improve accuracy, the integration ministep is decreased when a threshold is imminent.

Thresholds may be constants, parenthesized Expressions, or even Procedure Calls. In addition, the Transactions generated by a threshold crossing may be used to move the threshold.

Integrations are automatically begun in the active, or "enabled" state. However, you can turn an integration on or off while a simulation is running by using one or more INTEGRATION Blocks. This is discussed in Chapter 7.

Phases

Simulations run in alternate continuous and discrete phases. At any instant where events are scheduled, the simulation runs in a discrete phase. The clock does not advance within an instant in a discrete phase. Between instants, the simulation runs in a continuous phase, during which the integrations proceed in small time increments called ministeps. Plotted integration variables report intermediate values at the end of ministeps.

When a threshold crossing generates a Transaction, the simulation goes into a discrete phase. In this manner, the continuous and the discrete phases can be closely interrelated. Conversely, User Variables can be assigned new values in a discrete phase even if they are being integrated. You can do so using an EQU Command, or a PLUS Assignment Statement. If you want such assignments to occur within the running of the simulation, you must define a PLUS Procedure that makes the assignment. For example, if you defined a PLUS Procedure as

        PROCEDURE SetPop(PopLevel) BEGIN
                Foxes = PopLevel ;
       
END ;

you could reinitialize the Foxes User Variable by entering a PLUS Block, such as

        PLUS (SetPop(200))

or by using a parenthesized Expression that invokes SetPop() in some other kind of Block.

Integration Error

A Model Setting called the Integration Tolerance is used to limit the local truncation error of each individual integration. If you make the tolerance smaller, the integrations will take longer, but will be more accurate. This is set in the Simulate Page of the Model Settings Notebook.

                                CHOOSE View / Settings / Model

then select the Simulate page. Then fill in the desired value in the entry box marked Integration Tolerance. The installation default is 10-6.

Continuous state modeling is also discussed in Chapter 2.

Related Block

 INTEGRATION - Enables or disables the integration of a User Variable.

Related Windows

 Expressions Window - Online view of values of Expressions.

 Plot Window - Online view of a plot of up to 8 Expressions.

Restrictions

 If either Operand B or Operand C is used, both must be used.

 If either Operand D or Operand E is used, both must be used.

 

MATRIX

A MATRIX Command defines a GPSS Matrix Entity.

NAME MATRIX A,B,C,D,E,F,G

Label / Operands

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

A - Unused field (for compatibility with older GPSS implementations).

B - Required. Maximum count of elements in first dimension. Number of matrix rows. The operand must be PosInteger.

C - Required. Maximum count of elements in second dimension. Number of matrix columns. The operand must be PosInteger.

D - Optional. Maximum count of elements in third dimension.The operand can be PosInteger.

E - Optional. Maximum count of elements in fourth dimension. The operand can be PosInteger.

F - Optional. Maximum count of elements in fifth dimension. The operand can be PosInteger.

G - Optional. Maximum count of elements in sixth dimension. The operand can be PosInteger.

 

Example

Inventory MATRIX ,1000,5

This Command defines a Matrix Entity named Inventory with 1000 rows and 5 columns.

 

Action

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

A MATRIX Command causes a Matrix Entity to be created in the simulation. A Matrix Entity must be defined specifically in a MATRIX Command before it can be referenced.

The A Operand serves no purpose in GPSS World because there is no need to specify the precision of the Matrix elements. This operand is retained only for compatibility with older GPSS versions.

A Matrix Entity can have up to 6 dimensions. However, only the first two dimensions can be accessed in an MSAVEVALUE Block. In this case, all missing coordinates are presumed to be 1.

PLUS Procedures can access all elements of any matrix. If you need to use matrices of more than 2 dimensions, you will have to create one or more PLUS Procedures to access them. Matrices defined in a MATRIX Command have global scope and are known to all PLUS Procedures. In addition, temporary matrices with local scope can be created for the duration of a PLUS Procedure invocation. This is discussed further in Chapter 8.

Matrix Entities are never deleted from the simulation. However, a Matrix Entity may be redefined by another MATRIX Command.

When a Matrix Entity is first created, or when a CLEAR ON Command is used, all elements are given the value of 0. However, you can use the INITIAL Command to give elements the state of UNSPECIFIED. This is useful when you are using a Matrix Entity to hold the results of an experiment. When you pass such a Result Matrix to the ANOVA Library Procedure, the UNSPECIFIED elements will be treated as missing data, instead of results of 0.0.

  

Memory Restriction

 Matrix Entities are limited to the maximum memory request in the Model Setting Notebook. This is discussed in Chapter 2.

Related SNA

 MXentnum(m,n) - Matrix Entity element. The value in row m, column n of matrix entnum is returned. Only names, integers or P class SNAs can be used for row and column values.

Related Block

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

Related Commands

 INITIAL - initialize a Matrix Entity to 0 or UNSPECIFIED.

 CLEAR - initialize a Matrix Entity to 0..

Related Windows

 A Matrix Entity can be viewed in an online Matrix Window. This window shows a 2 dimensional cross section of any matrix.

 Any SNA can be viewed in an Expressions or Plot Window.

 

QTABLE

A QTABLE Command initializes a queue time frequency distribution table.

NAME QTABLE A,B,C,D

Label/Operands

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

A - Name of Queue Entity. Required. The operand must be PosInteger or Name.

B - Upper limit of first frequency class. The maximum argument which causes the first frequency class to be updated. Required. The operand must be Number or String.

C - Size of frequency classes. The difference between the upper limit and lower limit of each frequency class. Required. The operand must be Number or String.

D - Number of frequency classes. The operand must be PosInteger.

 

Action

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

By using a QTABLE Command, statistics will be kept automatically for Transactions which enter QUEUE and DEPART Blocks. The Queue Entity being measured is specified in the A Operand of the QTABLE definition Command.

When a Transaction enters a QUEUE Block which refers to a Queue Entity which has one or more Qtables, a special timestamp is created and kept with the Transaction. To collect a data item, a Transaction must enter a DEPART Block which refers to this same Queue Entity. When such a DEPART Block is entered, a table argument is calculated by subtracting the old saved timestamp from the current system time. If the calculated table argument is less than or equal to the B Operand of the QTABLE Command, the first frequency class of the table is chosen. If the table argument does not fit into the first frequency class, the class is chosen by dividing the argument value by the C Operand of the QTABLE Command. The lower limit of a frequency class is included in the previous class. If the table is not large enough to accommodate this value, the last frequency class in the table is chosen.

Then the integer in the chosen frequency class and the total count for all classes is incremented by the B Operand of the DEPART Block. Finally, accumulators for the mean and standard deviation of the Qtable argument are updated.

A Qtable Entity can be redefined by a second QTABLE Command with the same label as the first.

Example

WaitTimes QTABLE WaitingLine,100,100,10

In this simple example, the distribution of the QUEUE-DEPART intervals is entered into the table named WaitTimes. The QTABLE Command creates a table with a total of 10 frequency classes.

 

All time intervals at or below 100 cause the first frequency class of the table to be updated. Normally this means that the integer for the first frequency class is increased by 1, However, a weighting factor is available in the B Operand of the DEPART Block. This has the effect of adding the weighting factor to the integer for the frequency class. The weighting factor applies to the mean and standard deviation as well, having the same effect as multiple entries into the DEPART Block.

If the time interval of the Transaction is greater than 900, it will be placed in the tenth, and last, frequency class. If the time interval falls in neither the first nor the last frequency class, it is used to choose from the equally spaced frequency classes from the second to the ninth.

For example, if the time interval is 290, the third frequency class would be updated.

The statistics collected in a Qtable Entity are printed in the standard report. A sample report is in Chapter 11.

Related SNAs

 QEntnum - Current queue content. The current count value of queue Entnum.

 QAEntnum - Average queue content. The time weighted average count for queue Entnum.

 QCEntnum - Total queue entries. The sum of all queue entry counts for queue Entnum.

 QMEntnum - Maximum queue contents. The maximum count (high water mark) of queue Entnum.

 QTEntnum - Average queue residence time. The time weighted average of the count for queue Entnum.

 QXEntnum - Average queue residence time excluding zero entries. The time weighted average of the count for queue Entnum not counting entries wit a zero residence time.

 QZEntnum - Queue zero entry count. The number of entries of queue Entnum with a zero residence time.

Memory Restriction

 Qtable Entities are limited to the maximum memory request in the Model Setting Notebook. This is discussed in Chapter 2.

Related Blocks

 QUEUE - register statistics from the beginning of a waiting time.

 DEPART - register statistics for the end of a waiting time using an optional weighting factor.

Related Windows

 A Qtable Entity can be viewed in an online Table Window.

 Any SNA can be viewed in an Expressions or Plot Window.

 

 

REPORT

A REPORT Command causes a report to be created immediately.

REPORT A,B

Operands

A - Must be Null.

B - NOW, to write a Standard Report, immediately. Optional. the operand must be NOW or Null.

 

Example

REPORT

This Command directs GPSS World to create a Standard Report immediately.

REPORT ,NOW

This Command is kept for campatibility purposes. As in the previous example, it causes a Standard Report to be created immeditely.

 

 

Action

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

When a Simulation Object encounteres a REPORT command it immediately creaets a Standard Report according to the "In Windows" Setting of the Simulation Object. This can be found on the Reports page of the Settings Notebook.

If the "In Windows" option is set, the Simulation Object creates a new Report Object containing the new Standard Report. It may then be saved in a file or discarded. If "In Window" is not set, the Standard Report is created, given a sequential serial number, and placed in a file.

REPORT no longer uses operand A, and always assumes the NOW Operand is used in Operand B. It ignores the "Create Standard Report" Setting, which is used for automatic Standard Report creation, and it ignores operand B of the START Command used for the current simulation.

You do not normally need to use the REPORT Command. Reports are managed automatically according to the Configuration Settings. This is discussed in Chapter 11.

Related Setting

 Standard Reports are normally sent to Report Windows but can be sent directly to file. This is controlled by the "In Window" setting in the Reports Page of the Settings Notebook.

 

RESET

A RESET Command marks the beginning of a measurement period.

RESET

Operands

None.

 

Action

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

A RESET Command initializes the statistics accumulators without removing Transactions from the simulation. This is useful for replication of simulation experiments, and for throwing away data representing a transient startup period.

RESET sets the measurement period start time to equal the current system clock, and then initializes the statistics accumulators for Facilities, Queues, and Storage Entities. This provides for the start of a new time window used in the gathering of statistics.

A RESET Command does not remove Transactions form the simulation, whereas a CLEAR Command does

RESET has no effect on the random number generators, the system clock or the numbering of Transactions.

When a RESET Command is performed.

 Space-time products of Facilities, Storages, Queues, and Userchain Entities are set to 0.

 Total counts are set equal to current counts.

 Minimum and maximum values are set equal to current content in Queues, Userchains, and Storage Entities.

 Random number generators are not reset.

 The Relative Clock (time since last RESET) is set to 0.

 Table statistics are reset to 0.

 

 

RMULT

An RMULT Command sets the seeds for random number generators.

RMULT A,B,C,D,E,F,G

 

Operands

A - Seed for random number generator number 1. Optional. The operand must be Null, or PosInteger.

B - Seed for random number generator number 2. Optional. The operand must be Null, or PosInteger.

C - Seed for random number generator number 3. Optional. The operand must be Null, or PosInteger.

D - Seed for random number generator number 4. Optional. The operand must be Null, or PosInteger.

E - Seed for random number generator number 5. Optional. The operand must be Null, or PosInteger.

F - Seed for random number generator number 6. Optional. The operand must be Null, or PosInteger.

G - Seed for random number generator number 7. Optional. The operand must be Null, or PosInteger.

 

Example

RMULT ,,111

In this example, random number generator 3 is initialized with a seed of 111.

 

Action

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

The RMULT Command initializes up to 7 random number generators with new seeds. Only random number generators numbered 7 or below can be controlled by an RMULT Command. However, since the default seed of a random number generator is its entity number, you can in fact have any number of random number generators, and you can choose the initial seed of each. After the first simulation run the seeds can only be controlled easily with the RMULT Command on generators 1-7.

You can select which random number stream GPSS World uses it to calculate random time increments in ADVANCE and GENERATE Blocks, in Fractional Mode TRANSFER and TRANSFER PICK Blocks and to resolve the scheduling of time ties. This is set in the "Random" page of the Model Settings Notebook.

                                CHOOSE View / Settings / Model

then select the Random page. Then fill in the desired Random Number Stream Entity number in the corresponding entry boxes. The installation default is to use Random Number Stream number 1 in each case.

Since GPSS World uses multiplicative congruential random number generators, it is possible to control pairs of random number streams for variance reduction purposes. This is done by matching the seeds of the random number generators. If s is the seed for the first random number generator, then a choice of 2147483647-s for the seed of the second random number generator will generate a stream of random numbers with antithetic properties.

Special Restriction

 Random number seeds must be positive integers.

Related SNA

 RNEntnum - Random number. RNEntnum returns a random integer 0-999 from the random number generator Entnum.

Related Window

 The ANOVA Window can perform Analysis of Variance and calculate confidence intervals.

 

 

SHOW

A SHOW Command sends an Expression for evaluation by the Simulation Object, and writes the result in the Status Line.

SHOW X

Operand

X - Expression.

 

Example

SHOW 2#LOG(Q$Barber)

This Command finds the natural logarithm of the SNA Q$Barber, doubles it, and writes the result in the Status Line of the Model Window.

Action

The SHOW Command is an Immediate Command. It is performed when received by the Simulation Object.

The SHOW Command evaluates an Expression in the context of the simulation, and writes the result in the Status Line of the Model Window. Additional messages are sent to any open Journal Windows.

The rules for evaluating Expressions may be found in Section 3.4. Expressions must be well-formed according to the rules of elementary algebra. You may used 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. If there is no Active Transaction because no simulation has been started, an error message will be written. Names which have not been explicitly assigned values cannot be used in Expressions. To do so you must assign a value by an EQU Command before the Expression is evaluated.

Examples

SHOW C1

shows the system clock in the Status Line.

 

SHOW 4#(SQR(2)+SIN(C1))

shows the result of 4 times the sum of the square root of 2 and the sine of the system clock.

 

SHOW N1^W$Chair

shows the result of raising the number of Transactions to have entered Block 1 to the power of the number of Transactions waiting at the Block named Chair.

Special Restrictions

 Some SNAs cannot be evaluated unless there is an Active Transaction.

 SHOW displays up to 38 characters or digits.

Related Windows

 Any valid Expression can be viewed in an Expressions or Plot Window.

 

 

START

A START Command begins a simulation.

START A,B,C,D

Operands

A - Termination count. Required. The operand must be PosInteger.

B - Printout operand. NP for "no printout". Default is to print a standard report. Optional. The operand must be NP or Null.

C - Not used. Kept for compatibility with older dialects of GPSS.

D - Chain printout. 1 to include the CEC and FEC in the standard report. Optional. The operand must be Null, or PosInteger.

 

Action

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

The START Command is used to set up and begin the actual simulation. The simulation does not end until the termination count, which is set by Operand A, reaches zero or becomes negative. TERMINATE Blocks are used to reduce the termination count.

The simulation may stop short if a HALT Command is issued, or if a Stop Condition is detected.

Operands B and D are used to control automatic report generation. If Operand B is not used, an standard report is written. If Operand B is NP, which stands for "no printout", no standard report is written. If Operand D is nonzero, the Current Events Chain (CEC) and the Future Events Chain (FEC) are reported. Otherwise they are not reported. A further discussion of the control and contents of the standard report may be found in Chapters 11 and 12.

Operand C is kept for compatibility with older versions of GPSS. It was used as a "snap" count to put out a report periodically. This Function is available by using more than one START and REPORT Command.

When a START Command is performed:

 The Termination Count is set.

 Any generate Blocks marked "not started" are primed with a single Transaction.

 Random number generators are not reset.

 If time is 0, a RESET of the statistics accumulators is performed. See the discussion of the RESET Command in this chapter.

Example

START 1000,,,1

In this example, the Termination Count is set to 1000 and the simulation is started. When the Termination Count reaches zero or becomes negative (by reduction due to TERMINATE Blocks in the simulation), a standard report is written which includes information on the Current Events Chain (CEC) and the Future Events Chain (FEC).

 

 

Related SNA

 TG1 - Termination count.

Related Blocks

 TERMINATE - destroy Transaction and optionally reduce the termination count.

 

 

STEP

A STEP Command causes the simulation to proceed a specified number of Block entries.

STEP A

Operand

A - Block entry count. Required. A must be a positive integer, more formally, PosInteger.

Example

STEP 1

This Command causes the simulation to proceed exactly one Block entry and then to stop. The simulation is then said to be in the "Halted" state.

Action

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

The STEP Command causes the Simulation Object to simulate the specified number of Block entries. When a simulation reaches the required number of Block entries, the Simulation Object sends a message to the Status Line, and any Journal Windows that are open. The message gives the time, the Active Transaction number, the current Block of the Active Transaction, and the next scheduled Block of the Active Transaction.

A simulation started by a STEP Command does not end when the termination count goes to zero, it ends when the required number of Block entries have occurred.

When a STEP Command is performed:

 The termination count is not set.

 Any generate Blocks marked "not started" are primed.

 Random number generators are not reset.

Hot Key

A STEP 1 Command can be sent to the simulation by pressing the [Ctrl] + [Alt] + [1]  key combination. A GPSS World window must have the input focus.

Related Windows

 The stepping of simulations can be viewed dynamically in the Blocks Window.

 

 

STOP

A STOP Command sets or removes a Stop Condition.

STOP A,B,C

Operands

A - Transaction number. A must be a positive integer. If the A Operand is omitted, any Transaction number will satisfy the condition. Optional. The operand must be Null, or PosInteger.

B - Block number. If the B Operand is omitted, any Block will satisfy the condition. Optional. The operand must be Null, Name, or PosInteger.

C - ON or OFF. If the C Operand is omitted, ON is assumed. Optional. The operand must be ON, OFF or Null.

Example

STOP 100,52

This Command inserts a Stop Condition which will cause a running simulation to stop when Transaction number 100 attempts to enter Block number 52.

Action

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

The STOP Command with the ON option inserts a Stop Condition into the simulation but does not cause the simulation to start. A subsequent START, STEP, or CONTINUE must be entered.

When a simulation reaches a Stop Condition, the Simulation Object sends a message to the Status Line, and any Journal Windows that are open. The message gives the time, the Active Transaction number, the current Block of the Active Transaction, and the next scheduled Block of the Active Transaction.

When a Stop Condition is detected, established Stop Conditions remain in force. If a CONTINUE Command is issued, the CONTINUE Command skips the original Stop Condition but does not remove it. If the same condition occurs again, the simulation will stop again. Stop Conditions must be removed explicitly by entering a new STOP Command containing the OFF option. They are also removed when a model is Translated.

STOP Commands can be sent by using mousing operations in the Blocks Window. This is discussed in more detail in Chapter 5.

If you skip the A Operand, any Transaction will satisfy the Stop Condition. If you skip the B Operand, any Block will satisfy the Stop Condition. A STOP Command with no operands will cause the simulation to stop immediately.

Any number of Stop Conditions may be established.

The STOP Command with the OFF option removes any existing Stop Conditions that satisfy the Transaction and Block conditions specified by operands A and B.

Examples

STOP

With no operands, the STOP Command will cause any subsequent simulation to stop immediately.

STOP ,,OFF

This Command removes all Stop Conditions from the simulation.

STOP 2

This Command will cause the simulation to stop when Transaction 2 becomes the Active Transaction.

 

STOP ,Chair

This Command will cause the simulation to stop when any Transaction attempts to enter the Block at location CHAIR.

 

STOP ,Chair,OFF

This Command will remove all Stop Conditions that specify Chair as the Block name.

 

Related Windows

 Mouse operations can be used in the Blocks Window to place and remove Stop Conditions.

 

 

STORAGE

A STORAGE Command defines a Storage Entity.

NAME STORAGE A

Label / Operand

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

A - Total storage capacity. Required. The operand must be PosInteger.

 

Example

MotorPool STORAGE 20

This Command defines a Storage Entity named MotorPool with a total capacity of 20 units.

 

Action

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

A STORAGE Command defines a Storage Entity in the simulation. When a Transaction attempts to enter an ENTER Block, its storage demand is compared with the available storage at the Storage Entity. If the demand can be granted, the Transaction is allowed to enter the ENTER Block and the available storage capacity of the Storage Entity is reduced. If the Transactionís demand cannot be satisfied, the Transaction comes to rest in the simulation on the Delay Chain of the Storage Entity. Storage Entities are explained in more detail in Chapter 4.

A Storage Entity may be redefined by entering a new STORAGE Command with the same label as the old one.

If you must refer to Storage Entities by number, not name, an EQU Command should precede the STORAGE definition. This is necessary if you wish to reference a range of STORAGES in a SELECT or COUNT Block.

 

Related SNAs

 REntnum - Unused storage capacity. The storage content (or "token" spaces) available for use by entering Transactions at storage Entnum.

 SEntnum - Storage in use. SEntnum returns the amount of storage content (or "token" spaces) currently in use by entering Transactions at storage Entnum.

 SAEntnum - Average storage in use. SAEntnum returns the time weighted average of storage capacity (or "token" spaces) in use at storage Entnum.

 SCEntnum - Storage use count. Total number of storage units that have been entered in (or "token" spaces that have been used at) storage Entnum.

 SEEntnum - Storage empty. SEEntnum returns 1 if storage Entnum is completely unused, 0 otherwise.

 SFEntnum - Storage full. SFentnum returns 1 if storage Entnum is completely used, 0 otherwise.

 SREntnum - Storage utilization. The fraction of total usage represented by the average storage in use at storage Entnum. SREntnum is expressed in parts-per-thousand and therefore returns an real value 0-1000, inclusively.

 SMEntnum - Maximum storage in use at storage Entnum. The "high water mark".

 STEntnum - Average holding time per unit at storage Entnum.

 SVEntnum - Storage in available state. SVEntnum returns 1 if storage Entnum is in the available state, 0 otherwise.

 

Related Blocks

 ENTER - take or wait for available storage space.

 LEAVE - release storage space for use by other Transactions.

Related Windows

 GPSS storage entities are visible in the Storages Window.

 Any SNA can be viewed in an Expressions or Plot Window.

 

 

TABLE

A TABLE Command initializes a frequency distribution table.

NAME TABLE A,B,C,D

Label / Operands

NAME - Entity Label for this entity. Required. The field must be Name. The length of a Table name is limited to 32 characters.

A - Table argument. Optional. The data item whose frequency distribution is to be tabulated. The operand must be Name, Number, String, ParenthesizedExpression, or SNA. Ignored by ANOVA, but must be specified when used by TABULATE Blocks.

B - Upper limit of first frequency class. The maximum argument which causes the first frequency class to be updated. Required. The operand must be Number or String.

C - Size of frequency classes. The difference between the upper limit and lower limit of each frequency class. Required. The operand must be Number or String.

D - Number of frequency classes. Required. The operand must be PosInteger.

 

Action

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

A TABLE Command is used to define a GPSS Table Entity for collecting a frequency distribution, its cumulative relative frequencies, its mean, and its standard deviation. 

In addition to general purpose data collection, a Table Entity can be used to tabulate the residuals in an Analysis of Variance. This specialized use is discussed below.  

To collect a data item, a Transaction must enter a TABULATE Block which refers to this TABLE. When a TABULATE Block is entered, the table argument (Operand A in the TABLE Command) is evaluated. If it is less than or equal to the B Operand of the TABLE Command, the first frequency class of the table is chosen. If the table argument does not fit into the first frequency class, the class is chosen by dividing the argument value by the C Operand of the TABLE Command. The lower limit of a frequency class is included in the previous class. If the table is not large enough to accommodate this value, the last frequency class in the table is chosen.

Then the integer in the chosen frequency class and the accumulated count is incremented by the B Operand of the TABULATE Command. The default increment is 1.

Finally, accumulators for the mean and standard deviation of the table are updated.

A Table Entity can be redefined or reinitialized by a second TABLE Command with the same label as the first.

Example

SalesTable TABLE P$Price,9.95,10,10

In this simple example, the distribution of the Price Parameter of Transactions is entered into the table named SalesTable. The TABLE Command creates a table with a total of 10 frequency classes.

 

All Price values at or below 9.95 cause the first frequency class of the table to be updated. Normally, this means that the integer for the first frequency class is increased by 1. However, a weighting factor is available in the B Operand of the TABULATE Block. This has the effect of adding the weighting factor to the current integer value in the appropriate frequency class. The weighting factor applies to the mean and standard deviation as well, having the same effect as multiple entries into the TABULATE Block.

If the value of the Price Parameter is greater than 89.95, the tenth, and last, frequency class will be updated. If the value of the Price Parameter falls in neither the first nor the last frequency class, it is used to choose from the equally spaced frequency classes from the second to the ninth.

For example, if the Price value is 29.49, the third frequency class would be updated.

The statistics collected in a GPSS Table Entity are printed in the standard report. An example is in Chapter 11.

 

ANOVA Residuals

 When you pass a named Results Matrix to the ANOVA Library Procedure, you can cause residuals of the Analysis to be tabulated automatically. All that you need to do is to have defined a Table Entity with the same name as the Matrix Entity with a suffix of " _RESIDUALS". For example, if you intend to use

ANOVA( MainResult, 3, 1 )

you can have the residuals tabulated automatically by defining a Table Entity such as

MainResult_Residuals TABLE ,-5,.5.20

prior to the invocation of ANOVA. 

When you do this, the ANOVA Procedure ignores Operand A of TABLE and tabulates residuals arising from the analysis of the Result Matrix. The ANOVA Table and the descriptive cell statistics appear in the Journal Window. Then, you can examine the residuals by opening a Table Window on the MainResult_Residuals Table.

 

Memory Restriction

 Table Entities are limited to the maximum memory request in the Model Settings Notebook. This is discussed in Chapter 2.

Related SNAs

 TBEntnum - Nonweighted average of entries in table Entnum.

 TCEntnum - Count of nonweighted table entries in table Entnum.

 TDEntnum - Standard deviation of nonweighted table entries in table Entnum.

Related Blocks

 TABULATE - register statistics for a data item in a Table Entity.

Related Windows

 A Table can be viewed in the online Table Window.

 Any SNA can be viewed in an Expressions or Plot Window.

 

VARIABLE

A VARIABLE Command defines an arithmetic Variable Entity.

NAME VARIABLE 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 VARIABLE 5#LOG(Q$WaitingLine)

This Command defines a Variable Entity which is to be evaluated when a V$Var1 is encountered. When this SNA is evaluated, the Expression defining the Variable Entity named Var1 is evaluated and returned as the result.

 

Action

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

When a VARIABLE 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 in a VARIABLE 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 VARIABLE 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.

 In Variable Entity evaluation in GPSS/PC Compatibility Mode, the intermediate results are truncated.

Related SNA

 VEntnum - Returns the result of evaluating an arithmetic Variable Entity Entnum.

Related Windows

 Any SNA can be viewed in an Expressions or Plot Window.

 

 [Table of Contents]