
How can I record the simulation time when a condition is met in Simulink?
19 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 11 Okt. 2022
Beantwortet: MathWorks Support Team
am 22 Nov. 2022
I have a set of conditions in Simulink release R2022b, and I would like to record the simulation time when they are met. How can I do that?
Akzeptierte Antwort
MathWorks Support Team
am 11 Okt. 2022
One way to do that is using a "Triggered subsystem" block:
https://www.mathworks.com/help/releases/R2022b/simulink/ug/triggered-subsystems.html
The triggered subsystem will become enabled when the control signal changes. By default, it is enabled when the control signal goes from a zero or negative value to a positive value.
The attached example records the time when a ramp signal crosses the value of 2. The ramp has a slope of 0.5, so the expected time of that event is 4 seconds.
As you can see, input of the "Triggered subsystem" is the simulation time using the "clock" block. The subsystem is simply wired so that its output is equal to its input. When the subsystem is triggered, it assigns the clock time to its output value and holds it.

0 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!