I am running a simulink model with 2 S-functions (more in the future), while it cannot gives a correct result. When using some printf in my codes, I found that the second s-function runs only at the first step, although the first s-function runs continuously each step. What makes me confused is that when run the two S-function separately, by using workspace for data transmission indirectly, it works. Thus, I think there should be some tricks about running a model where the s-function cooperating with each other. Could someone give me some hints about it?
In the attachment is my model with the two C-codes.
My problem is that my simulink model can only support one s-function running continuously with fixed step (0.001s). When connecting s-function to another, the second s-function runs only at the first step.
Thank you for your reading
Best Answer