This document provides information on configuring and running the MQTTspB Simulator, including its integration with Data Explorer Tools and runtime behavior. The simulator can be started from the Data Explorer UI or by executing it with command line parameters, creating an MQTTspB Client that connects to a configured broker and publishes simulated data to mapped topics.
On this page:
The following features are supported:
The MQTTspB Simulator is integrated with the Data Explorer Tools, making testing easier and faster by enabling the publication of up to 30,000 simulated values to the MQTT broker from the same design environment. This facilitates project testing, communication validation with the software platform MQTT client, and testing of the new Dynamic Tag Provider functionality with MQTT.
You can start the simulator using the Designer at Data Explorer / MQTT tools, or directly through the MQTTspBSimulator executable file, located inside the protocols folder of the product's installation path
Closing this window will terminate the execution of the simulator. You can minimize if you want to keep the simulation in the background. |
The Execution window has the Data TreeView and EventLog at the bottom, and configuration panels for:
The Simulation Control in the MQTTspB Simulator allows users to manage the data publication process.
When the simulator is connected with a Broker, these options are disabled for editing.
You can enable or disable the connection with the Broker using the buttons at the top of the Window.
MQTTspB Simulator - Connection Parameters Configuration | |
---|---|
Broker URL | MQTT Broker (Server) default value is loopback (local) IP (127.0.0.1). |
Broker Port | Port the Broker is connected to. |
UserName | Username defined on the Broker, needed for authentication in certain cases (optional). |
Password | Password defined on the Broker. This will be requested if the Broker needs this configuration (optional). |
Minimized | Application starts minimized (valid for the next time the application is started). |
BlockConfigurationField | Make configuration fields read-only. |
ConnectOnStartup | MQTTspB Client tries to connect to Broker automatically when application is started (valid for the next time the application is started). |
PublishDataOnStartup | MQTTspB Client tries to publish Data to Broker automatically when application is started (valid for the next time the application is started). |
The Simulator does not support SSL Protocols. |
The Connection Parameters are only applied when starting the connection with the Broker. |
The Payload Settings of the MQTTspB Simulator Configuration dialog allow users to manage settings related to the data payload being sent, such as GroupID, Number of NodesIDs and the Edit Data Structure button.
The structure is defined based on the hierarchy 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 Payload at the dialog window, which is described in detail in the next topic. Alternatively, you can directly modify the XML configuration file.
The Data Structure can only be edited while the OPC Server is not running. |
The Data Structure configuration dialog 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:
When defining many nodes or properties, it may be easier to edit them directly in the XML configuration file, TMQTTBroker.config.xml, located in the ToolSettings folder. |
In this region, you will be able to see the Payload Structure existing in the Broker.
The Simulator is Write-Only! You will not be able to subscribe to any topic; only publishing is allowed. |
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 |
You can customize the MQTTspBSimulator's properties by modifying the default XML configuration file, or by defining a different configuration file using the Config command line parameter explained in the section above.
The syntax for the XML configuration file is exemplified 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> |
In this section: