Edge Detect
Logic检测输入信号中的突变或边沿。能够检测上升沿(输入信号向上穿越阈值)、下降沿(输入信号向下穿越阈值)或任意边沿跳变。
数学模型
首个采样点:所有模式下 y[0] = 0。
输入与输出
| Direction | ID | Label | 类型 | Status |
|---|---|---|---|---|
| → In | in |
In | number | Required |
| ← Out | out |
Out | boolean | Output |
参数
| 参数 | Label | 类型 | 默认值 | 描述 |
|---|---|---|---|---|
mode |
Detection Mode | select | rising |
|
threshold |
Threshold | number | 0.5 |
Signal level separating low from high. An edge is a crossing of this level; move it outside the noise band to avoid spurious edges. |
initialState |
Initial State | number | 0 |
使用示例
- 事件触发:当控制信号从 0 跳变至 1 时,触发积分器复位或启动计时器。
- 脉冲计数:配合离散累加器使用,对机械转速脉冲或传感器事件计数。
说明与最佳实践
- 脉冲宽度:每检测到一个边沿,输出严格在一个仿真时间步长内保持高电平(1)。
- 首个采样点:在第一个时间步上始终输出 0(因为没有可对比的前序历史数据)。
- 噪声敏感性:边沿检测对方块输入的变化极为敏感;在执行边沿检测前建议对含噪信号进行低通滤波。
- 上升沿与下降沿:使用
rising捕获正向阈值跳变,使用falling捕获负向阈值跌落。 - Either 模式:双向检测任何跳变;非常适合作为状态改变时的通用触发器。
相关模块
- Comparator:基于阈值的信号比较
- IntervalTest:区间范围检测