主要内容

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

systemcomposer.rptgen.finder.AllocationSetResult 类

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

成套分配搜索结果

自 R2022b 起

描述

System Composer™ 架构模型中的分配集搜索结果对象。

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

创建对象

result = AllocationSetResult 会为使用 systemcomposer.rptgen.finder.AllocationSetFinder 对象找到的分配集创建一个搜索结果对象。

注意

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

属性

全部展开

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

数据类型: string

分配集的名称,以字符串形式返回。

数据类型: string

分配集的源模型,以字符串形式返回。

数据类型: string

分配集的目标模型,以字符串形式返回。

数据类型: string

分配集描述,以字符串形式返回。

数据类型: string

分配集中存在的方案,以包含字段的结构形式返回:

  • Name,以字符串形式返回。

  • Allocations,以包含字段的结构形式返回:

    • SourceElement,作为分配源组件的全称返回。

    • TargetElement,作为分配给目标组件的全限定名称返回。

  • UUID,即方案的通用唯一标识符,返回一个 s 字符串。

数据类型: struct

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

数据类型: string

方法

全部展开

示例

全部折叠

使用 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 中推出