Conditionally stop simulation in simulink

25 Ansichten (letzte 30 Tage)
Ting
Ting am 11 Okt. 2024
Beantwortet: Harsh Sharma am 11 Okt. 2024
Hi,everyone!
I want to detect a signal x in simulink and stop the simulation when it exceeds the limit a. How should I do it?
Thanks for your answer.

Akzeptierte Antwort

Harsh Sharma
Harsh Sharma am 11 Okt. 2024
Hi Ting,
You can connect “compare to constant” block to the signal “x” and then connect the output of that block to “stop simulation” block. In the compare to constant block, you can set the “operator” parameter to “>” and “constant value” parameter to “a”. This setup will stop the simulation when the value of signal “x” exceeds the limit “a”.
Below is an example of “ramp” signal with slope 1 which is set to stop when the signal value exceeds 3.
The output in scope is –
The simulation stops after T=3 when the signal value exceeds 3.
You can check the below documentation links to learn more about the “stop simulation” and “compare to constant” blocks –
I hope this answers your question.

Weitere Antworten (1)

Aquatris
Aquatris am 11 Okt. 2024
You can use the stop simulation block.

Kategorien

Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by