simulink preventing signal below 0
59 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Andreas Goser
el 17 de En. de 2014
Editada: Andreas Goser
el 17 de En. de 2014
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 comentarios
Haiko
el 17 de En. de 2014
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.
Ver también
Categorías
Más información sobre Sources en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!