I would like to prepare a Simulink
file for a real-time target. In the main Simulink
file I have a Model
reference block, which I set to run in Accelerator
mode. The Model
block also contains several S-functions
. The Model
file was also configured to use a fixed-step solver.
However, I'm getting this error:
Caused by:
Error using do_rt (line 410)
The noninlined S-function 'whatever/Model' in a referenced model is not allowed
to call macros that use the generic function in the SimStruct. To find such macros,
search for GenericFcn in simstruc.h
when building for the SIM
target.
Everything works well if I switch to Normal
mode for the Model
block.
How should I fix this issue?
I guess I found my answer. Here are the limitations of S-functions + Model reference: http://www.mathworks.se/help/simulink/ug/using-s-functions-with-model-referencing.html#bsp24qn-6
A referenced model cannot use noninlined S-functions in the following cases:
- The model uses a variable-step solver.
- Simulink Coder™ generated the S-function.
- The S-function supports use of fixed-point numbers as inputs, outputs, or parameters.
- The model is referenced more than once in the model reference hierarchy. To work around this limitation, use Normal mode.
- The S-function uses string parameters.