Slider
SourcesThe Slider block provides an interactive on-canvas graphical fader control that allows users to adjust signals or project variables live during a simulation run. Dragging the slider knob updates the output value in real time, automatically pacing the simulation to real-time wall-clock execution so the system responds immediately to user manipulation. The block can operate as a standard physical signal source or can directly drive global project variables (such as PID controller gains or physical plant mass) without requiring explicit signal wiring across the diagram.
Mathematical Model
The continuous output signal corresponds to the user-selected slider position , clamped within the defined range and quantized to the resolution step :
where , , , and:
When variable is non-empty (), the block simultaneously updates the shared global project parameter:
allowing all blocks referencing {{V_name}} to dynamically inherit the updated numerical value on the subsequent simulation step.
Inputs & Outputs
| Direction | ID | Label | Type | Status |
|---|---|---|---|---|
| ← Out | out |
Value | number | Output |
Parameters
| Parameters | Label | Type | Default | Description |
|---|---|---|---|---|
value |
Value | number | 0 |
Current slider value โ drag the on-canvas slider or edit here |
minValue |
Min | number | -1 |
|
maxValue |
Max | number | 1 |
|
step |
Step | number | 0.01 |
|
label |
Label | string | |
|
variable |
Drives Variable | string | |
Variable this slider sets live; parameters that use it follow. Empty: signal only. |
Usage Examples
Example 1: Real-Time Human Setpoint Steering for Speed Control
Using a Slider to provide interactive target speed commands to a servomotor. Configuring minValue = 0.0, maxValue = 3000.0, step = 10.0, and label = "Speed (RPM)". Dragging the slider handle live while observing the response on a uPlotDisplay allows dynamic evaluation of motor tracking delay and overshoot.
Example 2: Wireless Interactive Tuning of Controller Gain
Tuning a PID controller gain live in an embedded interactive showcase without cluttering the canvas with wires. Setting minValue = 0.1, maxValue = 20.0, step = 0.1, label = "Proportional Gain", and variable = "Kp". Inside the PIDController block, setting parameter kp to {{Kp}} binds the gain directly to the slider position.
Remarks & Best Practices
- Automatic Real-Time Pacing: Inserting an interactive Slider block automatically synchronizes the simulation engine to real-time wall-clock pacing (1 second of simulation time equals 1 second of wall-clock time), ensuring smooth interactive user control.
- Undo Integration: Releasing the mouse handle after a drag gesture automatically registers a single consolidated undo state in the platform history stack.
- Boundary Clamping: Output values are strictly clamped to even if an out-of-range value is entered manually in the inspector.
- Embedded Showcase Ready: Fully responsive inside zero-knowledge shared links and embedded interactive iframe demonstrations.
Related Components
- Joystick2D: Two-axis interactive joystick for simultaneous 2D XY steering.
- KeyboardInput: Steers simulation signals live via arrow or WASD keyboard keys.
- Constant: Fixed, non-interactive scalar value source.
- PIDController: Closed-loop controller frequently tuned interactively via sliders.