Main Content

模型变压器任务

使用Model Transformer应用程序来重构模型来实现变体,消除合格的数据存储块,并提高表查找操作的仿真和代码效率。您可以一次或一步一次执行模型变压器中的步骤。

转型

您可以使用Model Transformer应用程序替换:

  • 具有变体块的合格建模模式。

  • Data store blocks with blocks that make data dependency explicit

  • 使用预插块的查找表块带有插值

  • Modeling patterns with multiple Interpolation using Prelookup blocks into a single Interpolation using Prelookup block

If you want to perform all the transformations, for each step, specify the input parameters. Then, click the运行选定的检查按钮。运行每次检查后,通过单击转换创建新模型重构模型纽扣。

If you want to perform one transformation at a time, you can individually select the checks.

用瓦里安代替建模模式t Blocks

选择the转换模型到变体系统按钮以识别用于在变体转换和块中使用的系统常数Variant SubsystemorVariant Source块。These transformations are possible:

  • 如果一个nIf堵塞connects to one or more如果动作子系统块和每个如果动作子系统块有一个输出端口,用子系统替换此建模模式和Variant Source堵塞。

  • 如果一个nIf块连接到n如果动作子系统堵塞that has no output port or two or more output ports, replace this modeling pattern with aVariant Subsystem堵塞。

  • 如果一个开关情况堵塞connects to one or more开关情况一个ction Subsystem块和每个开关情况一个ction Subsystem块有一个输出端口,用子系统块替换此建模模式,一个Variant Source堵塞。

  • 如果一个开关情况块连接到开关情况一个ction Subsystem堵塞that has no output port or two or more output ports, replace this modeling pattern with aVariant Subsystem堵塞。

  • Replace a转变堵塞with aVariant Source堵塞。

  • Replace aMultiport Switch具有两个或多个数据端口的块Variant Source堵塞。

笔记

For some modelling patterns and settings, the Model Transformer cannot perform each one of the preceding transformations.

一个系统常数is a control input or part of an arithmetic expression that forms the control input toMultiport Switchor转变块和输入到Ifor开关情况块。您必须使用恒定块和块的组合,这些块形成受支持的MATLAB表达式作为这些块的控制输入。金宝app在恒定块中恒定值参数是系统常数。在转换的模型中,系统常数是条件表达式的一部分Variant SourceorVariant Subsystem块。

运行此转换后,Resulttable displays each modeling pattern with a hyperlink to the corresponding location in the model. If you do not want the Model Transformer to perform a transformation, clear the check box next to the pattern.

点击重构模型创建一个包含转换的模型。该应用在具有名称的文件夹中创建转换的模型M2M_ <原始型号名称>

For an example that converts blocks in a model to variant block, see转换模型到变体系统

Eliminate Data Store Blocks

选择Eliminate data store blocks识别Data Store Memory,,,,数据存储读取,,,,andData Store Write有资格淘汰的块。点击重构模型按钮创建一个模型,该模型用直接信号线代替这些块,延迟堵塞,,,,or合并堵塞。

Replacing these blocks improves model readability by making the data dependency explicit. The Model Transformer can replace these data stores:

  • For signals that are not buses, if a数据存储读取块在一个之前执行Data Store Write块,该应用程序用延迟堵塞。

  • For signals that are not buses, if aData Store Write块在一个之前执行数据存储读取块,该应用程序用直接连接替换了这些块。

  • 对于总线信号,如果写入总线元素在阅读总线之前执行,则应用程序替换数据存储读取andData Store Write具有直接连接和总线创建器块的块。

  • 对于总线信号,如果写入总线在阅读总线元素之前执行,则该应用替换数据存储读取andData Store Write具有直接连接的块总线选择器堵塞。

  • For conditionally executed subsystems, the app replaces the数据存储读取andData Store Write具有直接连接的块合并堵塞。

模型变压器应用仅消除了本地数据存储Data Store Memory块define. The app does not eliminate global data stores. For theData Store Memory街区,在Signal Attributestab of the Block Parameters dialog box, theData store name must resolve to Simulink signal objectparameter must be cleared.

运行此转换后,Result表显示超链接到相应的Data Store Memory,,,,数据存储读取,,,,andData Store Write块。如果您不希望模型变压器执行转换,请清除旁边的复选框Data Store Memory堵塞。

点击重构模型创建一个包含转换的模型。该应用在具有名称的文件夹中创建转换的模型M2M_ <原始型号名称>

有关替换模型中数据存储块的示例,请参见Replace Data Store Blocks

将表格查找块转换为预仔,并使用预插块插值

选择将表格查找转换为预插和插值识别N-D查找表块转换为共享prolookup使用预册块块和插值。消除模型中的冗余预锁块可改善线性插值的仿真速度。

模型变压器标识了多个N-D查找表块:

  • 使用相同的输入信号Lookup Table

  • 具有相同的断点规范,值和数据类型

  • 在“块参数”对话框中具有相同的算法参数

  • Have the same data type for fraction parameters

运行此转换后,Resulttable displays the identified blocks, their algorithm parameters, and the model, libraries, and referenced models. Select the blocks you want to transform, then click运行此检查

For an example about the transformation, seeImprove Efficiency of Simulation by Optimizing Prelookup Operation of Lookup Table Blocks。For more information about n-D Lookup Table blocks, seeN-D查找表

Replace Interpolation Using Prelookup Blocks

选择Common source interpolation transform识别倍数使用预插条插值有资格进行转型的块使用预插条插值堵塞。消除冗余使用预插条插值块提高了模型的代码效率。

模型变压器识别何时包含多个使用预插条插值that:

  • Have the same input signals connected to Prelookup blocks with the same index and fraction parameters

  • Have the output signals connected to the sameswitch堵塞

  • 具有相同的断点规范,值和数据类型

  • 具有相同的算法参数

  • Have the same data type for fraction parameters

模型变压器应用程序如果属性使用预插条插值块是相同的Table data

运行此转换后,Resulttable displays the identified blocks, their algorithm parameters, and the model, libraries, and referenced models. Select the blocks you want to transform, then click运行此检查

For an example about the transformation, see通过使用预插块合并多个插值来提高代码效率。For more information about Interpolation Using Prelookup blocks, seeUsing the Prelookup and Interpolation Blocks