Signal Generator
uniflow.plugin.signalgenerator
•
Category: Simulator / Logic
•
Version: v1.3.0
•
Min Uniflow Version: Uniflow ≥ v1.4.0
Signal Generator Plugin Reference Manual
1. Overview
Plugin Name: Signal Generator
Type: Simulator / Logic
Identifier: uniflow.plugin.signalgenerator
Description
Generates synthetic signals, waveforms, state transitions, and pulse triggers for device simulation and rule testing.
2. Technical Architecture
The Signal Generator plugin implements a high-precision synthetic signal calculation engine. It uses high-resolution background timers to evaluate mathematical waveform algorithms (Sine, Square, Triangle, Sawtooth, Pulse, and Gaussian Random Noise), applying configurable time scaling, phase offsets, and amplitude bounds to publish simulated telemetry values into the Uniflow catalog.
System Interaction & Exposed Catalog Routes
The Signal Generator plugin generates synthetic mathematical waveforms (Sine, Cosine, Square, Triangle, Sawtooth, Ramp, Random Noise). It provides sample telemetry streams at configurable frequencies for testing rule pipelines.
Catalog Routes & Node Integration
Input Event Triggers (Input Nodes):
signal.sample_generated - Emitted on waveform sample generation.signal.waveform_period_completed - Emitted when a full signal period finishes.Executable Actions (Action Nodes):
signal.set_frequency - Configures generator frequency (Hz).signal.set_amplitude - Adjusts waveform amplitude.signal.set_waveform_type - Switches signal wave function.signal.toggle_generator - Starts or pauses signal generation.Architecture Diagram
3. Configuration Parameters
The Signal Generator plugin configuration is divided into Global Source Settings (controlling engine tick rates and global time scaling) and Signal Point Configurations (defining individual synthetic signal channels and their mathematical wave parameters).
3.1 Global Source Settings
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| Base Tick Interval (ms) signal.baseIntervalMs | |||
| ↳ | 100 | Defines the background generation tick loop interval in milliseconds (default 100 ms = 10 Hz sample rate). Controls update frequency for all points under this source. | |
| Time Scale Multiplier signal.timeScale | |||
| ↳ | 1.0 | Real-time simulation clock speed multiplier. For example, setting 2.0 doubles the speed of all wave frequencies, ramp durations, and timers. | |
| Auto Start Engine signal.autoStart | |||
| ↳ | true | When true, background signal generation starts automatically on source initialization. When false, the engine remains paused until triggered. | |
3.2 Signal Point Common Attributes
Every signal point configured within a Signal Generator source defines the following core properties:
Signals/Point1).SourceValueType): Data type emitted (Double, Int32, Int64, Bool, String, Json, DateTimeOffset).GeneratorType): Selection of the signal generation algorithm.3.3 Generation Types & Parameter Reference
Below is a detailed breakdown of all 13 supported signal generation algorithms, explaining the displayed UI configuration parameters, their mathematical operation, and how they influence the generated output.
1. Sine Wave (SineWave)
Generates smooth, continuous harmonic oscillations according to a sinusoidal wave equation.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| Amplitude Amplitude | |||
| ↳ | 10.0 | Peak wave excursion above and below the offset line. Higher values increase wave height. | |
| Frequency (Hz) FrequencyHz | |||
| ↳ | 0.1 | Number of complete sine wave cycles per second. | |
| Offset Offset | |||
| ↳ | 20.0 | Vertical DC bias added to the wave center line. | |
| Phase (Degrees) PhaseDegrees | |||
| ↳ | 0.0 | Initial phase angle shift (0° to 360°). | |
| Noise Level NoiseLevel | |||
| ↳ | 0.0 | Standard deviation of additive Gaussian noise layered onto the sine signal. | |
2. Square Wave (SquareWave)
Generates bi-level switching pulses alternating between HIGH and LOW output states.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| High Value HighValue | |||
| ↳ | 1.0 | Signal output value during the HIGH state. | |
| Low Value LowValue | |||
| ↳ | 0.0 | Signal output value during the LOW state. | |
| Frequency (Hz) FrequencyHz | |||
| ↳ | 0.5 | Oscillation frequency in Hertz (T = 1 / FrequencyHz). | |
| Duty Cycle (%) DutyCyclePct | |||
| ↳ | 50.0 | Percentage of period T spent in the HIGH state (1% to 99%). | |
| Phase (Degrees) PhaseDegrees | |||
| ↳ | 0.0 | Time offset phase shift in degrees. | |
Evaluates whether the normalized time within the period is less than the active duty cycle duration. When OutputType is set to Bool, outputs true (HIGH) or false (LOW); otherwise emits HighValue or LowValue.
3. Triangle Wave (TriangleWave)
Generates symmetric linear rise and fall sweeps between configured bounds.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| Min Value MinValue | |||
| ↳ | 0.0 | Lower floor bound at the bottom peak. | |
| Max Value MaxValue | |||
| ↳ | 100.0 | Upper ceiling bound at the top peak. | |
| Frequency (Hz) FrequencyHz | |||
| ↳ | 0.1 | Cycle repetition frequency in Hertz. | |
| Symmetry (%) SymmetryPct | |||
| ↳ | 50.0 | Percentage of period spent ramping up (50% yields equal rising/falling slopes). | |
Ramps linearly from MinValue to MaxValue over T · (SymmetryPct / 100), then ramps linearly back down to MinValue.
4. Sawtooth Wave (SawtoothWave)
Generates asymmetric ramp signals that rise linearly and drop instantly upon cycle completion.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| Min Value MinValue | |||
| ↳ | 0.0 | Ramp starting floor value. | |
| Max Value MaxValue | |||
| ↳ | 100.0 | Peak ramp value prior to reset. | |
| Frequency (Hz) FrequencyHz | |||
| ↳ | 0.1 | Ramp repetition frequency in Hertz. | |
Equivalent to a Triangle Wave with SymmetryPct = 100%. Linearly increases from MinValue to MaxValue over period T, then resets instantly to MinValue.
5. Step Wave (StepWave)
Generates discrete staircase steps with configurable step counts, duration, and reset behaviors.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| Start Value StartValue | |||
| ↳ | 0.0 | Initial baseline value at step 0. | |
| Step Delta StepDelta | |||
| ↳ | 5.0 | Value increment added at each step. | |
| Steps Count StepsCount | |||
| ↳ | 5 | Total number of discrete steps in a full cycle. | |
| Step Duration (ms) StepDurationMs | |||
| ↳ | 1000 | Dwell time in milliseconds at each step. | |
| Reset Mode ResetMode | |||
| ↳ | "ResetToStart" | Wrap-around strategy ("ResetToStart", "Bounce", or "HoldMax"). | |
Calculates step index S = ⌊ (t · 1000) / StepDurationMs ⌋. Under "ResetToStart", wraps back to 0; under "Bounce", steps back down; under "HoldMax", holds at maximum. Output is StartValue + Seffective · StepDelta.
6. Trapezoidal Profile (TrapezoidalProfile)
Generates a 4-phase motion profile consisting of acceleration (ramp up), steady state (hold), deceleration (ramp down), and idle rest.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| Idle Value IdleValue | |||
| ↳ | 0.0 | Baseline value during the rest state. | |
| Target Value TargetValue | |||
| ↳ | 100.0 | Peak plateau value during the hold phase. | |
| Ramp Up (ms) RampUpMs | |||
| ↳ | 2000 | Duration in ms to accelerate linearly from IdleValue to TargetValue. | |
| Hold (ms) HoldMs | |||
| ↳ | 5000 | Duration in ms held at TargetValue. | |
| Ramp Down (ms) RampDownMs | |||
| ↳ | 2000 | Duration in ms to decelerate linearly from TargetValue to IdleValue. | |
| Rest (ms) RestMs | |||
| ↳ | 3000 | Dwell duration in ms held at IdleValue before starting the next cycle. | |
Executes a total cycle of duration Tcycle = RampUp + Hold + RampDown + Rest, providing continuous piecewise linear output.
7. White Noise (WhiteNoise)
Generates random noise values using either Gaussian (Normal) or Uniform probability distribution models.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| Distribution Distribution | |||
| ↳ | "Gaussian" | Statistical distribution model ("Gaussian" or "Uniform"). | |
| Mean Mean | |||
| ↳ | 50.0 | Expected central mean value for Gaussian distribution. | |
| StdDev StdDev | |||
| ↳ | 5.0 | Standard deviation/spread for Gaussian distribution. | |
| Min Value MinValue | |||
| ↳ | 0.0 | Lower clamp limit (or minimum range for Uniform). | |
| Max Value MaxValue | |||
| ↳ | 100.0 | Upper clamp limit (or maximum range for Uniform). | |
Uniform distribution selects uniformly within [MinValue, MaxValue]. Gaussian distribution samples 𝒩(Mean, StdDev) using Box-Muller transformation and clamps result to [MinValue, MaxValue].
8. Random Walk (RandomWalk)
Generates bounded stochastic drift (Brownian motion) with optional directional trend bias.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| Initial Value InitialValue | |||
| ↳ | 25.0 | Starting value at engine initialization. | |
| Max Step Delta MaxStepDelta | |||
| ↳ | 0.5 | Maximum random step change magnitude per evaluation tick. | |
| Drift Factor DriftFactor | |||
| ↳ | 0.0 | Constant directional trend bias per step (positive = upward drift, negative = downward drift). | |
| Min Value MinValue | |||
| ↳ | 0.0 | Hard lower boundary clamp. | |
| Max Value MaxValue | |||
| ↳ | 100.0 | Hard upper boundary clamp. | |
Performs stateful step integration: Vn+1 = Clamp(Vn + Rand(-1, 1) · MaxStepDelta + DriftFactor, MinValue, MaxValue).
9. Heartbeat Pulse (HeartbeatPulse)
Generates periodic short pulse triggers for liveness monitoring and watchdog simulation.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| Interval (ms) IntervalMs | |||
| ↳ | 1000 | Repeat interval between pulse triggers in milliseconds. | |
| Pulse Width (ms) PulseWidthMs | |||
| ↳ | 100 | Duration of active pulse HIGH state in milliseconds. | |
| Emit As Trigger EmitAsTrigger | |||
| ↳ | false | When true, outputs boolean true/false trigger states. | |
Evaluates (t · 1000) ±od{IntervalMs} < PulseWidthMs. Emits HIGH state (1.0 or true) during active pulse width and LOW (0.0 or false) during off interval.
10. Anomaly Spike (AnomalySpike)
Generates baseline telemetry with stochastic transient spike anomalies for anomaly detection testing.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| Baseline Value BaselineValue | |||
| ↳ | 22.0 | Normal steady-state operating value. | |
| Spike Probability (%) SpikeProbabilityPct | |||
| ↳ | 5.0 | Percentage probability (0% to 100%) of triggering an anomaly spike per tick. | |
| Spike Magnitude SpikeMagnitude | |||
| ↳ | 50.0 | Value offset added to BaselineValue during a spike event. | |
| Spike Duration (ms) SpikeDurationMs | |||
| ↳ | 500 | Duration in milliseconds that an active spike persists. | |
Normally outputs BaselineValue. Upon random spike trigger, enters anomaly state and outputs BaselineValue + SpikeMagnitude for SpikeDurationMs before reverting to baseline.
11. State Machine (StateMachine)
Generates state transition outputs based on a configurable sequence of states and dwell durations.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| States JSON StatesJson | |||
| ↳ | 4-state loop | JSON array defining objects with Id, Name, Value, and DwellTimeMs (Stopped [3s] → Starting [2s] → Running [10s] → Fault [4s]). | |
Sequentially steps through state definitions. Outputs numeric state ID (for Int32/Double output types) or state Name (for String output type).
12. Sequence Player (SequencePlayer)
Plays back pre-recorded or user-defined arrays of values with optional interpolation and looping modes.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| Raw Sequence Data RawSequenceData | |||
| ↳ | "10,20,50,80,30" | Comma-separated sequence of values. | |
| Sample Interval (ms) SampleIntervalMs | |||
| ↳ | 1000 | Dwell duration in milliseconds per step. | |
| Play Mode PlayMode | |||
| ↳ | "Loop" | Playback mode ("Loop", "PingPong", or "OneShot"). | |
| Interpolation Interpolation | |||
| ↳ | "Step" | Transition mode ("Step" for immediate jump, "Linear" for smooth linear interpolation). | |
Steps through sequence items. In "Linear" mode with numeric data, smoothly interpolates values between step boundaries over SampleIntervalMs.
13. JSON Template (JsonTemplate)
Generates dynamic structured JSON payloads populated with real-time timestamps, engine ticks, random values, or cross-referenced catalog fields.
| Setting Name | Code Parameter | Default | Description |
|---|---|---|---|
| Template Text TemplateText | |||
| ↳ | Payload pattern | JSON template string containing dynamic replacement tokens (e.g. {"deviceId": "SIM-01", "timestamp": "{TimeIso}", "value": {RandomDouble}}). | |
{TimeIso}: Replaced with current UTC timestamp in ISO-8601 format.{Tick}: Replaced with total background tick count.{RandomDouble}: Replaced with a random double value (0.00 to 100.00).{Catalog/Node/Path}: Replaced with live values from any catalog node path.Evaluates all token macros on each tick and emits a formatted JSON string payload (SourceValueType.Json).
4. Exposed Routes & Data Types
This plugin exposes catalog fields across the following rule graph nodes:
Input Source
The Input Source node reads generated synthetic signal values and engine control state.
| Human-Readable Field Name | Data Type | Description |
|---|---|---|
| Configured Signal Waveform Double` / `Int32` / `Bool` / `String | ||
| ↳ | Live synthetic value emitted by configured signal algorithm (Sine, Square, Triangle, Sawtooth, Pulse, Noise). | |
| Generator Enabled Bool | ||
| ↳ | Flag indicating whether the background signal generation clock is active (True) or paused (False). | |
| Time Scale Multiplier Double | ||
| ↳ | Current time scale frequency multiplier. | |
Output Target
The Output Target node acts as an action sink node to control generator execution and reset internal wave clocks.
| Target Name | Data Type | Associated Parameters | Parameter Data Type | Required | Description |
|---|---|---|---|---|---|
| Generator Enabled Bool | |||||
| ↳ | Value | Bool | True | Set generator running state (True to start, False to pause). | |
| Time Scale Multiplier Double | |||||
| ↳ | Value | Double | True | Adjust execution frequency time scale speed. | |
| Reset Generator Clock Bool | |||||
| ↳ | Value | Bool | True | Command action sink to reset wave phase calculation and internal tick counter back to zero. | |
5. Usage Examples
Scenario A: Synthetic Sine Wave Telemetry Mirrors to Modbus Holding Register & Publishes to MQTT
Workflow Overview:
For testing automated control loops without hardware, a Signal Generator source generates a synthetic 0-100°C Sine Wave (Configured Signal Waveform). Uniflow samples the waveform at 1 Hz and executes two parallel target writes:
1. Mirrors the simulated float value into Modbus TCP HoldingRegister 200.
2. Publishes the telemetry JSON payload to MQTT topic telemetry/simulated/temperature.
Rule Node Configuration:
1. Input Source Node: Signal Generator Poller
SineConfigured Signal Waveform (Double)2. Logic Pass-Through Node: Value Scale / Formatter
SimulatedTemp (Double)3. Output Target Node A: Modbus Client Writer
Direct AccessType: Holding RegisterAddress: 200Value: SimulatedTemp4. Output Target Node B: MQTT Client Action
Publish Message (mqtt.publish_message)Topic: telemetry/simulated/temperaturePayload: {"temperature": ${SimulatedTemp}}Logic Flow Diagram:
Scenario B: High-Temperature Emergency Event Pauses Signal Generator Simulation Clock
Workflow Overview:
When an actual Modbus boiler alarm fires (HoldingRegister 101 > 90.0°C), Uniflow issues a command to pause the simulation engine (Generator Enabled = False) to prevent synthetic data interference during physical emergency conditions.
Rule Node Configuration:
1. Input Source Node: Modbus Client Poller
Holding Register101BoilerTemp (Double)2. Logic Condition Node: GreaterThan
BoilerTemp > 90.03. Output Target Node: Signal Generator Action
Generator Enabled (signal.toggle_generator)Value: False