Main Content

systemcomposer.rptgen.report.AllocationSet Class

Namespace: systemcomposer.rptgen.report
Superclasses: slreportgen.report.Reporter (Simulink Report Generator)

Allocation set reporter

Since R2022b

Description

Create a reporter that reports on an allocation set file used between System Composer™ models.

The systemcomposer.rptgen.report.AllocationSet class is a handle class.

Creation

reporter = AllocationSet("Source",result) creates a reporter that reports on an allocation set using a systemcomposer.rptgen.finder.AllocationSetResult object specified by "Source".

Properties

expand all

Allocation set result, specified as a systemcomposer.rptgen.finder.AllocationSetResult object.

Custom summary reporter, specified as a reporter object. The default value is the mlreportgen.report.BaseTable (MATLAB Report Generator) report object.

Scenarios in allocation set, specified as a reporter object. The default value is the mlreportgen.report.BaseTable (MATLAB Report Generator) reporter.

Whether to include summary table, specified as 1 (true) or 0 (false).

Data Types: logical

Whether to include allocation scenario table, specified as 1 (true) or 0 (false).

Data Types: logical

Source of the template for this reporter, specified in one of these ways:

  • Character vector or string scalar that specifies the path of the file that contains the template for this reporter

  • Reporter or report whose template this reporter uses or whose template library contains the template for this reporter

  • Document Object Model (DOM) document or document part whose template this reporter uses or whose template library contains the template for this reporter

The specified template must be the same type as the report to which you append this reporter. For example, for a Microsoft® Word report, TemplateSrc must be a Word reporter template. If the TemplateSrc property is empty, this reporter uses the default reporter template for the output type of the report.

Attributes:

GetAccess
public
SetAccess
public
NonCopyable
true

Name of the template for this reporter, specified as a character vector or string scalar. The template for this reporter must be in the template library of the template specified by the TemplateSrc property of this reporter.

Attributes:

GetAccess
public
SetAccess
public

Data Types: char | string

Hyperlink target for this reporter, specified as a character vector or string scalar that specifies the link target ID, or an mlreportgen.dom.LinkTarget (MATLAB Report Generator) object. A character vector or string scalar value converts to a LinkTarget object. The link target immediately precedes the content of this reporter in the output report.

Attributes:

GetAccess
public
SetAccess
public

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