Syntax:
SELECT(| <list of nodes> | <multiple node> <range> |, <integer value>) <associated instruction>;It is used to select messages from ELs of a type D node corresponding to its predecessors.
<list of nodes>
is a list of predecessor nodes of the D type
node.
<multiple node > <range>
is the name of an antecessor multiple
node with a range within the range of the node indexes.
<integer value>
is an integer positive constant or an integer
type variable with positive values.
When the instruction is executed, the ELs of the node are examined
in the order in which they appear in the list. If the predecessor is
a multiple node, the successive indexed nodes indicated in the
<range>
are examined.
A quantity of
messages equal to <integer value>
(or less if there are not enough
in the EL) are extracted. For each extracted message the fields are
passed to the O_<fields>
and the <associated instruction>
is executed. This must have a SENDTO instruction to send the message
to any list. If the SENDTO is not executed, the message remains in
its EL.
The selected maximum can be known and modified for the next selection
using the MAXSEL system variable. If the predecessor is a multiple
node, the index of the EL actually examined is indicated in INO.
MAXSEL and INO may be used in the <associated instruction>
The instruction only can be used in type D nodes and if and only if there are more than one predecessor or the predecessor is an indexed node.
Examples:
Proda (I) Sel :: IT := Tproa + UNIF(0.2, 0.4); Prodb (I) Sel :: IT := Tprob + UNIF(0.1, 0.5); Prodc (I) Sel :: IT := Tproc + UNIF(0.2, 0.6); Sel (D) Assemb :: I := MINI(LL(EL_Sel(Proda)), MINI(LL(EL_Sel(Prodb)), LL(EL_Sel(Prodc)))); IF I >= 2 THEN SELECT(Proda, Prodb, Prodc: I) SENDTO(Assemb); Assemb (E) ::Messages (parts to be assembled) are produced at
Proda
, Prodb
and Prodc
and sent to
3 queues that are the ELs of Sel.
When the minimum quantity in the queues is 2, then 2 messages
are selected from each queue and sent to Assemb
.Parts of five different types are produced at Pr with different processing times. They are sent to a Selection subsystem. When the production of each kind accumulates the required quantities, given by the function FQuantReq, (for some types more than that may be produced) the required quantities are selected and sent to Assembly, This simulation is a part of a bigger model. Its purpose is to see how many assembles can be made and how many unmatched parts remain. NETWORK Pr (I) [1..5] Selection :: IT := UNIF(Tmin[INO], Tmax[INO]); PartType := INO; SENDTO(Selection); Selection (D) :: {Evaluate extraction condition: } Extract := TRUE; FOR INO := 1 TO 5 DO IF LL(EL_Selection(PR[INO])) < FQuantReq(INO) THEN Extract := FALSE; MAXSEL := FQuantReq(1); IF Extract THEN SELECT(PR[1..5]: MAXSEL) BEGIN MAXSEL := FQuantReq(INO); SENDTO(Assembly); WRITELN(MAXSEL,' Selected Type ',INO {or PartType} ); END; Assembly (E) :: WRITELN(TIME: 8: 3, ' ***Out From PartType ', PartType); PAUSE; INIT TSIM := 50; FOR INO := 1 TO 5 DO ACT(PR[INO], UNIF(Tmin[INO], Tmax[INO])); TITLE := 'Test Select I'; ASSI Tmin[1..5] := (2.8, 3.5, 3.6, 3.9, 1.5); ASSI Tmax[1..5] := (4.8, 7.2, 7.6, 8.4, 3.5); FQuantReq := 1, 2 / 2, 1 / 3, 1 / 4, 1 / 5, 2; DECL VAR Extract: BOOLEAN; Tmin, Tmax: ARRAY[1..5] OF REAL; MESSAGES Pr(PartType: INTEGER); GFUNCTIONS FQuantReq DISC (INTEGER): INTEGER: 5; STATISTICS ALLNODES; END.