主要内容

显示调试的端口值

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

对于许多信号携带数据的块,Simulink万博1manbetx®可以在模拟期间和之后的框图上显示信号值(块输出)为端口值标签(类似于工具提示)。端口值标签显示块输出值当Simulink运行块输出方法。万博1manbetx该模型显示了端口的端口值标签持续的Mathblocks, output values of14.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.

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

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 the热门block. The output is constant at0

此技术可帮助您隔离问题。

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

对于非数字数据显示,Simulink使用以下值:万博1manbetx

信息 解释
action 信号执行动作子系统。
fcn-call The signal is a function-call signal, e.g., Function Call Generator output.
地面 信号来自地面块。
不是数据信号 该信号不包含有效数据,例如,该信号来自评论的块。

在某些情况下:

  • 端口值显示可能无法获取值信号或

  • 信号的价值无法轻易显示

在这种情况下,Simulink万博1manbetx使用这些值。

信息 解释
... 信号尺寸超过了Simulink可以显示的最大元素数量。万博1manbetx有关更多信息,请参阅显示模型的端口值
(没有消息) 可用的仿真数据不足。向前或按播放以获取更多数据。
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.
无法访问 万博1manbetxSimulink无法获得端口值。例如,请参阅信号存储重复使用
[m*n] 这是一个非矢量信号。万博1manbetxSimulink无法显示矩阵的实际值。它改为显示矩阵维度。
尚无数据

当:

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

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

不曾用过 万博1manbetxSimulink由于优化而无法获得信号值。
removed 万博1manbetxSimulink无法获得由于块降低而获得的信号值。
优化 万博1manbetxSimulink由于优化而无法获得信号值。在正常模式下,此消息出现用于与条件输入分支执行已启用。有关更多信息,请参阅Conditionally Executed Subsystems Overview
不可用 可用的仿真数据不足。For example, see模拟Stepper

笔记

您可以通过将信号指定为测试点来强制值标签以显示信号值。使用特性dialog box to do this.

显示特定端口的值

要在模拟之前显示特定端口或端口值的值或端口值,请选择一个或多个信号,右键单击选择,然后选择选定端口的展示价值标签

默认情况下,Simuli万博1manbetxnk在模拟过程中单击信号时会显示信号的值。您可以控制此行为。在调试tab, select the从画布中删除所有模拟输出值显示button arrow,然后选择选项。在“值标签显示选项”对话框中,选择默认情况下启用模拟期间

笔记

要删除所有数据提示调试tab, select the从画布中删除所有模拟输出值显示button arrow,然后选择删除值显示

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

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

单击对话框外面的任何地方以关闭它。出现端口值标签。该标签没有数据;当您模拟模型时,它会显示值。

模拟模型时,端口值标签显示您选择的信号的名称和值。要更改要显示的信号,请单击端口值标签以重新打开对话框。您也可以单击另一个信号以显示其值。

笔记

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.

  1. In the model whose port values you want to display, on the调试tab, select the从画布中删除所有模拟输出值显示button arrow,然后选择选项

  2. In the Value Label Display Options dialog box, specify your preferences for:

    • 显示选项,包括字体尺寸,刷新频率以及信号宽度大于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 to单击时切换值标签减慢模拟。

加速模式

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

加速模式 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.

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

信号存储重复使用

如果通过优化信号存储重用的优化,块的输出端口缓冲区与另一个块共享,则端口值显示为无法访问。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和其他几种数据类型。

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

  • 万博1manbetxSimulink不会显示具有一些复合数据类型的信号的数据,例如总线信号。

子系统

  • 你不能显示子系统控制的端口值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.

  • 当您禁用有条件执行的子系统时,端口值显示的信号显示为外港块显示外港block, depending on theOutput when disabled环境。

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

模拟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 (配置参数>数据导入/导出>Additional parameters>精炼因素),因为Simuli万博1manbetxnk更新端口值仅在主要时间步骤中显示。

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.

命令行模拟

为了效率,Simulink不支持万博1manbetx在命令行模拟期间使用端口值显示万博1manbetxSIM命令。

Merge Block

万博1manbetxSimulink不会向合并块显示输入值。要查看此值,请参阅源块。

命令行接口

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

Non-万博1manbetx信号

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

相关话题