MATLAB Answers

Simulink test multiple sequences for harness

17 ビュー (過去 30 日間)
Michael Sarcevic
Michael Sarcevic 2020 年 2 月 26 日
コメント済み: Paul Urban 2020 年 3 月 2 日
Does a test harness in simulink test have a one to one relationship to a test sequence? Or can I add multiple test sequences to a harness?
If not I don't see the point of a test sequence harness.

  0 件のコメント

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

回答 (1 件)

Paul Urban
Paul Urban 2020 年 2 月 26 日
Yes it is possible to put multiple test sequences inot a test harness. You can use variants to control which Test Sequence is active during a specific test.

  2 件のコメント

Michael Sarcevic
Michael Sarcevic 2020 年 2 月 27 日
Oh thank you, thats great news! Is there a documentation for this functionality? In all tutorials and all documentations I found there are always only one test sequence.
Paul Urban
Paul Urban 2020 年 3 月 2 日
Unfortunately there isn't an example of test sequences with variants but there is doc on using Variants that could be applied to a Test Sequence. https://www.mathworks.com/help/simulink/slref/variant-subsystems.html
It also is possible to have more than one test sequence within a single test sequence block in a test harness byt using the when-decomposition pattern. In the Test Sequence editor:
  • create a parameter, e.g., ScenarioId,
  • create one top-level step and use the context menu to enable when-decomposition,
  • create two or more child steps underneath with the following content:
  • Scenario1 when ScenarioId == 1
% MATLAB code for scenario 1
  • Scenario2 when ScenarioId == 2
% MATLAB code for scenario 2
  • UnknownScenario
assert(false, 'unknown scenario %d', ScenarioId)
  • in the base or model workspace, create a variable named ScenarioId with the scenario number that you’d like to run.

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

タグ

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by