Syntax:
REL(<internal list of node R>, <logical expression>) <associated instruction>;This instruction is used to extract a message from the IL of a R type node.
When executed, a search starts at the IL of the
node, looking for the first message for which
<logical
expression>
is true. If there is not such a message nothing is done. If it is found,
it is extracted from the IL and the <associated instruction>
is
executed. If a time of exit is scheduled for a normal release of the
resource, the corresponding event of the FEL is removed to eliminate
the scheduling.
If there is extraction of message, the boolean variable EXTREL is
put to TRUE, otherwise, it remains FALSE. The values in the fields of
the extracted messages are
passed to the corresponding O_<variables>
.
The <associated instruction>
must
have a SENDTO instruction to dispose
of the extracted instruction. Before the SENDTO is executed,
instructions can be used
to change the values of the fields. To do this, the names of the
O_<fields>
must be used.
This instruction can be used in nodes of any type.
Example:
NETWORK Entry (I) :: IT := EXPO(3); Urgency := Round(TRIA(0, 5,7)); WRITELN('Enter # ', Number: 3,' Urgency ', Urgency: 2); PAUSE; Ward (R) :: USE := 1; Call (A) Physician :: REL(IL_Ward, O_Urgency + 0.2 * (TIME - O_Et) > 5) SENDTO(Physician); IF NOT EXTREL AND (U_Ward > 0) AND (LL(EL_Physician) < 4) THEN EXTR(IL_Ward,FIRST) SENDTO(Physician); IT := 10; Physician (R) :: STAY := TRIA(4, 6, 9); Exit (E) :: WRITELN('Exit # ', Number: 3, ' Urgency ', Urgency: 2); PAUSE; INIT TSIM := 200; Urgency := 3; ACT(Entry, 0); ACT(Call, 0); DECL MESSAGES Entry(Urgency: INTEGER);Messages (patients) are admitted into the
Ward
if there is room enough.
Each 10 minutes Call
is activated. This extracts the first
message for
which the value of the field Urgency
plus a multiple of the
waiting time is greater than 5. The extracted message is sent
to the node Physician
.
If no message fulfills this condition the first one in the queue is
extracted and sent.See example 10 (GLIDER examples book).