Main Content

slreportgen.report.SystemHierarchy class

Package: slreportgen.report
Superclasses: slreportgen.report.Reporter

System hierarchy reporter

Since R2019b

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.

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.

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. The default value of this property is an object of mlreportgen.dom.UnorderedList. 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 referenced subsystems, specified as true or false. If IncludeReferencedSubsystems is true, the list includes referenced 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.

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 as one of these options:

  • 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 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 source (TemplateSrc) for this reporter.

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

Methods

expand all

Examples

collapse all

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

Run the following command to access the supporting files used in this example.

openExample('rptgenext/SimulinkReportGeneratorFilesExample');
% Import the API packages
import slreportgen.report.*
import mlreportgen.report.*
import mlreportgen.dom.*

% Load the model
model = "slrgex_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.

Version History

Introduced in R2019b