主要内容

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

systemcomposer.rptgen.report.AllocationList 类

命名空间: systemcomposer.rptgen.report
超类: slreportgen.report.Reporter (Simulink Report Generator)

分配列表报告器

自 R2022b 起

描述

创建一个报告器,报告 System Composer™ 架构模型中某个特定组件被分配到的所有组件,以及从哪个组件分配到哪个组件。

systemcomposer.rptgen.report.AllocationList 类是 handle 类。

创建对象

reporter = AllocationList("Source",result) 创建一个报告器,使用 systemcomposer.rptgen.finder.AllocationListResult 对象报告 ComponentName 属性定义的组件周围的分配情况。

属性

全部展开

分配列表结果,指定为 systemcomposer.rptgen.finder.AllocationListResult 对象。

指定组件分配自的组件,指定为 mlreportgen.dom.OrderedList (MATLAB Report Generator) 对象。

指定组件分配到的组件,指定为 mlreportgen.dom.OrderedList (MATLAB Report Generator) 对象。

是否报告分配源的列表,指定为 1 (true) 或 0 (false)。

数据类型: logical

是否报告分配给列表,指定为 1 (true) 或 0 (false)。

数据类型: logical

此报告器的模板来源,以下列方式之一指定:

  • 指定此报告器模板文件路径的字符向量或字符串标量

  • 此报告器所用模板的源报告器或报告(或其模板库包含此报告器的模板)

  • 此报告器所用模板的文档对象模型 (DOM) 文档或文档部件(或其模板库包含此报告器的模板)

指定的模板必须与您附加此报告器的报告类型相同。例如,对于 Microsoft® Word 报告,TemplateSrc 必须是 Word 报告器模板。如果 TemplateSrc 属性为空,则此报告器将使用默认报告器模板作为报告的输出类型。

属性:

GetAccess
public
SetAccess
public
NonCopyable
true

此报告器的模板名称,指定为字符向量或字符串标量。该报告器的模板必须位于该报告器的 TemplateSrc 属性指定的模板的模板库中。

属性:

GetAccess
public
SetAccess
public

数据类型: char | string

此报告器的超链接目标,指定为指定链接目标 ID 的字符向量或字符串标量,或 mlreportgen.dom.LinkTarget (MATLAB Report Generator) 对象。字符向量或字符串标量值转换为 LinkTarget 对象。链接目标在输出报告中紧接着此报告器的内容。

属性:

GetAccess
public
SetAccess
public

方法

全部展开

示例

全部折叠

使用 AllocationSetFinderAllocationSetResultAllocationListFinderAllocationListResult 类创建报告,查找给定分配集中的所有分配。

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

打开 scExampleTirePressureMonitorSystem 工程。

prj_name = "scExampleTirePressureMonitorSystem";
prj = openProject(prj_name);

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

allocReport = slreportgen.report.Report(output="AllocationAnalysisReport", ...
    CompileModelBeforeReporting=false);
append(allocReport,TitlePage(Title="Allocation Sets and Lists in " + prj_name + " Project"));
append(allocReport,TableOfContents);

创建名为 Allocation Sets 的章节,并为每个分配集创建一个部分。

allocSetsChapter = Chapter("Allocation Sets");

allocSetFinder = AllocationSetFinder("FunctionalAllocation.mldatx");

while hasNext(allocSetFinder)
    allocationSets = next(allocSetFinder);
    allocSetSection = Section("Allocations in "+ allocationSets.Name);
    append(allocSetSection,allocationSets);
    append(allocSetsChapter,allocSetSection);
end

append(allocReport,allocSetsChapter);
systemcomposer.allocation.AllocationSet.closeAll;

创建名为 Allocation Lists 的章节,找到 TPMS_FunctionalArchitecture 模型中的所有组件,并为每个组件创建一个分配列表部分。

allocListChapter = Chapter("Allocation Lists");

arch = "TPMS_FunctionalArchitecture";
mdl = systemcomposer.loadModel(arch);
constraint = systemcomposer.query.AnyComponent;
componentPaths = find(mdl,constraint);

% for each component in the TPMS_FunctionalArchitecture model
for i=1:length(componentPaths)
    % find all components allocated to and from this component
    allocListFinder = AllocationListFinder("FunctionalAllocation.mldatx");
    allocListFinder.ComponentName = string(componentPaths(i));
    allocListSection = Section(allocListFinder.ComponentName);
    
    allocListResult = find(allocListFinder);
    append(allocListSection,allocListResult);
    append(allocListChapter,allocListSection);
end

append(allocReport,allocListChapter);
systemcomposer.allocation.AllocationSet.closeAll;

查看生成的报告。

close(allocReport);
rptview(allocReport);

版本历史记录

在 R2022b 中推出