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

3 views (last 30 days)
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.

Answers (3)

Kaustubha Govind
Kaustubha Govind on 14 Mar 2012
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 on 14 Mar 2012
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 on 26 Mar 2012
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 Comment
Kaustubha Govind
Kaustubha Govind on 30 Mar 2012
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.

Sign in to comment.

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!