Main Content

systemcomposer.rptgen.finder.AllocationListResult Class

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

Search result for allocations

Since R2022b

Description

Allocation list search result object for a component in a System Composer™ architecture model.

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

Creation

result = AllocationListResult creates a search result object for allocations to and from a specific component that you find by using a systemcomposer.rptgen.finder.AllocationListFinder object.

Note

The find method of the systemcomposer.rptgen.finder.AllocationListFinder class creates a search result object for each allocation 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

Components from which specified component has been allocated, returned as an array of strings.

Data Types: string

Components to which specified component has been allocated, returned as an array of strings.

Data Types: string

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