Signal Label Propagation
You can give names to signals and configure the signals to propagate the signal names in a Simulink® model to track a signal through one block or many blocks. For a list of supported blocks, see Blocks That Support Signal Label Propagation.
When you name a signal and enable the display of signal label propagation for output signals of allowed blocks:
If there is a user-specified signal name that Simulink can propagate, the propagated signal label includes the name in angle brackets (for example,
<sig1>
).If there is no signal name to propagate, Simulink displays an empty set of angle brackets (
<>
) for the label.
Simulink does not propagate signal labels for commented out blocks.
For example, in the following model, the output signal from the Subsystem block is
configured for signal label propagation. The propagated signal label
(<const>
) is based on the name of the upstream
output signal of the Constant block (const
).
For more information on how Simulink creates propagated signal labels, see How Simulink Propagates Signal Labels.
Blocks That Support Signal Label Propagation
You can propagate signal labels at the output of these blocks:
Bus Selector — The propagated names come from the inputs to the corresponding Bus Creator block, the inputs to the corresponding Out Bus Element block, the elements of the corresponding
Simulink.Bus
object, or similar.From — The propagated name comes from the input to the corresponding Goto block.
In Bus Element — The propagated name depends on what the In Bus Element block selects.
When the In Bus Element block selects the entire input from a subsystem port, the block propagates the upstream name from the parent. To support this type of signal label propagation, the In Bus Element block must be in a subsystem, not a model.
When the In Bus Element block selects an element from a subsystem or model port, the block propagates the element name. (since R2024b)
Inport — The propagated name comes from the corresponding input to the parent subsystem. To support signal label propagation, the Inport block must be in a subsystem, not a model.
Model — When specified, the propagated names come from the Output name parameter of the corresponding Out Bus Element blocks (since R2023a) or the Signal name parameter of the corresponding Outport blocks. Otherwise, the propagated names come from the inputs to the corresponding Outport or Out Bus Element blocks.
Subsystem — The propagated names come from the inputs to the corresponding Outport or Out Bus Element blocks.
The Signal Properties dialog box for a signal indicates whether that signal supports signal label propagation. The Show propagated signals parameter is available only for blocks that support signal label propagation. For details, see Display Propagated Signal Labels.
How Simulink Propagates Signal Labels
In general, Simulink performs signal label propagation consistently:
For different modeling constructs (for example, nonbus signals and buses, virtual and nonvirtual buses, subsystem and model variants, model references, and libraries)
In models with or without hidden blocks, which Simulink inserts in certain cases to enable simulation
At model load, edit, update, and simulation times
For information about some special cases, see:
General Signal Label Propagation Processing
In general, when you enable signal label propagation for an output signal of a block (for example, BlockA), Simulink performs the following processing to find the source signal name to propagate:
Checks the block whose output signal connects to BlockA, and if necessary, continues checking upstream blocks, working backward from the closest block to the farthest block.
Stops when it encounters a block that either:
Supports signal label propagation and has a signal name
Does not support signal label propagation
Obtains the signal name, if any, of the output signal for the block at which Simulink stops.
Uses that signal name for the propagated signal label of any output signals of downstream blocks for which you enable signal label propagation.
For example, in the following model, suppose that you enable signal
label propagation for the output signal for the
Subsystem block (that is, the signal connected to
the Out1
port).
Simulink checks inside the subsystem, checks upstream from the From and GoTo blocks (which support signal label propagation and do not have a name), and then checks further upstream, to the Constant block, which does not support signal label propagation.
Simulink uses the signal name of the Constant
block output signal, const
. The propagated signal
label for the Subsystem block output signal is
<const>
.
If the output signal from the Constant block did not
have a signal name, then the propagated signal label would be an empty
set of angle brackets (<>
).
Suppose that in the Subsystem block you enable signal
label propagation for the output signal from the In1
block, and you use the Signal Properties dialog box to specify the
signal name const-from
for the output signal of the
From block, as shown below.
The propagated signal label for the Subsystem block
output signal changes to <const-from>
,
because that is the first named signal that Simulink encounters in its signal label propagation
processing.
In the following model, the signal label propagation for the output
signal of the Subsystem block uses the signal name
bus1
, which is the name of the output bus of
the Bus Creator block. The propagated signal label does
not include the names of the bus element signals (a
and b
).
Display Propagated Signal Labels
You can display propagated signal labels for individual signals, or display the propagated signal labels for all signals in a model. To display the labels for all signals, in the Simulink Editor, on the Debug tab, select Information Overlays > Propagated Signal Labels.
To display a propagated signal label for an individual signal:
Right-click the signal for which you want to display a propagated signal label and select Properties.
In the Signal Properties dialog box, select Show propagated signals.
The Show propagated signals parameter is available only for output signals from blocks that support signal label propagation.
To configure a signal to display its propagated name programmatically, use
the set_param
function to
specify the value of the ShowPropagatedSignals
property
for the port handle that corresponds to the block output port that produces
the signal. For example, to enable signal label propagation for the output
signal on the first output port of Subsystem block
Subsystem
in the model MyModel
:
Use the
get_param
function to get the port handles for the block.portHandles = get_param("MyModel/Subsystem","PortHandles");
Access the handle for the first output port by index. The block port handles are returned as a structure that contains a field for each type of port the block might have.
outport1 = portHandles.Outport(1);
Use the
set_param
function to specify the value for theShowPropagatedSignals
parameter for the output port ason
.set_param(outport1,ShowPropagatedSignals="on")
If a signal already has a label, then an alternative approach for displaying a propagated signal label is:
In the model diagram, click the signal label.
Remove the label text.
In the signal label text box, enter an angle bracket (
<
).Click outside the signal label.
Simulink displays the propagated signal label.
Special Cases of Signal Propagation
Processing for Referenced Models
To enable signal label propagation for referenced models, in addition to the steps described in Display Propagated Signal Labels, use the default setting for the Model Configuration Parameters > Model Referencing > Propagate all signal labels out of the model parameter. In other words, make sure the parameter is enabled.
If you make a change inside a referenced model that affects signal label propagation, the propagated signal labels outside of the referenced model do not reflect those changes until after you update the diagram or simulate the model.
For example, the model
ex_signal_label_prop_model_ref
has a
referenced model that includes an output signal from the In1 block
that has a signal name of input_1
.
If you enable signal label propagation for the signal from the Out1
port of the Model block, that signal does
not reflect the name
input_1
until after you update the diagram or
simulate the model.
Processing for Variants and Configurable Subsystems
Simulink updates the propagated signal label (if enabled) for the output signal of the Subsystem or Model block, when both of these conditions occur:
The output signals for variant models have different signal names.
You change the active variant model or variant subsystem.
For Subsystem blocks, the signal label updates at edit time. For Model blocks, the update occurs when you update diagram or simulate the model.