Mantle: Sparkplug B tags in Ignition, with no reference tags
A Sparkplug B Auto-Historian for Ignition 8.3, with Alarms on the Generated Tags and No Gaps in History
All posts · Mantle ·
Companion post for the Mantle video. It shows all of this on screen in about six minutes: watch it here.
As controls engineers, we spend a lot of our time making tags in the PLC, and then we make them again in the HMI, and sometimes again in the historian. We have all these tag databases to maintain over time, and it's very time consuming.
The whole point of MQTT to me, besides the bandwidth and performance improvements, is that we make our tags once in the PLC, publish them straight to the HMI, and they're automatically there for all the consumers and subscribers on our network. The usual advice for MQTT tags in Ignition is to build reference tags and configure those for history and alarms. So we have two different sets of tags. To me, that defeats the purpose. We want to build the tags once at the edge, configure them in that one place, and have everything just get them.
So I wanted a module where I could work with the tags that are generated automatically, with no extra manual steps like creating reference tags. That's Mantle, a Sparkplug B module for Ignition 8.3 that we wrote. It's free and open source.
Every tag historized
I also wanted every tag historized automatically. I work in a lot of regulated industries where data is very important, and the most likely cause of history data loss isn't downtime or something breaking. It's usually that we never set up the tags for history in the first place, or we forgot a tag.
As long as you have a historian provider set up, every tag Mantle creates is historized. The trend in the video is from our Core historian, starting at birth, and I didn't set any of those tags up. They started coming in as soon as they were birthed.
Writes work too, using Sparkplug B's NCMD. If I write the setpoint from Ignition, it goes down to the controller and shows up on the trend.
Installing it
Sparkplug B is a standard format for the payload in MQTT, so tag names, values and data types all come across in the payload. In Ignition, Mantle installs like any other 8.3 module. It's simpler than the official MQTT module because it was designed only for Sparkplug B, so there are fewer configuration options: a name and a broker URL under Connections.
The edge in the video is Nautilus, because it's the easiest thing to test with. My AI coding agent can spin one up, build a manifest and publish tags, and we can see them in Mantle within minutes, from scratch. Any Sparkplug B edge works.
Alarms on the generated tags
Since Mantle works directly with the generated tags, the alarm goes right on the tag, no reference tag needed. In the video I add Overspeed on the pump, above 1800, run it at 1900, and it's active.
A UDT change at the edge keeps everything
Our pump is a UDT. I add a temperature to it in Nautilus, it rebirths, and in Ignition the UDT picks up the new member with its value. My alarm is still on the speed. Everything is preserved.
Typically, a UDT change at the edge in the official MQTT module means deleting those tags in Ignition and building them again. Any configuration you've done to them gets lost, or you spend time exporting it beforehand and reapplying it. I wanted to make sure our module didn't do that.
Store and forward, and the primary host
Store and forward in Sparkplug works using something called the primary host. You have something identified as the primary host, Ignition in our case, and edge nodes publishing up to it.
The primary host publishes its status to a retained topic on the MQTT broker, so the value stays on that topic, and an edge that connects later sees it as soon as it connects. When the primary host is online it publishes online, with a will that says if the primary host ever stops talking to the broker, set that topic to offline.
All the edges watch that topic. If it ever says offline, they start storing their values. Once they see it's online again, they publish all of their values, usually paced so they don't overwhelm the bandwidth, and the primary host backfills that data into the historian. You have no gaps in history, even if your MQTT broker or primary host goes offline.
In the video I do it while looking at Ignition. I stop the broker with Ctrl+C. The controller says the primary host is offline and starts storing. In Ignition the tags go stale, but they keep their values. Then I start the broker back up, the controller births again and forwards what it stored, and the gap in the trend fills in.
The will timeout
One thing to keep in mind is the will timeout. If Ignition crashes instead of restarting, the broker only sends the will once the keep-alive runs out. With Mantle's default of 30 seconds, that's up to about 45 seconds, and what the edge sends in that window isn't stored. You can shorten the keep-alive in the connection settings to limit the window, but in the case of a crash you'll probably get some data loss.
Try it
Mantle is free and open source (Apache-2.0). If you try it and find any issues, you can submit them on GitHub. We're very responsive there and would really love your feedback.
Download Mantle 1.3.4: Mantle.modl · Source: github.com/joyautomation/ignition-modules · The page: joyautomation.com/software/mantle
If you think Mantle or Nautilus might fit your next project and you need support, reach out to us at Joy Automation. We also do pre-configured server platforms and custom industrial application development, including long-term support plans: joyautomation.com/services.
Subscribe to the weekly newsletter to keep up to date: joyautomation.com/newsletter