The MQTTspB Simulator can be Started from the DataExplorer User interface, or running its executable directly with the proper command line parameters.
When running, it will create an MQTTspB Client that will connect to the configured Broker, publishing simulated data to mapped Topics. From the Broker point of view, the MQTTspB Simulator, will act as any other MQTT Client.
On this page:
The MQTTspB Simulator is integrate with the Data Explorer Tools.
We are releasing an MQTT Client simulator (with Sparkplug) to make testing easier and faster – testing for projects in general, testing for communication with the software platform MQTT Client, and for testing our new Dynamic Tag Provider functionality with MQTT.
Why struggle with multiple tools? With this simulator, you can easily publish 30k simulated values to the MQTT Broker – all from the same design environment.
This document has information on the MQTTspB Simulator configuration and Runtime Behavior.
Watch a video on how to use the MQTT Simulator with Tag Provider here. |
This simulator application comes with the default installation of product version 10. The executable file can be found under the ../fx-10/Protocols/MQTTspBSimulator.exe directory.
Make sure to execute the file from inside this folder to ensure all dependencies are satisfied.
The following features are supported:
The Simulator is Write-Only! You will not be able to subscribe to any topic; only publishing is allowed. |
When you click on the icon next to the command buttons, it opens the MQTTspB Simulator Configuration dialog. This configuration dialog has the following fields:
MQTTspB Simulator Configuration | |
---|---|
Broker URL | Specifies the IP address or domain name of the MQTT broker. For example, 127.0.0.1 indicates a local broker running on the same machine as the simulator. |
Broker Port | Indicates the port number used to connect to the MQTT broker. The default port for MQTT is 1883, which is specified here. |
Username | Allows to enter the username required for authentication with the MQTT broker. This is used to verify the identity of the client connecting to the broker. |
Password | Allows to enter the password required for authentication with the MQTT broker. This works in conjunction with the username to authenticate the client. |
GroupId | Specifies a unique identifier for a group of clients or devices. This can be used to manage and identify clients within a specific group. |
ConfigFile | Displays the path to the configuration file used by the simulator. This file contains the saved settings for the simulator, allowing for easy reconfiguration and management. |
Minimized | When checked, starts the simulator minimized. This can be useful for reducing screen clutter and running the simulator in the background. |
Block Configuration Field | When checked, prevents changes to the configuration fields once the simulator is running. This helps maintain consistency and prevents accidental modifications during operation. |
Connect On Startup | When checked, automatically connects the simulator to the MQTT broker upon startup. This is useful for ensuring that the simulator is always connected and ready to operate as soon as it is launched. |
Publish Data On Startup | When checked, enables the simulator to start publishing data immediately upon connecting to the broker. This automates the data publication process, ensuring that data starts flowing as soon as the connection is established. |
Refer to the MQTTspB Simulator for detailed information.
This configuration popup in the MQTTspB Simulator allows users to define and customize the data payload that the simulator will publish to the MQTT broker. Here is a detailed description and explanation of each section and its components:
NumberOfNodes: Specifies the number of nodes (or groups of devices) included in the data structure. Default value is set to 4, meaning there are four groups of devices.
Node List: Lists the node names. By default, the nodes are named "Barcelona," "Bilbao," "Madrid," and "Sevilha." Users can add or remove nodes using the add (+) and remove (–) buttons.
Device List: Lists the devices under the selected node. By default, the devices are named "Panel_1," "Panel_2," and "Panel_3." Users can add or remove devices using the add (+) and remove (–) buttons.
Tags Table: Defines the tags associated with each device. Each row represents a variable with the following columns:
Name: The name of the variable (e.g., "Name," "State," "Latitude," "Longitude").
Type: The data type of the variable (e.g., "String," "Boolean," "Double").
VariationFlag: Indicates whether the variable should vary over time. When checked, the variable's value will change according to the specified range.
Min: The minimum value of the variable when it varies.
Max: The maximum value of the variable when it varies.
InitialValue: The initial value assigned to the variable when the simulation starts.
The Simulation Control in the MQTTspB Simulator allows users to manage the data publication process. Here is an explanation of each control option available:
Publish One Data Sample: Initiates publishing a single data sample to the MQTT broker. It is useful for testing and verifying if the data structure and connection are configured correctly. By publishing one sample, users can ensure the data is sent and received as expected without starting a continuous data flow.
Publish Continuous Data: Starts the continuous publication of data to the MQTT broker. When active, the simulator will repeatedly send data samples at specified intervals. This is useful for simulating real-time data streams and stress testing the MQTT infrastructure. Continuous data publishing also helps evaluate how the system handles sustained data loads.
Stop Publishing Data: Stops the data publication process, whether a single or continuous data sample. It controls the data flow and stops the simulation when necessary. Stopping data publication can be used to adjust configurations, analyze received data, or halt the simulation after a specific testing period.
The MQTTspB Simulator is divided in three main regions. Configuration (Connection Parameters and Payload Settings), SimulationControl and View (DataBrowser and EventLog).
Connections Parameters displays configurations options defined on MQTTspB Simulator Configuration, such as the Broker URL, Port, Username, Password, Start Minimized, Block Configuration Field, Connect On Startup and Publish Data On Startup.
The Payload Settings of the MQTTspB Simulator Configuration dialog allows users to manage settings related to the data payload being sent, such as GroupID, Number of NodesIDs and the Edit Data Structure button.
GroupID: Specifies a unique identifier for a group of clients or devices. This identifier helps organizing and managing clients within the same group.
Number Of NodeIDs: Indicates the number of nodes or individual devices within the specified group. This value helps structuring the data to be sent, ensuring that the correct number of nodes is included in the payload.
Edit Data Structure: This button allows users to modify the data structure that will be used in the payload. Clicking this button opens a configuration popup where users can define or adjust the data points, types, and hierarchical organization of the data to be published.
This window has buttons to connect and disconnect. It also has two tabs: Connection Parameters and Payload Settings.
Here is configured the necessary information required to establish a connection to a Broker.
The Simulator does not support SSL Protocols. |
The fields can only be modified while the MQTTspB Client is not connected to a Broker. |
In this tab, you will be able to configure the Payload Structure to be published.
The structure is defined based on a hierarchical structure illustrated below:
<GroupID Name="<GroupName>"> |-- <NodeIDs> | |-- <NodeID Name="<NodeName>"> | | |-- <DeviceIDs> | | | |-- <DeviceID Name="<DeviceName>"> | | | | |-- <Variables> | | | | | |-- Var1 | | | | | |-- ... | | | | | |-- VarN | | | |-- <DeviceID Name="<DeviceName2>"> | | | |-- <Variables> | | | | | |-- Var1 | | | | | |-- ... | | | | | |-- VarX | |-- <NodeID Name="<NodeName2>"> | |-- <DeviceIDs> | | |-- <DeviceID Name="<DeviceName>"> | | | |-- <Variables> | | | | | |-- Var1 | | | | | |-- ... | | | | | |-- VarY | | |-- <DeviceID Name="<DeviceName>"> | | |-- <Variables> | | | | | |-- Var1 | | | | | |-- ... | | | | | |-- VarZ |
To edit the structure, click on the Edit Data Structure button and customize your Payloas at the dialog window.
There are some properties to be defined for Variables:
The DataStructure can only be edited while the OPC Server is not running. |
This section is used to define the simulator behavior in runtime.
In this region, you will be able to see the Payload Structure existing in the Broker.
This log displays useful information regarding the MQTTspB Simulator activity.
The MQTTspB Simulator can be executed with custom parameters through the command line. The syntax is as follows:
"..\MQTTspBSimulator.exe" /param1:<param1Value> ... /paramN |
The existing parameters are listed below:
Usage:
"..\MQTTspBSimulator.exe" /Minimized /AutoStart /Config:"C:\Documents\CustomConfig.xml" |
The input parameters are not case-sensitive |
With a custom configuration file, you will be able to define your own Broker Configuration and DataStructure. The syntax for the configuration is described below:
<?xml version="1.0" encoding="utf-8"?> <MQTTspBSimulator> <ConnectionParameters> <BrokerUrl>127.0.0.1</BrokerUrl> <BrokerPort>1883</BrokerPort> <UserName></UserName> <Password></Password> </ConnectionParameters> <PayloadSettings> <GroupID Name="GroupID"> <NodeIDs> <NodeID Name="NodeID1"> <DeviceIDs> <DeviceID Name="DeviceID1"> <Variables> <Variable Name="Name" Type="string" VariationFlag="false" InitialValue="City"/> <Variable Name="State" Type="boolean" VariationFlag="true"/> <Variable Name="Latitude" Type="double" VariationFlag="true" Min="-5" Max="2" InitialValue="0"/> <Variable Name="Longitude" Type="double" VariationFlag="true" Min="40" Max="43" InitialValue="40"/> <Variable Name="PanelPower" Type="double" VariationFlag="true" Min="200" Max="500" InitialValue="200"/> <Variable Name="PanelVoltage" Type="double" VariationFlag="true" Min="-220" Max="220" InitialValue="0"/> <Variable Name="PanelCurrent" Type="double" VariationFlag="true" Min="-10" Max="10" InitialValue="0"/> <Variable Name="TemperaturePort" Type="integer" VariationFlag="true" Min="15" Max="35" InitialValue="0"/> </Variables> </DeviceID> <DeviceID Name="DeviceID2"> <Variables> <Variable Name="Name" Type="string" VariationFlag="false" InitialValue="City"/> <Variable Name="State" Type="boolean" VariationFlag="true"/> <Variable Name="Latitude" Type="double" VariationFlag="true" Min="-5" Max="2" InitialValue="0"/> </Variables> </DeviceID> </DeviceIDs> </NodeID> <NodeID Name="NodeID2"> <DeviceIDs> <DeviceID Name="DeviceID1"> <Variables> <Variable Name="Name" Type="string" VariationFlag="false" InitialValue="City"/> <Variable Name="State" Type="boolean" VariationFlag="true"/> <Variable Name="Latitude" Type="double" VariationFlag="true" Min="-5" Max="2" InitialValue="0"/> <Variable Name="Longitude" Type="double" VariationFlag="true" Min="40" Max="43" InitialValue="40"/> <Variable Name="PanelPower" Type="double" VariationFlag="true" Min="200" Max="500" InitialValue="200"/> <Variable Name="PanelVoltage" Type="double" VariationFlag="true" Min="-220" Max="220" InitialValue="0"/> <Variable Name="PanelCurrent" Type="double" VariationFlag="true" Min="-10" Max="10" InitialValue="0"/> <Variable Name="TemperaturePort" Type="integer" VariationFlag="true" Min="15" Max="35" InitialValue="0"/> </Variables> </DeviceID> <DeviceID Name="DeviceID2"> <Variables> <Variable Name="Name" Type="string" VariationFlag="false" InitialValue="City"/> <Variable Name="State" Type="boolean" VariationFlag="true"/> <Variable Name="Latitude" Type="double" VariationFlag="true" Min="-5" Max="2" InitialValue="0"/> </Variables> </DeviceID> </DeviceIDs> </NodeID> </NodeIDs> </GroupID> </PayloadSettings> <SimulatorControl> <ConnectOnStartup>false</ConnectOnStartup> <PublishDataOnStartup>false</PublishDataOnStartup> <Minimized>false</Minimized> <BlockConfigurationFields>false</BlockConfigurationFields> </SimulatorControl> </MQTTspBSimulator> |
Additional Information:
Solution for when the configurations from the XML MQTTspBSimulator-Demo9.2.exe.config are applied and the tags do not appear.
When you are using the demo project fsAssetsMonitor via the MQTTspB Simulator, it's necessary that the file "MQTTspBSimulator-Demo9.2.exe.config" be copied and pasted into the folder along with the project "fxAssetsMonitor.tproj". Upon opening the project, you can verify in Edit>Scripts>Classes, within the class CheckStatus that this class contains a method called StartMqttSimulator(). When running the project this method will fetch some arguments and together with the .config file, and from these configured arguments, the MQTTSpb Simulator will be called to run the values that are configured within this .config. When running the project this will be done automatically, without needing to manually open the simulator.
The original file "MQTTspBSimulator.exe.config" within the product's installation folder comes with default values for simulation and can be modified to generate new simulation values. To add new attributes, you can follow the pattern of the other attributes in the file.
In this section: