Skip to content

04 Emulation

Mark Todd edited this page Jun 25, 2026 · 1 revision

Emulation

MQTTProbe includes a built-in Sparkplug B emulator that lets you explore the app without any external MQTT clients. It generates realistic Sparkplug B traffic with configurable nodes, devices, and metrics.

Getting Started

  1. Connect to any MQTT broker (including the optional Mosquitto broker in Docker)
  2. Open the Emulation panel
  3. Add a node with devices and metrics
  4. Click Start to begin publishing

Emulator Types

Sparkplug B Emulator

Creates a fully compliant Sparkplug B node with its own MQTT connection:

  • Publishes NBIRTH with all metric definitions and aliases
  • Publishes DBIRTH for each device
  • Continuously publishes NDATA and DDATA with generated values
  • Sends NDEATH when stopped
  • Includes health metrics (CPU, heap, threads, uptime, publish cycles) as node-level metrics

Generic Emulator

Publishes simple messages through the shared MQTT connection:

  • Supports JSON, Plain Text, and Hex payload formats
  • Uses a configurable topic template
  • No MQTT connection overhead — good for testing basic pub/sub

Node Configuration

Node Settings

Setting Description
Type SparkplugB or Generic
Group ID Sparkplug B group identifier
Node ID Sparkplug B node identifier
Payload Format (Generic only) Json, PlainText, or Hex
Topic Template (Generic only) Topic with {metric} placeholder

Device Settings

Setting Description
Device ID Unique device identifier within the node

Metric Settings

Setting Description
Name Metric name
Value Type Double, Int64, or Boolean
Waveform Signal generation pattern (see below)

Waveform Types

Waveform Description Key Settings
Sine Smooth sinusoidal wave Min, Max, Period
Ramp Linear ramp between Min and Max Min, Max, Period
Random Walk Gradual random drift Min, Max, Step Amplitude
Constant Fixed value Constant Value
Fixed Boolean Always true or always false Boolean Value
Toggle Alternates true/false each cycle
Random Boolean Random true/false True Probability (0-1)

Publish Interval

The publish interval controls how often each node publishes data. The minimum interval is 50ms.

Throughput Warning

When the projected message rate exceeds 200 messages/second, a high-throughput warning is displayed. The rate is calculated based on:

  • Sparkplug B: 1 (node metrics) + devices-with-metrics per tick
  • Generic JSON: devices-with-metrics per tick
  • Generic PlainText/Hex: individual metric count per tick

Managing Emulator State

Add a Node

Click Add Node to create a new emulator node with default settings. You can then edit it to add devices and metrics.

Duplicate a Node

You can duplicate an existing node to quickly create multiple similar emulators.

Remove Nodes

  • Remove individual nodes with the delete button
  • Click Remove All to clear all emulator nodes

Persistence

Emulator configurations are saved to config/appsettings.json and restored when you reconnect.

Auto-Stop

The emulator automatically stops when the main MQTT client disconnects. This prevents orphaned emulation traffic.

Example: Sparkplug B Node

To emulate a Sparkplug B temperature sensor:

  1. Add Node: Type = SparkplugB, Group ID = Sparkplugs, Node ID = SensorNode1
  2. Add Device: Device ID = TemperatureSensor
  3. Add Metric: Name = Temperature, Value Type = Double, Waveform = Sine, Min = 60, Max = 80, Period = 10
  4. Start the emulator

You'll see NBIRTH, DBIRTH, and NDATA messages appear in the MQTTProbe message browser, and the Sparkplug Nodes view will show your emulated node with live temperature data.

Clone this wiki locally