The error message is not caused by any sample time mismatches with the subsystem. It typically occurs when you are mixing continuous and discrete time blocks. In certain cases, the Real-Time Workshop generated S-function throws an error message saying that the fixed step size of the model in which it is being used must match the fixed step size with which it was generated. Unfortunately, there is no way to change the fixed step size of the Real-Time Workshop generated S-function. The step size will always be calculated and set based on the blocks in the subsystem, if any of them have a specified (non-inherited) sample time.
This error is used to catch certain rate transition errors, under the following conditions:
1. There are discrete and continuous blocks in the subsystem.
2. Multitasking is turned on (Auto becomes multitasking for multirate systems)
3. The diagnostic for multitask rate transitions is set to 'Error'
Currently, to work around this issue, try changing the solvers to Single Tasking mode before generating the S-function, and in the final model. Alternatively, try changing the diagnostic for Multitask Rate Transition from "Error" to "None" or "Warning". Note that the dynamics of your model could be affected, as all blocks in the S-Function subsystem will be updated at the fixed sample time selected when the S-Function was generated.
Best Answer