S-function executes only if clock is present in Simulink file

Hi all, I have a general questions about using Matlab S-functions. I'm using a Level-2 m file as an S-function to simulate a simple model. When I just use an M-S-function block in simulink and provide all parameters and the inputs needed for it and then start simulating. I see that the start(block) function is executed and also the terminate() function but the update, output and derivative functions are never called. If I simply add the clock block to the simulink model with a terminator at its output everything runs as expected.
Why is that?
Thanks for any help.

답변 (3개)

Kaustubha Govind
Kaustubha Govind 2012년 3월 14일

0 개 추천

Turn on 'Format>Sample Time Display>Colors' on your model without the Clock block. What colors do you see? This may provide us some clue of what is going on. Also, which Solver have you selected from the Configuration Parameters window?
xlr8t
xlr8t 2012년 3월 14일

0 개 추천

The Sample Time is: Fixed in Minor Step (value = [0,1]) Not sure what that means. I also have used a pulse generator with variable sampling time but even if I remove this generator the problem remains.
I didn't change the solver and it uses ode45.
xlr8t
xlr8t 2012년 3월 26일

0 개 추천

I made another S-function and the problem stays the same. The derivative(block) function gets not executed if the clock block is missing in the simulink model file.
Does anyone have a clue? That seems really akward... Thanks

댓글 수: 1

Just to verify if it the S-function or your model that is the cause, could you try with a copy of the S-function block that's used in the demo 'msfcndemo_limintm'? You can just type the name of the model in the MATLAB prompt to open it.

댓글을 달려면 로그인하십시오.

카테고리

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

질문:

2012년 3월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by