Main Content

Display Port Values for Debugging

显示端口值,以便轻松调试

对于许多信号携带数据的块,Simulink金宝app®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 theConstantandMathblocks, output values of1and4.04

如果端口值标签出现空,这意味着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.

如果您在模拟(例如虚拟子系统块)中切换或悬停在模拟中优化仿真的块上,则在模拟时金宝app,模型将显示文本优化

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.

这些结果表明该模型有问题,因为:

  • 加热成本是0在所有温度下。

  • 房屋内部的温度几乎完全匹配环境温度。

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加热器子系统是0at every time step.

要了解更多信息,您可以启用端口值标签加热器subsystem. Using Simulation Stepper, if you step forward again to display the values, you can see that there is an issue with theHeatGainblock. The output is constant at0

This technique helps you isolate the issue.

为了简化调试,您可以在模拟过程中打开和关闭端口值标签。除了提供有用的调试信息外,端口值显示还可以帮助您在模拟过程中监视信号值。但是,这些标签并未通过模型保存。

For nonnumeric data display, Simulink uses these values:

Message 解释
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 such cases, Simulink uses these values.

Message 解释
... 信号尺寸超过了Simulink可以显示的最大元素数量。金宝app有关更多信息,请参阅Display Port Values for a Model
(no message) 可用的仿真数据不足。向前或按播放以获取更多数据。
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.
无法访问 金宝appSimulink无法获得端口值。例如,请参阅Signal Storage Reuse
[m*n] 这是一个非矢量信号。金宝appSimulink无法显示矩阵的实际值。它改为显示矩阵维度。
no data yet

当:

  • 仿真数据不可用。启动模拟以查看值。

  • If the model contains subsystems (for example, an enabled subsystem) and model references and they are not executed during a simulation.

不曾用过 金宝appSimulink由于优化而无法获得信号值。
removed Simulink cannot obtain the signal value due to block reduction.
优化 金宝appSimulink由于优化而无法获得信号值。在正常模式下,此消息出现用于与条件输入分支执行enabled. For more information, seeConditionally Executed Subsystems Overview
不可用 可用的仿真数据不足。For example, seeSimulation Stepper

笔记

您可以通过将信号指定为测试点来强制值标签以显示信号值。使用特性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选定端口的展示价值标签

默认情况下,Simuli金宝appnk在模拟过程中单击信号时会显示信号的值。您可以控制此行为。在Debugtab, select>选项,,,,then in the Value Label Display Options dialog box, select默认情况下启用模拟期间

笔记

To remove all data tips, on theDebugtab, select>删除值显示

For bus signals, the选定端口的展示价值标签选项打开一个对话框,您可以从总线中的所有信号中选择。例如,在此模型中,您可以查看所有包含的信号的对话框modelbus

您可以通过名称搜索信号或通过层次结构过滤。选择父信号以包含其包含的所有信号。您还可以过滤显示器以仅查看您选择的那些信号。

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.

笔记

Simulink does not save the values of a signal when you remove the port value label.

Display Port Values for a Model

Specify port value display formatting and the frequency of updates. The Value Label Display Options dialog box controls these settings on the entire model.

  1. In the model whose port values you want to display, on theDebugtab, select>选项

  2. 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

Port Value Display Limitations

Performance

Enabling the hovering option for a model or setting at least one block toToggle Value Labels When Clickedslows down simulation.

加速模式

端口值仅以正常和加速器模式工作。它们不在快速加速器和外部模式下工作。该表显示了加速器模式如何影响端口值的显示。

加速模式 Port Values
Accelerator
  • Signals not optimized in Accelerator mode display port values as in Normal mode. Signals optimized in Accelerator mode display port values as优化。有关更多信息,请参阅显示端口值,以便轻松调试

  • Model reference blocks simulated in Accelerator mode do not get their port value displays updated.

Rapid Accelerator 不相容。是否存在模型或其母体指定加速模拟的限制。有关更多信息,请参阅通过使用RSIM系统目标文件,在主机计算机上加速,完善和测试混合动态系统(金宝appSimulink编码器)

Signal Storage Reuse

如果通过优化信号存储重用的优化,块的输出端口缓冲区与另一个块共享,则端口值显示为无法访问。You can disable signal storage reuse using the信号存储重复使用check box. However, disabling signal storage reuse increases the memory used during simulation.

Signal Data Types

  • Simulink displays the port value for ports connected to most kinds of signals, including signals with built-in data types (such asdouble,,,,int32, 或者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.

Subsystems

  • 你不能显示子系统控制的端口值ained 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 anOutport块显示Outportblock, depending on theOutput when disabled环境。

  • Simulink does not display data for the ports of an enabled subsystem that is not enabled.

Simulation Stepper

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不可用显示标签。

Refine Factor

Port value displays do not honor refine factor values (配置参数>Data Import/Export>Additional parameters>Refine factor) because Simulink updates port value displays only during major time steps.

Signal Specification Block and Inport Block

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.

Command-Line Simulations

为了效率,Simulink不支持金宝app在命令行模拟期间使用端口值显示金宝appSIM命令。

Merge Block

金宝appSimulink不会向合并块显示输入值。要查看此值,请参阅源块。

Command Line Interface

You cannot specify port value displays through the command line interface.

Non-金宝app信号

You cannot place port values on non-Simulink signals, such as Simscape™ or SimEvents®信号。此限制也适用于条件断点。

Related Topics