In this section the user may define structures of messages with user's defined fields, besides the default fields (see 9.1). The declarations must have the heading MESSAGES. After this one or more message declarations follow. The declaration syntax is:
| <node identifier> | <message identifier> | (<list of field declaration>);
<node identifier>
is the name of a I type node.
Index must not be included in this declaration.
The declaration defines the structure of the messages generated at
that Input type node.
<message identifier>
is an identifier that may be used by a
CREATE instruction
to generate messages with the declared structure. The
CREATE instruction may be used in any node,
except I type nodes
<list of field declaration>
is a list of field declarations
with the same syntax that the RECORD structure declaration.
Examples:
ShipArr (I) :: ShipType := FTypeFreq; IT := EXPO(Tba[ord(ShipType)]; ...................................... TrainContr (A) :: ................................ CREATE(Train) BEGIN WCars := Round(TotalLoad / Capacity); SENDTO(Yard) END; ...................................... DECL TYPE St = (Freighter, Tanker, Barge) MESSAGES ShipArr(ShipType: St; Load: ARRAY[1 .. 5] OF REAL; Displ: REAL); Train(WCars: INTEGER; Capacity: REAL);In the node
ShipArr
, messages representing different types
of simulated ships are generated.
The characteristics (fields of the message) are: ship type, five quantities
indicating different kinds of loads, and displacement. In the node
TrainContr
, according to conditions computed by a complex code, the
decision of sending a message (train) to a yard is taken.