Parameterized Modules or Module Calls

Parameterized modules, also known as “module calls”, facilitate the design of large systems. A parameterized module is one which is started and stopped by another module, and which accepts parameters as if it were a function call (i.e. by enclosing them in parentheses). The order of the parameters is significant, just as they are in a function or statement. A set of parenthesis must always follow the module call, regardless of whether parameters are included within in them.

A sample module call follows:

Motor(398, 765 { X-Y coordinates },

13 { Color }, 

MtrStat { Motor status }, 

MtrAmps { Motor current }); 

 

We refer to the state containing the parameterized module call to as the "calling state". Parameterized modules may themselves contain parameterized module calls, but take care not to call the first module from within the second. A circular or a recursive situation will result in a module calling itself repeatedly until a stack overflow fault occurs and the application crashes.

A parameterized module must be called from steady state.  Modules called from within scripts have a very different behavior, as described in the topic Launched Modules. When the state containing a module call activates, an instance of the parameterized module will start. When the state containing the module call stops, the called module’s instance will also stop.

 

Topics in this section:

Declaring and Passing Parameters

Default Values for Parameters