How to connect the scenarios for Test Sequence and Test Assessment blocks for a Simulink Model using Simulink Test in MATLAB R2023a?

22 vues (au cours des 30 derniers jours)

I am trying to use "Test Sequence" and "Test Assessment" blocks for my Simulink model with a test harness. I defined scenarios in the "Test Sequence" block and also in the "Test Assessment" block. My workflow requires to interoperate between "Test Sequence" blocks and "Test Assessment" block by linking up with scenarios. How can I achieve this workflow?

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 10 Juin 2024
Each block has an "Active_Scenario_Index" that you can control to activate scenarios defined in each block. Double click on both the "Test Sequence" and "Test assessment" blocks and check the option for "Control active scenario from workspace" in the scenarios tab for both the blocks. For more information on programmatically controlling the active scenario, see documentation linked below:
Then, navigate to the test harness you created and open Simulink Test Manager. In the Test Manager, create a test case by pointing to the corresponding model and harness. Go to the "Parameter Overrides" option in the test case and add parameter overrides using the format shown below: 
Parameter_Set 1:
Parameter Set/ workspace variable: Active_Scenario_Index
Override Value: 1
Source: model workspace
Model Element: test_cases_Harness1/Test_Assesment_Blocktest_cases_Harness1/Test_Sequence_Block
Parameter_Set 2:
Parameter Set/ workspace variable: Active_Scenario_Index
Override Value: 2
Source: model workspace
Model Element: test_cases_Harness1/Test_Assesment_Blocktest_cases_Harness1/Test_Sequence_Block
Parameter_Set 3:
Parameter Set/ workspace variable: Active_Scenario_Index
Override Value: 3
Source: model workspace
Model Element: test_cases_Harness1/Test_Assesment_Blocktest_cases_Harness1/Test_Sequence_Block
For more information on overriding a model parameter, see documentation link below: 
Then, create Iteration which will run the test alongside each "Parameter_Set" in the test manager. Effectively, this assigns a value to the "Active_Scenario_Index" during each parameter override for the respective model elements you defined and runs these parameters during the iterations.
The final workflow looks like this:
  • Iteration 1: Scenario 1 in Test Sequence + Scenario 1 in Test Assessment
  • Iteration 2: Scenario 2 in Test Sequence + Scenario 2 in Test Assessment
  • Iteration 3: Scenario 3 in Test Sequence + Scenario 3 in Test Assessment
In this way, you can interoperate between "Test Sequence" and "Test Assessment" blocks by linking up with scenarios.

Plus de réponses (0)

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by