next up previous
Next: TITLE puts title to Up: INSTRUCTIONS Previous: STAY schedules exit time

SYNCHRONIZE retains messages in the EL to release them together

Syntax:

    SYNCHRONIZE(<integer value> | ALL | , | <logic expression> |
                 EQUFIELD(<field>) | ) <associated instruction>;
SYNCHRONIZE is used to retain messages that come to a node, maybe at different times, and to release together a set of them at the same time (synchronized) when certain conditions are met. The associated instruction must contain a SENDTO instruction to send the synchronized set.

The instruction is suited to simulate synchronization processes in assembling lines, and gathering items for batch processing.

The instruction must be used in a node with an EL that has the ability to send messages (nodes of G, L, D, and general type with EL).

When this instruction is executed the EL is scanned from the beginning. Each message (comparing message) is compared with those (compared messages) that follow it. The first comparing message is the first one in the EL. The values of the fields of the comparing message are in the field variables. Those of the compared message are put in the O_<variables>. The comparison consists in the evaluation of the <logic expression>, that may include field variables of the comparing messages, O_<variables> of the compared message and any other type of variables and constants. If the expression is TRUE, both, the comparing and compared messages, are candidates to be synchronized. When all messages are compared, the second message in the EL is taken as the new comparing message which is compared with those that follow it. The process is repeated so that all the possible comparisons are made. If at any point of the process a number of candidates reach the value expressed by <integer value>, then synchronization is successful. Then, the synchronized messages are taken out of the list one by one and for each synchronized message the <associated instruction> is executed. The whole process is then repeated to see if another successful synchronization group of the required size is possible with the remaining messages.

If the parameter ALL is used, there is not limit for the synchronized set.

If the <logical expression> is reduced to the constant TRUE, the messages are inconditionally synchronized up to the specified number (or all the messages if ALL is used).

If there is not successful synchronization at all, nothing is done and the <associated instruction> is not executed.

If the function EQUFIELD(<field>) is used instead of the <logical condition>, messages with the same values on that field are synchronized.

In all cases, it is assumed that all the messages in the EL have the fields that are used by the synchronizing conditions.

The <associated instruction> executed for each successful synchronization, may have instructions to change the fields of the messages (assigning values to field variables) and must have a SENDTO instruction to dispose of the message that represents them. Note that this <associated instruction> may change the values of variables in the <logical condition> and in the <integer value>, so changing the synchronization conditions for the next group or for a new execution of the SYNCHRONIZE instruction. If there was some successful synchronization, the variable SYNC is put to TRUE, otherwise it is put to FALSE.

See the instruction ASSEMBLE (6.1). See example 11 (GLIDER examples book).


next up previous
Next: TITLE puts title to Up: INSTRUCTIONS Previous: STAY schedules exit time

domingo c
Mon Mar 20 17:36:19 PST 2000