# Historian and Sparkplug-B

**URL:** <https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709>\
**Category:** Ignition\
**Created:** [October 1, 2019, 5:19pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709 "2019-10-01T17:19:37Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikeg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mikeg/32/8853_2.png) [@mikeg](https://forum.inductiveautomation.com/u/mikeg)\
**Post date:** [October 1, 2019, 5:19pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/1 "2019-10-01T17:19:37Z")

</div>

I’m trying to understand the interaction between Ignition’s own data logging process and historical data delivered via Sparkplug MQTT.

Specifically, as I understand it, Ignition will sit and monitor the live value of a tag, looking for changes according to its deadband algorithm and the minimum and maximum sample times specified in the tag configuration. Any changes that make it through the processing will be stored in SQL. That all makes sense. But suppose the MQTT provider drops offline, and upon recovery, dumps a huge series of historical values into Ignition via Sparkplug, tagging each as historical via is\_historical property on the metric.

The question is: Does this historical data get plonked straight into the SQL database without going through the processing that Ignition applies to data that it itself samples, or are the deadband and sample rate properties applied?

In other words, suppose a tag is configured with a deadband and a minimum sample time of 10 seconds. I understand that if MQTT is delivering live data, only values that meet these criteria will get put into SQL, so you’ll see a sample at most one every 10 seconds. But suppose MQTT then delivers 5 minutes worth of historical data that is sampled one per second and often does not exceed the deadband. Does this historical data go straight into SQL, or is subject to the sample processing as live data?

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [October 2, 2019, 8:43am UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/2 "2019-10-02T08:43:17Z")

</div>

Perhaps @wes0johnson could answer to your question.

---

<div class="post-metadata">

**Author:** ![wes0johnson](https://avatars.discourse-cdn.com/v4/letter/w/7ab992/32.png) [@wes0johnson](https://forum.inductiveautomation.com/u/wes0johnson)\
**Post date:** [October 2, 2019, 3:24pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/3 "2019-10-02T15:24:31Z")

</div>

On your questions:

> Does this historical data get plonked straight into the SQL database without going through the processing that Ignition applies to data that it itself samples, or are the deadband and sample rate properties applied?

By default this is how it works in that data is just written directly to the DB bypassing 'tag change events. There is an alternate configuration which will result in all data being flushed in order from the edge and tag change events will be called/triggered.

> In other words, suppose a tag is configured with a deadband and a minimum sample time of 10 seconds. I understand that if MQTT is delivering live data, only values that meet these criteria will get put into SQL, so you’ll see a sample at most one every 10 seconds. But suppose MQTT then delivers 5 minutes worth of historical data that is sampled one per second and often does not exceed the deadband. Does this historical data go straight into SQL, or is subject to the sample processing as live data?

There are a a lot of factors to consider here... Generally we would recommend that deadbands be set on the OPC tag at the edge/Transmission side. In that scenario if history was being stored at the edge only values that crossed the deadband limits would ever be stored and forwarded (just as they would trigger tag change events). So, by doing this the data to be thrown out never even gets transmitted over MQTT.

---

<div class="post-metadata">

**Author:** ![mikeg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mikeg/32/8853_2.png) [@mikeg](https://forum.inductiveautomation.com/u/mikeg)\
**Post date:** [October 2, 2019, 9:24pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/4 "2019-10-02T21:24:20Z")

</div>

Thanks for this. You say that there’s an alternative configuration. For completeness, can you explain how this mode is enabled? I agree BTW that the edge device should be applying the deadband etc. Just want to make sure I understand how it all fits together!

---

<div class="post-metadata">

**Author:** ![wes0johnson](https://avatars.discourse-cdn.com/v4/letter/w/7ab992/32.png) [@wes0johnson](https://forum.inductiveautomation.com/u/wes0johnson)\
**Post date:** [October 2, 2019, 11:15pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/5 "2019-10-02T23:15:16Z")

</div>

On the Transmission Transmitter config, there is a ‘In-Order History’ boolean. Change this to true. On the MQTT Engine side under the general tab, there is a ‘Store Historical Events’ boolean. Change this to false. This will use the alternate configuration that will trigger tag change scripts, alarms, transaction groups, etc on the MQTT Engine side. Keep in mind there are only two valid configurations for these parameters. Those are the default settings and those outlined here. Any other combination doesn’t make sense.

---

<div class="post-metadata">

**Author:** ![mikeg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mikeg/32/8853_2.png) [@mikeg](https://forum.inductiveautomation.com/u/mikeg)\
**Post date:** [October 3, 2019, 2:28pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/6 "2019-10-03T14:28:12Z")

</div>

Forgive me, but I need a clue on where to find the Transmission Transmitter…

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [October 3, 2019, 3:24pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/7 "2019-10-03T15:24:53Z")

</div>

Gateway configuration home page -\>configure-\>MQTT Transmission-\>Settings -\>Transmitters tab

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [October 5, 2019, 5:07pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/8 "2019-10-05T17:07:30Z")

</div>

@wes0johnson, @Kevin.Herron

I don't think we can manage the deadbands on opcua tag in Ignition 8.0 ?

> [@OPC Subcription Settings](http://forum.inductiveautomation.com/t/opc-subcription-settings/10876):
>
> Does Ignitions OPC UA client support more advanced subscription/monitoring settings such as: Queue Size Discard oldest objects Data change filters Data change triggers options (Status/Value/Timestamp) Deadband Type: Absolute/Percent Deadband value These are very nice features to reduce network bandwidth between the OPC server and client as well as system utilization of processing new values. It lets the OPC server handle the bulk of the work load as it should. A great free test OPC UA c…

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 5, 2019, 5:56pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/9 "2019-10-05T17:56:58Z")

</div>

No, but in 8.0 Tag Groups have an option to configure the Queue Size for all Monitored Items in the group as well as the UA Subscription Publishing Interval.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [October 6, 2019, 7:01pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/10 "2019-10-06T19:01:54Z")

</div>

Interesting, does it mean it is possible for a third party opcua server to push lots of timestamped data to the Ignition client with this ?  
Some opcua server are connected to RTU with a protocol which transmit historical data in case of connections failure with the RTU. We want these realtime data délayed in time go through Ignition realtime alarm and historical traits.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [October 6, 2019, 7:25pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/11 "2019-10-06T19:25:21Z")

</div>

Yes, and that’s how we intend to support DNP3 event buffering. I think alarm and history systems still need some small changes to accommodate the arrival of this bulk data, though.

---

<div class="post-metadata">

**Author:** ![prashanta.shrestha](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/prashanta.shrestha/32/20575_2.png) [@prashanta.shrestha](https://forum.inductiveautomation.com/u/prashanta.shrestha)\
**Post date:** [October 7, 2019, 3:45pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/12 "2019-10-07T15:45:16Z")

</div>

I am not able to record all Sparkplug historical data points to Ignition Historian.

This is my setup - A node.js program sends 50 SparkplugB messages (using [sparkplug-client](https://www.npmjs.com/package/sparkplug-client)) - each message contains incremental value from 1 to 50; timestamp is set at 10 ms apart and metrics.isHistorical = true.

On the Ignition Gateway \> MQTT Engine \> “Store Historical Events” is enabled.

Tag History is set up for the metrics in question, with Historical Scanclass set to “Evaluate on Change”

After the Sparkplug message are done sending, upon checking sqlt\_data\_\* database table, only one data point is being recorded.

Is there any other setting I am missing here?

---

<div class="post-metadata">

**Author:** ![mkeenan](https://avatars.discourse-cdn.com/v4/letter/m/aca169/32.png) [@mkeenan](https://forum.inductiveautomation.com/u/mkeenan)\
**Post date:** [August 28, 2020, 2:35am UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/13 "2020-08-28T02:35:48Z")

</div>

Thanks for this info. Would this still work with a timer based transaction group?

---

<div class="post-metadata">

**Author:** ![wes0johnson](https://avatars.discourse-cdn.com/v4/letter/w/7ab992/32.png) [@wes0johnson](https://forum.inductiveautomation.com/u/wes0johnson)\
**Post date:** [August 28, 2020, 3:57pm UTC](https://forum.inductiveautomation.com/t/historian-and-sparkplug-b/28709/14 "2020-08-28T15:57:03Z")

</div>

It would not in all cases - it really depends on how your timing parameters are set up both in the Transmission side ‘flush rate’ as well as in the Transaction group poll rate. This is because during a flush, tags can be written very quickly to the tag on the Engine side as it is ‘catching up’. As a result, time based polling in a Transaction Group will miss tag events because they’re happening faster than at regular speed.

For this reason, we created ‘latch tags’, which allow you to sync events between MQTT Engine and a Transaction Group or Tag Change Script. See here for details: [https://docs.chariot.io/display/CLD80/MQTT+Engine+Tag+Latching](https://docs.chariot.io/display/CLD80/MQTT+Engine+Tag+Latching)
