Accelerating the pace of engineering and science

Documentation Center

• Trial Software

Grouped Test Vectors

When you create a test vector, it is an ungrouped vector by default, except for Probability Distribution test vectors. You can also create grouped vectors, in order to affect the way iterations are run. By grouping test vectors, they will be indexed simultaneously with the other vectors in their group. Each set of grouped values are then permuted with all the ungrouped test vectors. This gives more control over the flow of tests and is useful for Design of Experiments (DOE) or Monte Carlo-based testing as well as defining signal groups, similar to those defined in the Simulink® Signal Builder block.

For example, if you are testing a throttle body controller, you may want to sweep across a range of input level or gain values, while simultaneously selecting different throttle body types, each defined by their mass and damping characteristics.

An example of the vectors in this scenario could look like this:

```gain = [1 10 100]
mass = [a b c d]
damping = [w x y z]```

If the gain vector is ungrouped, and the mass and damping vectors are grouped, it will result in mass and damping being indexed simultaneously for each value of gain. The test runs would look like this:

```Run 1: (1, a, w)
Run 2: (1, b, x)
Run 3: (1, c, y)
Run 4: (1, d, z)
Run 5: (10, a, w)
Run 6: (10, b, x)
Run 7: (10, c, y)
Run 8: (10, d, z)
Run 9: (100, a, w)
Run 10: (100, b, x)
Run 11: (100, c, y)
Run 12: (100, d, z)```
 Note:   Grouped test vectors must be the same length.

You create a grouped test vector as you do any other vector, by clicking the New button in the Test Vectors pane. To group a vector, change the selection using the Grouping tab in the Insert Test Vector dialog box. You can group any type of test vector, and you can create multiple test vector groups. You can also group or ungroup test vectors after you create them.

In general, it doesn't usually make sense to group Signal Builder Block test vectors or Simulink Design Verifier Data File test vectors. There are advantages to grouping MATLAB Expression, Probability Distribution, and Spreadsheet Data test vectors at times, depending on your test goals. One of the main advantages to grouping is for Monte Carlo-based testing, as described by the example above.

To group a test vector:

1. Create a test vector and configure it in the General tab of the Insert Test Vector dialog box.

2. Click the Grouping tab in the Insert Test Vector dialog box.

3. Select the Assign test vector to a group option.

A group is created and given the default name of Group1, as shown here.

4. To change the name, type the new name over the default name and press Enter.

5. Click OK in the Insert Test Vector dialog box.

In the Test Vectors pane, the name of the group is displayed in the table.

6. Now if you create another test vector, you can add it to the same group as the first one. To do this, click the New button again.

7. Select the test vector type and configure it in the General tab.

8. Click the Grouping tab, and select the Assign test vector to a group option.

Note that test vectors in a group must all be the same length.

If you already have one test vector group, the new vector is placed in that group by default.

9. Click OK in the Insert Test Vector dialog box.

You can create multiple test vector groups. Once you have multiple groups, when you create new test vectors, you can select which group to put them in as you create them. The following figure shows Group1 containing TestVector1 and TestVector2, and Group2 containing TestVector3 and TestVector4.

You can also create groups after test vectors are already created by editing a test vector in the Test Vectors pane. Select a test vector in the table to edit its properties in the editor area below the table. There you can add it to a group using the Grouping tab. You can also add it to a group in the table by clicking in the Group Name column.

Managing Test Vector Groups

You can modify groups to ungroup a test vector, move a test vector to another group, rename a group, or delete a group.

• Ungroup a test vector — To remove a test vector from a group, select it in the test vectors table, then click the Group Name column. Use the down-arrow to select the first entry, which is a blank space. The Group Name column will then be empty for that test vector, indicating it is no longer in a group.

• Move a test vector to another group — To move a test vector from one group to another, select it in the test vectors table, then click the Group Name column. Use the down arrow to select the group to move it to. The Group Name column will then show the new group name.

• Rename a group — You can change the name of a test vector group either in the table or in the editor area. Renaming a group in the table results in the group name for a single test vector being changed. Renaming a group in the editor area results in the name being changed for all vectors in the group.

 To rename a group for a single test vector, select that vector in the table, then click in the Group Name column. Type a new name and press Enter. To rename a group for all test vectors in the group, select one of the test vectors in the table. Then in the Grouping tab in the editor area, select that group name in the upper section and type a new name. Press Enter. You then see all of the test vectors in that group change to the new name in the table.
• Delete a group — To delete a test vector group, select one of the test vectors in the table that is in that group. Then in the editor area, under the Grouping tab, that group name will be selected. Click the Delete button on the Grouping tab. The group is deleted and all test vectors belonging to that group become ungrouped.