Tag History binding returns only values of 0

Hello,

I am having trouble configuring an XY chart to display historical tag data. I currently have a tag, PressureArray_01, that has historization enabled on it. I have a view, test, with a single XY chart on it. I have a custom property called key, that is an array object. It is set up to be the array object that the XYChart's datasource property will be bound to. I am running into an issue where the tag history binding is only returning values of 0.

Could someone help me understand why the this is happening? What I am expecting are values that should be similar to the results of a queryTagHistory function call:

Hi Tony,

Can you show your Tag History binding? I think what's happening is a rounding issue - somewhere, the (already miniscule) values are being truncated.

For instance, look at your first value displayed in the Script Console:

7.56e-08 == 0.0000000756

Those are very small quantities, so visually they would show up near 0 at your zoom level in the screenshot, but the values should still be non-zero in your raw dataset.

Here are some screenshots of the binding and related items.


image

Can you hover over the Tag History binding preview? I want to see if its also showing 0s there.

I'm out of my depth here, but I still believe there's a truncation or rounding issue. The aggregate mode in your snip is set to average - that means the the values will be added together divided by the number of points in that time slice. This could be where 0.0000000756 turns into 0, but I'm not sure.

Can you change your view.custom.key to try setting aggregate to LastValue instead of Average to test out this theory?

Thank You for the prompt reply. Unfortunately I tried both of those things and the issue was not resolved.
image

1 Like

One last thing: can you try setting the Query Mode to AsStored instead of PointCount?

I've tried that as well but that makes it so that nothing is returned.

One last, last thing: can you set the Time Range to Historical with the startDate being now() - 1hr or so to see if you get values? I'm trying to eliminate any differences between your system.tag.queryTagHistory call and the Tag History binding.

It almost seems as though I am not able to fetch the tag history properly.

Doing what you suggested shows NULL values instead of 0. I wonder if this is why real time is showing 0s because its interpolating these NULL values to 0.

That usually means you are:

  • Using an external OPC UA server, and

  • That server's time is wrong, putting values into history in the past. (Or future, perhaps, but that usually yields wrong data, not missing data.)

We have 2 gateways, one for HMI and one for IO. Previously we were able to pull tag history through the remote provider and were able to trend realtime and historical data. Its only recently that we have been seeing the behavior mentioned above. Do you have any advice on how to troubleshoot?

Start by looking at your tag timestamps. If they are wildly different from current gateway time, fix your OPC UA source server's time.

After that, I'd look in the gateway logs for history-related errors.

2 Likes

Just thought I'd post an update. After following pturmel's advice, I found that the date and time setting of the machine where Ignition was installed was wrong and after correcting the time I was able to see the tag history again.

2 Likes