Simulink Clock (time) reset?
26 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I am currently trying to implement a timer into a Simulink model I am working on. The idea is to take the current simulation time, limit it to 5400 seconds and when it reaches that value it has to reset to 0, reach 5400 s again and so on.
I was experimenting with different blocks but it either gets too complicated or I do not get the desirable results. I am attaching a screenshot of what I am trying to achieve just to give you an idea. I am trying to make something like this, but way more simpler. As you can tell from this model, it is not very practical. In addition Simuilink gets slower and slower, and also I am limited to the times I do add this loop. I used series of switches, each +5400 and in the end I subtract 86400s (equivelant to 24 hours) from the whole thing to make it start again and so on. I am pretty sure there is a much easier and simpler way I can do this.
Solutions solely involving Simulink would be much appreciated as I do not have experience with MatLab commands and scripts.
Thank you in advance.
Kind regards.
0 Kommentare
Antworten (1)
Fangjun Jiang
am 24 Feb. 2021
Feed Constant value 1 to an integrator, the output is the time. Wrap the state of the Integrator to 5400 and 0.
2 Kommentare
Fangjun Jiang
am 24 Feb. 2021
This is related to the solver. Depending on your need for resolution, you could reduce the step size, set step size to be 0.1.
Siehe auch
Kategorien
Mehr zu Event Functions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!