MATLAB: Does the Real-Time Workshop 6.0 (R14) generated S-function not inherit sample times

buildcompiledsampletimeinheritinheritedrateright clickrtws-functionsamplesfunsfunctionsimulink codertimetimestransition

I have a model with a subsystem that inherits sample time. When I generate an S-function from this subsystem, the resulting S-function should inherit sample time as well. However, when I use this S-function in another model, it does not inherit its sample time. Instead, it uses the compiled sample time of the original subsystem.

Best Answer

The ability to generate an S-function that uses the compiled sample time of the subsystem is not available in Real-Time Workshop 6.0 (R14).
To work around this problem, do one of the following:
1. Use a Model Reference block instead of an S-function to achieve portability between models.
2. In the Configuration Parameters > Solver pane, set the Periodic sample time consraint parameter to "Ensure sample time independence". The Periodic sample time consraint parameter is available when the Type parameter is set to "Fixed-step".