addChild
Description
Examples
Add a Child Requirement to a Requirement Table Block
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);
Add a Child Assumption with a Precondition and Postcondition
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
row
— Requirement or assumption
RequirementRow
object | AssumptionRow
object
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.
Actions
— Action expressions
{''}
(default) | cell array of character vectors
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
— Duration expression
""
(default) | string scalar | character vector
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
Preconditions
— Precondition expressions
{''}
(default) | cell array of character vectors
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
Postconditions
— Postcondition expression
{''}
(default) | cell array of character vectors
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
rowType
— Row type
"normal"
(default) | "default"
| "anyChildActive"
| "allChildrenActive"
Row type, specified as one of these values:
Value | Description |
---|---|
"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
Summary
— Child row summary text
""
(default) | string scalar | character vector
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
newChild
— Child requirement or assumption
RequirementRow
or AssumptionRow
object
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
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)