How to go back a time step and recalculate it again in Simulink
1 view (last 30 days)
Show older comments
Basically I am trying to detect when the value of a signal A exceeds a certain preset limit and, using feedback, change another signal B that brings the value of signal A down. Is there a way that I can go back and recalculate the time-step at which the limit was exceeded? Currently the feedback is working but there are still instances where signal A goes above the limit. Another way that I can achieve the same result will be to be able to predict the value of signal A for a given value of signal B but I don't know if that's possible without running the whole simulation for every time-step. Thanks very much in advance
0 Comments
Answers (1)
Ced
on 16 Mar 2016
Edited: Ced
on 16 Mar 2016
How are you checking it at the moment?
Maybe this would work:
The integrators in simulink have an inbuilt "condition check". When this is violated, you get a signal from an additional output port of the integrator (you can switch this on in the integrator block). You can also get the initial value of the integration externally.
Now, if this value is violated at a particular time step, it should not have been violated one time step earlier. Hence, keep a version of the delayed signal ( e.g. with a memory block ), and use this as initial value for the integration.
Like this, every time your limit is violated, you go back one time step and recompute the signal from there. Note however that this only resets this particular signal and not the whole system, depends what you want.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!