Main Content

Establish Hierarchy inRequirements TableBlocks

When defining requirements and assumptions in aRequirements Tableblock, you may decide that some requirements or assumptions must relate to one another in a hierarchy. For example, you may have a requirement precondition that you want to check only if another precondition is valid. Alternatively, you may have a requirement where your model must satisfy several preconditions before you check a postcondition. You can establish hierarchies by using child and semantic rows.

For more information on how to define requirements and assumptions, seeUse a Requirements Table Block to Create Formal RequirementsandAdd Assumptions to Requirements.

Add Child Rows

Requirements and assumptions are organized in rows. You can organize the rows into a hierarchy by creatingandchildrows. Use child rows to determine evaluation hierarchy. For example, if a parent requirement precondition is valid, the block checks the preconditions of the child requirements. Otherwise, the block ignores the child preconditions.

To create child rows, right-click the index of a row and selectAdd Child RequirementorAdd Child Assumption. If you want to move a row to a higher or lower hierarchy level, click the row index and selectMake ParentorMake Child. You can delete and modify child rows by right-clicking the index of a child row and clickingDelete RequirementorDelete Assumption.

The index number of a child row is the index of the parent followed by the index of the child. You can have multiple child rows at each hierarchy level and multiple hierarchy levels. Rows in the same hierarchy level that have the same parent, or rows that do not have parent rows, are called兄弟姐妹.

Use Child Rows in an Example Model

This example uses a Requirements Table block that has child requirements. The model tests a signal and outputs two values if the model behavior meets the parent and child requirements.

Open the Requirements Table block to see the parent and child requirements. If the input signal satisfies the precondition of the first requirement, the block executes the action and then tests the child requirements. In this example, the child requirements control the output dataz. The second requirement executes if the input signal does not satisfy the precondition of the first requirement.

Run the simulation and open the Scope block to observe the block output.

Add Semantic Rows

While designing your model, you may need to define rows that have several applicable preconditions. For example, you may have a requirement where only one precondition must be satisfied, or each of the preconditions must be simultaneously satisfied. TheRequirements Tableblock allows you to construct these rows usingsemantic rows. Semantic rows evaluate two or more preconditions before checking the postconditions or executing the actions of a parent row.

从哪里添加语义需求e only one child precondition must be satisfied before the parent requirement executes, right-click the requirement index and clickAdd Semantic Requirement>Any Child Active Active. You can perform the same task in theAssumptions Tableby clickingAdd Semantic Assumption>Any Child Active.

To add a semantic requirement that executes only if each of the child requirement preconditions are satisfied, right-click the requirement index and clickAdd Semantic Requirement>All Children Active. You can perform the same task in theAssumptions Tableby clickingAdd Semantic Assumption>All Children Active. For each kind of semantic row, the table dims cells that cannot be filled and indicates the logic used by the children in each parent. This table illustrates what each semantic requirement looks like.

This image shows an empty table with multiple line logic blank requirements of each kind.

You can specify the duration in the parent or in individual children. For more information on the duration, seeUsing the Duration Column. If you specify the duration in a child, the duration applies only to the child. If you specify the duration for the parent, the block checks the duration only if the semantic is satisfied.

If you want to switch the semantic row type, point to the precondition cell of the parent row. The option to switch betweenAny Child ActiveandAll Children Activeappears at the bottom of the cell.

This image shows the switch option that appears when you hover over the parent row precondition cell of a semantic row.

Create Default Requirements

If you want to define behavior that occurs if none of the sibling requirements are met, include a default requirement. Right-click the index of the sibling requirement and clickAdd Semantic Requirement>Default.

You can specify multiple default requirements for each group of siblings. For example, this table has two requirements that each contain two child requirements and a default requirement. The default requirement executes only if the parent precondition is true and if the siblings are false.

The requirements table shows two sets of child requirements, each with a default requirement. The default requirements do not affect the other children models.

Use Semantic Rows in an Example Model

这个例子使用一个需求表块semantic requirements. The model tests two signals and adjusts the output if the model behavior meets the semantic requirement preconditions.

Open the block. The block contains two semantic requirements and a default requirement:

  • If the inputu1satisfies the precondition of the first child and the inputu2satisfies the precondition of the second child, the block sets the outputyto2.

  • Otherwise, if either the first or second preconditions for the children of the second requirement are true, then the block setsyto1.

  • If the semantic requirement preconditions are not satisfied, the block executes the action of the default requirement and setsyto0.

Run the model and open the Scope block to observe the block output.

See Also

Related Topics