For using Sfunction, how can I make simulation stay in while loop until break condition taking place?
古いコメントを表示
For example I have an input x and an output y, the pseudo code is like
while(true){
y=1; // this will activate some other blocks in the plant model
if (x==1){
break;
}
}
I suppose in Simulink the simulation will be stuck in the infinite loop because the solver tries to finish while loop within one time step. But in reality, while loop is commonly used in software to wait the hardware response, and then to break the loop when break condition satisfied and to implement interruption. Thus, I'm thinking whether there is a method to make the simulation stay in while loop and just run the while loop code once each time step. Thanks.
2 件のコメント
Purushottama Rao
2015 年 5 月 5 日
Are you looking for some kind of triggered subsystem?
Z Li
2015 年 5 月 5 日
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Embedded Coder についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!