主要内容

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

systemcomposer.rptgen.finder.FunctionResult 类

命名空间: systemcomposer.rptgen.finder
超类: mlreportgen.finder.Result (MATLAB Report Generator)

函数搜索结果

自 R2022b 起

描述

在 System Composer™ 软件架构模型中搜索结果对象,以查找有关函数的信息。

systemcomposer.rptgen.finder.FunctionResult 类是 handle 类。

创建对象

result = FunctionResult 为您通过 systemcomposer.rptgen.finder.FunctionFinder 对象找到的函数创建搜索结果对象。

注意

systemcomposer.rptgen.finder.FunctionFinder 类的 find 方法会为找到的每个函数创建一个搜索结果对象。您不需要自己创建该对象。

属性

全部展开

结果元素的通用唯一标识符 (UUID),以字符串形式返回。

数据类型: string

函数名称,以字符串形式返回。

数据类型: string

定义函数的组件,指定为字符串。

数据类型: string

定义函数的组件的父架构,指定为字符串。

数据类型: string

函数周期,指定为可转换为字符串的数值或有效 MATLAB® 变量字符串。您可以编辑非周期性函数的 Period 属性。如果编辑周期函数的 Period 属性,会出现错误。

函数的执行顺序,指定为数值行向量。

示例: [model.Architecture.Functions.ExecutionOrder]

数据类型: uint64

与结果相关联的标记,指定为字符串。您可以使用此属性为结果附加额外信息。您可以将此属性设置为任何符合您需求的值。

数据类型: string

方法

全部展开

示例

全部折叠

使用 ComponentFinderComponentResultFunctionFinderFunctionResult 类生成报告,查找给定软件架构模型中的所有组件及其函数。

import mlreportgen.report.*
import slreportgen.report.*
import systemcomposer.query.*
import systemcomposer.rptgen.finder.*

打开 ACCSoftwareComposition 模型。

model_name = "ACCSoftwareComposition";
mdl = systemcomposer.loadModel(model_name);

创建一个报告,并追加标题页和目录。

functionsReport = slreportgen.report.Report(OutputPath=model_name + "_FunctionsReport", ...
    CompileModelBeforeReporting=false);
append(functionsReport,TitlePage(Title="Components and their Functions in " + model_name));
append(functionsReport,TableOfContents);

创建一个章节,包含与组件及其函数相关的所有节。

compChapter = Chapter("Components and their Functions");

查找架构模型中的所有组件。

componentFinder = ComponentFinder(model_name);
componentFinder.Query = AnyComponent;

为每个组件创建一个章节。

while hasNext(componentFinder)
    comp = next(componentFinder);
    compSection = Section(Title=comp.Name);
    compReporter = getReporter(comp);
    compReporter.IncludeSnapshot = 1;
    compReporter.IncludeProperties = 0;
    compReporter.IncludeFunctions = 0;
    append(compSection,compReporter);

查找与组件相关的所有函数。

    functionFinder = FunctionFinder(model_name);
    functionFinder.ComponentName = comp.Name;
    functionResult = find(functionFinder);
    append(compSection,functionResult);

    append(compChapter,compSection);
end

将章节附加到报告中,并查看生成的报告。

append(functionsReport,compChapter);
close(functionsReport);
rptview(functionsReport);

版本历史记录

在 R2022b 中推出