Main Content

slreportgen.report.ExecutionOrder class

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

System task and block execution order reporter

Since R2020b

Description

Use an object of the slreportgen.report.ExecutionOrder class to report the tasks of a model or nonvirtual subsystem and the blocks in each task, sorted by execution order. By default, an ExecutionOrder reporter generates:

  • A table of task names and properties

  • A list of the blocks in each task

Conditionally executed blocks, such as subsystems triggered by a function call or an If block, are not displayed in the block execution order list. Instead, these blocks are displayed in a Conditional Execution table that follows the block execution order list. The table lists the conditionally executed blocks and the blocks that trigger their execution.

Use the ExecutionOrder reporter properties to filter the reported content and customize the content formatting.

Note

To use an slreportgen.report.ExecutionOrder reporter in a report, you must create the report using the slreportgen.report.Report class or subclass. An ExecutionOrder reporter does not generate content if it is added to an slreportgen.report.Report object that has the CompileModelBeforeReporting set to false.

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

Class Attributes

HandleCompatible
true

For information on class attributes, see Class Attributes.

Creation

Description

reporter = slreportgen.report.ExecutionOrder() creates an empty ExecutionOrder reporter object based on the default template. You must specify a model or subsystem for which to report the execution order by setting the Object property. Use other properties to specify report options.

example

reporter = slreportgen.report.ExecutionOrder(system) creates an ExecutionOrder reporter and sets the Object property to the specified model or subsystem.

reporter = slreportgen.report.ExecutionOrder(Name=Value) sets the reporter properties using name-value pairs. You can specify multiple name-value pair arguments in any order.

Properties

expand all

Model or nonvirtual subsystem block to report, specified as one of these types of values:

Specifying a BlockResult or DiagramResult that represents an unloaded model or a virtual subsystem results in an error.

Whether to include a task details table, specified as true or false. If ShowTaskDetails is true, the reporter generates a table that displays names and properties of tasks in the specified system.

Data Types: logical

Whether to include block execution order lists, specified as true or false. If ShowBlockEecutionOrder is true, the reporter includes a list of blocks, sorted in order of execution, for each task in the system. Conditionally executed blocks, such as subsystems triggered by a function call or If block, are not displayed in the execution order list. Instead, these blocks are displayed in a Conditional Execution table that follows the block execution order list. The table lists the conditionally executed blocks and the blocks that trigger their execution.

Data Types: logical

Properties to report for each system task, specified as a string array or cell array of character vectors. By default, all properties are included. Valid properties are:

  • Order — Place of the task in the task execution order at each time step. For Asynchronous and Constant tasks, this property is reported as N/A.

  • Name — Name of the task.

  • Type — Type of the task, for example, Periodic, Aperiodic, Asynchronous, or Constant.

  • Trigger — Rate at which periodic tasks execute or the list of times at which aperiodic tasks execute.

  • TaskID — Task index in the specified system.

  • SourceBlock — Block that defines the task.

Example: ["Order" "Name" "Type" "Trigger" "TaskID" "SourceBlock"]

Example: {'Order' 'Name' 'Type'}

Whether to show empty columns in the task details table, specified as true or false. If ShowEmptyColumns is true, the task details table includes columns that do not have any data.

Data Types: logical

Whether to show the type of each block in the block execution order lists, specified as true or false. If ShowBlocktype is true, the reporter includes the type of each block next to the block name in the execution order lists.

Data Types: logical

Whether to show blocks created at compile time, specified as true or false. If ShowHiddenBlocks is true, the reporter includes blocks that Simulink® inserts when the model is compiled. If ShowHiddenBlocks is false, the reporter includes only user-added blocks.

Data Types: logical

Whether to reference block lists of nonvirtual subsystems, specified as true or false. If IncludeSubsystemBlocks is true, the reporter includes references to nonvirtual subsystem blocks. The SubsystemBlocksDisplayPolicy property determines how the nonvirtual subsystem blocks are referenced.

Data Types: logical

Policy for referencing execution order lists of blocks that are in nonvirtual subsystems, specified as one of these string scalars or character vectors:

  • "Link" — (default) A link to a separate block execution order list for the subsystem is inserted next to the subsystem name. The link works only if the report generation program that includes this reporter also includes a separate ExecutionOrder reporter for the subsystem. For each task that includes the subsystem in a multitasking model, the link goes to the block execution order list for the corresponding task reported by the subsystem ExecutionOrder reporter. No link is inserted for MATLAB Function block subsystems.

  • "NestedList" — Subsystem blocks are displayed as a nested list.

Function or expression to filter system tasks from a report, specified as a function handle, string scalar, or character vector. Specify a function as a function handle. Specify an expression as a string scalar or character vector. If TaskFilterFcn is empty, all tasks are included in the report.

If you provide a function handle, the associated function must:

  • Take these arguments:

    • taskName — Name of the task.

    • taskType — Type of the task.

    • trigger — Sample time or hit times of the task. If the hit times for an aperiodic task are specified as an expression, trigger is a string that contains the expression to be evaluated.

    • sourceBlock— Block that defines the task.

  • Return true to filter the specified task from the report, or false to include the task in the report.

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

openExample('rptgenext/SimulinkReportGeneratorFilesExample');

For example, this code uses the TaskFilterFcn property to report only periodic tasks:

import slreportgen.finder.*
import slreportgen.report.*
import mlreportgen.report.*

model_name = "slrgex_vdp";
load_system(model_name);

rpt = slreportgen.report.Report("ExecutionOrder_example","html");

finder = DiagramFinder(model_name);

ch = Chapter("Diagrams");
while hasNext(finder)
    result = next(finder);
    % Only report block diagrams and nonvirtual subsystems
    if (strcmpi(result.Type,"Simulink.SubSystem")...
            && strcmpi(get_param(result.Object,"IsSubsystemVirtual"),"off")) ...
            || strcmpi(result.Type,"Simulink.BlockDiagram")
        sect = Section(result.Name);
        append(sect,result);
        % Create ExecutionOrder reporter and add to report
        rptr = ExecutionOrder(result);
        % Filter all but periodic tasks
        filterFcnHandle = @(taskName, taskType, trigger, sourceBlock) ...
            ~strcmpi(taskType, "Periodic");
        rptr.TaskFilterFcn = filterFcnHandle;
        append(sect,rptr);
        
        append(ch,sect);
    end
end

append(rpt,ch);
close(rpt);
rptview(rpt);

If you provide a string scalar or a character vector, it must contain an expression. The expression:

  • Can use the variables taskName, taskType, trigger, and sourceBlock

  • Must set the variable isFiltered to true to filter the specified task from the report, or false to include the task in the report

For example, this code uses the TaskFilterFcn property to report only periodic tasks:

import slreportgen.finder.*
import slreportgen.report.*
import mlreportgen.report.*

model_name = "slrgex_vdp";
load_system(model_name);

rpt = slreportgen.report.Report("ExecutionOrder_example","html");

finder = DiagramFinder(model_name);

ch = Chapter("Diagrams");
while hasNext(finder)
    result = next(finder);
    % Only report block diagrams and nonvirtual subsystems
    if (strcmpi(result.Type,"Simulink.SubSystem")...
            && strcmpi(get_param(result.Object,"IsSubsystemVirtual"),"off")) ...
            || strcmpi(result.Type,"Simulink.BlockDiagram")
        sect = Section(result.Name);
        append(sect,result);
        % Create ExecutionOrder reporter and add to report
        rptr = ExecutionOrder(result);
        % Filter all but periodic tasks
        % Code string to include only asynchronous tasks
        filterStr = "isFiltered = ~strcmpi(taskType, ""Periodic"");";
        rptr.TaskFilterFcn = filterStr;
        append(sect,rptr);
        
        append(ch,sect);
    end
end

append(rpt,ch);
close(rpt);
rptview(rpt);

Formatter for the task details table, specified as an mlreportgen.report.BaseTable object. The default value of this property is a BaseTable object with the TableStyleName property set to the ExecutionOrderTable style, which is defined in the default template for an ExecutionOrder reporter. To customize the appearance of the table, modify the properties of the default BaseTable object or replace the object with your own BaseTable object. If you add content to the Title property of the BaseTable object, the content appears in front of the table title in the generated report.

Diagram reporter to format the block execution order diagrams, specified as an slreportgen.report.Diagram reporter.

Formatter for the block execution order lists, specified as an mlreportgen.dom.OrderedList object or mlreportgen.dom.UnorderedList object. The OrderedList or UnorderedList object must not contain list items.

The default value of this property is an OrderedList object with the StyleName property set to the ExecutionOrderList style, which is defined in the default template for an ExecutionOrder reporter. To customize the appearance of the list, modify the properties of the default OrderedList object or replace the object with a your own OrderedList or UnorderedList object.

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

For each block diagram or virtual subsystem of the slrgex_vdp model, report the system tasks and the blocks in each task, in execution order.

Import the MATLAB and Simulink Report API packages so that you do not have to use long, fully qualified class names.

import mlreportgen.report.*
import slreportgen.finder.*
import slreportgen.report.*

Open the model and create a report.

model_name = 'slrgex_vdp';
load_system(model_name);
 
rpt = slreportgen.report.Report("ExecutionOrder_example","pdf");

Create a finder to find all of the diagrams in the model. Create a Diagrams chapter.

finder = DiagramFinder(model_name);
ch = Chapter("Diagrams");

For each diagram that is a block diagram or a nonvirtual subsystem, report the system tasks and blocks in execution order, using the default values of the slreportgen.report.ExecutionOrder reporter properties.

while hasNext(finder)
    result = next(finder);
    if (strcmpi(result.Type,"Simulink.SubSystem") &&...
            strcmpi(get_param(result.Object,"IsSubsystemVirtual"),"off")) ...
            || strcmpi(result.Type,"Simulink.BlockDiagram")
        sect = mlreportgen.report.Section(result.Name);
        append(sect,result);
        rptr = slreportgen.report.ExecutionOrder(result);
        append(sect,rptr);
        append(ch,sect);
    end
end

Append the chapter to the report. Close and view the report.

append(rpt,ch);
close(rpt);
rptview(rpt);

Version History

Introduced in R2020b