slreportgen.report.SystemHierarchy class

Package: slreportgen.report

System hierarchy reporter

Description

Creates a system hierarchy reporter that generates a nested list of the subsystems of a Simulink® model or subsystem in a report.

Note

To use a system hierarchy reporter in a report, you must create the report using the slreportgen.report.Report class or subclass.

The slreportgen.report.SystemHierarchy class is a handle class.

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes (MATLAB).

Creation

Description

rptr = slreportgen.report.SystemHierarchy() creates an empty system hierarchy reporter based on a default template. Customize the content and format of the generated list by using the reporter properties. Before you add the reporter to a report, you must specify a model or subsystem in the Source property of the reporter. Adding an empty reporter to a report produces an error.

example

rptr = slreportgen.report.SystemHierarchy(source) creates a system hierarchy reporter for the model or subsystem specified by source. See the Source property.

rptr = slreportgen.report.SystemHierarchy(Name,Value) sets the reporter properties using name-value pairs. You can specify multiple name-value pair arguments in any order. Enclose each property name in single or double quotes.

Properties

expand all

Simulink model or subsystem, specified as a string scalar or character vector that contains the path to the model or subsystem, or as a handle to the model or subsystem.

Maximum number of levels of ancestors of the source subsystem to include in the generated list, specified as a nonnegative integer scalar. For example, if MaxAncestorLevel is 2, the list includes the source and up to two levels of ancestors. If MaxAncestorLevel is Inf, the default value, the list includes all ancestors. If MaxAncestorLevel is zero, the list does not include ancestors.

Maximum number of levels of descendants of the source model or subsystem to include in the generated list, specified as a nonnegative integer scalar. For example, if MaxDescendantLevel is 2, the list includes the source and up to two levels of descendants. If MaxDescendantLevel is Inf, the default value, the list includes all descendants. If MaxDescendantLevel is zero, the list does not include descendants.

Whether to include peers of the source subsystem in the generated list, specified as true or false.

Whether to emphasize the source model or subsystem in the generated list, specified as true or false. If EmphasizeSource is true, the name of the source model or subsystem is formatted according to the TextFormatter property. Otherwise, it is formatted like the other items in the list.

List formatter that formats the generated list, specified as an mlreportgen.dom.UnorderedList object or an mlreportgen.dom.OrderedList object. To customize the list formatting, modify the list object properties or replace the list object with a customized list object that does not contain list items.

Text formatter object that formats the name of the source model or subsystem in the generated list, specified as an mlreportgen.dom.Text object. This property applies only if the EmphasizeSource property is true. The initial value of the SourceTextFormatter property is an mlreportgen.dom.Text object with the Bold and Italic properties set to true. To customize the appearance of the name in the generated list, modify the mlreportgen.dom.Text object properties or replace the object with a customized mlreportgen.dom.Text object. If you add text to the default or replacement text object, the text appears in front of the source name in the generated report.

Whether the generated list of descendants of the source system includes masked subsystems, specified as true or false. If IncludeMaskedSubsystems is true, the list includes masked subsystems and their descendant subsystems, as long as the number of levels below the source subsystem is less than or equal to the value of the MaxDescendantLevel property.

To enable the system hierarchy reporter to link masked subsystems to the corresponding diagrams in the report, in the diagram reporter, set the MaskedSystemLinkPolicy property to 'system'.

Whether the generated list of descendants of the source system includes referenced models, specified as true or false. If IncludeReferencedModels is true, the list includes referenced models and their descendant subsystems, as long as the number of levels below the source subsystem is less than or equal to the value of the MaxDescendantLevel property.

Whether the generated list of descendants of the source system includes subsystems that link to a Simulink library subsystem, specified as true or false. The list includes a linked subsystem or one of its descendant subsystems, only if all of these conditions are true:

  • The value of IncludeSimulinkLibraryLinks is true.

  • The subsystem is not masked, or the subsystem is masked and the value of the IncludeMaskedSubsystems property is true.

  • The number of levels below the source subsystem is less than or equal to the value of the MaxDescendantLevel property.

Whether the generated list of descendants of the source system includes subsystems that link to a user-defined library subsystem, specified as true or false. The list includes a linked subsystem, or one of its descendant subsystems, only if all of these conditions are true:

  • The value of IncludeUserLibraryLinks is true.

  • The subsystem is not masked, or the subsystem is masked and the value of the IncludeMaskedSubsystems property is true.

  • The number of levels below the source subsystem is less than or equal to the value of the MaxDescendantLevel property.

Variants of a variant block to include in the generated list of descendants of the source system, specified as one of the values in the table. You can specify the value as a string scalar or a character vector.

ValueDescription
"Active"Active variants (default)
"All"All variants
"ActivePlusCode"Active variants and code variants

The list includes the variants only if the number of levels below the source subsystem is less than or equal to the value of the MaxDescendantLevel property.

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 is used for this reporter or whose template library contains the template for this reporter

  • DOM document or document part whose template is used for this reporter or whose template library contains the template for this reporter

The specified template must be the same type as the report to which this reporter is appended. 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.

Name of the template for this reporter, specified as a character vector or string scalar. The template for this reporter is in the template library of the template source (TemplateSrc) for this reporter.

Hyperlink target for this reporter, specified as a string or character array that specifies the link target ID, or an mlreportgen.dom.LinkTarget object. A string or character array value is converted to a LinkTarget object. The link target object immediately precedes the content of this reporter in the output report.

Methods

expand all

Examples

collapse all

Include the system hierarchy of the fuelsys model in a report by adding a slreportgen.report.SystemHierarchy reporter to a report generation program. Generate the model diagrams by adding a slreportgen.finder.DiagramFinder object. The system hierarchy reporter generates links from subsystems in the nested list to the corresponding diagrams.

% Import the API packages
import slreportgen.report.*
import mlreportgen.report.*
import mlreportgen.dom.*

% Load the model
model = 'fuelsys';
load_system(model);

% Create a report
rpt = slreportgen.report.Report('output','pdf');

% Create a chapter reporter
chapter = Chapter("System Hierarchy for the " + model + " Model");

% Create a SystemHierarchy reporter for the model
rptr = SystemHierarchy(model);

% Add the SystemHierarchy reporter to the chapter.
% Add the chapter to the report
add(chapter, rptr);
add(rpt, chapter);

% Find the diagrams for the subsystems
finder = slreportgen.finder.DiagramFinder(model);
while hasNext(finder)
    result = next(finder);
    ch = Chapter(result.Name);
    add(ch, result);
    add(rpt, ch);
end

% Close and view the output report
close(rpt);
close_system(model);
rptview(rpt);

Here is the system hierarchy in the generated report:

To see the diagram corresponding to a subsystem, click the subsystem in the list.

Introduced in R2019b