Syntax:
CREATE( | <message name> | <node> | ) <associated instruction>;This instruction is used to create messages in nodes that are not of I type.
It creates a message with the structure defined
in the declaration MESSAGES with the name indicated in
<message name>
.
If <node>
is used, this may be a name of a I type node
and the structure of the created message will be that of the
messages that can be created by that I type node. It may also
be a general type node for which a message structure has been
defined.
After one message is created, the <associated instruction>
is executed.
The <associated instruction>
must have a
SENDTO instruction to send the generated message to a list.
In the <associated instruction>
values may be given
to the fields of the created instruction by means of
the names of the <field>
variables
(not the O_<fields>
).
This must be done before the message is sent to the EL of a node.
This instruction can be used in nodes of G, L, D, E, R, A, C, or general type.
Examples:
Death (E) Heaven :: N := N + 1; CREATE(Soul) BEGIN Nc := N; SENDTO(Heaven) END; ------------------ INIT N := 0; ------------------ DECL VAR N: INTEGER; MESSAGES Soul(Nc: INTEGER);For each message that reach the node
Death
and it is destroyed a
new message with the structure defined in the MESSAGE
declaration
Soul
is created and sent to Heaven
. The number of creation
is counted in the global variable N and stored in the
field Nc of the message. As the destroyed and generated messages
may have different structures, the process may be useful to
simulate the change of the structure of a message. Prod_Order (I) :: IT := EXPO(Tb_Orders); Recep_Time := TIME; Control (R) File_Order, Ship_Order :: RELEASE BEGIN SENDTO(Ship_Order); CREATE(Prod_Order) BEGIN Control_Time := TIME; SENDTO(File_Order) END END; STAY := Insp_Time * (1 + UNIF(-0.1, 0.1)); ------------------------------------------ INIT ACT(Prod_Order, 0); TSIM := 100; Tb_Orders := 4; Insp_Time := 2; DECL VAR Insp_Time, Tb_Orders: REAL; MESSAGES Prod_Order(Quantity: INTEGER; Name: STRING[20]; Recep_Time, Control_Time, Ship_Time: REAL);Messages (orders) produced by
Prod_Order
are
sent to Control
to be inspected and then sent to Ship_Order
. For each order sent
to Ship_Order
a message of the same structure is created an sent
to File_Order
with the value of the control time in the field
Control_Time
.