Versions Compared

Key

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

Abstract

This page describes how MQTT Transmission Transmitter configurations interact with Ignition tag trees to publish MQTT messages and tags to an MQTT Server. It explains how tags get identified to be published as well as the specific topics that data will be published on. It also goes over some example configurations to show how the system will behave in different scenarios.

Note

The combination of the Transmitter configuration and Ignition tag trees provides the ultimate flexibility in how published data is described. It is important to understand these concepts when defining your system data hierarchy.

Sparkplug Overview

All MQTT clients using the Sparkplug specification will publish MQTT messages consisting of a topic and payload component. For the Sparkplug B specification, which is used by MQTT Transmission, the Topic Namespace structure is defined as

spBv1.0/GROUP_ID/VERB/EDGE_NODE_ID/DEVICE_ID

where

  • GROUP_ID is meant to represent a logical grouping of Edge Nodes. This can be a region, a facility name, or any meaningful grouping of Edge Nodes within your application.
  • VERB provides an indication on how to handle the payload of the message. This includes whether the message is a birth certificate, death certificate, data message, command message, etc.
  • EDGE_NODE_ID is the ID of the logical Edge Node. This is often the name of the system running Ignition with MQTT Transmission.
  • DEVICE_ID is the ID of a device attached to the Ignition instance. This can be a PLC or logical grouping of tags that represent a physical or logical device connected to Ignition.
warning


In the Sparkplug specification there are two Sparkplug Descriptors defined as:

  • Edge Node Descriptor which is the GROUP_ID and EDGE_NODE_ID combination
  • Device Descriptor which is the GROUP_ID, EDGE_NODE_ID and DEVICE_ID combination

The MQTT topics are essentially the 'addresses' of the different components in the distributed system and the

combination of any GROUP_ID and EDGE_NODE_ID

Sparkplug Edge Node Descriptor must be unique within the distributed system.

 Because these are used as 'addresses' in the system you should never have two that conflict with each other

. It

- it is a bit like having two houses with the same postal address. It isn't possible for other MQTT clients in the system to tell which edge node sent the data and, when sending messages to them, they will both receive the messages.

Of course, you can have two or more Edge Nodes with the same GROUP_ID as long as each EDGE_NODE_ID is unique. To use the analogy above, it would be like having houses on the same street with different house numbers.

Transmitters and Tag Trees

MQTT Transmission is designed to dynamically pick up tags in Ignition or Ignition Edge and publish tag change events to an MQTT Server. How the tags are published to the MQTT Server is based on a combination of a 'Transmitter' configuration as well as the arrangement of tags in the Ignition tag tree.

Transmitters will monitor tags from a specific Tag Provider and, optionally, a specific Tag Path. Each folder under the Tag Path would be considered a Sparkplug 'Group ID', each folder under a 'Group ID' folder would be considered an 'Edge Node ID' and finally, each folder under an 'Edge Node ID' folder would be considered a 'Device ID'. The tag folder hierarchy is then used to dynamically build the MQTT message that will represent the tags.

A transmitter will use the tag folder hierarchy under the configured Tag Path in combination with the Sparkplug IDs to dynamically build the topic namespace used to represent the tags.

The following the rules below are used when building the topic namespace:

  • If the Sparkplug IDs are empty, there must be at least 3 folder levels below the Tag Path to resolve the Group, Edge and Device IDs (if needed) where the Group and Edge combination is unique.

  • If the Sparkplug Group ID only is configured, there must be at least 2 folder levels below the Tag Path to resolve to Edge and Device IDs (if needed) where the Group and Edge combination is unique.

  • If the Sparkplug Group ID and Edge ID only are configured, there must be least 1 folder level or device level UDT below the Tag Path to resolve to a Device ID (if needed)

  • If the Sparkplug IDs are all configured the tag folder hierarchy will not be used

MQTT Transmission will then use the remainder of the tag folder hierarchy not used in the topic namespace to identify the name of the tag included in the payload metrics.

Note

Each Edge Node Descriptor

Note
Each EdgeNodeID

will generate a single MQTT Client connection. If your tag tree has multiple folders that are identified as Edge Node IDs, a single Transmitter configuration will result in multiple Sparkplug MQTT clients publishing messages to an MQTT Server

.
Tip
If your tag folder hierarchy does not conform to this structure, you can explicitly define these required elements under the Sparkplug Settings section in the Transmitter configuration. When configured, these elements will replace the Sparkplug IDs that would otherwise be dynamically picked up from the folder structure

.


Let’s take a look at some examples that demonstrate how the message topic and payload

is

are affected by the tag tree and Transmitter configurations starting with

a basic

a basic Ignition tag folder hierarchy conforming to the GroupID, EdgeNodeID and DeviceID structure and the default Transmitter configuration.

In this example the folders represent a facility, physical edge node device and the PLCs connected to that device.

Image RemovedImage Added

With this configuration of an empty Tag Path and empty Sparkplug IDs, Transmission will dynamically

pick up

pickup the folders from the root of the tag

tree

provider building the

following

Sparkplug

IDs

Descriptors as:

GroupID = Facility1, EdgeNodeID = Line1 and DeviceID =
  • Edge Node Descriptor = Facility/Line1
  • Device Descriptor = Facility/Line1/PLC1

Since there is only one

folder representing an EdgeNodeID (Line1)

Edge Node Descriptor identified, only one MQTT Client will be created.

When tag data changes, there is only one publish topic from this MQTT Client with the payload metrics containing the tag name Tag3 :

  • Topic: spBv1.0/
Facility1
  • Facility/DDATA/Line1/PLC1
    • Payload: {"timestamp":1643823757750,"metrics":[{"name":"Tag3","timestamp":1643823756467,"dataType":"Double","value":33.02}],"seq":23}


Let's extend the Ignition tag folder with this example:

Image Added


With the same configuration, there is no change to the message topic of spBv1.0/Facility/DDATA/LIne1/PLC1 but the payload metrics will use the remainder of the Ignition tag path for the tag name:

  • Payload: {"timestamp":1643823757750,"metrics":[{"name":"Area1/Batch1/Tag3","timestamp":1643823756467,"dataType":"Double","value":
35
  • 33.
537027196095224
  • 02}],"seq":23}

Let’s add additional PLCs under the physical Edge Node.

Image Removed


Now let's see how changing the Tag Path and Sparkplug IDs in the Transmitter configuration affects the message topic and payload name metric for the Ignition tag based on the topic namespace rules list above:

TagPath

Sparkplug Group ID

Sparkplug Edge Node ID

Sparkplug Device ID

Sparkplug Topic

Tag Name in payload metrics





spBv1.0/Facility/DDATA/Line1/PLC1Area1/Batch1/Tag3

My Group

spBv1.0/My Group/DDATA/Facility/Line1PLC1/Area1/Batch1/Tag3
FacilityMy Group

spBv1.0/My Group/DDATA/Line1/PLC1Area1/Batch1/Tag3
Facility/Line1


spBv1.0/PLC1/DDATA/Area1/Batch1Tag3
Facility/Line1/PLC1/Area1/Batch1My GroupMy Edge NodeMy DevicespBv1.0/My Group/DDATA/My Edge Node/My DeviceTag3
Facility/Line1/PLC1My Group

spBv1.0/My Group/DDATA/Area1/Batch1Tag3
Facility1/Line1/PLC1My GroupMy Edge Node
spBv1.0/My Group/DDATA/MyEdgeNode/Area1Batch1/Tag3

My GroupMy Edge Node
spBv1.0/My Group/DDATA/MyEdgeNode/Facility1Line1/PLC1/Area1/Batch1/Tag3

As you can see the combination of Tag Path and Sparkplug IDs provides immense flexibility in your Sparkplug namespace configuration.


Let's add an additional tag and tag folder with the configuration of an empty Tag Path and empty Sparkplug IDs:

Image Added


Transmission will build the following Sparkplug Descriptors:

  • Edge Node Descriptor
    1. Facility/Line1
  • Device Descriptors
    1. Facility/Line1/PLC1
    2. Facility/Line1/PLC2

As there is still only one Edge Node Descriptor, only one MQTT Client will be created. 

This will result in following Sparkplug IDs but still only one MQTT Client:

GroupID = Facility1, EdgeNodeID = Line1 and DeviceID = PLC1

GroupID = Facility1, EdgeNodeID = Line1 and DeviceID = PLC2

When tag data changes, there are two publish topics from this MQTT Client with the payload metrics containing the tag names Tag3 and Tag1.

  • Topic: spBv1.0/
Facility1
  • Facility/DDATA/Line1/PLC1
    • Payload: {"timestamp":1643823757750,"metrics":[{"name":"Tag3","timestamp":1643823756467,"dataType":"Double","value":
35
    • 1.
537027196095224
    • 88}],"seq":23}
  • Topic: spBv1.0/
Facility1
  • Facility/DDATA/Line1/PLC2
    • Payload: {"timestamp":1643823757750,"metrics":[{"name":"Tag1","timestamp":1643823722222,"dataType":"Double","value":
40
    • 85.16}],"seq":
23
    • 24}

Extending the tag tree to add a second physical Edge Node with PLCs

Image Removed


Let's add an additional tags and tag folders: 

Image Added


Transmission will build the following Sparkplug Descriptors:

  • Edge Node Descriptors
    1. Facility/Line1
    2. Facility/Line2
  • Device Descriptors
    1. Facility/Line1/PLC1
    2. Facility/Line1/PLC2
    3. Facility/Line2/PLC1
    4. Facility/Line2/PLC2

Now there are two Edge Node Descriptors which results in the creation of two MQTT Clients.

This will result in following Sparkplug IDs and, since there are now two EdgeNodes identified, two MQTT Clients will be created.

GroupID = Facility1, EdgeNodeID = Line1 and DeviceID = PLC1

GroupID = Facility1, EdgeNodeID = Line1 and DeviceID = PLC2

GroupID = Facility1, EdgeNodeID = Line2 and DeviceID = PLC1

GroupID = Facility1, EdgeNodeID = Line2 and DeviceID = PLC2

When tag data changes, there are two publish topics from each MQTT Client with the payload metrics containing the tag

.MQTT Client Facility1/Line1

names Tag1, Tag2 and Tag3.

  • Topic: spBv1.0/
Facility1
  • Facility/DDATA/Line1/PLC1
    • Payload: {"timestamp":1643823757750,"metrics":[{"name":"Tag3","timestamp":1643823756467,"dataType":"Double","value":
35
    • 60.
537027196095224
    • 22}]
,
    • "seq":23}

MQTT Client Facility1/Line1

Topic: spBv1
  • cspBv1.0/
Facility1
  • Facility/DDATA/Line1/PLC2
    • Payload: {"timestamp":1643823757750,"metrics":[{"name":"Tag1","timestamp":1643823722222,"dataType":"Double","value":
40
    • 53.79}],"seq":17}
MQTT Client Facility1/Line2
  • Topic: spBv1.0/
Facility1
  • Facility/DDATA/Line2/PLC1
    • Payload: {"timestamp":1643823757750,"metrics":[{"name":"Tag1","timestamp":1643823756467,"dataType":"Double","value":60.22}],"seq":19}
MQTT Client Facility1/Line2
  • Topic: spBv1.0/
Facility1
  • Facility/DDATA/Line2/PLC2
    • Payload: {"timestamp":1643823757750,"metrics":[{"name":"
Tag1
    • Tag2","timestamp":1643823722222,"dataType":"Double","value":
50
    • 60.22}],"seq":57}

You can see how many MQTT Clients have been created and whether they are connected from the Servers tab.

Image Removed


As you can see, we

haven’t

haven't made any changes to the Transmitter configuration and MQTT Transmission has dynamically created the MQTT Clients, topic

,

and payloads from the Ignition tag tree.

Let’s


Lets extend our infrastructure

again

to add a second facility with

a physical Edge Node connected to

a

PLC. Again, we will use the default Transmitter configuration for this device.

Image Removed

Image Removed

Transmitter configured with an empty Tag Path and Sparkplug IDs.

Image Added

Image Added

At this second facility

we will end up with the following Sparkplug IDs and a single MQTT Client.GroupID = Facility2, EdgeNodeID = Line1 and DeviceID = PLC1

, Transmission will build the following Sparkplug Descriptors:

  • Edge Node Descriptor
    1. Facility2/Line1
  • Device Descriptor
    1. Facility2/Line1/PLC1
    2. Facility2/Line1/PLC2

Data published from this second facility will use the

topic

topics spBv1.0/Facility2/DDATA/Line1/PLC1 and

since the GroupID/EdgeNodeID combination is unique across the two facilities

spBv1.0/Facility2/DDATA/Line1/PLC2.

Since the Edge Node Descriptors across the infrastructure are unique, there will be no data conflict at any MQTT Clients subscribing to the data messages.

Tip
If you can design your tag tree to conform to the Sparkplug specification, you can leave MQTT Transmission to dynamically manage the topics and payloads for the tags being published.

Of course this may not be possible due to existing infrastructure definitions and so the Transmitter configuration allows ways to manage this using the Tag Path and Sparkplug Setting parameters.

Consider this tag tree which doesn’t easily conform to the Sparkplug specification. Using the Transmitter configuration, we can affect the MQTT Clients created, and topics published for the data.

Image Removed

Image Removed

If we use the default Transmitter configuration, this will result in following Sparkplug IDs with one MQTT Client.

GroupID = MyCompany, EdgeNodeID = Lakeside and DeviceID = Finished Goods

When tag data changes, there will be one publish topic from this MQTT Client, however, because there are additional folders below the identified DeviceID folder of “Finished Goods”, the tag name included in the payload will include these additional folders.

Topic: spBv1.0/MyCompany/DDATA/Lakeside/Finished Goods

Payload: {"timestamp":1643823757750,"metrics":[{"name":"Line1/Input/PLC1/Tag3","timestamp":1643823756467,"dataType":"Double","value":45.58}],"seq":23}

Payload: {"timestamp":1643823757750,"metrics":[{"name":"Line1/Input/PLC2/Tag2","timestamp":1643823756467,"dataType":"Double","value":50}],"seq":24}

Payload: {"timestamp":1643823757750,"metrics":[{"name":"Line1/Output/PLC2/Tag2","timestamp":1643823756467,"dataType":"Double","value":4}],"seq":25}

If we change the Tag Path to point to a different folder in the tag tree, we will affect how the data is published:

Image Removed

With a Tag Path of My Company/Lakeside/Finished Goods defined, Transmission will dynamically pick up the folders in the tag tree below the Tag Path for the Sparkplug IDs and so we end up with the following:

GroupID = Line1, EdgeNodeID = Input and DeviceID = PLC1

GroupID = Line1, EdgeNodeID = Input and DeviceID = PLC2

GroupID = Line1, EdgeNodeID = Output and DeviceID = PLC1

Now we have two folders representing EdgeNodeIDs and so two MQTT Clients will be created one for Line1/Input and one for Line1/Output

However, when tag data changes, each MQTT Client will publish a unique publish topic for each DeviceID and, since there are no additional folders below the DeviceID folder, the tag name only is included in the payload:

MQTT Client connecting as Line1/Input

Topic: spBv1.0/Line1/DDATA/Input/PLC1

Payload: {"timestamp":1643824561258,"metrics":[{"name":"Tag3","timestamp":1643824559684,"dataType":"Double","value":-47.23189031326556}],"seq":95}

Topic: spBv1.0/Line1/DDATA/Input/PLC2

Payload: {"timestamp":1643825036860,"metrics":[{"name":"Tag1","timestamp":1643825035561,"dataType":"Int32","value":50}],"seq":97}

MQTT Client connecting as Line1/Output

Topic: spBv1.0/Line1/DDATA/Output/PLC1

Payload: {"timestamp":1643825036860,"metrics":[{"name":"Tag1","timestamp":1643825035561,"dataType":"Int32","value":80}],"seq":77}

Whilst these two examples shows how flexible the configuration can be, you will need to ensure that your namespace works with your infrastructure. If we added a second identical facility of Meadowside and used the same Transmitter configuration, we would end up with GroupID/EdgeID conflicts.

For example, both Lakeside and Meadowside locations would publish using the topic namespace of spBv1.0/Line1/DDATA/Input/PLC1 and it would not be possible for any MQTT clients subscribing to the data to know which edge node sent the data.

AnchorSparkplugSettingsSparkplugSettingsSparkplug Settings

If your tag folder hierarchy does not allow for MQTT Transmission to dynamically build the required Sparkplug Group ID and Edge ID, then you will need to explicitly define these under the Transmitter Sparkplug Settings section in the MQTT Transmission configuration guide. When configured, these elements will replace the Sparkplug IDs that would otherwise be dynamically picked up from the folder structure.

As an example, using the tag tree and Transmitter configuration below:


Now let's consider extending the original configuration to 100 locations without having to make changes to the tag tree. How would we avoid Edge Node collisions in this scenario? 

Here is where we can leverage the Transmitter Tag Path and Sparkplug ID configurations.

At each facility we can build a transmitter configuration with a Tag Path of Facility and set a specific GROUP_ID corresponding to the location such as :

Image Added

Image Added

Image Added

Image Added

With this configuration, MQTT Transmission will pickup the next two folder levels under the Tag Path to use as the EDGE_NODE_ID and DEVICE_ID resulting in the following:

  • Edge Node Descriptors
    • Plant_1/Line1
    • Plant_1/Line2
    • Plant_2/Line1
    • Plant_2/Line2

through to

    • Plant_100/Line1
    • Plant_100/Line2

Topics for data published would then become:

  • spBv1.0/Plant_1/DDATA/Line1/PLC1
  • spBv1.0/Plant_1/DDATA/Line1/PLC1
  • spBv1.0/Plant_2/DDATA/Line1/PLC1
  • spBv1.0/Plant_2/DDATA/Line1/PLC1

through to

  • spBv1.0/Plant_100/DDATA/Line1/PLC1
  • spBv1.0/Plant_100/DDATA/Line1/PLC1

The infrastructure would have 200 MQTT Clients with unique Edge Node Descriptors across the infrastructure.



Excerpt Include
CLD80:FAQ: Ignition Modules
CLD80:

Image Removed

Image Removed

With this Transmitter configuration and tag tree we end up with the following Sparkplug IDs:

GroupID = Lakeside, EdgeNodeID = "" and DeviceID = ""

Since there are no EdgeNodeIDs discovered, no MQTT Client will be created, and you will see that no MQTT Clients are connected when looking at the MQTT Transmission Server settings.

Image Removed

We can explicitly configure the Group ID, Edge ID and Device ID under the Sparkplug Settings for the Transmitter. In this example we will set Group ID = MyGroup and Edge Node ID = MyEdgeNode

Note
If you do not explicitly set a value, the Transmitter will dynamically determine those from the tag tree using the Tag Path.

Image Removed

We will have the following Sparkplug IDs and only one MQTT Client created.

GroupID = MyGroup, EdgeNodeID = MyEdgeNode and DeviceID = Lakeside (determined dynamically from the tag tree structure under the Tag Path)

When tag data changes, there is only one publish topic from this MQTT Client

Topic: spBv1.0/MyGroup/DDATA/MyEdgeNode/Lakeside

Payload: {"timestamp":1643828214163,"metrics":[{"name":"Tag3","timestamp":1643828212379,"dataType":"Double","value":-6.622853362629208}],"seq":113}

If we explicitly set the Device ID also

Image Removed

We will have the following Sparkplug IDs and only one MQTT Client created.

GroupID = MyGroup, EdgeNodeID = MyEdgeNode and DeviceID = MyDevice

When tag data changes, there is only one publish topic from this MQTT Client and any folders below the Tag Path are represented in the tag name included in the payload

Topic: spBv1.0/MyGroup/DDATA/MyEdgeNode/MyDevice

Payload: {"timestamp":1643828854747,"metrics":[{"name":"Lakeside/Tag3","timestamp":1643828852918,"dataType":"Double","value":32.82691817225028}],"seq":10}

Returning to our first example tag tree:

Image Removed

Image Removed

Even through we have a well formatted tag tree and could take advantage of the dynamic nature of the MQTT Transmitters configuration, we can still explicitly set the Sparkplug IDs.

We will have the following Sparkplug IDs and only one MQTT Client created.

GroupID = MyGroup, EdgeNodeID = MyEdgeNode and DeviceID = MyDevice

When tag data changes, there is only one publish topic from this MQTT Client and any folders below the Tag Path are represented in the tag name included in the payload

Topic: spBv1.0/MyGroup/DDATA/MyEdgeNode/MyDevice

Payload: {"timestamp":1643829342647,"metrics":[{"name":"Facility1/Line1/PLC1/Tag3","timestamp":1643829340684,"dataType":"Double","value":-49.89888853762046}],"seq":89}

Payload: {"timestamp":1643829404508,"metrics":[{"name":"Facility1/Line1/PLC1/Tag3","timestamp":1643829402895,"dataType":"Double","value":-16.272136663001845}{"name":"Facility1/Line1/PLC2/Tag1","timestamp":1643829403931,"dataType":"Int32","value":50}],"seq":120}

Payload: {"timestamp":1643829415502,"metrics”:[{"name":"Facility1/Line1/PLC2/Tag1","timestamp":1643829403931,"dataType":"Int32","value":60}],"seq":130}

Excerpt IncludeFAQ: Ignition Modules

FAQ: Ignition Modules
nopaneltrue