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

gpss_manual

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

Subroutine Mode

When the A Operand is SBR, the TRANSFER Block operates in "Subroutine Mode". In Subroutine Mode, the Active

Transaction always jumps to the location specified by the B

Operand. The location of the transfer Block is placed in the

Parameter specified in Operand C.

TRANSFER SBR,New_Place,Placemarker

When a Transaction enters this TRANSFER Block, it is immediately scheduled for the Block at location New_Place. The location of the TRANSFER Block is placed in the Parameter named Placemarker. If there is no such Parameter, it is created.

To return from the subroutine, use a TRANSFER Block in

Parameter Mode as shown above.

Simultaneous Mode

When the A Operand is SIM, the TRANSFER Block operates in

"Simultaneous Mode". In Simultaneous Mode, the Active Transaction jumps to one of two locations depending on the

Delay Indicator of the Transaction. If the Delay Indicator is set, the Transaction jumps to the location specified by the C Operand and the Delay Indicator is reset (turned off). If the Delay Indicator is reset (off), the Transaction jumps to the location specified by the B Operand.

The Delay Indicator of a Transaction is set when the Transaction is refused by a Block. The Delay Indicator remains set until the Transaction enters a Simultaneous Mode TRANSFER Block.

TRANSFER SIM,Nodelay_Place,Delay_Place

When a Transaction enters this TRANSFER Block, it is immediately scheduled for the Block at location DELAY_PLACE if its Delay Indicator is set, or

NODELAY_PLACE if it is reset. After the transfer, the Delay Indicator is always reset.

TRANSFER SIM is rarely used. It is much more efficient to us a

BOOLEAN VARIABLE in a Refuse Mode TEST Block when you wish to coordinate the state of a number of entities. TRANSFER SIM was originally developed before BOOLEAN VARIABLES had been added to the GPSS language.

Special Restrictions

In All Mode, Operand C must be greater than

Operand B., and if D is used (C-B) must be an even multiple of D.

All calculated Transaction destinations must be valid Block locations.

In Both Mode or All Mode it is possible to waste a lot of computer time on unsuccessful testing.

You may want to place Transactions on a User

Chain until the test is likely to be successful. This can be done by using LINK and UNLINK Blocks.

Refuse Mode

A Transaction is never refused entry by a TRANSFER Block. If a Transaction becomes blocked by refusal of destination

Blocks, it remains in the TRANSFER Block.

Related Windows

Blocks Window - Online view of Block 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.

UNLINK

An UNLINK Block removes Transactions from the User Chain of a Userchain Entity.

UNLINK O A,B,C,D,E,F

Operands

O - Relational operator. Relationship of D to E for removal to

occur. These choices are explained below. Optional. The operator must be Null, E, G, GE, L, LE or NE.

A - User Chain number. User Chain from which one or more

Transactions will be removed. Required. The operand must be

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

B - Block number. The destination Block for removed

Transactions. Required. The operand must be Name,

PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.

C - Removal limit. The maximum number of Transactions to be removed. If not specified, ALL is used. Optional. The operand must be ALL, Null, Name, PosInteger,

ParenthesizedExpression, SNA, or SNA*Parameter.

D - Test value. The member Transaction Parameter name or

number to be tested, a Boolean variable to be tested, or BACK to remove from the tail of the chain. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression,

SNA, SNA*Parameter or BACK.

E - Reference value. The value against which the D Operand is compared. Optional. The operand must be Null, Name,

Number, String, ParenthesizedExpression, SNA, or

SNA*Parameter. Operand E is not used if Operand D is a Boolean Variable.

F - Block number. The alternate destination for the entering Transaction. Optional. The operand must be Null, Name,

PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.

Example

UNLINK OnHold,Reentry,1

This is the simplest way to use the UNLINK Block. The first Transaction at the head of the Userchain Entity named

OnHold, if any, is taken off the chain and is directed to the

Block labeled Reentry. It is put on the CEC behind

Transactions of the same priority. The Transaction entering the

UNLINK Block proceeds to the Next Sequential Block.

Action

An UNLINK Block removes Transactions from a User Chain and directs them to a new Block. Transactions can be selected for removal, and a limit can be imposed on the number of Transactions removed. If there are no Transactions on the chain when the UNLINK Block is entered, the Link Indicator of the User Chain is reset. Also, the Transaction entering the

UNLINK Block may be redirected according to the optional F

Operand.

You may limit the number of Transactions to be removed from the User Chain by specifying the C Operand. If Operand C is omitted, ALL is assumed.

You may test each Transaction for removal by using the relational operator and/or operands D and E, both of which are evaluated numerically.

Operands D and E and the conditional operator are optional. When they are omitted, all Transactions are removed from the front of the chain, until the chain is exhausted or the limit count (Operand C) is reached.

You can use one of 3 options for Operand D. Operand D can be a Boolean variable, a Parameter number, or the word

BACK. If Operand D is a Boolean variable, it is evaluated with respect to the chained Transaction, and if the result is nonzero, the chained Transaction is removed. If Operand D is BACK, Transactions are removed from the rear of the User Chain until the limit count is reached. Otherwise, the operand is evaluated with respect to the User Chain member Transaction and used as a Parameter number, whose value is returned from the User Chain member as the final result. This final value is compared to the result of evaluating Operand E.

If D specifies a Parameter and E is not used, a Parameter of the User Chain Transaction is compared to the same

Parameter of the Active Transaction. If they are equal, the chained Transaction is removed from the chain.

Operand E is used if and only if the relational operator is used.

In this case, Operand D is required as well. The User Chain is scanned from the front. Each Transaction, up to the limit count

(Operand C), is removed if Operand D bears the same relationship to Operand E as is specified by the relational operator. If Operand E is a Transaction related SNA, it is evaluated with respect to the Active Transaction.

You may use the relational operator to specify the relationship between the Transaction attribute (Operand D) and the reference value (Operand E) which will initiate a removal of the Transaction. The default for the relational operator is E for equality. If you use no relational operator, but you use Operand D and Operand E, the values must be equal for the Transaction to be removed from the chain.

The F Operand is used to specify an alternate destination to be taken by the entering Transaction when the limit count (Operand C) cannot be reached, or when no Transactions can be removed from the User Chain. If the F Operand is not used, the entering Transaction always goes to the Next Sequential

Block.

Userchain Entities have a self-contained gate called a Link

Indicator. When it is off (reset), LINK Blocks which have a C

Operand will not place an entering Transaction on the User

Chain. The "gate" to the User Chain is "closed" when the Link

Indicator is off (reset).

The Link Indicator is manipulated by both LINK and UNLINK

Blocks. It is turned off when an UNLINK Block finds the User

Chain empty. This condition may represent a case where the next Transaction to arrive should not wait (on the User Chain).

The Link Indicator represents the busy condition of a hypothetical resource. You can use LINK and UNLINK Blocks to handle the queuing on such a resource. A further discussion of the Link Indicator may be found in the description of LINK

Blocks in this chapter.

Relational Operators

The relational operator may be E, G, GE, L, LE, or NE. If no relational operator is used, E (equality) is assumed. When the relationship is true and the limit condition has not been reached, the Transaction being tested is removed from the User Chain. The relationships are defined as follows:

E - The Transaction attribute specified by Operand D must be equal to the reference value specified by Operand E for the

Transaction to be removed from the chain.

G - The Transaction attribute specified by Operand D must be greater than the reference value specified by Operand E for the

Transaction to be removed from the chain.

GE - The Transaction attribute specified by Operand D must be greater than or equal to the reference value specified by Operand E for the Transaction to be removed from the chain.

L - The Transaction attribute specified by Operand D must be less than the reference value specified by Operand E for the

Transaction to be removed from the chain.

LE - The Transaction attribute specified by Operand D must be less than or equal to the reference value specified by

Operand E for the Transaction to be removed from the chain.

NE - The Transaction attribute specified by Operand D must be unequal to the reference value specified by Operand E for the Transaction to be removed from the chain.

Special Restrictions

A, B, C, and F, if specified, must be positive.

B and F, if specified, must be Block locations in the simulation.

If Operand D is used but is neither a BV class

SNA or BACK, then you must use Operand E.

If Operand D is BACK or a Boolean variable, then you must use neither Operand E or a relational operator.

If you use a relational operator, you must use operands D and E. D must be used, but must not be a Boolean variable.

If you use Operand E you must use Operand D.

Operand D cannot be the literal constant 0.

Refuse Mode

A Transaction is never refused entry to an UNLINK Block.

Related SNAs

CAEntnum - Average Userchain content. The time weighted average number of chained

Transactions for Userchain Entnum.

CCEntnum - Total Userchain entries. The count of all Transactions chained to Userchain Entnum.

CHEntnum - Current Userchain content. The current number of Transactions chained to Userchain Entnum.

CMEntnum - Maximum Userchain content. The maximum number of Transactions chained to Userchain Entnum. The "high water mark".

CTEntnum - Average Userchain residence time.

The average duration of Transactions at Userchain Entnum.

Related Window

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

UNTRACE

An UNTRACE Block turns off the Trace Indicator of the Active Transaction.

UNTRACE

Operands

None

Example

UNTRACE

In this example, all Transactions passing through an UNTRACE Block will have their Trace Indicators unset. These Transactions will no longer produce trace messages as they move from Block to Block.

Action

When a Transaction enters a UNTRACE Block its Trace

Indicator is turned off. Thereafter, no Block entry traces will be recorded on behalf of the Transaction unless it enters a

TRACE Block.

Trace messages are sent to all open Journal Windows.

Refuse Mode

A Transaction is never refused entry to an UNTRACE Block.

Related Windows

Journal Window - Record session events.

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.

WRITE

A WRITE Block passes a text line to a Data Stream.

WRITE A,B,C,D

Operands

A - Text Line. Required. Evaluated as a string. The operand must be Name, Number, String, ParenthesizedExpression,

SNA or SNA*Parameter.

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

Name, PosInteger, ParenthesizedExpression, SNA or SNA*Parameter. Default is 1.

C - Alternate Destination Block name or number. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.

D - Insert Mode. Optional. The operand must be Null, ON or OFF. The default is ON.

Example

WRITE "New Line 20",1,Done

In this example, the WRITE Block send a text line to Data Stream number 1. If an error occurs, the Active Transaction proceeds to the Block labeled Done. Otherwise it moves to the Next Sequential Block. In this case, if the Data Stream is an I/O Stream or an In-Memory Stream, the WRITE is processed in

Insert Mode.

Action

When a Transaction enters a WRITE Block, Operand A is evaluated as a string. Numeric values are converted to an ASCII string equivalent. Then the identity of the Data Stream is determined from Operand B.

If Operand B is used, it is evaluated numerically, truncated, and

used as the Data Stream Entity number. This must be a positive integer. If Operand B is not used, Data Stream number

1 is assumed.

If Operand C is used, any error occurring during the WRITE causes the Active Transaction to proceed to the Block with that number.

Operand D sets the write mode, as discussed below.

In any case, if an error is detected, the error code is stored internally. A CLOSE Block can be used to retrieve the error. Chapter 4 (4.16) contains a full discussion of Data Streams, including the error code descriptions.

Write Modes

A WRITE to a Data Stream is operated in either Insert Mode or

Replace Mode. The Current Line Position is used slightly differently in these two modes. The write mode is set by

Operand D. If it is not used, or is ON, the WRITE is processed in Insert Mode. If it is OFF, the WRITE is processed in Replace Mode.

Insert Mode

This is the default mode for WRITE Blocks.

Action:

1.Move all text lines at, or after, the Current Line Position down one position.

2.If the Current Line Position is after the last text line, set it to just after the last text line in the Data Stream.

3.Place a copy of the new text line at the Current Line Position.

4.Increment the Current Line Position.

Replace Mode

Action:

1.If the Current Line Position is after the last text line, fill any intervening line positions with null text lines.

2.Delete any text line at the Current Line Position.

3.Place a copy of the new text line at the Current Line

Position.

4.Increment the Current Line Position.

Further Discussion

Chapter 4 (4.16) contains a full discussion of

Data Streams under the Section entitled, Data Streams.

Refuse Mode

A Transaction is never refused entry to a WRITE Block.

Related Blocks

OPEN - Create a Data Stream.

CLOSE - Shut down a Data Stream.

READ - Retrieve a text line from a Data Stream.

SEEK - Set the Current Line Position of a Data

Stream.

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