Main Content

systemcomposer.rptgen.finder.AllocationSetResult Class

Namespace: systemcomposer.rptgen.finder
Superclasses: mlreportgen.finder.Result (MATLAB Report Generator)

Search result for allocation sets

Since R2022b

Description

Allocation set search result object in a System Composer™ architecture model.

The systemcomposer.rptgen.finder.AllocationSetResult class is a handle class.

Creation

result = AllocationSetResult creates a search result object for an allocation set that you find by using a systemcomposer.rptgen.finder.AllocationSetFinder object.

Note

The find method of the systemcomposer.rptgen.finder.AllocationSetFinder class creates a search result object for each allocation set that it finds. You do not need to create this object yourself.

Properties

expand all

Universal unique identifier (UUID) of result element, returned as a string.

Data Types: string

Name of allocation set, returned as a string.

Data Types: string

Source model of allocation set, returned as a string.

Data Types: string

Target model of allocation set, returned as a string.

Data Types: string

Description of allocation set, returned as a string.

Data Types: string

Scenarios present in allocation set, returned as a structure with fields:

  • Name, returned as a string.

  • Allocations, returned as a structure with fields:

    • SourceElement, returned as the fully qualified name of the source component allocated from.

    • TargetElement, returned as the fully qualified name of the target component allocated to.

  • UUID, or universal unique identifier of the scenario, returned a s string.

Data Types: struct

Tag to associate with result, specified as a string. You can use this property to attach additional information to a result. You can set this property to any value that meets your requirements.

Data Types: string

Methods

expand all

Examples

collapse all

Use the AllocationSetFinder, AllocationSetResult, AllocationListFinder, and AllocationListResult classes to create a report that finds all allocations in a given allocation set.

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

Open the scExampleTirePressureMonitorSystem project.

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

Create a report and append a title page and table of contents.

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

Create a chapter called Allocation Sets and create a section for each allocation set.

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;

Create a chapter called Allocation Lists, find all components in the TPMS_FunctionalArchitecture model, and create an allocation list section for each component.

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;

View the generated report.

close(allocReport);
rptview(allocReport);

Version History

Introduced in R2022b