The EVENT macro is predefined and is used to output an event in a model. This macro accepts one to three parameters. The first parameter is a string that specifies the event name. The second parameter is usually a Python list containing arbitrary parameters that are sent with the event. (By default, it is an empty list.) The transition that handles the event can thus retrieve the parameter list with macro PARAMS. Individual parameter is accessible with [PARAMS][i], where i is the index of the parameter in the list. The third parameter of the EVENT macro may be a lock to be released when the event has been handled (discussed later).
The following example (param1.des) demonstrates the use of the two macros:
STATECHART: A [DS] B TRANSITION: S: A N: A E: e O: [EVENT("f", ["message", "Hello World"])] TRANSITION: S: A N: B E: f O: [DUMP([PARAMS]+": "+[PARAMS])]
The simulation result is as following:
['A'] > e message: Hello World ['B'] > exit
In this example, the user sends event e to the model. The event triggers a self-loop on A. In the output of the self-loop, event f is output with two parameters: Python strings "message" and "Hello World". This event is then handled by the other transition defined in the model. In the output of that transition, [PARAMS] is equal to "message", and [PARAMS] is equal to "Hello World".