Main Content

addRequirementRow

Add requirement to Requirements Table block

Since R2022a

Description

example

RequirementRow = addRequirementRow(reqTable) adds a requirement to the Requirements Table block specified by reqTable.

RequirementRow = addRequirementRow(reqTable,Name=Value) adds a requirement using one or more name-value arguments.

Examples

collapse all

Create a Requirements Table block and retrieve the RequirementsTable object.

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

Add a requirement to the block.

row = addRequirementRow(table);

Create a Requirements Table block and retrieve the RequirementsTable object.

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

Add a requirement to the block with expressions in the Precondition, Postcondition, and Action columns.

row = addRequirementRow(table,Preconditions={'u1 > 1'},...
Postcoditions={'y1 > 0'},Actions={'y2 = 1'});

Input Arguments

collapse all

Requirements Table block, specified as a RequirementsTable object.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: addRequirementRow(table,Preconditions={'u1 > 0'}) adds a requirement to a Requirements Table block with a precondition u1 > 0.

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: char | cell

Duration expression, specified as a string scalar or character vector. For more information on the duration, see Control Requirement Execution by Using Temporal Logic.

Data Types: char | string

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

Example: addRequirementRow(table,Preconditions={'u1 > 0','','u3 > 0'}) adds a requirement to a Requirements Table block with u1 > 0 in the first Precondition column, nothing in the second Precondition column, and u3 > 0 in the third Precondition column.

Data Types: char | cell

Postcondition expressions, entered as a string array or cell array of character vectors. For more information on postconditions, see Use a Requirements Table Block to Create Formal Requirements.

Example: addRequirementRow(table,Postconditions={'u1 > 0','','u3 > 0'}) adds a requirement to a Requirements Table block with u1 > 0 in the first Postcondition column, nothing in the second Postcondition column, and u3 > 0 in the third Postcondition column.

Data Types: char | cell

Requirement type, specified by one of these values:

ValueDescription
"normal"Creates a normal requirement with all of the available properties.
"default"Creates a default semantic requirement. Default requirements cannot have preconditions.
"anyChildActive"Creates an Any Child Active semantic requirement. The parent requirement cannot have preconditions, and the children cannot have postconditions or actions.
"allChildrenActive"Creates an All Child Active semantic requirement. The parent requirement cannot have preconditions, and the children cannot have postconditions or actions.

You can create normal requirements or semantic requirements. For more information on semantic requirements and assumptions, see Specify Row Type in Requirements Table Blocks. If you do not include this name-value pair, the function creates a normal requirement.

Data Types: enumerated

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

Data Types: char | string

Output Arguments

collapse all

Requirement, returned as a RequirementRow object.

Version History

Introduced in R2022a