Enable
将使能端口添加到子系统或模型

库:
Simulink /
Ports & Subsystems
HDL Coder /
Ports & Subsystems
描述
Enable 模块允许外部信号控制子系统或模型的执行。要启用此功能,可在 Subsystem 模块中添加该模块,或在 Model 模块所引用模型的根级别添加该模块。
如果在模型的根级别使用使能端口:
对于多速率模型,请将求解器设置为单任务。
对于具有定步长的模型,模型中有至少一个模块必须以指定的定步长速率运行。
示例
使用使能子系统实现控制算法
此示例显示如何使用启用的子系统来实现基于二进制逻辑信号的控制算法。当二进制信号具有值时,启用的子系统执行并实现控制算法。在这个示例中,超扭转控制算法用于稳定不稳定的动态系统。超扭转算法是一种众所周知的滑模控制技术,具有鲁棒性好的特点。
Control Block States and Output of Enabled Subsystem
Reset or hold states of blocks inside an Enabled Subsystem block when the subsystem is disabled and how to control the subsystem output. In this example, you see four different combinations of state and output value configurations for both discrete and continuous control signals. When the enabled subsystem is disabled, the combinations work as follows:
Counters Using Conditionally Executed Subsystems
Implement counters using Enabled and Triggered subsystems. In this example, the model sldemo_counters
controls flow of water into a tank and uses a counter to count the number of times overflow occurs, where overflow occurs when the water level in the tank is 8 meters or more for 30 seconds or more.
Building a Clutch Lock-Up Model
Use Simulink® to model and simulate a rotating clutch system. Although modeling a clutch system is difficult because of topological changes in the system dynamics during lockup, this example shows how enabled subsystem can easily handle such problems. We illustrate how to employ important Simulink modeling concepts in the creation of the clutch simulation. Designers can apply these concepts to many models with strong discontinuities and constraints that may change dynamically.
端口
输出
使能信号从外部连接到 Enabled Subsystem 模块的外部,并传递到子系统的内部。当您选择显示输出端口参数时,使能信号端口将添加到 Enable 模块。
数据类型: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| Boolean
| fixed point
| expression
参数
对于处于禁用状态的 Subsystem 模块或 Model 模块,选择在激活这些模块时其所含模块的状态变化情况。
- 保持
按其先前值保持模块状态。
- 重置
将模块状态重置为其初始条件(如果未定义,则为零)。
编程用法
模块参数:StatesWhenEnabling |
类型:字符向量 |
值:'held' | 'reset' |
默认值:'held' |
选择何时传播可变大小信号。
- 仅在启用时
当重新启用包含 Enable 端口模块的 Subsystem 模块或 Model 模块时,传播可变大小的信号。如果您选择此选项,采样时间必须为周期性采样时间。
- 执行期间
在每个时间步传播可变大小的信号。
编程用法
模块参数:PropagateVarSize |
类型:字符向量 |
值:'Only when enabling' | 'During execution' |
默认值:'Only when enabling' |
输出端口将 Enabled Subsystem 模块或激活的 Model 模块的外接使能信号传递到内部。
- off
在 Enable 端口模块上删除输出端口。
- on
在 Enable 端口模块上显示输出端口。选择此选项将允许子系统或模型处理使能信号。
编程用法
模块参数:ShowOutputPort |
类型:字符向量 |
值:'off' | 'on' |
默认值:'off' |
控制模型的过零检测。
- on
检测过零点。
- off
不检测过零点。
编程用法
模块参数:ZeroCross |
类型:字符向量 |
值:'on' | 'off' |
默认值:'on' |
指定从外部连接到 Model 模块并传递到模块内部的使能信号的维度。
1
标量信号。
[n]
宽度为
n
的向量信号。[m n]
具有
m
行和n
列的矩阵信号。
编程用法
模块参数:PortDimensions |
类型:字符向量 |
值:'1' | '[n]' | '[m n]' |
默认值:'1' |
指定模块方法执行之间的时间间隔。请参阅指定采样时间。
-1
从模型继承采样时间。
Ts
标量,其中 Ts 是时间间隔。
[Ts, To]
向量,其中 Ts 是时间间隔,To 是初始时间偏移量。
编程用法
模块参数:SampleTime |
类型:字符向量 |
值:'-1' | 'Ts' | '[Ts, To]' |
默认值:'-1' |
指定从外部连接到 Model 模块并传递到模块内部的使能信号的最小值。
Simulink® 使用此值来执行:
仿真范围检查。请参阅指定信号范围。
定点数据类型的自动定标。
所生成代码的优化。此优化可删除算法代码,并影响某些仿真模式(如 SIL 或外部模式)的结果。请参阅Optimize using the specified minimum and maximum values (Embedded Coder)。
[]
不指定最小值。
- 实数标量
实数双精度标量值。
编程用法
模块参数:OutMin |
类型:字符向量 |
值:'[]' | 用引号引起来的实数标量 |
默认值:'[]' |
指定从外部连接到 Model 模块并传递到模块内部的使能信号的最大值。
Simulink 使用此值来执行:
仿真范围检查。请参阅指定信号范围。
定点数据类型的自动定标。
所生成代码的优化。此优化可删除算法代码,并影响某些仿真模式(如 SIL 或外部模式)的结果。请参阅Optimize using the specified minimum and maximum values (Embedded Coder)。
[]
不指定最大值。
- 实数标量
实数双精度标量值。
编程用法
模块参数:OutMax |
类型:字符向量 |
值:'[]' | 用引号引起来的实数标量 |
默认值:'[]' |
指定从外部连接到 Model 模块并传递到模块内部的使能信号的数据类型。
- double
双精度浮点。
- single
单精度浮点。
- int8
有符号 8 位整数。
- uint8
无符号 8 位整数。
- int16
有符号 16 位整数。
- uint16
无符号 16 位整数。
- int32
有符号 32 位整数。
- uint32
无符号 32 位整数。
- int64
有符号 64 位整数。
- uint64
无符号 64 位整数。
- boolean
值为
true
或false
的布尔值。- fixdt(1,16)
未定义二进制小数点位置的有符号 16 位定点数。
- fixdt(1,16,0)
二进制小数点位置设置为零的有符号 16 位定点数。
- fixdt(1,16,2^,0)
斜率设置为
2^0
且偏置设置为0
的有符号 16 位定点数。- <数据类型表达式>
数据类型对象,例如
Simulink.NumericType
。您不能以数据类型表达式的形式输入Simulink.Bus
对象的名称。
编程用法
模块参数:OutDataTypeStr |
类型:字符向量 |
值:'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'int64' | 'uint64' | 'boolean' | '<fixdt(1,16)' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)' | '<data type expression>' |
默认值:'double' |
选择数据类型类别并显示下拉列表以帮助您定义数据类型。
- 内置
显示数据类型和“数据类型覆盖”的下拉列表。
- 定点
显示“符号性”、“定标”和“数据类型覆盖”的下拉列表。
- 表达式
显示用于输入表达式的框。
依赖关系
要启用此参数,请选择“显示数据类型助手”按钮。
编程用法
没有等效的命令行参数。
指定从工作区加载数据时缺失的工作区数据的值。
- on
在不存在对应工作区数据的时间步上对输出进行线性插值。
- off
不在时间步处进行输出插值。取存在数据的最近时间步上的输出作为当前输出。
编程用法
模块参数:Interpolate |
类型:字符向量 |
值:'on' | 'off' |
默认值:'on' |
模块特性
数据类型 |
|
直接馈通 |
|
多维信号 |
|
可变大小信号 |
|
过零检测 |
|
扩展功能
C/C++ 代码生成
使用 Simulink® Coder™ 生成 C 代码和 C++ 代码。
HDL Coder™ 提供影响 HDL 实现和综合逻辑的额外配置选项。
有关详细信息,请参阅 Enabled Subsystem 中的 HDL 代码生成。
此模块具有一个默认 HDL 架构。
PLC 代码生成
使用 Simulink® PLC Coder™ 生成结构化文本代码。
定点转换
使用 Fixed-Point Designer™ 设计和仿真定点系统。
版本历史记录
在 R2006a 之前推出
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)