slreportgen.report.Bus Class
Namespace: slreportgen.report
Superclasses: slreportgen.report.Reporter
Description
Use an object of the slreportgen.report.Bus
class to report on buses that
are selected or created by Simulink® blocks.
A bus reporter finds buses to report by searching a model, subsystem, block, or signal for
blocks that select signals from a bus or combine signals to create a bus. For a model or
subsystem, the Bus
reporter reports all of the buses selected or created in the
model or subsystem. For a block, the reporter reports the bus that is selected or created by
the block. For a signal, the reporter reports all of the buses selected or created by the
blocks that are connected to the port specified by the signal. Use the Object
property
to specify the model, subsystem, block, or signal for which to report buses.
By default, a Bus
reporter generates:
A hierarchical list of the signals in the bus
A table with details about the selected signals or the signals used to create the bus
Paragraphs with details about bus objects and connected blocks for each bus-related block found
Use the reporter properties to customize the content and appearance of the generated
report. For example, use the ReportedBlockType
property to specify which
types of blocks to use when searching for buses.
Note
To use an slreportgen.report.Bus
reporter in a report, you must create
the report using the slreportgen.report.Report
class or subclass.
The slreportgen.report.Bus
class is a handle
class.
Creation
Description
sets the busRptr
= slreportgen.report.Bus(Name=Value)Bus
object properties
using name-value pairs. You can specify multiple name-value pair arguments in any
order.
Properties
Object
— Model, block, or signal to search for buses
[]
(default) | string scalar | character vector | handle | slreportgen.finder.DiagramResult
object | slreportgen.finder.BlockResult
object | slreportgen.finder.SignalResult
object
Model, block, or signal to search for buses, specified as one of the following values:
String scalar or character vector that contains the name of a model, Subsystem block, Bus Creator block, Bus Assignment block, or Bus Selector block
Handle of a model, Subsystem block, Bus Creator block, Bus Assignment block, or Bus Selector block
Handle of a block input or output port connected to a signal
slreportgen.finder.DiagramResult
,slreportgen.finder.BlockResult
, orslreportgen.finder.SignalResult
object
Title
— Title for each reported bus
[]
(default) | string scalar | character vector | DOM object | function handle
Title for each reported bus, specified as a string scalar, character vector, DOM object, or function handle. The contents of this property are reported with each bus included by the reporter. If this property is empty, no title is reported.
If this property contains text or a function handle that returns text, the text is
added to an mlreportgen.dom.Paragraph
object with the
style BusTitleParagraph
.
If this property is specified as a function handle, the function must return
content that can be added to a report, such as a string scalar, character vector, or DOM
object. The function must accept a struct
with these fields:
PortHandle
— Handle to the input port or output port of the bus signal. For In Bus Element and Out Bus Element blocks in a subsystem, this field is the port handle of the subsystem that corresponds to the blocks. For In Bus Element and Out Bus Element blocks in the top level of a model, this field is-1
.BlockName
— Name of reported model, Bus Creator, Bus Selector, Bus Assignment, or Subsystem block that creates or selects the reported bus, specified as a string scalar.BlockPath
— Full path of model, Bus Creator, Bus Selector, Bus Assignment, or Subsystem block that creates or selects the reported bus, specified as a string scalar.BusPortString
— For a bus created or selected by a model or subsystem port, this field contains the input port or output port connected to the bus signal, specified as a string scalar. For example,"Inport <x>"
. Otherwise, this field is an empty string (""
).
For example: busRptr.Title = @(blkInfo)
blkInfo.BlockName;
ReportedBlockType
— Types of blocks used to report bus information
"auto"
(default) | "all"
| string array of block types | cell array of block types
Types of blocks used to report bus information, specified as one of these values:
"auto"
— Reports bus information from Bus Creator, Bus Assignment, and Out Bus Element blocks if the input is a Bus Creator, Bus Assignment, or Out Bus Element block. Otherwise, reports bus information from Bus Selector and In Bus Element blocks."all"
— Reports bus information from all supported bus-related block types.List of block types, specified as a string array or a cell array of character vectors. Valid block types are:
BusCreator
BusSelector
BusAssignment
Inport
Outport
For example:
["BusCreator","BusSelector"]
For models or subsystems, the Bus
reporter reports bus information
from all blocks of the types that this property specifies. For signals, the reporter
reports bus information from all blocks of the specified types that are connected to the
signal (source and destination). For blocks, this property is used only if the
IncludeNestedBuses
property is
true
. For Bus Selector and In Bus
Element blocks, the reporter reports bus information from all blocks of the
specified type that are connected to the output signals of the block. For Bus
Creator, Bus Assignment, and Out Bus
Element blocks, the reporter reports bus information from all blocks of the
specified type that are connected to the input signals of the block.
IncludeNestedBuses
— Whether to report nested buses
false
(default) | true
Whether to report nested buses, specified as true
or
false
. If this property is true
, the reporter
reports bus-related blocks of the type specified
by ReportedBlockType
that are connected to the selected signals
or to signals used to create a bus. If this property is false
and
Object
is a block, the reporter reports only the block specified
by Object
. If this property is false
and
Object
is a signal, the reporter reports only the blocks directly
connected to the signal.
If Object
is a model or subsystem, this property has no effect
because all blocks of the type specified by the ReportedBlockType
property are used to report buses.
ShowSignalHierarchy
— Whether to report hierarchy of bus signals for each bus
false
(default) | true
Whether to report the hierarchy of bus signals for each bus, specified as
true
or false
. If this property is
true
, the reporter includes a list of the names of signals in the
bus. For blocks that create buses, the list describes the signal hierarchy of the output
bus. For blocks that select signals from buses, the list describes the signal hierarchy
of the input bus. If the bus includes any nested signals, the signal names are included
as a nested list.
The reporter does not include the signal hierarchy for buses created or selected by top-level model input or output ports.
ShowSignalTable
— Whether to report details of signals
true
(default) | false
Whether to report details of signals, specified as true
or
false
. If this property is true
, the reporter
includes a table describing the signals selected from a bus or used to create a bus,
depending on the block type.
ShowBusObject
— Whether to report name of Simulink.Bus
object
true
(default) | false
Whether to report the name of a Simulink.Bus
object that is
associated with the reported bus, specified as true
or
false
. If this property is true
and the reported
bus is described by a Simulink.BusObject
, the report includes the name of
the bus object and links the name to the bus object information reported elsewhere in
the report.
The reporter does not include the bus object name for buses created or selected by top-level model input or output ports.
ShowConnectedBlocks
— Whether to report names of blocks connected to each full bus signal
true
(default) | false
Whether to report the names of blocks connected to each full bus signal, specified
as true
or false
. If this property is
true
:
For blocks that create buses, the reporter reports the names of the blocks connected to the port that outputs the full bus signal.
For blocks that select bus signals, the reporter reports the name of the block from which the full bus signal is output.
If
IncludeBusLinks
istrue
, aBus Created
orSignals Selected
link is included after the names of blocks that match the block types specified byReportedBlockType
.
The reporter does not include the names of connected blocks for buses created or selected by top-level model input or output ports.
IncludeBusLinks
— Whether to include link to bus created or selected by connected block
true
(default) | false
Whether to include a link to a bus created or selected by a connected block,
specified as true
or false
. If this property is
true
, the reporter includes a link to the bus information for
blocks that are reported as a source or destination in the signal table or connected
blocks sections. For blocks whose block types are included in
ReportedBlockTypes
, a Bus
Created
or Signals Selected
link is
included next to the block name.
IncludeBlockLinks
— Whether to report block names as links to block details
false
(default) | true
Whether to report block names as links to block details, specified as
true
or false
. If this property is
true
, a block name in a signal table title links to the block
details reported elsewhere in the report.
IncludeSignalLinks
— Whether to report port numbers as links to signal details
false
(default) | true
Whether to report port numbers as links to signal details, specified as
true
or false
. If this property is
true
, the reporter reports signal port numbers in the signal table
as links to the signal details reported elsewhere in the report.
SelectorSignalProperties
— Properties to report for selected bus signals
["Outport" "Name" "DataType"
"Destination"]
(default) | string array | cell array of character vectors
Properties to report for the signals selected by Bus Selector or In Bus Element blocks, specified as a string array or a cell array of character vectors. Specify any of these properties:
Outport
Name
DataType
Destination
Description
Complexity
Dimensions
Min
Max
CreatorSignalProperties
— Properties reported for signals used to create a bus
["Inport" "Name" "DataType" "Source"]
(default) | string array | cell array of character vectors
Properties to report for the signals used to create a bus by Bus Creator, Bus Assignment, and Out Bus Element blocks, specified as a string array or a cell array of character vectors. Specify any of these properties:
Inport
Name
DataType
Source
Description
Complexity
Dimensions
Min
Max
ShowEmptyColumns
— Whether to show empty columns in signal table
false
(default) | true
Whether to show empty columns in a signal table, specified as
true
or false
.
SignalFilterFcn
— Function or expression to filter signals in signal table
[]
(default) | function handle | string scalar | character vector
Function or expression to filter signals in a signal table, 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. The function or code is executed for each signal that is selected or used to create a bus.
If TaskFilterFcn
is empty, all tasks are included in the
report.
If you provide a function handle, the associated function must:
Take these arguments:
portHandle
— Handle to port of the selected signal or signal used to create the bus.parentPath
— Full path of parent block used to report bus information, specified as a string scalar.sourcePath
— Full path of the source block of the signal, specified as a string scalar.destinationPath
— Full path of the destination block of the signal. If there are multiple destinations, this argument is a string array of destination blocks.
Return
true
to filter the specified signal from the report, orfalse
to include the task in the report.
For example, this code uses the SignalFilterFcn
property to
filter out the signals that feed into the Display3
block:
import slreportgen.report.* import mlreportgen.report.* model_name = "sldemo_bus_arrays"; load_system(model_name); rpt = slreportgen.report.Report("Bus_example","pdf"); append(rpt,slreportgen.report.Diagram(model_name)); ch = Chapter("Buses"); busRptr = Bus(model_name); busRptr.SignalFilterFcn = @(~, ~, ~, destinationPath) endsWith(destinationPath,"Display3"); append(ch,busRptr); 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
portHandle
,parentPath
,sourcePath
, anddestinationPath
Must set the variable
isFiltered
totrue
to filter the specified task from the report, orfalse
to include the task in the report
For example, this code uses the SignalFilterFcn
property to
filter out the signals that feed into the Display4
block:
import slreportgen.report.* import mlreportgen.report.* model_name = "sldemo_bus_arrays"; load_system(model_name); rpt = slreportgen.report.Report("Bus_example","pdf"); append(rpt,slreportgen.report.Diagram(model_name)); ch = Chapter("Buses"); busRptr = Bus(model_name); filterStr = "isFiltered = endsWith(destinationPath,""Display4"");"; busRptr.SignalFilterFcn = filterStr; append(ch,busRptr); append(rpt,ch); close(rpt); rptview(rpt);
TableReporter
— Formatter for signal table
mlreportgen.report.BaseTable
object
Formatter for signal 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 BusTable
style, which is defined in the default template
for a Bus
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.
ListFormatter
— Formatter for signal hierarchy list
mlreportgen.dom.OrderedList
object | mlreportgen.dom.UnorderedList
object
Formatter for the signal hierarchy list, specified as an mlreportgen.dom.OrderedList
or mlreportgen.dom.UnorderedList
object. The formatter reports and formats the
signal hierarchy list if the ShowSignalHierarchy
property of this
Bus
reporter is true
. The OrderedList
or UnorderedList
object must not contain list items.
The default value of this property is an UnorderedList
object with
the StyleName
property set to the BusList
style,
which is defined in the default template for a Bus
reporter. To customize
the appearance of the list, modify the properties of the default
UnorderedList
object or replace the object with your own
UnorderedList
or OrderedList
object.
ParagraphFormatter
— Paragraph formatter for connected blocks and bus object details
mlreportgen.dom.Paragraph
object
Paragraph formatter to report and format the connected blocks and bus object
details, specified as an mlreportgen.dom.Paragraph
object. The
default value of this property is an mlreportgen.dom.Paragraph
object with the StyleName
property set to the BusParagraph
style, which is defined in the
default template for a Bus
reporter. To customize the appearance of the
paragraph, modify the properties of the default mlreportgen.dom.Paragraph
object or replace the object with a customized mlreportgen.dom.Paragraph
object. If you add content to the default or replacement paragraph object, the content
appears in front of the content reported for the connected blocks and bus object details
in the generated report.
TemplateSrc
— Source of template for this reporter
character vector | string scalar | reporter or report | DOM document or document part
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
Document Object Model (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 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.
TemplateName
— Name of template for this reporter
character vector | string scalar
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.
Data Types: char
| string
LinkTarget
— Hyperlink target for this reporter
[]
(default) | character vector | string scalar | mlreportgen.dom.LinkTarget
object
Hyperlink target for this reporter, specified as a character vector or string scalar
that specifies the link target ID, or an mlreportgen.dom.LinkTarget
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.
Methods
Public Methods
slreportgen.report.Bus.createTemplate | Create bus reporter template |
slreportgen.report.Bus.customizeReporter | Create subclass of slreportgen.report.Bus class |
slreportgen.report.Bus.getClassFolder | Get location of folder that contains the slreportgen.report.Bus
class definition file |
copy | Create copy of a Simulink reporter object and make deep copies of certain property values |
getImpl | Get implementation of reporter |
Examples
Report Model Buses
Use an slreportgen.report.Bus
object to report on the buses that are selected by the blocks in a model.
Import the Report API packages so that you do not have to use long fully qualified class names.
import mlreportgen.report.* import slreportgen.report.*
Load the model.
model_name = "sldemo_bus_arrays";
load_system(model_name);
Create a Simulink report.
rpt = slreportgen.report.Report("Bus_example","pdf");
Add the diagram of the model to the report.
append(rpt,slreportgen.report.Diagram(model_name));
Report the bus information for the model in a chapter.
ch = Chapter("Buses");
busRptr = Bus(model_name);
Use the block name as the title for each block bus.
busRptr.Title = @(blkInfo) blkInfo.BlockName;
Add the bus reporter to the chapter.
append(ch,busRptr);
Add the chapter to the report.
append(rpt,ch); close(rpt); rptview(rpt);
Version History
Introduced in R2021a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)