simulink preventing signal below 0
33 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I have a model which runs fast but the problem is that simulink takes to big time steps and by this the signal goes below zero. My model has exponential functions and thus will never go below zero. But because a too big time step close to 0 the signal jumps below zero and I get errors of derivative inputs being infinite. Is there a way to prevent simulink from getting values below 0 because due to the model this could normally not happen. I still want simulink to calculate fast (thus changing the absolute/relative error margins is not advisable because this seems to work but the simulation time for the values which are far from 0 takes 50 times longer) but only if he sees that it becomes zero that he goes back to the past and take smaller time steps. It is also not zero crossing because he will search for a value which he will never be able to find. Can somebody help me with this problem?
Tom Wambecq
0 件のコメント
回答 (2 件)
Andreas Goser
2014 年 1 月 17 日
編集済み: Andreas Goser
2014 年 1 月 17 日
OK, you seem to be aware of the numerical risks of addressing this issue not by solver settings...
In this case I suggest the block "Saturation" and set the lower limit to 0 and the upper limit to a reasonable value you will not reach anyway or inf.
2 件のコメント
Haiko
2014 年 1 月 17 日
A simple possibility is to add a few blocks to your system.
For example a switch block. Using the normal input when larger than zero and z zero input when smaller than zero.
Anonther easy solution would be an if block and subsystems.
Something like this:
if (u1 > 0) {
body_1;
}
elseif (u1 < 0){
body_2; % with in the subblock a gain of zero
}
else {
body_3;
}
Anonther easy solution would be a switch block. Using the normal input when larger than zero and z zero input when smaller than zero.
参考
カテゴリ
Help Center および File Exchange で Event Functions についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!