Main Content

addChild

Add child requirement or assumption to Requirements Table block

Since R2022a

Description

example

newChild = addChild(row) adds a child row to the requirement or assumption specified by row.

newChild = addChild(row,Name=Value) adds a child row using one or more name-value arguments. The available name-value arguments depend on whether row is a requirement or assumption.

Examples

collapse all

Create a Requirements Table block and retrieve the RequirementsTable object.

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

New Requirements Table blocks start with one requirement. Find the RequirementRow object that corresponds to the requirement by using the getRequirementRows function.

row = getRequirementRows(table);

Add a child to the requirement.

childReq = addChild(row);

Create a Requirements Table block and retrieve the RequirementsTable object.

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

Add an assumption to the block by using the addAssumptionRow function.

row = addAssumptionRow(table);

Add a child with expressions in the Precondition and Postcondition columns to the assumption.

child = addChild(row,Preconditions={'u1 > 1'},...
Postcoditions={'y1 > 0'});

Input Arguments

collapse all

Requirement or assumption in a Requirements Table block, specified as a RequirementRow or AssumptionRow object. To retrieve the row, use getRequirementRows, getAssumptionRows, or getChildren.

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: newChild = addChild(row,Preconditions={'u1 > 1'},Duration="5") returns a child requirement from the RequirementRow object row that has the precondition u1 > 1 and a duration equal to 5. This example produces an error if row is a AssumptionRow, because assumptions do not have a duration property.

Action expressions, specified as a cell array of character vectors. You can only specify this property if row is a RequirementRow object. For more information on actions, see Use a Requirements Table Block to Create Formal Requirements.

Data Types: cell | char

Duration expression, specified as a string scalar or character vector. You can only specify this property if row is a RequirementRow object. 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. If row is an assumption, you can specify only one precondition per child. For more information on preconditions, see Use a Requirements Table Block to Create Formal Requirements.

Data Types: cell | char

Postcondition expressions, specified as a cell array of character vectors. If row is an assumption, you can specify only one postcondition per child. For more information on postconditions, see Use a Requirements Table Block to Create Formal Requirements.

Data Types: cell | char

Row type, specified as one of these values:

ValueDescription
"normal"Creates a normal child row with all of the available properties.
"default"Creates a default semantic child row. Default rows cannot have a precondition.
"anyChildActive"Creates a semantic child row where any of the child rows can be active. The children of the added row cannot have postconditions or actions, and the added row cannot have preconditions. See Specify Row Type in Requirements Table Blocks.
"allChildrenActive"Creates a semantic child row where all of the child rows must be active. The children of the added row cannot have postconditions or actions, and the added row cannot have preconditions. See Specify Row Type in Requirements Table Blocks.

If you do not include this name-value pair, the function creates a normal row.

Data Types: enumerated

Child row 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 or Assumptions tabs of the Requirements Table block.

Data Types: char | string

Output Arguments

collapse all

Child requirement or assumption, returned as the same object type specified by the input argument row. For example, if row is a RequirementRow, newChild is a RequirementRow. For more information on requirement hierarchies in Requirements Table blocks, see Establish Hierarchy in Requirements Table Blocks.

Version History

Introduced in R2022a