Sample Time Mismatch with S-Function of Same Sample Time?

I have a large model with many blocks and subsystems. In order to hide one of the subsystems, I have created an S-Function using RTW to replace the system in question. I have tested this S-Function outside my main model and it is functional and behaves the same way as the original subsytem for a given set of inputs.
Now, when I try to implement it back into my main model, I get the following error:
Sample time mismatch. Sample time ([0.00166666666666667, 0]) of signal driving input port 1 of 'PORT_NAME' does not match the sample time ([0.00166666666666667, 0]) of the block.
I am not sure what to do about this, seeing as what Simulink thinks is a sample time mismatch is actually the exact same sample time.

Answers (1)

When you create the S-function for that subsystem, check the input boundary signals and their sample time settings. Try use Inherient (-1) as the sample time and avoid specifying the actual sample time. I suspect that one of the Inport blocks has its sample time spcified as 1/600. When its S-function is generated, it uses 0.00166666666666667 as the sample time. Now it complains 0.00166666666666667 is not equal to 1/600 which is specified in your main model, although the message also says it is 0.00166666666666667.

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products

Release

R2009a

Asked:

on 15 Jul 2020

Answered:

on 15 Jul 2020

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!