Main Content

RequirementRow

Requirements in Requirements Table block

Since R2022a

Description

RequirementRow objects represent requirements in Requirements Table blocks. Use the objects to programmatically adjust the requirement properties.

Creation

There are several ways to create a RequirementRow object:

  • Create a new requirement in a Requirements Table block by using the addRequirementRow object function.

  • Create a requirement interactively in the Requirements Table block, then get the associated RequirementRow object by using the getRequirementRows object function.

Properties

expand all

Action expressions, specified as a cell array of character vectors. For more information on actions, see Use a Requirements Table Block to Create Formal Requirements.

Data Types: cell | char

Duration expression, entered as a string scalar or character vector.

Data Types: char | string

Child requirement evaluation, specified as 'independent', 'exclusiveExhaustive', or 'prioritized'. This property only applies to the direct children of the requirement row. For more information on child evaluation, see Specify Child Evaluation in Requirements Table Blocks

Data Types: char

Requirement type, specified as 'normal', 'default', 'anyChildActive', or 'allChildrenActive'. For more information on requirement row types, see Specify Row Type in Requirements Table Blocks.

Data Types: char

This property is read-only.

Index of the requirement, returned as a character vector. When you create a new requirement, the software automatically assigns the requirement a unique index.

Precondition expressions, specified as a cell array of character vectors. You can also use the addRequirementRow object function to set the Precondition property when you create the RequirementRow object.

Example: reqRow.Preconditions = {'u1 > 0','','u3 > 0'} specifies the preconditions in a requirement with u1 > 0 in the first Precondition column, nothing in the second Precondition column, and u3 > 0 in the third Precondition column.

Data Types: cell | char

Postcondition expressions, specified as a cell array of character vectors.

Example: reqRow.Postconditions = {'u1 > 0','','u3 > 0'} specifies the postconditions in a requirement with u1 > 0 in the first Postcondition column, nothing in the second Postcondition column, and u3 > 0 in the third Postcondition column.

Data Types: cell | char

Requirement summary text, specified as a string scalar or character vector. Use this property to add text to the Summary column in the Requirements tab of the Requirements Table block.

Data Types: char | string

Object Functions

addChildAdd child requirement or assumption to Requirements Table block
getChildrenRetrieve child requirements and assumptions in Requirements Table block
clearClear row in Requirements Table block
removeRowRemove Requirements Table block row

Examples

collapse all

In a RequirementsTable object named reqTable, add two additional requirements.

addRequirementRow(reqTable);
addRequirementRow(reqTable);

Retrieve the RequirementRow objects.

rRow = getRequirementRows(reqTable);

Set the preconditions for the requirements.

rRow(1).Preconditions = {'u1 > 1'};
rRow(2).Preconditions = {'u1 > 0'};
rRow(3).Preconditions = {'u1 > -1'};

Set the postconditions for the requirements.

rRow(1).Postconditions = {'u2 > 1'};
rRow(2).Postconditions = {'u2 > 0'};
rRow(3).Postconditions = {'u2 < -1'};

This example shows how to create a Requirements Table block with one parent requirement and three exclusive exhaustive child requirements.

Create a new model called myModel that contains a Requirements Table block, reqTable.

reqTable = slreq.modeling.create("myModel");

Retrieve the requirement.

rRow = getRequirementRows(reqTable);

Set the child evaluation of the parent requirement to exclusive exhaustive.

rRow.ChildEvaluation = 'exclusiveExhaustive';

Add three child requirements to the requirement rRow to create three exclusive exhaustive sibling requirements.

addChild(rRow);
addChild(rRow);
addChild(rRow);

Close myModel.

bdclose("myModel");

Version History

Introduced in R2022a

expand all