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

gpss_manual

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

of the Facility Entity unless it (the Facility) is currently preempted. If a Transaction must be displaced from ownership of the Facility, it is not permitted to reside on the FEC and its movement in the simulation is restricted.

PREEMPT Teller1,,Teller2,101,RE

In this example, the PREEMPT Block operates in Interrupt

Mode because the B Operand is omitted. This means that a

Transaction can enter the Block and own the Facility if the Facility is not already owned by a preempting Transaction. Transaction priorities are ignored. When a Transaction is preempted, any remaining time in an ADVANCE Block is recorded in Parameter 101 of the preempted Transaction. The preempted Transaction is removed from contention for the

Facility and sent to the Block labeled Teller2. An error will result if such a Transaction later tries to RELEASE or RETURN the Facility named Teller1, without owning it again.

PREEMPT Teller1,PR,Teller2

In this example, the PREEMPT operates in Priority Mode. This means that a Transaction can enter the Block and own the Facility Entity if the Facility is not already owned by a Transaction of equal or higher priority. Any preempted Transaction is not removed from contention for the Facility. This means that such a Transaction can no longer exist on the FEC or leave ASSEMBLE, GATHER, or MATCH Blocks. Under these restrictions, preempted Transactions may continue to circulate in the simulation, and in this case are sent to the

Block location Teller2. Such Transactions remain in contention for the Facility named Teller1, and normally will regain ownership of it. A preempted Transaction may RETURN or RELEASE a Facility even if it does not own it. This removes the Transaction from contention for the Facility by removing it from the Interrupt Chain of the Facility.

Action

A PREEMPT Block behaves like a SEIZE Block when the

Facility is idle. Otherwise, the PREEMPT Block operates in either Priority Mode or Interrupt Mode. This is determined by Operand B.

In Priority Mode, only a higher priority Transaction can displace the Transaction which owns the Facility. If a would-be preemptor is of insufficient priority, it is placed on the Delay Chain of the Facility in priority order.

In Interrupt Mode, if the Facility is already preempted, the

Active Transaction is placed on the Pending Chain.

Transactions on the Pending Chain are given ownership of the

Facility in preference to preempted Transactions or to

Transactions on the Delay Chain.

Operands C to E are concerned with what to do with the current owner of the Facility which is about to become preempted. Preempted Transactions are not permitted to exist on the FEC. Preempted Transactions which have unfinished time in an ADVANCE Block may be replaced on the FEC automatically by omitting the C and E operands. Alternately, if you choose to replace the Transaction on the FEC yourself, to resume the unfinished time, you must use Operand D and eventually send the preempted Transaction to an ADVANCE

Block.

A preempted Transaction may be removed from contention for the Facility (i.e. removed from all chains of the Facility) by using the RE option in the E Operand. The RE option removes the restrictions placed on preempted Transactions due to preemption at this Facility, and makes any subsequent attempt to RELEASE or RETURN the Facility an Error Stop condition.

A preempted Transaction cannot exist on the FEC. A more detailed discussion of preemption is in Section 9.4. Any newly preempted Transaction in an ADVANCE Block which is on the FEC is removed from the FEC and the residual time duration is saved. If the D Operand is used, the residual time is also saved in a Transaction Parameter. If no such Parameter exists, one is created. The residual time is used to reschedule the Transaction on the FEC when it regains ownership of all Facilities for which it contends. Alternately, you may give a preempted Transaction a new Block to attempt to enter by using the C Operand.

A preempted Transaction remains in contention for a Facility even if it was displaced by the C Operand, unless RE is used in Operand E. If a preempted Transaction, which is still in contention for a Facility, attempts to enter a TERMINATE Block an Error Stop occurs. Such Transactions must enter a

RELEASE or RETURN Block before they are permitted to TERMINATE. Alternately, if you intend to TERMINATE the preempted Transaction you could use the RE option to make sure it doesn’t inadvertently regain ownership before termination. such a Transaction could not RELEASE or

RETURN the Facility.

When a Transaction is displaced by using the C Operand, it is given a new Block destination and is dequeued from:

FEC

PENDING (INTERRUPT-MODE PREEMPT)

CHAINS

DELAY (MAJOR PRIORITY) CHAINS

USER CHAINS

RETRY CHAINS and not dequeued from:

CEC

INTERRUPT (PREEMPTED) CHAINS

GROUP CHAINS

When a Transaction is displaced from its present context, by using an alternate destination, it is removed from blocking conditions, but preemptions at other Facilities are not cleared.

When the C Operand is not used, a preempted Transaction taken off the FEC will be returned to it automatically.

Preempted Transactions which have not been displaced using the C Operand are expected eventually to enter a RETURN or RELEASE Block in order to give up ownership of the Facility. If such a Transaction arrives at the RETURN or RELEASE before regaining ownership of the Facility, the Transaction is removed from contention for the Facility. No error condition occurs.

A Transaction can be preempted from any number of Facilities and continue to circulate in the simulation. However, it is subject to two restrictions:

It will be refused entry to ADVANCE Blocks with positive time arguments.

It will not be allowed to leave an ASSEMBLE, GATHER, or MATCH Block until all its preemptions have been cleared.

A Facility can be preempted any number of times. However, once a Transaction has been preempted, it cannot attempt to seize the Facility from which it has been preempted. A Transaction can be preempted from any number of Facilities.

Special Restrictions

If E is RE, C must be used.

A Transaction may not preempt itself.

Refuse Mode

A Transaction is refused entry to a PREEMPT Block if, in Interrupt Mode, the Facility is currently preempted. Such

Transactions are placed at the end of the Facility’s Pending

Chain.

A Transaction is refused entry to a PREEMPT Block if, in

Priority Mode, the Facility is currently owned by a Transaction

of priority equal to or greater than that of the Active

Transaction. The Active Transaction is placed in priority order on the Facility’s Delay Chain.

A Transaction is refused entry to a PREEMPT Block if the

Facility is in the unavailable state. Such Transactions are placed on the Facility’s Delay Chain, in priority order, FIFO within priority.

Related Blocks

DISPLACE - Move any Transaction.

FAVAIL - Place Facility in the available state.

FUNAVAIL - Place Facility in the unavailable state.

RELEASE - Give up ownership and remove contention for a Facility.

RETURN - Give up ownership and remove contention for a Facility.

SEIZE - Acquire or wait for ownership of a Facility.

Related SNAs

FEntnum - Facility busy. If Facility Entnum is currently busy, FEntnum returns 1. Otherwise FEntnum returns 0.

FCEntnum - Facility capture count. The number of times Facility Entnum has become owned by a

Transaction.

FIEntnum - Facility Entnum interrupted. If Facility Entnum is currently preempted, FIEntnum returns 1. Otherwise FIEntnum returns 0.

FREntnum - Facility utilization. The fraction of time Facility Entnum has been busy. FREntnum is expressed in parts-per-thousand and therefore returns an real value 0-1000, inclusively.

FTEntnum - Average Facility holding time. The average time Facility Entnum is owned by a capturing Transaction.

FVEntnum - Facility in available state. FV Entnum returns 1 if Facility Entnum is in the available state, 0 otherwise.

Related Windows

Facilities Window - Online view of Facility 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.

PRIORITY

A PRIORITY Block sets the priority of the Active Transaction.

PRIORITY A,B

Operands

A - New priority value. Required. The operand must be Name, integer, String, ParenthesizedExpression, SNA, or

SNA*Parameter.

B - Buffer option. Places Active Transaction behind priority peers on CEC. Optional. The operand must be BU or Null.

Example

PRIORITY 10

In this example any entering Transaction is made to have a priority of 10.

Action

When a Transaction enters a PRIORITY Block, Operand A is evaluated numerically, truncated, and assigned to the priority of the Active Transaction.

The Transaction is scheduled for the Next Sequential Block

and is placed on the CEC according to its new priority. If the

BU option was used in Operand B, the Transaction is placed behind its priority peers on the CEC. Otherwise, it is placed in front of its priority peers.

Transaction priorities are integers. When a Transaction is created without an explicit priority, it is given a priority of 0, by default. GPSS World is most efficient when priorities used in the simulation are contiguous. For example, use 0, 1, 2, instead of -200, 0, 23.

Refuse Mode

A Transaction is never refused entry to a PRIORITY Block.

Related SNA

PR - Transaction priority. The value of the priority of the Active Transaction.

Related Windows

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.

QUEUE

A QUEUE Block updates Queue Entity statistics to reflect an increase in content.

QUEUE 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 increase the content of the

Queue Entity. Default value is 1. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.

Example

QUEUE WaitingLine

In this example the content of the Queue Entity named

WaitingLine is increased by one and the associated statistics accumulators are updated.

Action

When a Transaction enters a QUEUE Block, Operand A is evaluated, truncated, and used to find the Queue Entity with that number. The Queue Entity is created if necessary.

Operand B specifies the value to be used to increase the content of the Queue Entity. If B was specified, Operand B is evaluated, truncated, and used as the increment. If B was not specified, the value of 1 is used.

Finally, the statistics accumulated on behalf of the Queue Entity are updated.

Special Restriction

B, if specified, must be positive.

Refuse Mode

A Transaction is never refused entry to a QUEUE Block.

Related SNAs

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

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

Entnum.

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

QMEntnum - Maximum queue content. The maximum count (high water mark) of Queue Entity Entnum.

QTEntnum - Average queue residence time.

The time weighted average of the count for

Queue Entity Entnum.

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

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

Related Window

Queues Window - Online view of Queue Entity dynamics.

READ

A READ Block retrieves a text line from a Data Stream.

READ A,B,C

Operands

A - Transaction Parameter. Required. The operand must be

Name, PosInteger, 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.

Example

READ Text_Parm,1,Done

In this example, the READ Block retrieves a text line from Data Stream number 1 and places a copy in the Transaction Parameter Text_Parm. If no such Parameter exists, it is

created. If an error occurs the Active Transaction proceeds to the Block labeled Done, otherwise it proceeds to the Next Sequential Block.

Action

When a Transaction enters a READ Block, Operand A is evaluated numerically, truncated, and used to identify the Transaction Parameter which will receive the text line. If a text line is received successfully and no Parameter exists for the Active Transaction, one is created.

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 READ causes the Active Transaction to proceed to the Block with that number.

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.

If the Data Stream is a Pipe Stream, the text line is read from the named pipe and returned to the Transaction Parameter. The simulation is blocked while this occurs.

If the Data Stream is not a Pipe Stream, the text line is determined by the Current Line Position, a 1-relative line index associated with the Data Stream. In this case, the line indicated by the Current Line Position, even if the line is a null string, is returned to the Transaction Parameter as a result of the READ. Then, the Current Line Position is incremented, i.e. move to the next line number. If there is no line to be read, no data is returned and the Active Transaction is sent to the Alternate Destination Block without any error code being stored.

Reads can be computationally expensive. You can speed processing by using a large amount of data on a small number of text lines.

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 READ Block.

Blocking Condition

The simulation is blocked while READ retrieves the text line.

Related Blocks

OPEN - Create a Data Stream.

CLOSE - Shut down a Data Stream.

WRITE - Send a text line to a Data Stream.

SEEK - Set the Current Line Position of a Data

Stream.

RELEASE

A RELEASE Block releases ownership of a Facility, or removes a preempted Transaction from contention for a Facility.

RELEASE A

Operand

A - Facility number. Required. The operand must be Name,

PosInteger, ParenthesizedExpression, SNA, or

SNA*Parameter.

Example

RELEASE Teller1

In this example, when a Transaction which owns the Facility

Entity named Teller1 enters the RELEASE Block, it gives up ownership to the Facility.

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