Chapter 7 - Block Statements
You use Block Statements to create GPSS Block Entities. Block Statements which are part of the Initial Model Translation create permanent Blocks in the simulation. A Block Statement sent to an existing simulation creates a one-time temporary Block to be used in a mode called Manual Simulation. This is discussed in more detail in Section 2.3.
A model is simply a sequence of Model Statements. A GPSS World Model Statement is either a GPSS Statement or a PLUS Procedure definition. The GPSS Statements, in turn, are either Block Statements, which cause a Block to be created, or Commands, which do not. Any Model Statement can be sent to an existing simulation as an Interactive Statement.
This chapter contains reference information for each Block Statement supported by GPSS World.
The GPSS Block statements are:
ADOPT - Change Assembly Set.
ADVANCE - Place Transaction on Future Events Chain.
ALTER - Test and modify Transactions in a Group.
ASSEMBLE - Wait for and destroy related Transactions.
ASSIGN - Modify Transaction Parameter.
BUFFER - Place Transaction on the Current Events Chain behind its priority peers.
CLOSE - End the Data Stream.
COUNT - Place count of entities into a Transaction Parameter.
DEPART - Decrement content of a Queue Entity.
DISPLACE - Change the Next Sequential Block of a Transaction.
ENTER - Occupy or wait for storage units in a Storage Entity.
EXAMINE - Test group membership.
EXECUTE - Perform action specified by a different Block.
FAVAIL - Change status of a Facility Entity to "available".
FUNAVAIL - Change status of a Facility Entity to "not available".
GATE - Test entity and modify Transaction flow.
GATHER - Wait for related Transactions.
GENERATE - Create Transaction and place on Future Events Chain.
INDEX - Modify Transaction Parameter.
INTEGRATION - Turn the integration of a User Variable On or Off.
JOIN - Place a member into a Numeric or Transaction Group.
LEAVE - Release storage units of a Storage Entity.
LINK - Move Transaction to Userchain Entity.
LOGIC - Modify Logicswitch Entity.
LOOP - Decrement Parameter, jump to different Block if result is nonzero.
MARK - Place value of system clock into Transaction Parameter.
MATCH - Wait for related Transaction to reach conjugate MATCH Block.
MSAVEVALUE - Assign value to Matrix Entity element.
OPEN - Initialize a Data Stream.
PLUS - Evaluate PLUS Expression and save result in Parameter.
PREEMPT - Displace Facility owner.
PRIORITY - Modify Transaction priority.
QUEUE - Increment content of a Queue Entity.
READ - Bring the next line of data from a Data Stream.
RELEASE - Free Facility Entity.
REMOVE - Take a member out of Numeric or Transaction Group.
RETURN - Free Facility Entity.
SAVAIL - Change status of Storage Entity to "available".
SAVEVALUE - Assign a value to Savevalue Entity.
SCAN - Test Transaction group, place value in Parameter.
SEEK - Change the line pointer in a Data Stream.
SEIZE - Assume ownership of or wait for a Facility Entity.
SELECT - Place selected entity number into Transaction Parameter.
SPLIT - Create related Transaction.
SUNAVAIL - Change status of Storage Entity to "not available".
TABULATE - Update Table Entity.
TERMINATE - Destroy Transaction, decrement Termination Count.
TEST - Test arithmetic condition and modify Transaction flow.
TRACE - Set Trace Indicator of the Active Transaction.
TRANSFER - Move to specified Block.
UNLINK - Remove Transaction from Userchain Entity.
UNTRACE - Turn off Trace Indicator in the Active Transaction.
WRITE - Send a value to a Data Stream.
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 state of Blocks and their effects on the other entities in your simulations. In general, windows are specialized by the entity type.
·
Model Window - Text View — Full screen textual model editor.·
Block Input Window - Drag and Drop model building.·
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 User Chains in the simulation.·
Transaction Groups Snapshot - Picture of the state of the Transaction Groups in the simulation.
ADOPT Blocks are used to change the Assembly Set of the Active Transaction.
ADOPT A
Operand
A
- Assembly Set. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
Example
ADOPT 2000
The numerical Assembly Set value of the Active Transaction is given the value 2000. In effect, the Active Transaction becomes a member of Assembly Set 2000.
Action
When a Transaction enters an ADOPT Block, Operand A is evaluated numerically, and truncated. If the result is less than or equal to zero, an Error Stop occurs. Otherwise, the result is assigned to the Assembly Set value of the Active Transaction.
Every Transaction is assigned to an Assembly Set when it is created. For Transactions created in GENERATE Blocks, the initial assignment uses the same number for the Assembly Set as was used for the Transaction Number. For Transactions created in SPLIT Blocks, the offspring Transactions are placed in the same Assembly Set as their parent Transaction.
Assembly Sets are used to combine related Transactions in ASSEMBLE and GATHER Blocks. The ADOPT Block provides for easy control of Assembly Set assignments.
Special Restriction
·
A must be positive.Refuse Mode
A Transaction is never refused entry to an ADOPT Block.
Related Blocks
·
ASSEMBLE - Wait for and destroy Assembly Set members.·
GATHER - Wait for Assembly Set members.·
MATCH - Wait for Assembly Set member.·
SPLIT - Create Transaction(s) in the same Assembly Set.Related SNAs
·
A1 - Assembly Set. Return the Assembly Set of the Active Transaction.·
MBEntnum - Match at Block. MBEntnum returns a 1 if there is a Transaction at Block Entnum which is in the same Assembly Set as the Active Transaction. MBEntnum returns a 0 otherwise.Related Window
·
Transaction Snapshot - Picture of the state of a Transaction in the simulation.
An ADVANCE Block delays the progress of a Transaction for a specified amount of simulated time.
ADVANCE A,B
Operands
A
- The mean time increment. Optional. The operand must be Name, Number, String, ParenthesizedExpression, SNA or SNA*Parameter. The default is 0.B - The time half-range or, if a function, the function modifier. Optional. The operand must be Null, Name, Number, String, ParenthesizedExpression, SNA, or SNA*Parameter.
Example
ADVANCE 101.6,50.3
This example creates a Block which chooses a random number between 51.3 and 151.9, inclusively (i.e. 101.6 plus or minus 50.3), and delays the entering Transaction that amount of simulated time.
Action
An ADVANCE Block calculates a time increment and places the entering Transaction on the Future Events Chain (FEC) for that amount of simulated time.
The time increment can be calculated in several ways. If only the A Operand is specified, it is evaluated and used as the time increment. If the A and B operands are present, and B does not specify a function, both A and B are evaluated numerically and a random number between A-B and A+B, inclusively, is used as the time increment. You can select which random number generator number is to be used as the source of the random number. This is set in the "Random" page of the Model Settings Notebook.
CHOOSE
View / Settings / Modelthen select the
Random page. Then fill in the desired random number stream entity number in the entry box marked "ADVANCE". The installation default is to use Random Number Stream number 1.If B is an FN class SNA, called a Function Modifier, the evaluating B is multiplied by the result of evaluating the A Operand; the product is used as the time increment.
If zero is calculated as the time increment (ADVANCE 0), the entering Transaction is placed on the Current Events Chain in front of priority peers. Such a Block then behaves as a null operation. A further discussion of the Current Events Chain can be found in Chapter 9.
Special Restriction
·
If a negative number is calculated as the time increment, an Error Stop occurs.Refuse Mode
Normally, Transactions are not refused entry to an ADVANCE Block. However, since preempted Transactions are not permitted to exist on the Future Events Chain, a preempted Transaction will not be permitted to enter an ADVANCE Block if the time increment is positive (nonzero).
When a Transaction is refused entry, its Delay Indicator is set and remains so until the Transaction enters a "Simultaneous" Mode TRANSFER Block. To coordinate the state of multiple entities, it is better to use a TEST Block and BOOLEAN VARIABLE instead of a TRANSFER SIM Block.
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.
An ALTER Block changes the priority or a Parameter of selected members of a Transaction Group.
ALTER O A,B,C,D,E,F,G
Operands
O
- Conditional operator. Relationship of E to F for the alteration to occur. These choices are explained below. Optional. The operator must be Null, E, G, GE, L, LE, MAX, MIN, or NE.A - Transaction Group. Group whose members will be tested for alteration. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
B - Limit. The maximum number of Transactions to be altered. The default is ALL. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
C - Altered attribute. The member Transaction Parameter to be altered, or PR to alter the member Transaction priority. The operand must be PR, Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
D - Replacement value. The value which will replace attribute C. Required. The operand must be Name, Number, String, ParenthesizedExpression, SNA, or SNA*Parameter.
E - Test value. PR or Parameter number. The member Transaction Parameter which determines whether each Group member Transaction should be altered, or PR to use the Transaction priority for the determination. It is evaluated with respect to the Transaction Group member. Optional. The operand must be PR, Null, Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
F - Reference value. The value against which the E Operand is compared. It is evaluated with respect to the Active Transaction. Optional. The operand must be Null, Name, Number, String, ParenthesizedExpression, SNA, or SNA*Parameter.
G - Alternate Block number. The alternate destination for the Active Transaction. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
Examples
ALTER Inventory,ALL,Price,49.95
In this simple example, all Transactions in the Transaction Group named Inventory have their Parameter named Price set equal to 49.95.
ALTER NE Bin7,10,Price,49.95,PartNum,99.95,Out
In this example, when a Transaction enters the ALTER Block, Transaction Group named Bin7 is scanned for Transactions which do not have a value of 99.95 in their Parameter named PartNum. The first 10 Transactions which meet the test have the value of their Parameter named Price set to 49.95. If 10 Transactions cannot be found which pass the test, the entering Transaction attempts to enter the Block labeled Out. Otherwise, it proceeds to the Next Sequential Block.
Action
An ALTER Block selects Transactions from a Transaction Group and alters one of the attributes of each of these Transactions. When a Transaction Group member is altered, its Transaction attribute specified by the C Operand is given the value specified by the D Operand. Altered Transactions are not displaced from their context. However, the Transaction entering the ALTER Block may be redirected according to the G Operand.
If you do not use a conditional operator, or operands E or F, all Transactions up to the limit (Operand B) are altered. In this case, no priority or Parameter test is made to determine whether or not to alter the attribute of the member Transaction.
If you use operands E, F, or a conditional operator, each Group member must pass a test before it is altered. Operand E specifies which attribute of the member Transactions is to be tested. It may be compared to the minimum or the maximum of all such Group member attributes by using MIN or MAX as the conditional operator. All Transactions which are tested and have the maximum or minimum attribute are altered. In this case, you must not use Operand F.
You may use a conditional operator to specify the relationship between the Transaction attribute (Operand E) and the reference value (Operand F) which will initiate the alteration of the Transaction. The default for the conditional operator is E for equality. If you use no conditional operator, but you use operand E and Operand F, the values must be equal for the member Transaction attribute to be altered.
You may compare the Group member attribute to Operand F, with or without a conditional operator. In this case, the conditional operator must not be MIN or MAX. Operand E always refers to the Group member under test. However, if any other operand is a Transaction related SNA, it is evaluated with respect to the entering Transaction.
The B Operand cuts off the Group scan when it equals the number of Transactions that have been altered. The default is ALL. If there is no attribute test, that is, if E is not specified, Transactions are altered until the alteration count equals B or until the entire Group has been tested.
The G Operand indicates an alternate destination Block to be taken by the entering Transaction when a special condition occurs. The G Operand is used for the next Block under the following conditions:
·
No Transaction is altered.·
The count of altered Transactions specified by B cannot be reached.If the G Operand is not used, the entering Transaction always goes to the Next Sequential Block.
Conditional Operators
The conditional operator may be E, G, GE, L, LE, MAX, MIN, or NE. If no conditional operator is used, E (equality) is assumed. When the condition is true, the Transaction being tested is altered. The conditions are defined as follows:
·
E - The member Transaction attribute specified by Operand E must be equal to the reference value specified by Operand F for the member Transaction to be altered.·
G - The member Transaction attribute specified by Operand E must be greater than the reference value specified by Operand F for the member Transaction to be altered.·
GE - The member Transaction attribute specified by Operand E must be greater than or equal to the reference value specified by Operand F for the member Transaction to be altered.·
L - The member Transaction attribute specified by Operand E must be less than the reference value specified by Operand F for the member Transaction to be altered.·
LE - The member Transaction attribute specified by Operand E must be less than or equal to the reference value specified by Operand F for the member Transaction to be altered.·
MAX - The member Transaction attribute specified by Operand E must be equal to the largest such attribute of all Transactions in the Group for the member Transaction to be altered.·
MIN - The member Transaction attribute specified by Operand E must be equal to the smallest such attribute of all Transactions in the Group for the member Transaction to be altered.·
NE - The member Transaction attribute specified by Operand E must be unequal to the reference value specified by Operand F for the member Transaction to be altered.If no conditional operator is used, E is assumed.
Special Restrictions
·
If Operand E is used, then you must use Operand F or else you must use the conditional operator MIN or MAX.·
If Operand F is used, you must use Operand E, and not MIN or MAX.·
If MIN or MAX is used for the conditional operator, Operand E must be used and Operand F must not be used.Refuse Mode
A Transaction is never refused entry to an ALTER Block.
Related Blocks
Transactions are added to Transaction Groups, and numbers are added to Numeric Groups by JOIN Blocks. Transactions in Groups can be referenced by ALTER, EXAMINE, REMOVE, and SCAN Blocks. Numbers in Numeric Groups can be referenced by EXAMINE and REMOVE Blocks.
Related SNA
·
GTEntnum - Transaction Group count. GTEntnum returns the membership count of Transaction Group Entnum.Related Windows
·
Transaction Snapshot - Picture of the state of a Transaction in the simulation.·
Transaction Groups Snapshot - Picture of the state of the Transaction Groups in the simulation.
Wait for and destroy related Transactions.
ASSEMBLE A
Operand
A
- Transaction count. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
Example
ASSEMBLE 2
This is the simplest way to use the ASSEMBLE Block. The first Transaction of an Assembly Set (see Section 9.3) is caused to wait when it enters an ASSEMBLE Block. When another Transaction in the same Assembly Set enters the Block, it is destroyed and the waiting Transaction is allowed to continue.
Action
When a Transaction enters an ASSEMBLE Block, the Match Chain of the Block is searched for a waiting Transaction of the same Assembly Set. If there are no other members of the same Assembly Set present, the A Operand is evaluated, truncated, decremented by one, and saved in a storage location in the Transaction. If this number is zero, the Transaction immediately attempts to enter the Next Sequential Block. Otherwise the Transaction is placed on a queue attached to the ASSEMBLE Block called the Match Chain to await the arrival of other members of its Assembly Set.
When a Transaction enters an ASSEMBLE Block, if a waiting Transaction is found, the entering Transaction is destroyed and the Transaction count that was saved in the chained Transaction is reduced by one. When this count becomes 0, the waiting Transaction is removed from the Match Chain. If this Transaction has not been preempted at any Facility, it attempts to enter the Next Sequential Block. When it does so, it is scheduled behind active Transactions of the same priority.
Preempted Transactions which complete an assembly at an ASSEMBLE Block are not permitted to leave the Block until all preemptions have been cleared. More discussion of the preemption mechanism can be found in Section 9.4. Preempted Transactions which have been removed from the Match Chain do not participate in later assemblies even though they remain in the ASSEMBLE Block.
ASSEMBLE Blocks differ from GATHER Blocks in that succeeding Transactions are destroyed at an ASSEMBLE.
Special Restriction
·
Transactions which are currently preempted are not permitted to leave ASSEMBLE Blocks.Refuse Mode
A Transaction is never refused entry to an ASSEMBLE Block.
Related Blocks
·
ADOPT - Set the Assembly Set of the Active Transaction.·
GATHER - Wait for members of an Assembly Set.·
MATCH - Wait for Assembly Set member.·
SPLIT - Create Transactions in the same Assembly Set.Related SNAs
·
A1 - Assembly Set. Return the Assembly Set of the Active Transaction.·
MBEntnum - Match at Block. MBEntnum returns a 1 if there is a Transaction at Block Entnum which is in the same Assembly Set as the Active Transaction. MBEntnum returns a 0 otherwise.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.
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.
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.
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.
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.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.
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.
Example
DEPART WaitingLine
In this example the content of the Queue Entity named WaitingLine is reduced by one and the associated statistics accumulators are updated.
Action
When a Transaction enters a DEPART Block, Operand A is evaluated, truncated, and used to find the Queue Entity with that number. The Queue Entity is created if necessary. If a Queue Entity is created, the attempt to decrement the content of the Queue Entity will cause an Error Stop. Manual Simulation can be used to alter the Queue Entity content interactively.
Operand B specifies the value to be used to decrease the content of the Queue Entity. If B was specified, Operand B is evaluated numerically, truncated, and used as the result. If B was not specified, the value of 1 is used.
Finally, the statistics accumulated on behalf of the Queue Entity are updated. If Qtable Entities have been defined for this same Queue Entity, they are also updated.
Special Restrictions
·
A and B must be positive, if specified.·
If the content of the Queue Entity is about to become negative, an Error Stop occurs.Refuse Mode
A Transaction is never refused entry to a DEPART Block.
Related SNAs
·
QEntnum - Current content of queue entity. 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.
A DISPLACE Block moves any Transaction.
DISPLACE A,B,C,D
Operands
A
- Transaction number. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA or SNA*Parameter.B - Displaced Transaction destination. Block name or number. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
C - Parameter number. Parameter of displaced Transaction to receive residual time if preempted Transaction is removed from FEC. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
D - Alternate destination for the Active Transaction. Block name or number. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
Example
DISPLACE X$Culprit,Compensate,Residual,NotCaught
In this example, the DISPLACE Block moves the Transaction whose number is kept in the Savevalue named Culprit. If the target Transaction exists, it is sent to the Block labeled Compensate as its Next Sequential Block. If it was residing on the Future Events Chain, any time left until its reentry into the simulation is calculated and stored in the Parameter named Residual of the displaced Transaction. If the Transaction was on the FEC and no such Parameter exists, it is created. If the target Transaction does not exist, the Active Transaction moves to the alternate destination Block labeled NotCaught, after entering the DISPLACE Block.
Action
A DISPLACE Block moves any Transaction in the simulation to any Block. The displaced Transaction is removed from Transaction chains, as discussed below, and is scheduled to enter the destination Block.
When a Transaction enters a DISPLACE Block, Operand A is evaluated numerically, truncated, and used to find the Transaction to be displaced. If that Transaction does not exist, processing ceases, and the Active Transaction is sent to the Alternate Destination specified by Operand D, if any.
If the Transaction exists, it is given the new Block destination specified by Operand B.
If the displaced Transaction is on the FEC, it is removed from it and the residual time duration is calculated as the time which the Transaction is scheduled to come off the FEC minus the current time. If the C Operand is used, the residual time is saved in a Transaction Parameter. If no such Parameter exists and Operand C is used, a new Parameter is created.
When a Transaction is displaced, it is given a new Block destination and is dequeued from:
·
FEC·
PENDING (INTERRUPT-MODE PREEMPT) CHAINS·
DELAY (MAJOR PRIORITY) CHAINS·
USER CHAINS·
RETRY CHAINSand not dequeued from:
·
CEC·
INTERRUPT (PREEMPTED) CHAINS·
GROUP CHAINSWhen a Transaction is displaced, preemptions at Facilities are not cleared.
Refuse Mode
A Transaction is never refused entry to a DISPLACE Block.
Related SNA
·
XN1 - Transaction number of the Active Transaction.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.Related Library Procedures
·
QueryXNExist - determine the existence of a Transaction.·
QueryXNParameter - retrieve the value of a Transaction Parameter.·
QueryXNAssemblySet - retrieve the Assembly Set of a Transaction.·
QueryXNPriority - retrieve the priority of a Transaction.·
QueryXNM1 - retrieve the Mark Time of a Transaction.
When a Transaction attempts to enter an ENTER Block, it either takes or waits for a specified number of storage units.
ENTER A,B
Operands
A
- Storage Entity name or number. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA or SNA*Parameter.B - Number of units by which to decrease the available storage capacity. Default value is 1. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
Example
ENTER Toolkit,2
In this example the Active Transaction demands 2 storage units from the storage units available at the Storage Entity named Toolkit. If there are not enough storage units remaining in the Storage Entity, the Transaction comes to rest on the Delay Chain of the Storage Entity.
Action
When a Transaction enters an ENTER Block, Operand A is evaluated and used to find the Storage Entity with that number. If the Storage Entity does not exist, an Error Stop occurs. Storage entities must be defined by a STORAGE Command.
If the Storage Entity exists, Operand B is used to determine the storage demand. If B was specified, Operand B is evaluated, truncated, and used as the result. If B was not specified, the value of 1 is used.
If the Storage Entity is in the available state, and if there are enough storage units to satisfy the demand, the Transaction is allowed to enter the ENTER Block and the demand is granted by reducing the current storage units by the amount of the demand. Otherwise, the Transaction comes to rest on the Delay Chain of the Storage Entity in priority order.
When storage units are freed by a LEAVE Block, a "first-fit-with-skip" discipline is used to choose the next Transaction(s) to be allowed entry into the ENTER Block. Any such entry is permitted before the Active Transaction leaves the LEAVE Block. This prevents "line-bucking".
When a Transaction enters an ENTER or LEAVE Block, the statistics accumulated on behalf of the Storage Entity are updated.
Special Restrictions
·
A must be positive.·
B must be nonnegative.·
A request for more storage than exists will result in an Error Stop. (e.g. a B Operand that is larger than the defined size of the STORAGE named in Operand A.)Refuse Mode
·
The Active Transaction is refused entry to the ENTER Block if its storage demand cannot be met.·
The Active Transaction is refused entry to the ENTER Block if the Storage Entity is in the unavailable state.When a Transaction is refused entry, its Delay Indicator is set and remains so until the Transaction enters a "Simultaneous" Mode TRANSFER Block. Simultaneous Mode TRANSFER Blocks are rarely used. A BOOLEAN VARIABLE can more efficiently control the coordination of the state of a number of resources when used in a TEST Block.
Related Command
A Storage Entity must be defined in a STORAGE Command before it can be updated by an ENTER Block. The STORAGE Command must exist in the model, or must be sent to the Simulation Object interactively, before a Transaction can enter the ENTER Block. Any attempt to do so before the Storage Entity is defined, cases an Error Stop.
A Storage Entity can be redefined by an interactive STORAGE Command.
Related SNAs
·
REntnum - Unused storage capacity. The storage content (or "token" spaces) available for use by entering Transactions at Storage Entity Entnum.·
SEntnum - Storage in use. SEntnum returns the amount of storage content (or "token" spaces) currently in use by entering Transactions at Storage Entity Entnum.·
SAEntnum - Average storage in use. SAEntnum returns the time weighted average of storage capacity (or "token" spaces) in use at Storage Entity Entnum.·
SCEntnum - Storage use count. Total number of storage units that have been entered in (or "token" spaces that have been used at) Storage Entity Entnum.·
SEEntnum - Storage empty. SEEntnum returns 1 if Storage Entity Entnum is completely unused, 0 otherwise.·
SFEntnum - Storage full. SFentnum returns 1 if Storage Entity Entnum is completely used, 0 otherwise.·
SREntnum - Storage utilization. The fraction of total usage represented by the average storage in use at Storage Entity Entnum. SREntnum is expressed in parts-per-thousand and therefore returns an real value 0-1000, inclusively.·
SMEntnum - Maximum storage in use at Storage Entity Entnum. The "high water mark".·
STEntnum - Average holding time per unit at Storage Entity Entnum.·
SVEntnum - Storage in available state. SVEntnum returns 1 if Storage Entity Entnum is in the available state, 0 otherwise.Related Window
·
Storages Window - Online view of Storage Entity dynamics.
An EXAMINE Block may be used to test for membership in a Numeric Group or a Transaction Group.
EXAMINE A,B,C
Operands
A
- Group number. Group whose members will be examined. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.B - Numeric Mode only. The value to be tested for membership in the Numeric Group. Optional. The operand must be Null, Name, Number, String, ParenthesizedExpression, SNA, or SNA*Parameter.
C - Block number. Alternate destination for Active Transaction if no membership is found. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
Examples
EXAMINE ValidColors,P$Color,NotCorrectColor
In this simple example, if the Numeric Group named ValidColors does not include the value contained in the Transaction Parameter named Color, the Active Transaction proceeds to the Block location NotCorrectColor. If the value is a Numeric Group member, the Active Transaction proceeds to the Next Sequential Block (NSB).
EXAMINE ValidXNs,,NotValidXN
In this example, if the Active Transaction is not a member of the Transaction Group named ValidXNs, the Active Transaction proceeds to the Block location NotValidXN. If the Transaction is a Transaction Group member, it proceeds to the Next Sequential Block (NSB).
Action
An EXAMINE Block operates in either "Numeric Mode" or "Transaction Mode". If the B Operand is used, the EXAMINE Block operates in Numeric Mode. In this case the value of Operand B is tested for membership in the Numeric Group. If the B Operand is not used, the EXAMINE operates in Transaction Mode. Then, It is the Active Transaction which is tested for membership in a Transaction Group.
When a Transaction enters an EXAMINE Block, Operand A is evaluated and the appropriate Group entity is found. If there is no such Group, one is created.
If the B Operand is used, it is evaluated numerically and the result is tested for membership in the Numeric Group. If Operand B is not used, the Active Transaction is tested for membership in the Transaction Group specified by the A Operand.
There is some loss of efficiency when non-integers are used in Numeric Groups.
If the membership test fails, Operand C is evaluated, truncated, and used as the destination Block number for the Active Transaction. If the membership test is successful, the Active Transaction proceeds to the Next Sequential Block (NSB).
Special Restrictions
·
A and C must be positive.·
C must be a Block location in the simulation.Refuse Mode
A Transaction is never refused entry to an EXAMINE Block.
Related Blocks
Transactions and numbers are added to Groups by JOIN Blocks. Transactions in Transaction Groups can be referenced by ALTER, EXAMINE, REMOVE, and SCAN Blocks. Numbers in Numeric Groups can be referenced by EXAMINE and REMOVE Blocks.
Related SNAs
·
GNEntnum - Numeric Group Count. GNEntnum returns the membership count of Numeric Group Entnum.·
GTEntnum - Transaction Group Count. GTEntnum returns the membership count of Transaction Group Entnum.Related Windows
·
Numeric Groups Snapshot - Picture of the state of the Numeric Groups in the simulation.·
Transaction Groups Snapshot - Picture of the state of the Transaction Groups in the simulation.
The EXECUTE Block can cause any Block routine in the simulation to be done on behalf of the Active Transaction.
EXECUTE A
Operand
A
- Block number. The name or number of the Block to be "performed". required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.Example
EXECUTE P$ActiveBlock
This EXECUTE Block will cause the Block, whose number is in the Parameter named ActiveBlock, to be executed with respect to the Active Transaction.
Action
When a Transaction enters an EXECUTE Block, the A Operand is evaluated and is used to find the Block with that number or name. Then the Block routine associated with the target Block is done on behalf of the Active Transaction.
If the Active Transaction is refused entry to the target Block, it remains in the EXECUTE Block.
After the target Block routine is performed, the Active Transaction is normally scheduled for the Block following the EXECUTE Block. However, if the target Block schedules an alternate destination for the Active Transaction, that Block, and not the EXECUTE Block’s next sequential Block, is scheduled.
Special Restrictions
·
A must be a Block location in the simulation.·
An EXECUTE Block cannot act on another EXECUTE Block.Refuse Mode
An EXECUTE Block never refuses entry to a Transaction.
Related Window
·
Blocks Window - Online view of Block dynamics.
A FAVAIL Block ensures that a Facility Entity is in the available state.
FAVAIL A
Operand
A
- Facility number. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.Example
FAVAIL Teller1
This Block, when entered by an Active Transaction, will ensure that the Facility Entity named Teller1 is in the available state.
Action
A FAVAIL Block ensures that a Facility Entity is in the available state. If the Facility Entity was previously idle, the FAVAIL Block tries to give ownership to a waiting Transaction. This is discussed in more detail in Chapter 9.
If the Facility Entity was previously available, FAVAIL has no effect.
FAVAIL cancels the affects of FUNAVAIL on the Facility Entity, but does not affect displaced Transactions.
Refuse Mode
A Transaction is never refused entry to a FAVAIL Block.
Related Block
·
FUNAVAIL - Place Facility Entity in the unavailable state.Related SNAs
The SNAs associated with Facilities are:
·
FEntnum - Facility busy. If Facility Entity Entnum is currently busy, FEntnum returns 1. Otherwise FEntnum returns 0.·
FCEntnum - Facility capture count. The number of times Facility Entity Entnum has become owned by a Transaction.·
FIEntnum - Facility Entnum interrupted. If Facility Entity Entnum is currently preempted, FIEntnum returns 1. Otherwise FIEntnum returns 0.·
FREntnum - Facility utilization. The fraction of time Facility Entity 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 Entity Entnum is owned by a capturing Transaction.·
FVEntnum - Facility in available state. FV Entnum returns 1 if Facility Entity Entnum is in the available state, 0 otherwise.Related Window
·
Facilities Window - Online view of Facility Entity dynamics.
FUNAVAIL Blocks are used to make a Facility Entity unavailable for ownership by Transactions.
FUNAVAIL A,B,C,D,E,F,G,H
Operands
A
- Facility name or number. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA or SNA*Parameter.B - REmove or COntinue Mode for owning Transaction. Optional. The operand must be RE, CO, or Null.
C - Block number. New Block for Transaction owning the Facility Entity. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
D - Parameter number. Parameter to receive residual time if owning Transaction is removed from FEC. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression, SNA or SNA*Parameter.
E - REmove or COntinue Mode for preempted Transactions. Optional. The operand must be RE, CO or Null.
F - Block number. New Block for Transactions preempted at the Facility Entity. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression, SNA or SNA*Parameter.
G - REmove or COntinue Mode for Transactions pending or delayed at the Facility Entity. Optional. The operand must be RE, CO or Null.
H - Block number. New Block for Transactions pending or delayed at the Facility Entity. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression, SNA or SNA*Parameter.
Examples
FUNAVAIL Teller1
This is the simplest way to use the FUNAVAIL Block. The Facility Entity named Teller1 is "frozen" during the unavailable period. Several types of Transactions other than the Active Transaction are affected. If an owning Transaction is in an ADVANCE Block, it will be rescheduled on the FEC automatically when the Facility again becomes available. The time remaining in the ADVANCE Block (i.e. the "residual time") is calculated and saved automatically when the Transaction is removed from the FEC. The residual time becomes the time increment when the Transaction is rescheduled on the FEC. Other Transactions delayed or pending at TELLER1 will not be able to move during the unavailable period.
FUNAVAIL TELLER,RE,TLR2,300,RE,MGR,CO
In this example, the Facility Entity TELLER is made unavailable. This means that newly arriving Transactions will be delayed. The Transactions at or preempted at the Facility TELLER are dealt with according to operands B-H. If the Transaction which owns Facility TELLER is on the FEC, it is dequeued and the residual time is saved in its Parameter number 300. The owning Transaction is displaced and sent to the Block named TLR2. Transactions currently preempted at Facility TELLER are removed from contention and sent to Block named MGR. Since Operand G is CO, Transactions currently delayed at Facility TELLER are allowed to own the Facility, even though it’s in the unavailable state.
Action
The complexity of the FUNAVAIL Block is due to the three classes of Transactions which must be dealt with:
1. the owning Transaction (operands B-D),
2. preempted Transactions on the Interrupt Chain (operands E-F), and
3. delayed Transactions on the Delay Chain or Pending Chain (operands G-H).
A FUNAVAIL Block allows you to put a Facility "out of action" and to control the fate of Transactions waiting for, using, or preempted at the Facility Entity. Transactions arriving during the unavailable period will be delayed and not be granted ownership. A FUNAVAIL Block has no effect if the Facility is already unavailable.
When the REmove option is used, the Transactions are removed from contention for the Facility If the REmove option is used for pending and delayed Transactions, i. e. if G is RE, then H must be used to redirect the Transactions.
When the COntinue option is used, the Transactions on the specific Facility chain may continue to own the Facility, even during the unavailable period. In this case, Facility utilization statistics are adjusted to include this time.
When an alternate destination Block is used, the Transactions are displaced from their current context and redirected to the new Block. Delayed and pending Transactions, which are controlled by operands G and H, cannot be redirected without also using the REmove option. The owning Transaction, controlled by operands B through D, and preempted Transactions, controlled by operands E and F, can remain in contention for the Facility and yet be displaced to a new destination. This is done by specifying an alternate destination without using the corresponding RE option.
When RE is not used in Operand B, any owning Transaction becomes preempted at this Facility. Such Transactions cannot leave ASSEMBLE, GATHER, or MATCH Blocks or enter (nonzero) ADVANCE Blocks until all preemptions are cleared.
When a Transaction is displaced by using the C, F, or H Operand, it is given a new Block destination and is dequeued from:
·
FEC·
PENDING (waiting to preempt) CHAINS·
DELAY (waiting to seize) CHAINS·
USER CHAINS·
RETRY CHAINSand not dequeued from:
·
CEC·
INTERRUPT (preempted) CHAINS of other Facilities·
GROUP CHAINSWhen a Transaction is displaced from its present context anywhere in the model, by using an alternate destination, it is removed from any Blocking conditions but preemptions are not cleared. Such a displaced Transaction is scheduled to enter the Block specified in Operand C of the FUNAVAIL Block. When an owning Transaction RELEASEs or RETURNs a Facility, the next owner is chosen from the head of the Pending Chain, the Interrupt Chain, or the Delay Chain, in that order.
TheOwning Transaction
Operands B-D are used to control the owning Transaction.
If B is CO, the owning Transaction is not removed from ownership. It may, however, be given a new destination with the C Operand.
If B is RE, the owning Transaction is removed from contention for the Facility. This means that the Transaction may continue to circulate in the simulation without restrictions due to a preemption at this Facility (there may be outstanding preemptions at other Facilities, however). It also means that the owning Transaction must not attempt to RETURN or RELEASE the Facility. The C Operand must be used to redirect the course of such a Transaction.
If B is Null, the owning Transaction is preempted and placed on the Interrupt Chain of the Facility. If it was taken from the FEC and the C Operand is not used, it will be automatically restored to the FEC using the automatically saved residual time when the Facility again becomes available.
The C Operand may be used regardless of Operand B. It causes the owning Transaction to be displaced, and gives it a new destination Block. If you choose to return the Transaction to the FEC, having used the C Operand, you must explicitly route the Transaction to an ADVANCE Block. The D Operand causes the residual time to be saved in a Parameter of the owning Transaction. The residual time value is then available for explicit rescheduling when you use the Parameter value as Operand A of an ADVANCE Block.
Preempted Transactions
Operands E and F are provided to control the fates of Transactions currently preempted at this Facility.
If E is CO, preempted Transactions are not removed from contention for the Facility, and may own the Facility during any unavailable period. Preempted Transactions may be given a new destination with the F Operand.
If E is RE, preempted Transactions are removed from contention for the Facility. This means that the Transaction may continue to circulate in the simulation without restrictions due to a preemption at this Facility (there may be outstanding preemptions at other Facilities, however). It also means that preempted Transactions must not attempt to RETURN or RELEASE the Facility. Optionally, the F Operand is available to redirect the course of such a Transaction.
If E is Null, preempted Transactions are left on the Interrupt Chain of the Facility, and cannot be granted ownership of the Facility during the unavailable period.
The F Operand may be used regardless of Operand E. It causes preempted Transactions to be displaced, and gives them a new destination Block. Preempted Transactions may not exist on the FEC, so no residual time options are relevant. If E is Null, the preemption is not cleared for displaced Transactions.
Pending Interrupt Mode Transactions
Operands G and H are provided to control the fates of Transactions on the Pending Chain (i.e. pending Interrupt Mode PREEMPTs) or the Delay Chain.
If G is CO, delayed Transactions are not removed from contention for the Facility, and may own the Facility during any unavailable period.
If G is RE, delayed Transactions are removed from contention for the Facility and allowed to circulate in the simulation. These Transactions must not attempt to RETURN or RELEASE the Facility. The H Operand must be used to redirect the course of such Transactions.
If G is Null, delayed Transactions are left on the Delay Chain or the Pending Chain of the Facility, and cannot be granted ownership of the Facility during the unavailable period. The use of Operand H is invalid when G is Null.
Special Restrictions
·
If B is RE, C must be used.·
If H is used, G must be RE.·
If G is RE, H must be used.Refuse Mode
A Transaction is never refused entry to a FUNAVAIL Block.
Related Block
·
FAVAIL - Place Facility in the available state.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.·
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.
A GATE Block alters Transaction flow based on the state of an entity.
GATE O A,B
Operands
O
- Conditional operator. Condition required of entity to be tested for successful test. Required. The operator must be FNV, FV, I, LS, LR, M, NI, NM, NU, SE, SF, SNE, SNF, SNV, SV, or U.A - Entity name or number to be tested. The entity type is implied by the conditional operator. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
B - Destination Block number when test is unsuccessful. Optional. The operand must be Null, Name, PosInteger, ParenthesizedExpression, SNA, SNA*Parameter.
Examples
GATE SNF MotorPool
In this example of a "Refuse Mode" GATE Block, the Active Transaction enters the GATE Block if the Storage Entity named MotorPool is not full (i. e. if at least 1 unit of storage is available). If the Storage is full, the Active Transaction is blocked until 1 or more storage units become available.
GATE SNE MotorPool,CupboardIsBare
In this example of an "Alternate Exit Mode" GATE Block, the Active Transaction always enters the GATE Block. If the Storage Entity named MotorPool is not empty (i. e. if at least 1 unit of storage is in use) the Transaction proceeds to the NSB. If the Storage is empty (unsuccessful test), the Active Transaction is scheduled to enter the Block at the location named CupboardIsBare.
Action
A GATE Block operates in either "Refuse Mode" or "Alternate Exit Mode".
If Operand B is not used, the GATE Block operates in Refuse Mode. When a Transaction attempts to enter a Refuse Mode GATE Block, and the test is unsuccessful, the Transaction is blocked until the test is repeated and is successful. If the test is successful, the Active Transaction enters the GATE Block and then proceeds to the Next Sequential Block.
Blocked Transactions are placed on the Retry Chain of the tested entity. When the state of any of the entity changes, the blocked Transaction is reactivated, the test specified by the GATE block is retried, and if successful, the Transaction is permitted to enter the GATE Block. However, the integration of User Variables does not cause blocked Transactions to be reactivated. You should use the thresholds in an INTEGRATE Command if you need to be notified about the level of one or more continuous variables. This is discussed further in Chapter 1, in the Section entitled Continuous Variables.
If Operand B is used, the GATE Block operates in Alternate Exit Mode. When a Transaction attempts to enter such a GATE Block, and the test is unsuccessful, the Transaction enters the GATE Block, is scheduled for the alternate destination Block specified by the B Operand, and is placed on the Current Events Chain in front of its priority peers. If the test is successful, the Active Transaction enters the GATE Block and then proceeds to the Next Sequential Block.
Conditional Operators
The conditional operator is required. It may be FNV, FV, I, LS, LR, M, NI, NM, NU, SE , SF, SNE, SNF, SNV, SV, or U. When the condition is true, the Transaction enters the GATE Block and proceeds to the Next Sequential Block. The conditions are defined as follows:
· FNV - The Facility specified implicitly by Operand A must be unavailable for a successful test.
·
FV - The Facility specified implicitly by Operand A must be available for a successful test.·
I - The Facility specified implicitly by Operand A must be currently interrupted for a successful test.·
LS - The Logicswitch entity specified implicitly by Operand A must be in the "set" state for a successful test.·
LR - The Logicswitch entity specified implicitly by Operand A must be in the "reset" state for a successful test.·
M - The Match Block specified implicitly by Operand A must have a related (to the Active Transaction) Transaction waiting for a Match Condition.·
NI - The Facility specified implicitly by Operand A must be not interrupted for a successful test.·
NM - The Match Block specified implicitly by Operand A must not have a related (to the Active Transaction) Transaction waiting for a Match Condition.·
NU - The Facility specified implicitly by Operand A must not be in use for a successful test.·
SE - The Storage Entity specified implicitly by Operand A must be empty for a successful test. All storage units must not be in use.·
SF - The Storage Entity specified implicitly by Operand A must be full for a successful test. All storage units must be being used.·
SNE - The Storage Entity specified implicitly by Operand A must be not empty for a successful test. At least one storage unit must be in use.·
SNF - The Storage Entity specified implicitly by Operand A must be not full for a successful test. There must be at least one storage unit that can be used.·
SNV - The Storage Entity specified implicitly by Operand A must be in the "unavailable" state for a successful test.·
SV - The Storage Entity specified implicitly by Operand A must be in the "available" state for a successful test.·
U - The Facility specified implicitly by Operand A must be in use for a successful test.Special Restrictions
·
B, if specified, must be the location of a Block in the simulation.·
GATE Blocks are extremely powerful, but they can cause a lot of computer time to be used in unsuccessful tests. You may need to arrange your simulation to reduce the frequency of unsuccessful tests. This can be done by placing Transactions with no chance of a successful test on a User Chain using LINK and UNLINK Blocks.·
The MB class of SNA should not be used alone to specify a blocking condition in a GATE Block. You should use MATCH Blocks instead.Refuse Mode
A GATE Block operating in Refuse Mode will refuse entry to a Transaction when the test fails. The refused Transaction will be blocked until the test is successful.
When a Transaction is refused entry, its delay indicator is set and remains so until the Transaction enters a "Simultaneous" Mode TRANSFER Block. However, since the advent of the Boolean Variable in the GPSS language, it is more efficient to use a TEST Block and a Boolean Variable when it is necessary to coordinate the state of multiple entities.
Related Windows
·
Blocks Window - Online view of Block dynamics.·
Facilities Window - Online view of Facility Entity dynamics.·
Logicswitches Window - Online view of Logicswitch Entity dynamics.·
Storages Window - Online view of Storage Entity dynamics.
Wait for related Transactions.
GATHER A
Operand
A
- Transaction count. Required. The operand must be Name, PosInteger, ParenthesizedExpression, SNA, or SNA*Parameter.
Example
GATHER 2
This is the simplest way to use the GATHER Block. The first Transaction of an Assembly Set (see Section 9.3) is caused to wait when it enters an GATHER Block. When another Transaction in the same Assembly Set enters the Block, both related Transactions are released and put on the Current Events Chain.
Action
When a Transaction enters a GATHER Block, the Match Chain of the Block is searched for a waiting Transaction of the same Assembly Set. If there are no other members of the same Assembly Set present, the A Operand is evaluated, truncated. decremented by one, and saved in a storage location in the Active Transaction. If this number is less than or equal to zero, the Transaction immediately attempts to enter the Next Sequential Block. Otherwise, the Transaction is placed on a special chain in the GATHER Block, called the Match Chain, to await the arrival of other members of its Assembly Set.
If the Active Transaction arrives to find other members of its Assembly Set already on the Match Chain, the Active Transaction is also placed on the chain and the Transaction count saved in the first chained Transaction is reduced by one. When this count becomes 0, all related Transactions are removed from the Match Chain. All Transactions which have not been preempted at any Facility are then placed on the CEC behind their priority peers.
Preempted Transactions which have completed an assembly at a GATHER Block are not permitted to leave the Block until all preemptions have been cleared. More discussion of the preemption mechanism can be found in Section 9.4. Preempted Transactions which have been removed from the Match Chain do not participate in later gatherings even though they remain in the GATHER Block.
GATHER Blocks differ from ASSEMBLE Blocks in that Transactions after the first are destroyed at an ASSEMBLE Block.
Special Restrictions
·
A must be positive.·
Transactions which are currently preempted are not permitted to leave GATHER Blocks.Refuse Mode
A Transaction is never refused entry to a GATHER Block.
Related Blocks
·
ADOPT - Set the Assembly Set of the Active Transaction.·
ASSEMBLE - Wait for and destroy Assembly Set members.·
MATCH - Wait for Assembly Set member.·
SPLIT - Create Transactions in the same Assembly Set.Related SNAs
·
A1 - Assembly Set. Return the Assembly Set of the Active Transaction.·
MBEntnum - Match at Block. MBEntnum returns a 1 if there is a Transaction at Block Entnum which is in the same Assembly Set as the Active Transaction. MBEntnum returns a 0, otherwise.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.
A GENERATE Block creates Transactions for future entry into the simulation.
GENERATE A,B,C,D,E
Operands
A
- Mean inter generation time. Optional. The operand must be Null, Name, Number, String, ParenthesizedExpression, or DirectSNA. You may not use Transaction Parameters.B - Inter generation time half-range or Function Modifier. Optional. The operand must be Null, Name, Number, String, ParenthesizedExpression, or DirectSNA. You may not use Transaction Parameters.
C - Start delay time. Time increment for the first Transaction. Optional. The operand must be Null, Name, Number, String, ParenthesizedExpression, or DirectSNA. You may not use Transaction Parameters.
D - Creation limit. The default is no limit. Optional. The operand must be Null, Name, PosInteger, String, ParenthesizedExpression, or DirectSNA. You may not use Transaction Parameters.
E - Priority level. Optional. Zero is the default. The operand must be Null, Name, integer, String, ParenthesizedExpression, or DirectSNA. You may not use Transaction Parameters.
Example
GENERATE 0.1
This is the simplest way to use the GENERATE Block. This Block causes a priority zero Transaction to enter the simulation every tenth of a time unit.
Action
When a simulation is begun, or an interactive Command is performed, any GENERATE Block which has not been "primed" is called upon to schedule its first Transaction. Such Transactions are scheduled to enter the GENERATE Block and placed on the Future Events Chain if they have a positive time increment. Operand C can be used to specify a positive time increment for the first Transaction. Otherwise, the first time increment is calculated from operands A and B.
You cannot use Parameters in GENERATE Block operands. Newly GENERATEd Transactions do not have Parameters, and their entry into such a GENERATE Block would cause an Error Stop.
Before the new Transaction is created, Operand D is evaluated numerically to see if all the Transactions desired have been created. If the creation limit has not been exceeded, processing continues. The GENERATE Block then creates the new Transaction assigning it the next Transaction number, the priority from the E Operand, and the Transaction Mark Time is assigned the value in the absolute system clock. The new Transaction represents a new Assembly Set with one member.
The inter arrival time for the new Transaction is calculated from the A, B, and C operands. If only the A Operand is specified, it is evaluated numerically and used as the time increment. If the A and B operands are present, and B does not specify a function, both A and B are evaluated numerically and a random number between A-B and A+B, inclusively, is used as the time increment. You can select which random number generator number is to be used as the source of the random number. This is set in the "Random" page of the Model Settings Notebook.
CHOOSE
Edit / Settingsthen select the
Random page. Then fill in the desired random number stream entity number in the entry box marked "GENERATE". The installation default is to use random number stream number 1.When Operand B is an FN