Ramp
SourcesRamp 方块生成一个线性增加(或减小)的斜坡信号,该信号从设定的起始时间开始,并以恒定的斜率速率发生变化。该方块常用于生成电机的软启动控制曲线、测试控制系统的斜坡跟踪稳态误差,以及模拟物理控制输入量的渐变过程。
数学模型
Ramp 方块实现如下数学模型:
其中:
- 为当前仿真时间
- 为起始时间前的初始输出值(
initialValue) - 为斜坡开始变化的时间点(
startTime) - 为每秒的变化速率/斜率(
slope)
输入与输出
| Direction | ID | Label | 类型 | Status |
|---|---|---|---|---|
| → In | trigger |
Trigger | number | Optional |
| ← Out | out |
Output | number | Output |
参数
| 参数 | Label | 类型 | 默认值 | 描述 |
|---|---|---|---|---|
slope |
Slope | number | 1 |
|
startTime |
Start Time | number | 0 |
|
initialValue |
Initial Value | number | 0 |
|
finalValue |
Final Value | number | 10 |
Maximum output value when Enable Final Value is true |
enableFinalValue |
Enable Final Value | boolean | false |
When enabled, the ramp will stop at the Final Value |
使用示例
单位斜坡 (Unit Ramp)
从 开始生成 的单位线性增长信号:
Ramp (slope: 1, startTime: 0) → 系统模型 → Scope
压力缓慢上升
模拟从第 2 秒起,系统压力以每秒 0.5 bar 的速度线性增压:
Ramp (slope: 0.5, startTime: 2, initialValue: 0) → 压力调节器说明与最佳实践
- 跟踪误差测试: 斜坡信号的导数为阶跃信号,是用于评估 1 型和 2 型控制系统速度稳态误差()的标准测试输入。
- 无限增长注意: 若未开启
enableFinalValue,输出将随着仿真时间无限线性增长,除非后续连接了限幅方块(如 Saturation)。 - WASM 性能: 原生 WebAssembly 极致执行效率,保证高精度数值跟踪。
相关模块
- Step: 用于阶跃瞬态变化信号
- Constant: 用于静态恒定信号源
- Integrator: 对常数输入进行积分同样可生成斜坡
- RateLimiter: 对任意信号施加变化率限制