フィルターのクリア

How to Stop Simulation in Test Sequence Block

51 ビュー (過去 30 日間)
Patrick
Patrick 2015 年 10 月 15 日
コメント済み: maiaL 2022 年 5 月 13 日
Hello Mathworks-Team,
I am currently trying out Simulink Test and I've got a question about the Test Sequence Block. Is there any opportunity to stop the simulation, if a specified state is reached. I tried
set_param(ModelName, 'simulationcommand', 'stop')
but this doesn't work. The ModelName can't be read from workspace because it's a char array and Simulink Test only supports numerical or logical types.
  1 件のコメント
Sai Vempati
Sai Vempati 2018 年 11 月 8 日
How to stop a sweep rate input signal if a required freq is achieved! im unable to Stop Simulation with this stop block if a specified state is reached
my seems to be similar ! Thanks in advance for everyone
Sai

サインインしてコメントする。

回答 (4 件)

Dave
Dave 2021 年 1 月 27 日
This should work when not using accellerated mode:
coder.extrinsic("set_param");
set_param(bdroot, 'simulationcommand', 'stop')
  1 件のコメント
maiaL
maiaL 2022 年 5 月 13 日
can confirm this works in 2021a

サインインしてコメントする。


Young Ma
Young Ma 2017 年 8 月 2 日
Hi Patrick,
I understand from your description that you want to stop the simulation when a specific state is reached in Test Sequence block. This is not supported yet in R2017a. I'll communicate this with the relevant staff and hopefully this feature will be available in a future release.
A workaround for this is to use 'Stop Simulation' block, which is documented in the following link: https://www.mathworks.com/help/simulink/slref/stopsimulation.html?
You can generate an non-zero output from Test Sequence block when a specific state is reached and feed this to the 'Stop Simulation' block so you can stop the simulation.
  2 件のコメント
Jonas Londschien
Jonas Londschien 2018 年 10 月 4 日
編集済み: Jonas Londschien 2018 年 10 月 4 日
Hello,
is this feature already added in 2018b? I am also interested in it, as an error will fail the test, and a extra block is annoying in a programmatic test created test sequence.
Denis Dmitriev
Denis Dmitriev 2019 年 11 月 26 日
Hello,
Is this feature already added to R2019a?
Thanks,
Deni

サインインしてコメントする。


Sebastian Castro
Sebastian Castro 2015 年 10 月 15 日
編集済み: Sebastian Castro 2015 年 10 月 15 日
You can use the error function inside the step you want. This will stop the simulation and output a custom error message.
error('My error message')
Another alternative is, when you reach the state, to change the value of an output signal from false to true. Then, connect this signal to a Stop Simulation block.
- Sebastian
  1 件のコメント
Patrick
Patrick 2015 年 10 月 16 日
Hi Sebastian, thanks for your answer. I would prefer the Stop Simulation block. Maybe it's a good idea to add a Stopped State Feature in further Simulink Test releases.

サインインしてコメントする。


Todd
Todd 2022 年 3 月 4 日
One method is to add an output signal that drives a Simulation Stop block.

カテゴリ

Help Center および File ExchangeInputs についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by