How to Plot a Folder of Tags in an XY Chart?

I am creating a dashboard in Ignition Perspective to monitor a parameter (we'll call it Parameter1) for an ultrasonic welding process over time.

I want to make the distinction that I am NOT looking to create a time series chart that updates on a set time interval (where the x axis is Time and the y axis is Parameter1). The ultrasonic welding process is run at irregular intervals (like, a few times a week), so it's not useful to see how this parameter varies with time.

It is important that I can display how this parameter varies with cycle number (e.g., Is this parameter drifting over 500 cycles? 1000?).

I have set up an OPC-UA server (connected to Node-RED) which has a folder containing 1000 tags, representing the last 1000 cycles. I added this folder to my Tag Browser (the values vary in the third decimal place, not shown):

Would it be possible to plot these values in an XYChart, where the X axis is Cycle Number? I tried binding the entire tag folder to an array but this did not work.


image

I manually binded the first 5 individual tags to values in objects (and manually added the cycle numbers) in a dataSource just to show what I am envisioning. However, I am wondering if there is a cleaner way to accomplish this task. Obviously this approach will NOT work for 1000+ tags.

image

Side note: any guidance on editing the tick marks on the Y axis here?

Would using Tag History be a better approach here? Again, I'm looking for a scatter plot with a new discrete point every time a weld cycle is run, NOT a time series chart.

Normally, I'd suggest a transaction group or scripted equivalent, but-- as it appears you are using edge-- that is not available to you.

A script should work ok here to collate all the points and stick them into a dataset tag. Something like:

baseTag = '[edge]Collapse Distance/c{}'

tagCount = 1000

tagPaths = [baseTag.format(i) for i in range(tagCount)]

headers = ['cycle', 'collapse']
data = [[i+1, tag.value] for i, tag in zip(range(tagCount), system.tag.readBlocking(tagPaths))]

system.tag.writeBlocking(['[edge]path/to/collated/data/tag'], system.dataset.toDataSet(headers, data))

Then you can just bind your data to the tag.

2 Likes

Thank you for this.

Where would this script live within Designer? I'm new to Ignition and just not quite sure where to start with a script that's used to configure tags.

I would add a tag that changes when a new test is run (I like using one that increments by one, for example).

Then I would use it to fire a Gateway Tag Change script to update the values.

1 Like

This is really helpful thank you.

So it looks like I would want to,

(1) Create a Memory Tag with a Data Type: Dataset.

(2) Add a Gateway Tag Change Script and attach this script to any tag path (obviously not the Memory Tag I just created, but I think I can just use one of the 1000 OPC tags from my OPC-UA server, since these will all change any time a weld cycle is run) which changes at the instant I need my Dataset to update.

(3) Paste your script into the Script tab of the Gateway Tag Change Script I just created.

(4) Copy the path of the Memory Tag and replace [edge]path/to/collated/data/tag with this path.

However I tried this and I'm not seeing the Memory Tag update with any values after a weld cycle is run (even though the OPC tags are definitely changing), it just says null.

Any idea what I am missing here?

Is there any error in the gateway log?

And does the script work in the script console?


It works! Definitely need to do some formatting but thank you!

Also kind of cool, you can see after cycle 700 where the data converges.

2 Likes