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

gpss_manual

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

ASSIGN

ASSIGN Blocks are used to place or modify a value in a Transaction Parameter.

ASSIGN A,B,C

Operands

A - Parameter number of the Active Transaction. Required. The operand must be Name, PosInteger,

ParenthesizedExpression, SNA, or SNA*Parameter, followed by +, -, or Null.

B - Value. Required. the operand must be Name, Number,

String, ParenthesizedExpression, SNA, or SNA*Parameter.

C - Function number. Optional. The operand must be Null,

Name, PosInteger, ParenthesizedExpression, SNA or

SNA*Parameter.

Examples

ASSIGN 2000,150.6

This is the simplest way to use the ASSIGN Block. The value 150.6 is assigned to Parameter number 2000 of the entering Transaction. If no such Parameter exists, it is created.

ASSIGN TEXT,"Look on my works, ye Mighty, and despair."

In this example, a string is assigned to the Parameter of the Active Transaction named TEXT. If no such Parameter exists, it is created.

ASSIGN 2000+,-3

In this example, the [+] following Operand A indicates that the value of Operand B is to be added to the original Parameter value. This Block adds a -3 to the value contained in Transaction Parameter 2000. If there is no such Transaction

Parameter, one is created and initialized to 0 before the addition. In this case, the value of the Transaction Parameter

becomes -3.

ASSIGN 2000-,-3

In this example, the [-] following Operand A indicates that the value of Operand B is to be subtracted from to the original

Parameter value. This Block subtracts a -3 from the value contained in Transaction Parameter 2000. If there is no such

Transaction Parameter, one is created and initialized to 0 before the subtraction. Then value of the Transaction Parameter becomes 3.

Action

When a Transaction enters an ASSIGN Block, the value of the

Transaction Parameter identified in the A Operand is set according to the B and C operands. A Transaction Parameter is created if necessary.

You may assign, add to, or subtract from the numeric equivalent of the Transaction Parameter’s value. If there is no C Operand, Operand B is evaluated and is used as the new value, or its numeric equivalent is used as the increment or decrement. Addition and subtraction are specified by a + or - suffix immediately following the A Operand. If there is no such suffix, Operand B is evaluated and the result is given to the value of the Transaction Parameter.

Optionally, Operand C may be used to determine the number of a function, here called a "Function Modifier". If specified, the function is evaluated, multiplied by the numerical equivalent of the evaluated B Operand, and the result is added, subtracted, or assigned to the value of the Transaction Parameter depending on the optional suffix of the A Operand. Notice that Operand C specifies a Function Entity number or name (do not precede it with an FN or FN$). If an FN class SNA is used, the GPSS Function is evaluated and the result is used to specify a second GPSS Function which is then evaluated.

Special Restriction

A must be positive, but may be followed by a + or - suffix.

Refuse Mode

A Transaction is never refused entry to an ASSIGN Block.

Related SNA

PParameter or *Parameter - Parameter value.

PParameter returns the value of Parameter Parameter. (note: e.g. P1 or *1 or P$NAME will yield the value in the Parameter 1 in the first two cases and the Parameter called NAME in the final case.)

Related Window

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

BUFFER

A BUFFER Block places the Active Transaction on the Current Events Chain behind its priority peers.

BUFFER

Operands

None.

Example

BUFFER

This example creates a Block which gives Transactions other than the Active Transaction a chance to be scheduled.

Action

When a Transaction enters a BUFFER Block, it is placed on the Current Events Chain behind Transactions of equal priority.

The Transaction scheduler tries to move the Active Transaction as far as it can in the simulation. In effect, the Transaction scheduler removes the Active Transaction from the CEC, calls the routine for the Next Sequential Block (NSB), and unless

something extraordinary occurs, replaces the Transaction on the CEC IN FRONT of its peers (i.e. same priority) on the CEC. This replacement is modified by PRIORITY and BUFFER Blocks. After a Transaction enters a BUFFER Block, it is replaced BEHIND its peers on the CEC. A more detailed discussion of Transaction scheduling is in Chapter 9.

BUFFER Blocks are used to allow newly reactivated Transactions to get ahead of the Active Transaction. It is a common occurrence that the Active Transaction enters a Block which triggers an event which must proceed to completion before the Active Transaction should proceed. It may be necessary to follow such Blocks by BUFFER Blocks in order to allow reactivated Transaction(s) to proceed immediately in the simulation. Alternately, the reactivated Transactions could be given a higher priority.

Refuse Mode

A Transaction is never refused entry to a BUFFER Block.

Related Windows

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.

CLOSE

A CLOSE Block terminates a Data Stream and retrieves its error code.

CLOSE A,B,C

Operands

A - Transaction Parameter. Optional. The operand must be

Null, Name, PosInteger, ParenthesizedExpression, SNA or SNA*Parameter.

B - Data Stream. Optional. The operand must be Null, Name,

PosInteger, ParenthesizedExpression, SNA, or

SNA*Parameter. The default is 1.

C - Alternate Destination. Optional. The operand must be Null,

Name, PosInteger, ParenthesizedExpression, SNA, or

SNA*Parameter.

Example

CLOSE Error_Parm,2

In this example, the CLOSE Block terminates the operation of

Data Stream 2 and frees all the resources associated with it.

The internal error code of Data Stream 2 is placed in

Parameter Error_Parm of the Active Transaction.

Action

A CLOSE Block shuts down a Data Stream and retrieves its error code.

If Operand A is used, it is evaluated numerically, truncated, and used as the number of a Parameter of the Active Transaction. If no such Parameter exits, one is created. The error code of the Data Stream is placed in this Parameter.

If Operand B is used, it is evaluated numerically, truncated, and used as the entity number of the Data Stream. The result must be a positive integer. If Operand B is not used, Data Stream number 1 is closed.

If Operand C is used, it is evaluated numerically, truncated, and used as the Block Entity number of an Alternate

Destination Block. When the error code of the Data Stream is nonzero, the Active Transaction proceeds to the Alternate

Destination Block after it enters the CLOSE Block.

Chapter 4 (4.16) contains a full discussion of Data Streams, including the error code descriptions, under the Section entitled

Data Streams.

Blocking Condition

The simulation is blocked while CLOSE retrieves the error code.

Special Restrictions

A and B, if specified, must be positive.

C, if specified, must be a valid Block location in the simulation.

Refuse Mode

A Transaction is never refused entry to a CLOSE Block.

Related Blocks

OPEN - Create a Data Stream.

READ - Retrieve a text line from a Data Stream.

WRITE - Send a text line to a Data Stream.

SEEK - Set the Current Line Position of a Data

Stream.

COUNT

A COUNT Block places an entity count into a Parameter of the Active Transaction.

COUNT O A,B,C,D,E Operands

O - Conditional operator or logical operator. These choices are

explained below. Required. The operator must be FNV, FV, I, LS, LR, NI, NU, SE, SF, SNE, SNF, SNV, SV, U, E, G, GE, L, LE, MIN, MAX, or NE.

A - Parameter number to receive count. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.

B - Number or name of entity at lower end of range. The entity

number of the first entity to be tested. The entity type is implicitly specified by the logical operator or by Operand E.

Required. The operand must be Name, PosInteger,

ParenthesizedExpression, SNA, or SNA*Parameter.

C - Number or name of entity at upper end of range. The entity number of the last entity to be tested. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA, or

SNA*Parameter.

D - Reference value for E Operand. Required only when in

Conditional Mode. Optional. The operand must be Null, Name,

Number, String, ParenthesizedExpression, SNA, or

SNA*Parameter.

E - SNA class name. Entity attribute specifier for Conditional

Mode tests. Required only for Conditional Mode. The type of SNA implies the entity type. You do not specify the entity number in Operand E. This is done automatically as the entity number range is searched. You may use any entity SNA class.

The operand must be Null or entitySNAclass.

Examples

COUNT SF FullCount,Warehouse1,Warehouse13

In this example, the number of full Storage Entities whose entity numbers fall between Warehouse1 and Warehouse13 and will be stored in the Transaction Parameter named FullCount. Normally, the Storage Entity Labels should be assigned contiguous integers in a set of EQU Commands.

COUNT E EmptyCount,FirstQueue,LastQueue,0,Q

In this example, the COUNT Block operates in Conditional Mode. Operand E specifies SNA class Q, which refers to a

Queue Entity. Each Queue Entity with entity number between that of FirstQueue and LastQueue is tested. Any such queue entity whose current content is 0 is counted. EmptyCount is the name of the Parameter of the Active Transaction to receive the count of "empty" Queue Entities in the specified range. Normally, the Queue Entity Labels should be assigned contiguous integers in a set of EQU Commands.

Action

When the COUNT Block is entered, the entity specified by Operand B is tested. If the entity does not exist and does not require a separate Command for its definition, a new entity is created. Thereafter, each entity in the range indicated by operands B and C is tested. An SNA is built automatically for each entity. The SNA class used to build the SNA is taken from Operand E or is specified by the logical operator.

A COUNT Block operates in either Logical Mode or in

Conditional Mode, depending on whether a logical operator or a conditional operator is used.

When a logical operator is used (defined below), Operands A,

B, and C are used. The condition specified by the logical operator is tested for the entities whose numbers fall between B and C. The count of entities in that condition is placed in the Parameter of the entering Transaction whose number or name is given by Operand A. If the Parameter does not exist, it is

created. The entity type is implied by the logical operator.

When a conditional operator is used, Operands A, B, C, D, and

E are used. Operands A, B, C, are used to specify the target

Parameter, and the range of entity numbers, as above. But now the conditional operator specifies the relationship between operands D and E that must hold for the entity to be counted.

In Conditional Mode, the SNA class is combined with the entity specifications in order to build an SNA. The entity type implied by each SNA class is given in Section 3.4. The complete SNA is built from this class and the number of the entity being tested. Each such SNA is evaluated for each entity and compared to the reference value in Operand D. If the condition set up in the conditional operator is met, the entity is counted.

Logical Operators

Either a conditional operator or a logical operator is required.

The logical operator may be FNV, FV, I, LS, LR, NI, NU, SE,

SF, SNE, SNF, SNV, SV, or U. When the logical operator is true, the entity being tested is counted. The conditions are defined as follows:

FNV - The Facility must be unavailable in order to be counted.

FV - The Facility must be available in order to be counted.

I - The Facility must be currently interrupted (preempted) in order to be counted.

LS - The Logicswitch Entity must be set (in the

"on" state) in order to be counted.

LR - The Logicswitch Entity must be reset (in the "off" state) in order to be counted.

NI - The Facility must NOT be currently interrupted (preempted) in order to be counted.

NU - The Facility must not be in use in order to be counted.

SE - The Storage must be empty in order to be counted.

SF - The Storage must be full in order to be counted.

SNE - The Storage must NOT be empty in order to be counted.

SNF - The Storage must NOT be full in order to be counted.

SNV - The Storage must NOT be available in order to be counted.

SV - The Storage must be available in order to be counted.

U - The Facility must be in use in order to be counted.

Conditional Operators

Either a conditional operator or a logical operator is required.

The conditional operator may be E, G, GE, L, LE, MAX, MIN, or

NE. The conditions are defined as follows:

E - The value of the automatic SNA must be equal to the reference value specified by

Operand D for the entity to be counted.

G - The value of the automatic SNA must be greater than the reference value specified by Operand D for the entity to be counted.

GE - The value of the automatic SNA must be greater than or equal to the reference value specified by Operand D for the entity to be counted.

L - The value of the automatic SNA must be less than the reference value specified by Operand D for the entity to be counted.

LE - The value of the automatic SNA must be less than or equal to the reference value specified by Operand D for the entity to be counted.

MAX - The value of the automatic SNA must be equal to the greatest of all such SNAs, for the entity to be counted.

MIN - The value of the automatic SNA must be equal to the least of all such SNAs, for the entity to be counted.

NE - The value of the automatic SNA must be unequal to the reference value specified by Operand E for the entity to be counted.

Special Restrictions

D and E are required if O is a conditional operator.

When evaluated, C must be greater than or equal to B.

The number of tested entities must be less than

32768.

Refuse Mode

A Transaction is never refused entry to a COUNT Block.

Related Windows

Facilities Window - Online view of Facility Entity dynamics.

Logicswitches Window - Online view of

Logicswitch Entity dynamics.

Storages Window - Online view of Storage

Entity dynamics.

DEPART

A DEPART Block registers statistics which indicate a reduction in the content of a Queue Entity.

DEPART A,B

Operands

A - Queue Entity name or number. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA or

SNA*Parameter.

B - Number of units by which to decrease content of the Queue Entity. Default value is 1. Optional. The operand must be Null,

Name, PosInteger, String, ParenthesizedExpression, SNA, or

SNA*Parameter.

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