For many blocks whose signals carry data, Simulink® can display signal values (block output) as port value labels (similar to tool
tips) on the block diagram during and after a simulation. Port value labels display block output
values when Simulink runs block output methods. This model shows a port value label for the ports on
the Constant and Math blocks, output values of
1
and 4.04
.
If the port value label appears empty, this means that no port value is currently available. For example, toggling a port value label on a continuous block when paused during simulation does not display any values in the label.
Port value labels are also empty when you have not yet simulated the model. This is because the block output methods do not run when the model does not simulate.
If you toggle or hover on a block that Simulink optimizes out of a simulation (such as a virtual subsystem block), while you
simulate, the model displays the text optimized
.
Displaying port value data tips can help during interactive debugging of a model. For example, the figure shows the output of a thermal model for a house.
These results suggest a problem with the model because:
The heating cost is 0
at all temperatures.
The temperature inside the house matches ambient temperature almost exactly.
In such cases, debugging the blocks in the model interactively can help isolate
the error. Port value labels provide information at the output of every block in the model. So
in this example, if you step forward using Simulation Stepper, you can see that the output of
the Heater subsystem is 0
at every time step.
To learn more, you can enable port value labels for blocks inside the
Heater subsystem. Using Simulation Stepper, if you step forward again to display
the values, you can see that there is an issue with the HeatGain block. The
output is constant at 0
.
This technique helps you isolate the issue.
To simplify debugging, you can turn on and off port value labels during simulation. Besides providing useful information for debugging, port value displays can help you monitor a signal value during simulation. However, these labels are not saved with a model.
For nonnumeric data display, Simulink uses these values:
Message | Explanation |
---|---|
action | The signal executes action subsystems. |
fcn-call | The signal is a function-call signal, e.g., Function Call Generator output. |
ground | The signal is coming from a Ground block. |
not a data signal | The signal does not contain valid data, e.g., the signal is from a block that is commented out. |
In some cases:
The port value display may not be able to acquire the value signal or
The signal’s value cannot be easily displayed
In such cases, Simulink uses these values.
Message | Explanation |
---|---|
... | The signal dimension exceeds the maximum number of elements Simulink can display. For more information, see Display Port Values for a Model. |
(no message) | The simulation data available is insufficient. Step forward or press play to obtain more data. |
click to add signals | You have enabled a port value label on a bus. However, you have not selected a signal to display. Click the label to select bus signals. |
inaccessible | Simulink cannot obtain the port value. For an example, see Signal Storage Reuse. |
[m*n] | This is a nonvector signal. Simulink cannot display the actual values of the matrix. It displays the matrix dimension instead. |
no data yet | This message appears when:
|
not used | Simulink cannot obtain the signal value due to optimization. |
removed | Simulink cannot obtain the signal value due to block reduction. |
optimized | Simulink cannot obtain the signal value due to optimization. In Normal mode, this message appears for blocks with Conditional input branch execution enabled. For more information, see Conditionally Executed Subsystems Overview. |
unavailable | The simulation data available is insufficient. For example, see Simulation Stepper. |
Note
You can force a value label to display the signal value by designating the signal as a test point. Use the Properties dialog box to do this.
To display the value of a specific port or port values for a block before simulation, select one or more signals, right-click the selection, and select Show Value Label of Selected Port.
By default, Simulink displays the value of a signal when you click it during simulation. You can
control this behavior. On the Debug tab, select > Options, then in the Value Label Display Options dialog box, select Enable by
default during simulation.
Note
To remove all data tips, on the Debug tab, select > Remove Value Displays.
For bus signals, the Show Value Label of Selected Port option opens a dialog box where you can select from all signals in the bus. For example, in this model, you can see the dialog box for all signals that are contained in ModelBus.
You can search for a signal by name or filter through the hierarchy. Select a parent signal to include all of the signals it contains. You can also filter the display to view only those signals you have selected.
Click anywhere outside the dialog box to close it. The port value label appears. The label has no data; it displays values when you simulate the model.
When you simulate the model, the port value label displays the names and values of the signals you chose. To change the signals to display, click on the port value label to reopen the dialog. You can also click on another signal to display its value.
Note
Simulink does not save the values of a signal when you remove the port value label.
Specify port value display formatting and the frequency of updates. The Value Label Display Options dialog box controls these settings on the entire model.
In the model whose port values you want to display, on the Debug
tab, select > Options.
In the Value Label Display Options dialog box, specify your preferences for:
The display options, including font size, the refresh frequency, and the number of elements displayed for vector signals with signal widths greater than 1
The display mode
Floating-point or fixed-point format
Enabling the hovering option for a model or setting at least one block to Toggle Value Labels When Clicked slows down simulation.
Port values work in Normal and Accelerator modes only. They do not work in Rapid Accelerator and External modes. The table shows how accelerator modes affect the display of port values.
Accelerated Mode | Port Values |
---|---|
Accelerator |
|
Rapid Accelerator | Incompatible. The limitation exists whether the model or its parent specifies accelerated simulation. For more information, see Accelerate, Refine, and Test Hybrid Dynamic System on Host Computer by Using RSim System Target File (Simulink Coder). |
If the output port buffer of a block is shared with another block through the optimization
of signal storage reuse, the port value displays as inaccessible
. You can
disable signal storage reuse using the Signal storage reuse check box. However, disabling signal storage reuse increases the memory used
during simulation.
Simulink displays the port value for ports connected to most kinds of signals, including
signals with built-in data types (such as double
,
int32
, or Boolean
),
DYNAMICALLY_TYPED
, and several other data types.
Simulink shows the floating format for only noncomplex signal value displays.
Simulink displays the port value of fixed point data types based on the converted double value.
Simulink does not display data for signals with some composite data types, such as bus signals.
You cannot display port values for subsystems contained in a variant subsystem when there are no signal lines connecting to them. In such cases, during simulation, Simulink automatically determines block connectivity based on the active variant. However, you can display port values within the subsystems contained in the variant subsystem. You can also display values on signal lines outside of the variant subsystem.
When you disable a conditionally executed subsystem, the port value display for a signal that goes into an Outport block displays the value of the Outport block, depending on the Output when disabled setting.
Simulink does not display data for the ports of an enabled subsystem that is not enabled.
If you do not enable port value display when stepping forward, the display will not be
available when stepping back. When stepping back, if the port value is unavailable, the
unavailable
label is displayed.
Port value displays do not honor refine factor values (Configuration Parameters > Data Import/Export > Additional parameters > Refine factor) because Simulink updates port value displays only during major time steps.
When you display port values on Signal Specification and Inport blocks in a subsystem, the value that is driving the blocks displays instead of the block values.
For efficiency, Simulink does not support port value displays during a command-line simulation using the
sim
command.
Simulink does not display the input values to the merge block. To see this value, refer to the source block.
You cannot specify port value displays through the command line interface.
You cannot place port values on non-Simulink signals, such as Simscape™ or SimEvents® signals. This limitation applies to conditional breakpoints as well.