Integrate Generated Code with Custom Code
For the top-level subsystem that has internal state, the generated
FUNCTION_BLOCK code has ssMethodType.
ssMethodType is a special input argument that the coder adds to
the input variables section of the FUNCTION_BLOCK section during code
generation. ssMethodType enables you to execute code for Simulink® Subsystem block methods such as initialization and computation steps. The
generated code executes the associated CASE statement based on the value passed in for
this argument.
To use ssMethodType with a FUNCTION_BLOCK for
your model, in the generated code, the top-level subsystem function block prototype has
one of the following formats:
| Has Internal State | ssMethodType Contains... |
|---|---|
| Yes | The generated function block for the block has an extra first
parameter |
| No | The function block interface only has parameters mapped from
Simulink block I/O ports. There is no
|
For non top-level subsystems, in the generated code, the subsystem function block prototype has one of the following formats:
| Has Internal State | ssMethodType Contains... |
|---|---|
| Yes | The function block interface has the
If non top-level subsystems
have blocks with constant sample time the generated code could have
|
| No | The function block interface only has parameters mapped from
Simulink block I/O ports. There is no
|