Scope
SinksuPlotDisplay 方块是一个超高性能、交互式的实时信号曲线绘制组件,可直接嵌入仿真原理图画布中进行可视化分析。它依托轻量级 uPlot 图表渲染引擎,能够在浏览器中无延迟、极其流畅地实时呈现数十万甚至上百万个离散数据采样点。
该方块作为数据接收端(Sink),支持在其输入端口上同时接入多路时变信号,以便在同一图表中直接进行动态对比。
数学模型
输入与输出
| Direction | ID | Label | 类型 | Status |
|---|---|---|---|---|
| → In | signal |
Signal | number | Required |
参数
| 参数 | Label | 类型 | 默认值 | 描述 |
|---|---|---|---|---|
title |
Title | text | Signal Plot |
|
viewportMode |
Time window | select | expanding |
|
windowDuration |
Window duration (s) | number | 10 |
|
renderMode |
Update mode | select | timebased |
|
updateFrequencyHz |
Refresh rate (Hz) | number | 10 |
How often the plot updates visually when in Time-based mode. |
maxPoints |
Max display points | number | 500000 |
Limit the number of points drawn to prevent performance drops. |
useAutoY |
Auto-scale Y-axis | boolean | true |
Automatically adjust the Y-axis to fit all visible data. |
yMin |
Y-axis minimum | number | -1 |
|
yMax |
Y-axis maximum | number | 1 |
|
lineWidth |
Line width | number | 2.5 |
|
showGrid |
Show grid | boolean | true |
|
showLegend |
Show legend | boolean | false |
|
showPoints |
Show points | boolean | false |
|
showStatistics |
Show statistics | boolean | false |
Display min, max, and mean values. |
triggerEnabled |
Trigger | boolean | false |
Stabilise periodic waves by aligning the window to a level crossing (time-domain, rolling only). |
triggerSource |
Trigger source (signal index) | number | 0 |
Which input signal triggers (0 = first). |
triggerLevel |
Trigger level | number | 0 |
Amplitude threshold for the trigger crossing. |
triggerEdge |
Trigger edge | select | rising |
Detect crossings on the rising or falling edge. |
xyXChannel |
XY: X signal index | number | 0 |
In XY mode, which input signal is the X axis (0 = first). |
xyYChannel |
XY: Y signal index | number | 1 |
In XY mode, which input signal is the Y axis. |
使用示例
阶跃响应实时监测
将阶跃信号接入受控对象,直观实时监视控制回路的过渡过程与超调量:
Step → PIDController → 被控对象 → uPlotDisplay
李萨如相平面轨迹 (XY 模式)
将两个正交且存在相位差的正弦波进行 XY 轨迹绘制:
正弦信号 1 (X) ──┐
├── uPlotDisplay (renderMode: "xy")
正弦信号 2 (Y) ──┘说明与最佳实践
- 硬件渲染加速: 深度结合 Canvas2D / WebGL 硬件加速绘制。
- 长时间运行建议: 对于仿真时长较长的模型,强烈推荐采用定时刷新模式(
Time-based, 5–10 Hz),以保证前端 UI 操作丝滑顺畅。 - 动态降采样 (Downsampling): 当数据点数超过
maxPoints时,底层算法将自动对视口数据进行动态降采样抽稀,避免占用过多内存。
相关模块
- NumericDisplay: 用于实时观察当前瞬时数值的数显表头
- BodePlot: 频域波特图专用绘图分析工具
- SignalGenerator: 生成各类正弦与周期测试波形