Demo MQTT is an example consisting of two projects: Field Application and Data Aggregator Application. The objective of this demo is to simply show an example of communication via MQTT protocol between a hypothetical application running on a machine/plant (Field Application) and an application that collects the data sent by the machine, showing them in the form of a dashboard (Data Aggregator Application). Usually, it would be done only with the visualization of historical data (cold data) but in this project, we also wanted to show an example of receiving live data.
To start this application, you just need:
- Optix (version 1.0.1.24 or higher)
- Internet connection
- Modbus simulator
- MQTTnet V3.1.2 by "The contributors of MQTTnet" GitHub
- MQTTnet.Extensions.ManagedClient V3.1.2 by "The contributors of MQTTnet" GitHub
- Newtonsoft.Json V13.0.1 by "James Newton-King" [Link](by "The contributors of MQTTnet" GitHub
- M2MQTT V4.3.0 by Paolo Patierno Link
Once the libraries are installed from NuGet, import them in your project by following these steps:
- Open the NetLogic
- Click on the project’s .csproj file
- Modify it by adding
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
after<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
- Build the project
The example is provided as-is and can be a useful reference for building your application. The example as it is cannot be used on a real machine but must be adapted for the purpose, respecting the highest safety standards required. A public and open source MQTT broker is used in the project for demonstration purposes only, it is not secured, and its uptime can’t be guaranteed. We strongly encourage you to change the topic and server names using your provider before deploying the final application.
This application simulates the connection to a real machine/plant via a Modbus driver.
To be able to use the demo, please choose a Modbus simulator and configure it properly (IP Address, Port) to view the variables exchanged between Field Application and Data Aggregator Application. Tags register number (Holding register memory area): 1, 2, 3.
After that, you can run your application with FT Optix Emulator.
If the connection with the Modbus Simulator is working, the “Connected to Station” LED will be green.
Once the application has started and the Modbus Simulator connection is ON, you can easily simulate the Modbus Station tags with the "variable generator" switch. This switch is connected to the Runtime Netlogic “VariableGenerator” (see Netlogic folder) that generates random values.
Browse through the pages to see:
- Live data
- Trends
- Live alarms
- Historical alarms
Rockwell Automation maintains these repositories as a convenience to you and other users. Although Rockwell Automation reserves the right at any time and for any reason to refuse access to edit or remove content from this Repository, you acknowledge and agree to accept sole responsibility and liability for any Repository content posted, transmitted, downloaded, or used by you. Rockwell Automation has no obligation to monitor or update Repository content
The examples provided are to be used as a reference for building your own application and should not be used in production as-is. It is recommended to adapt the example for the purpose, observing the highest safety standards.