MATLAB Answers

How can I input expected output values for a signal to simulink design verifier and generate tests with it?

22 ビュー (過去 30 日間)
Xinkun Wu
Xinkun Wu 2020 年 3 月 11 日
コメント済み: Pat Canny 2020 年 3 月 18 日
I want to get a test case which gives a specific value for an output signal. In other words I want to find the combination of the input signal values which gives me my desired value for a specific output signal.
As far as I understand from the documentation, it is possible to do it with simulink design verifier test generation function. I read, it is possible with "include expected output value option". However I can`t find how to input expected results for the output signal. I would be very happy if someone can help me with this issue. Any information or example would be highly appreciated!
Thank you very much in advance!

回答 (1 件)

Pat Canny
Pat Canny 2020 年 3 月 12 日
編集済み: Pat Canny 2020 年 3 月 12 日
Hi Xinkun,
Thank you for your question.
I recommend you use a Test Objective block, which you can use to define a desired value for any signal in your model. You can also use the Test Condition block to constrain other signal values. Simulink Design Verifier will try to generate any test that achieves the objective of reaching the value defined within the Test Objective, and will constrain other signals accordingly based on the Test Conditions.
Try the following example for Test Objective blocks:
A Test Condition block can also be used to constrain the rate of change of a signal, which is commonly required. This can be achieved using standard Simulink blocks, such as in this simple example:
The "Expected Output" option will actually create a cell array of vectors containing the output values of the model outputs after the tests are generated. This is a bit confusing, and I will take this feedback to our Documentation team.
  2 件のコメント
Pat Canny
Pat Canny 2020 年 3 月 18 日
Hi Xinkun,
Yes, the parameter table should work for your use case. The parameter should be defined as a Simulink.Parameter, otherwise it might not be found when you use "Find in Model".
- Pat





Community Treasure Hunt

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

Start Hunting!

Translated by