Versions Compared

Key

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

...

This tutorial will use the "default" Tag Provider.  Expand 'All Providers' in the Tag Browser and select 'default'.  Note that if Ignition Edge is being used, the tag provider will be named 'edge'.

Image Removed

Image AddedWith 'default' (or 'edge') selected, click the 'OPC' icon in the Tag Browser icon list:

Image RemovedImage Added

This will open a new window as shown below.  If the OPC server and client were set up and configured properly, you should see something similar to the following:

Image RemovedImage Added

Note there is a device with an attached PLC and two sets of registers.  Yours will look different based on the device you are using and how it is configured.  At this point, we can select do the following:

  1. Select the device (

...

  1. TestDevice in this case) and drag it into the Tag Browser under the 'default' Tag Provider.

...

  1. Rename the "_TestDevice_" folder to "Tutorial Tags".
  2. Rename the "UnitId 1" and "UnitId 2" folders to "PLC1" and "PLC2".
  3. Delete the "_Diagnostics_" folder as it is not used in this tutorial.

This is shown below:

Image Added

The folder structure of these Tags should be carefully noted so that MQTT Transmission can be configured correctly to monitor the Tags.

With the Tags set up, MQTT Transmission can now be configured

Image Removed

The first level of folders is very important in terms of layout and how the tags will be understood and represented by MQTT Transmission.  These are the rules:

  • For terminology reference, please review the Sparkplug specification if you have not done so.
  • Under the Tag Provider, the first folder must be exactly 'Edge Nodes'
  • Under the 'Edge Nodes' folder a 'Group ID' must be next.  This can be anything you want but realize it represents a group of edge nodes.  You can have as many group IDs as you want.
  • Under 'Group ID' you can one or more Edge Nodes.
  • Under each Edge Node, you can have one or more devices.
  • Under each device, you can have any depth of folder/tag structure to represent the tags.

In our example, we have a single Edge Node of 'CLTEST002DIRECTOR', under it a single Device called PLC1, and under it, 15 registers in two different folders.  We could rearrange this by renaming and moving folders and tags to a different representation as desired.  The layout below is also valid as was done simply by moving/renaming the tags shown above.

Image Removed

Note while the folders and tags were moved and renamed, the required basic structure stayed the same with:

...

With our tags set up as we want them, we now must configure MQTT Transmission.  Do so by browsing to the the Configure section of the Ignition Gateway web UI and selecting 'MQTT Transmission -> Settings' on the left: Image Removed

This tutorial uses In this example we're usiing the default MQTT Server of MQTT Distributor:

Image Removed

Image AddedUnder the Transmitters tab, we're also using the defaults:

Image Removed

Note the Tag Provider Name is the same Tag Provider we build out our Edge Nodes from in the Tag Browser earlier.  Now we can go back to Designer and force MQTT Transmission to update.  MQTT Transmission does not dynamically look for changes in the tag structure and update them.  If it did, you could end up with a lot of improperly structured data while the changes to the tag tree are being made.  So, the update must be forced via 'Refresh'.  This is a tag under the MQTT Transmission tag provider as shown below in the Tag Browser.

Image Removed

a new Transmitter will need to be created.  Click on the "Create new Setting..." link as shown below:

Image AddedModify the following settings:

Tag Settings
  • Name: Tutorial Transmitter
  • Tag Provider: default
  • Tag Path: Tutorial Tags
Sparkplug Settings
  • Group ID: Tutorial Group
  • Edge node ID: Tutorial Edge

(leave all other setting as defaults)

Image Added

Click "Save Changes" to see the new Transmitter was successfully created.

Image Added

This new Transmitter will scan the Tags in the "Tutorial Tags" folder and publish them to MQTT Engine using the hard coded Group and Edge Node IDs that were configured in the Transmitters settings.  Since the Device ID was left blank in the Transmitter settings, they will be scanned from the Tag Tree.  Each Folder in the "Tutorial Tags" folder will be considered a device.  For this tutorial the devices will be "PLC1" and "PLC2".

In Designer force MQTT Transmission to update by toggling the "Refresh" Tag shown below:

Image AddedNote that In order to refresh, Designer must be in read/write and preview mode.   Do so by selecting these two buttons in the top menu of Designer:

Image Removed   Image Removed

Once this is done, click 'Refresh' in the Tag Browser.  This will force MQTT Transmission to read the default Tag Browser tree, find 'Edge Nodes', and begin sending MQTT messages based on tag change events.  You can see this by clicking the refresh icon in the Tag Browser menu:

Image Removed

Image AddedAt this point, you should be able to expand the "MQTT Engine tag " Tag provider and see all of the tags in MQTT Engine:

Image Removed

Image AddedIn addition to the tags being displayed in Engine, they are also writable if this enabled in MQTT Engine.  By default, MQTT Engine blocks command messages from being sent to devices.  To enable this feature, in the Ignition web console browse to the MQTT Engine Module Settings.Image Removed

Make sure the "Block Node Commands" and "Block Device Commands" settings are disabled, as shown below.

Image Removed

With this enabled and Designer in read/write and preview mode, you can write to the outputs of the modbus device from the Tag Browser:

Image Added

Note that after updating the MQTT Engine settings, the Tags in the Tag Browser under the MQTT Engine Tag Provider may become Stale.  This is because the primary host ID is not set up on both MQTT Engine and MQTT Transmission which is outside of the scope of this Tutorial.  To get around this, manually toggle the MQTT Transmission "Refresh" Tag as shown above.

Now attempt to write to any output Tags that are available on the OPC device, via the corresponding Tag in the MQTT Engine Tag Provider.

Image RemovedImage Added

Note there is some delay in the response.  This is due in part to MQTT Transmissions 'Tag Pacing Period'.  This is the delay for MQTT messages to wait before being sent to allow multiple change events to buffer before putting them into a single MQTT message.  This can be changed in the MQTT Transmission module's Transmitter configuration in the Ignition web console.

...