[00:00]
In this video, we are going to take a look at how we can configure tag history. Tag history is Ignition's built-in method of recording tag values to a database, and then later pulling them back out so that we can view them within our projects, all without having any knowledge of how a database works, or how to use the SQL Query language. All we need is a valid database connection. To configure tag history, we need to open up our designer, and find a tag. Tag history is actually configured on the tag itself. So when we find our tag, we'll go ahead and edit that tag. Here in the tags properties, we're going to scroll all the way down to the bottom of this list. We're going to find the history section, and there's going to be a single property there called history enabled. To turn on tag history, we need to set that to true.
[01:05]
Now, when you do that, you'll notice the scroll bar on the right jumped a little bit. And that's because there are now additional properties under this history section when history enabled is set to true. So I'm going to scroll down so we can see the rest of those. Now to finish configuring tag history, the only other thing that we need to do here is specify a storage provider. The storage provider is the database where you want to store your tag history data. I'm going to go ahead and specify my database that I already have set up and connected. Now like I said, this is actually all that we need to do. We can leave all these other properties at their default settings, hit okay, and we are now storing history on this particular tag. You'll notice that the tag has a symbol next to it of a little clock that signifies that historical records are being saved for this particular tag. Now that historical values are being stored for this tag, we can pull that data back out of our database using either a chart or a table, or any of the other components that we might have in either Vision or Perspective.
[02:14]
You can find out more information about how to pull the data out of the database, by checking out some of our other videos, such as tag history binding in either Vision or Perspective, or our various charting videos. Now while the tag history system can work just fine at default settings, you may recall that there were a few other properties that we can configure on the tag when we set up tag history. Let's take a look at those now. There are three properties in particular that I want to talk about. The first property is Deadband style. Now by default, the Deadband style is set to auto, but there are actually two main settings for Deadband style. Either analog, or discreet. To put it simply, the Deadband style of discreet is used for tags that have discreet values, such as a status.
[03:09]
When the values for this particular tag are recorded with a discreet Deadband style, we can assume that the values jump from one to the next. So if the values that get recorded go from zero to then two, the jump is immediate. The analog Deadband style works a little bit differently, and is typically used for tags that do not have discrete values. Take, for example, a temperature. While a temperature can have values of say 60, 61, and 62, there are many values in between those values, such as 60.5 or 61.7. So when the tag history system records this tag with a Deadband style of analog, the tag history system assumes that the value is flowing from one value to the next. Meaning if I had recorded a value of 60, and then later a value of 62, I can assume that at some point, the value flowed over 60.5, 61, 61.5, and all of the values in between.
[04:11]
Again, very different from discreet, which would go from zero directly to two without ever being one in between. The default setting here of auto simply determines for you based on the tag data type and its values. The next property that I want to talk about is the Deadband mode. The dead band mode determines how to apply the Deadband to the value of the tag to determine when it's changed. By default, it's set to absolute, and the historical Deadband property will directly be applied to the value of the tag. However, it is possible to change the Deadband mode to percent, at which point the historical Deadband will be applied as a percentage of the tag's value. The last property that I want to take a look at here is the sample mode property. The sample mode property determines how often we are going to be sampling this tag to determine if we are going to store it in the database.
[05:07]
By default, the sample mode is set to On Change, which means that we are going to check the tag value every time it changes to determine whether we should store it within the database or not. If you're pulling your tag at a very high rate, that may be a little bit quick though. So we do have some other options available to you. Periodic allows you to specify a rate at which you want this to be sampled. Say, you can set your periodic rate to 10 seconds. You would be able to set that up there. The other option is Tag Group, which specifies a rate based on a tag group that you have previously set up. These tag groups are also used to specify a rate at which tags are sampled. And you can use those here within your tag history setup as well. Tag Group is similar to the periodic option, but Tag Group allows you to take advantage of some of the tag group's features, such as driven or leased tagged groups.
[06:08]
The last thing that I want to go over is turning on tag history on a UDT. Configuring history on a UDT works very similar to how you would configure history on a standard tag. The big difference is that you configure the tag history in the UDT definition, rather than on the tag itself. I already have a UDT setup, and some instances of this UDT created here. I've got some motors, and you'll notice none of them have history being stored on them. And if I go over to my UDT definitions tab, we can see my motor definition there. I'll go ahead and edit the definition, and select one of my tags inside, say this amps tag. And just like before, I'm going to scroll down to the bottom of its property list.
[06:59]
I'm going to find that history enabled property, and set that to true. Again, I'll scroll down further, and find that storage provider setting, and choose a storage provider where my data will be stored. I can then configure any of the other properties that I want, and when I'm done, I can hit Okay. This tag history setting will now be applied to this UDT. So all instances of the UDT will now be storing history on that Amps tag.