主要内容

本页采用了机器翻译。点击此处可查看英文原文。

RequirementRow

Requirements Table 模块中的需求

自 R2022a 起

说明

RequirementRow 对象代表 Requirements Table 模块中的需求。使用对象以编程方式调整需求属性。

创建对象

有几种方法可以创建 RequirementRow 对象:

  • 使用 addRequirementRow 对象函数在 Requirements Table 模块中创建新需求。

  • Requirements Table 模块中交互地创建一个需求,然后使用 getRequirementRows 对象函数获取关联的 RequirementRow 对象。

属性

全部展开

动作表达式,指定为字符向量元胞数组。有关操作的更多信息,请参阅 使用 Requirements Table 模块创建正式需求

数据类型: cell | char

持续时间表达式,以字符串标量或字符向量输入。

数据类型: char | string

子需求评估,指定为 'independent''exclusiveExhaustive''prioritized'。此属性仅适用于需求行的直接子行。有关子评估的更多信息,请参阅在 Requirements Table 模块中指定子评估

数据类型: char

需求类型,指定为 'normal''default''anyChildActive''allChildrenActive'。有关需求行类型的更多信息,请参阅 在 Requirements Table 模块中指定行类型

数据类型: char

此属性是只读的。

需求的索引,以字符向量形式返回。当您创建新需求时,软件会自动为该需求分配一个唯一索引。

预条件表达式,指定为字符向量元胞数组。您还可以在创建 RequirementRow 对象时使用 addRequirementRow 对象函数来设置 Precondition 属性。

示例: reqRow.Preconditions = {'u1 > 0','','u3 > 0'} 指定需求中的预条件,其中第一列预条件u1 > 0,第二列预条件为无,第三列预条件u3 > 0

数据类型: cell | char

后条件表达式,指定为字符向量元胞数组。

示例: reqRow.Postconditions = {'u1 > 0','','u3 > 0'} 指定需求中的后条件,其中第一个后条件列中有 u1 > 0,第二个后条件列中没有任何内容,第三个后条件列中有 u3 > 0

数据类型: cell | char

需求摘要文本,指定为字符串标量或字符向量。使用此属性将文本添加到 Requirements Table 模块的需求选项卡中的摘要列。

数据类型: char | string

对象函数

addChild将子需求或假设添加到 Requirements Table 模块
getChildren检索 Requirements Table 模块中的子需求和假设
clear清除 Requirements Table 模块中的行
removeRow删除 Requirements Table 模块行
requirement从 Requirements Table 模块的需求行中获取需求
inLinks获取 Requirements Table 模块行的入向链接
outLinks获取 Requirements Table 模块行中的出向链接

示例

全部折叠

在名为 reqTableRequirementsTable 对象中,添加两个额外需求。

addRequirementRow(reqTable);
addRequirementRow(reqTable);

检索 RequirementRow 对象。

rRow = getRequirementRows(reqTable);

设定需求的预条件。

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

设置需求的后条件。

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

此示例显示如何创建具有一个父需求和三个互斥穷举子需求的 Requirements Table 模块。

创建一个名为 myModel 的新模型,其中包含 Requirements Table 模块、reqTable

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

检索需求。

rRow = getRequirementRows(reqTable);

将父需求的子评估设置为互斥穷举。

rRow.ChildEvaluation = 'exclusiveExhaustive';

向需求 rRow 添加三个子需求,以创建三个互斥穷举同级需求。

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

关闭 myModel

bdclose("myModel");

版本历史记录

在 R2022a 中推出

全部展开