减少块
描述
通过折叠或删除块组来减少执行时间。
类别:Simulation Target
设置
默认:On
- On
-
万博1manbetx®软件搜索并减少了这些块模式:
冗余类型转换- 不必要的类型转换块,例如
int
type conversion block with an input and output of typeint
Dead code-块or signals in an unused code path
Fast-to-slow费率转换单任务系统中的块-费率转换blocks with an input frequency faster than its output frequency
- 离开
-
万博1manbetxSimulink软件不会搜索可以优化的块模式。仿真和生成的代码未优化。
提示
什么时候you select减少块,S万博1manbetximulink软件将某些块组折叠成单个,更有效的块或完全将其删除。这种减少导致模型仿真和生成代码中的执行速度更快。
块减少不会改变源模型的外观。
Tunable parameters do not prevent a block from being reduced by dead code elimination.
Once block reduction takes place, Simulink software does not display the sorted order for blocks that have been removed.
您可以通过查询该模型中的编程确定哪些块减少了哪些块
减少了nonvirtualblocklist
模型的参数以获得还原块的块把手的向量。还原blockhandlesvector = get_param(型号名称,“减少nonvirtualblocklist”);
如果你有万博1manbetxSimulink编码器™license, block reduction is intended to remove only the generated code that represents execution of a block. Other supporting data, such as definitions for sample time and data types might remain in the generated code.
消除死亡代码
Any blocks or signals in an未使用的代码路径are eliminated from generated code.
需要满足以下条件才能将块视为未使用的代码路径的一部分:
块端的所有信号路径都带有一个不执行的块。不执行的块的示例包括终结者块,禁用断言blocks,S功能blocks configured for block reduction, and到工作区blocks when MAT-file logging is disabled for code generation.
该块的没有信号路径包括块下游的全局信号存储。
Tunable parameters do not prevent a block from being reduced by dead code elimination.
考虑以下框图中的信号路径。
如果您检查减少块,,,,万博1manbetxSimulink编码器software responds to each signal path as follows:
对于信号路径... 万博1manbetxSimulink编码器软件... in1至out1 生成代码,因为未满足死亡代码消除条件。 in2 to终止器 由于满足死亡代码的消除条件,因此不会生成代码。 in3范围 Generates code if MAT-file logging is enabled and eliminates code if MAT-file logging is disabled.
Highlight Reduced Blocks
什么时候减少块选择,您可以突出显示被删除的非虚拟块,以减少模型仿真和代码生成期间的执行时间。要突出此类块,在Simulink工具条上,请转到万博1manbetxDebug标签。来自信息叠加菜单,选择Reduced Blocks
。
笔记
如果没有减少的块可以突出显示,Reduced Blocks
选项被禁用。
较少的块在画布上突出显示。更新或模拟模型后,突出显示了在正常模拟过程中减少的块。构建模型后,突出显示了代码生成期间减少的块。
要删除突出显示,请单击在画布的右上角,或清除Reduced Blocks
selection from the信息叠加菜单。
Command-Line Information
Parameter:阻止 |
价值:'上' |'离开' |
默认:'上' |
推荐设置
应用 | Setting |
---|---|
调试 | 关闭模拟或开发期间 对生产代码的生成没有影响 |
可追溯性 | 离开 |
效率 | On |
安全预防措施 | No impact |
Related Topics
- 删除对计算结果没有影响的块的代码(万博1manbetxSimulink编码器)
- 消除生成代码中的死亡代码路径(万博1manbetxSimulink编码器)
- 基于时间的时间表(万博1manbetxSimulink编码器)
- 表现(万博1manbetxSimulink编码器)
- Model Configuration Parameters: Simulation Target