Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Overview

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

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:

Table of Contents
maxLevel3
stylenone

Overview

This document has information on the MQTTspB Simulator configuration and Runtime Behavior.

Image Removed

Info

Watch a video on how to use the MQTT Simulator with Tag Provider here.

System Requirements

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.

Supported Features

The following features are supported:

  • Connection to Brokers (local and Remote) that may (or not) require a Username and Password.
  • Customization of Topic parameters - GroupID, NodeID and DeviceID.
  • Create Multiple NodeIds in the same GroupID, each with its own DeviceID’s.
  • Create Multiple DeviceIDs in the same NodeID.
  • Change the DeviceIds attributes using a config file.
  • Publish NBIRTH, DBIRTH, DDATA, NDEATH and DDEATH messages.
Note

The Simulator is Write-Only! You will not be able to subscribe to any topic; only publishing is allowed.


Included Features

The following features are supported:

  • Connection to brokers (local and remote) with or without username and password.
  • Customization of topic parameters: GroupID, NodeID, and DeviceID.
  • Creation of multiple NodeIDs within the same GroupID, each with its own DeviceIDs.
  • Creation of multiple DeviceIDs within the same NodeID.
  • Modification of DeviceIDs attributes using a configuration file.
  • Publishing of NBIRTH, DBIRTH, DDATA, NDEATH, and DDEATH messages.

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.


Simulator Execution Window

You can start the simulator using the Designer at Data Explorer → MQTT tools, or directly thought its executable at the product installation protocols folder MQTTspBSimulator.exe

Image Added

Tip

Closing that window will terminate the execution the simulator. You can minimize if you want to keep the simulation in background. 

The Execution window has the Data TreeView and EventLog at the button, and configuration panels for:

  • Simulation Control
  • Connection Parameters
  • Payload Settings

Simulation Control

The Simulation Control in the MQTTspB Simulator allows users to manage the data publication process.

  • Publish One Data Sample: Sends one DDATA message for each Device created in the session.
  • Publish Continuous Data: Sends continuous DDATA messages with a time rate of 1 second.
  • Stop Publishing Data: Stop publishing continuous data.

When the simulator is connected with a Broker, those options are disabled for editing. 

You can Connect or Disconnect with the Broker with the buttons at the top of Window.


Connection Parameters

MQTTspB Simulator - Connection Parameters Configuration

Broker URL

MQTT Broker (Server) Default value is loopback (local) ip (127.0.0.1).

Broker Port

Username defined on the Broker.

Simulator Configuration

The MQTTspB Simulator is divided in three main regions. Configuration (Connection Parameters and Payload Settings), SimulationControl and View (DataBrowser and EventLog).

Connection Parameters

Here is configured the necessary information required to establish a connection to a Broker.

  • Broker URL: MQTT Broker (Server) Default value is loopback (local) ip (127.0.0.1).
  • Port Number: MQTT Broker listening port Default value is 1883.
  • Username: Username defined on the Broker. This will be requested if the Broker needs this configuration (optional).
  • Password: Password defined on the Broker.

    This will be requested if the Broker needs this configuration (optional).

  • Start Minimized: Application starts minimized (valid for the next time the application is started).
  • 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

    Password defined on the Broker. This will be requested if the Broker needs this configuration (optional).

    Start Minimized

    Application starts minimized

    Connect On Startup: MQTTspB Client tries to connect to Broker automatically when application is started

    (valid for the next time the application is started).

    Publish

    BlockConfigurationField

    Make configuration fields read-only.

    Connect On Startup

    MQTTspB Client tries to connect to Broker automatically when application is started (valid for the next time the application is started).

    Publish Data On Startup

    :

    MQTTspB Client tries to publish Data to Broker automatically when application is started (valid for the next time the application is started).

  • Block All Configuration Fields: Make configuration fields read-only.

  •  

    Info

    The Simulator does not support SSL Protocols.


    Info

    The fields can only be modified while the MQTTspB Client is not connected to a Connection Parameter are only applied when starting the connection with the Broker.



    Payload Settings

    Image Added

    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.


    Payload Data Structure

    The structure is defined based on a hierarchical structure illustrated below:

    Code Block
    languagexml
    <GroupID Name="<GroupName>">
    |-- <NodeIDs>
    |   |-- <NodeID Name="<NodeName>">
    

    In this tab, you will be able to configure the Payload Structure to be published.

    Image Removed

    The structure is defined based on a hierarchical structure illustrated below:

    Code Block
    languagexml
    <GroupID Name="<GroupName>">
    |-- <NodeIDs>
    |   |-- <NodeID Name="<NodeName>">
    |   |   |-- <DeviceIDs>
    |   |   |   |-- <DeviceID Name="<DeviceName>">
    |   |   |   |   |-- <Variables><DeviceIDs>
    |   |   |   |-- <DeviceID Name="<DeviceName>">
    |   |   |   |   |-- Var1<Variables>
    |   |   |   |   |   |-- ... Var1
    |   |   |   |   |   |-- VarN... 
    |   |   |   |--  <DeviceID Name= |   |-- 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 to customize your Payloas Payload at the dialog window, describe in next topic.

    Image Removed

    Alternatively, you can modify directly the XML configuration file.

    Info

    The DataStructure can only be edited while the OPC Server is not running.



    Customize the Simulation Data Structure

    Image Added

    There are some properties There are some properties to be defined for Variables:

    • Type: Define the Variable DataType. Options are:
      • Double
      • Integer
      • Boolean
      • String
    • VariationFlag: Flag that indicates if variable value will be simulated every second in Runtime.
    • Min: Defines the minimum value for simulated data.
    • Max: Defines the maximum value for simulated data.
    • InitialValue: Defines an initial value for the variable.
    Info

    The DataStructure can only be edited while the OPC Server is not running.

    Simulation Control

    This section is used to define the simulator behavior in runtime.

    • Publish One Data Sample: Sends one DDATA message for each Device created in the session.
    • Publish Continuous Data: Sends continuous DDATA messages with a time rate of 1 second.
    • Stop Publishing Data: Stop publishing continuous data.

    Data Browser

    In this region, you will be able to see the Payload Structure existing in the Broker.

    Image Removed

    EventLog

    This log displays useful information regarding the MQTTspB Simulator activity.

    Image Removed

    Command Line Parameters

    The MQTTspB Simulator can be executed with custom parameters through the command line. The syntax is as follows:

    Code Block
    languagebash
    "..\MQTTspBSimulator.exe" /param1:<param1Value> ... /paramN

    The existing parameters are listed below:

  • Minimized: Application starts minimized.
  • ConnectOnStartup: MQTTspB Client tries to connect to Broker automatically when application is started
  • PublishDataOnStartup: MQTTspB Client tries to publish Data to Broker automatically when application is started
  • BlockConfigurationFields: Make configuration fields read-only.
  • BrokerUrl: MQTT Broker URL
  • Port: MQTT Broker listening port
  • UserName:  Username defined on the Broker. This will be requested if the Broker needs this configuration (optional)
  • Password:  Password defined on the Broker. This will be requested if the Broker needs this configuration (optional).
  • GroupId: Defines the initial GroupID for the Payload Structure.
  • Config: Full path for *.xml configuration file with Server Configuration and custom DataStructure. More details on the syntax for the *.xml file in section 4.
  • Path: Full path of a FrameworX solution directory in which a configuration file can be found
  • Usage:

    Code Block
    "..\MQTTspBSimulator.exe" /Minimized /AutoStart
                             /Config:"C:\Documents\CustomConfig.xml"
    Info

    The input parameters are not case-sensitive

    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:

    NodeIDs

      • 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.

    DeviceIDs

      • 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

      • 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.
    Tip

    When defining many nodes or properties, it likely easier to edit directly the XML configuration file, TMQTTBroker.config.xml, located the ToolSettings folder



    Data Browser TreeView

    In this region, you will be able to see the Payload Structure existing in the Broker.

    Image Added

    Note

    The Simulator is Write-Only! You will not be able to subscribe to any topic; only publishing is allowed.

    EventLog

    This log displays useful information regarding the MQTTspB Simulator activity.

    Image Added


    Command Line Parameters

    The MQTTspB Simulator can be executed with custom parameters through the command line. The syntax is as follows:

    Code Block
    languagebash
    "..\MQTTspBSimulator.exe" /param1:<param1Value> ... /paramN

    The existing parameters are listed below:

    • Minimized: Application starts minimized.
    • ConnectOnStartup: MQTTspB Client tries to connect to Broker automatically when application is started
    • PublishDataOnStartup: MQTTspB Client tries to publish Data to Broker automatically when application is started
    • BlockConfigurationFields: Make configuration fields read-only.
    • BrokerUrl: MQTT Broker URL
    • Port: MQTT Broker listening port
    • UserName:  Username defined on the Broker. This will be requested if the Broker needs this configuration (optional)
    • Password:  Password defined on the Broker. This will be requested if the Broker needs this configuration (optional).
    • GroupId: Defines the initial GroupID for the Payload Structure.
    • Config: Full path for *.xml configuration file with Server Configuration and custom DataStructure. More details on the syntax for the *.xml file in section 4.
    • Path: Full path of a FrameworX solution directory in which a configuration file can be found

    Usage:

    Code Block
    "..\MQTTspBSimulator.exe" /Minimized /AutoStart
                             /Config:"C:\Documents\CustomConfig.xml"


    Info

    The input parameters are not case-sensitive



    XML Configuration File

    Modifying the default XML configuration file, or using a new by Command Line options, you can customize all its settings.  

    The syntax for the configuration is described below:

    Code Block
    <?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>

    Custom Configuration(*.xml)

    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:

    Code Block
    <?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="PanelCurrentName" Type="doublestring" VariationFlag="true" Min="-10" Max="10" InitialValue="0"false" InitialValue="City"/>
    								<Variable Name="State" Type="boolean" VariationFlag="true"/>
    								<Variable Name="TemperaturePortLatitude" Type="integerdouble" VariationFlag="true" Min="15-5" Max="352" InitialValue="0"/>
    							</Variables>
    						</DeviceID>
    						<DeviceID Name="DeviceID2">
    							<Variables>
    								<Variable Name="Name" Type="string" VariationFlag="false	<Variable Name="Longitude" Type="double" VariationFlag="true" Min="40" Max="43" InitialValue="City40"/>
    								<Variable Name="StatePanelPower" Type="booleandouble" VariationFlag="true"/> Min="200" Max="500" InitialValue="200"/>
    								<Variable Name="LatitudePanelVoltage" Type="double" VariationFlag="true" Min="-5220" Max="2220" InitialValue="0"/>								
    							</Variables>
    						</DeviceID>
    					</DeviceIDs>
    				</NodeID>
    				<NodeID Name="NodeID2"	<Variable Name="PanelCurrent" Type="double" VariationFlag="true" Min="-10" Max="10" InitialValue="0"/>
    					<DeviceIDs>
    						<DeviceID<Variable Name="DeviceID1">
    							<Variables>
    								<Variable Name="Name" Type="string" VariationFlag="falseTemperaturePort" Type="integer" VariationFlag="true" Min="15" Max="35" InitialValue="City0"/>
    								<Variable Name="State" Type="boolean" VariationFlag="true"/></Variables>
    						</DeviceID>
    						<Variable<DeviceID Name="Latitude" Type="double" VariationFlag="true" Min="-5" Max="2" InitialValue="0DeviceID2">
    							<Variables>
    								<Variable Name="Name" Type="string" VariationFlag="false" InitialValue="City"/>
    								<Variable Name="LongitudeState" Type="doubleboolean" VariationFlag="true" Min="40" Max="43" InitialValue="40"/>/>
    								<Variable Name="PanelPowerLatitude" Type="double" VariationFlag="true" Min="200-5" Max="5002" InitialValue="2000"/>								
    								<Variable Name="PanelVoltage" Type="double" VariationFlag="true" Min="-220" Max="220" InitialValue="0"/>
    		</Variables>
    						</DeviceID>
    					</DeviceIDs>
    				</NodeID>
    				<NodeID Name="NodeID2">
    					<DeviceIDs>
    						<Variable<DeviceID Name="PanelCurrent" Type="double" VariationFlag="true" Min="-10" Max="10DeviceID1">
    							<Variables>
    								<Variable Name="Name" Type="string" VariationFlag="false" InitialValue="0City"/>
    								<Variable Name="TemperaturePortState" Type="integerboolean" VariationFlag="true" Min="15/>
    								<Variable Name="Latitude" Type="double" VariationFlag="true" Min="-5" Max="352" InitialValue="0"/>
    							</Variables>
    						</DeviceID>
    						<DeviceID	<Variable Name="DeviceID2">
    							<Variables>
    								<Variable Name="Name" Type="string" VariationFlag="falseLongitude" Type="double" VariationFlag="true" Min="40" Max="43" InitialValue="City40"/>
    								<Variable Name="StatePanelPower" Type="booleandouble" VariationFlag="true" Min="200" Max="500" InitialValue="200"/>
    								<Variable Name="LatitudePanelVoltage" Type="double" VariationFlag="true" Min="-5220" Max="2220" InitialValue="0"/>
    							</Variables>	<Variable Name="PanelCurrent" Type="double" VariationFlag="true" Min="-10" Max="10" InitialValue="0"/>
    						</DeviceID>
    					</DeviceIDs>
    				</NodeID>		<Variable Name="TemperaturePort" Type="integer" VariationFlag="true" Min="15" Max="35" InitialValue="0"/>
    			</NodeIDs>			
    		</GroupID>Variables>
    		
    	</PayloadSettings>
    	<SimulatorControl>
    		<ConnectOnStartup>false<</ConnectOnStartup>DeviceID>
    			<PublishDataOnStartup>false</PublishDataOnStartup>
    		<Minimized>false</Minimized>
    		<BlockConfigurationFields>false</BlockConfigurationFields>
    	</SimulatorControl>
    </MQTTspBSimulator>

    MQTTspB Simulator with the fxAssetsMonitor demo project

    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.

    Image Removed

    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.
    			<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:

    Page Tree
    root@parent
    spacesV10