Main Content

解决率过渡

通常,如果它们的样本时间不同,则在两个块之间存在速率转换,即它们的样本时间向量分量的任一块是不同的。例外是:

  • 输出常量值的块永远不会具有任何其他速率的速率转换。

  • 如果您使用固定步骤求解器,则连续采样时间(黑色)和最快的离散速率(红色)从未具有速率转换。

  • 可变的采样时间和在次要步骤中固定的时间没有速率转换。

您可以通过插入速率转换块和使用两个诊断工具来手动解决速率转换。对于单任务执行模式,单项任务率过渡diagnostic allows you to set the level of Simulink®速率过渡消息。这多任务率过渡诊断为多任务执行模式提供相同的功能。这些执行模式直接涉及使用中的求解器类型:可变步骤求解器始终单任务;可以将固定步骤求解器明确设置为单任务或多任务处理。

自动速率过渡

金宝appSimulink在更新图中可以检测多任务型模型中的不匹配速率转换,并自动插入速率过渡blocks to handle them. To enable this, in theSolver模型配置参数的窗格,选择自动处理数据传输的速率转换。这default setting for this option is off. When you select this option:

  • 金宝appSimulink处理周期性采样时间和异步任务之间的转换。

  • 金宝appSimulink在框图中插入隐藏速率转换块。

  • 自动插入速率过渡块以受保护模式运行,用于定期任务和异步任务。您无法更改此行为。对于定期任务,自动插入的速率转换块与由此指定的确定性级别运行确定性数据传输参数在Solver窗格。默认设置是只要有可能,这使得数据传输能够在整数倍相关的周期性样本次数之间传输数据传输。有关更多信息,请参阅确定性数据传输。要使用其他模式,必须插入速率过渡块并手动设置它们的模式。

可视化插入速率转换块

当你选择自动处理数据传输的速率转换选项,Simul金宝appink在具有不匹配的过渡速率的路径中插入速率转换块。默认情况下隐藏这些块。要可视化插入的块,请更新图表。徽章标签出现在模型中,并在编译阶段中的Simulink插入速率转换块的位置。金宝app例如,在该模型中,在编译模型时,在两个正弦波块和多路复用器和集成器之间插入三个速率转换块。ZOH和DBBUF徽章标签表示这些块。

您可以显示或隐藏徽章标签。在这方面Debug选项卡,选择信息覆盖>自动速率过渡s

要配置隐藏的速率转换块,请右键单击徽章标签,然后单击插入速率过渡块使块可见。

当您显示隐藏的速率转换块时:

  • 您可以看到插入的速率转换块以及模型中的位置。

  • 你可以设置初始条件这些块。

  • You can change data transfer and sample time block parameters.

Validate the changes to your model by updating your diagram.

Displaying inserted Rate Transition blocks is not compatible with export-function models.

要了解有关速率转换块类型的更多信息,请参阅速率过渡

笔记

Suppose you automatically insert rate transition blocks and there is a virtual block specifying sample time upstream of the block you insert. You cannot click the badge of the inserted block to configure the block and make it visible because the sample time on the virtual block causes a rate transition as well. In this case, manually insert a rate transition block before the virtual block. To learn more about virtual blocks, see非宽恕和虚拟块

相关例子

更多关于