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.

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2020년 7월 15일

0 개 추천

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.

카테고리

도움말 센터File Exchange에서 Simulink Coder에 대해 자세히 알아보기

제품

릴리스

R2009a

질문:

2020년 7월 15일

답변:

2020년 7월 15일

Community Treasure Hunt

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

Start Hunting!

Translated by