Sei sulla pagina 1di 5

GPSS Module 4 TEST Block A TEST block compares values of SNAs and controls the destination of the entering

g transaction based on the result of comparison. Format


O: A: B: C: TEST O A,B,C

A relational operator. E, G, EG, L, LE, or NE. The test value The reference value The destination value

If C operand is missing, then it works in a refuse mode. That is, the entering transaction would not be allowed to enter here if the test proves unsuccessful. e.g.
TEST G C1,1000

If the entering transaction finds the system clock value greater than 1000, it would be allowed to proceed to the next block. Otherwise, it would be blocked to enter here. Blocking will continue until the condition changes.
TEST GE Q$CPU1Q,Q$CPU2Q,IO

When a transaction enters here, compute the current queue lengths of CPU1Q and CPU2Q. If the former is greater than or equal to the latter, it proceeds to the next sequential block. Otherwise, it goes to the block labeled IO.

GATE Block A GATE block works like a valve affecting the flow based on the state of an entity. Format:
GATE 0 A,B

O: Conditional operator. FNV, FV, I, LS, LR, M, NI, NM

NU, SE, SF, SNE, SNF, SNV, SV, U A: Entity name to be tested B: Destination block if test fails. The meaning of conditional operators.
FNV: The facility in operand A must be unavailable FV: The facility in A must be available I: The facility in A must be currently interrupted LS: The logicswitch in A must be in a set state LR: The logicswitch in A must be in a reset state M: The match block specified by A must have a related transaction waiting for a match condition. NM: No transaction waiting under match condition. NU: Facility in A is not in use SE: Storage specified by A is empty SF: Storage specified by A is full SNE: Storage specified by A has at least one transaction SNF: Storage specified by A has at least one available storage unit. SNV: Storage specified by A is unavailable U: The facility specified by A is in use.

e.g.

GATE

SNF

HALL

Transaction is accepted in this block if the storage HALL is not full. Otherwise, transaction stays where it is.
GATE LR DBLOCK,THERE

If the logic switch DBLOCK is reset (open lock), accept the transaction here. Otherwise, it goes to the block marked THERE. GATE blocks are extremely powerful, and they can chew up a lot of CPU time in unsuccessful tests. Design your code to reduce frequency of unwanted unsuccessful tests.

The output from the simulation run

As we can gather, LOGIC Block changes the status of a logicswitch entity. Format
LOGIC O A

O: Logical operator S, RS A: Logical switch

An example. Simulation of a traffic junction. East-West & North-South traffics hinged on an intersection they both share. First part is the traffic-light system, the second and the third part are the two traffic corridors.

The report looks like

Potrebbero piacerti anche