BlockWerk 文档
📈

Scope

Sinks

uPlotDisplay 方块是一个超高性能、交互式的实时信号曲线绘制组件,可直接嵌入仿真原理图画布中进行可视化分析。它依托轻量级 uPlot 图表渲染引擎,能够在浏览器中无延迟、极其流畅地实时呈现数十万甚至上百万个离散数据采样点。

该方块作为数据接收端(Sink),支持在其输入端口上同时接入多路时变信号,以便在同一图表中直接进行动态对比。

在 BlockWerk 中仿真

浏览器即开即用的交互式仿真环境 — 无需安装,由 WebAssembly 强力驱动。

在 BlockWerk 中仿真 →

数学模型

y(t)=可视化呈现 u1(t),u2(t),…,un(t)y(t) = \text{可视化呈现 } u_1(t), u_2(t), \dots, u_n(t)

输入与输出

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 时,底层算法将自动对视口数据进行动态降采样抽稀,避免占用过多内存。

相关模块