We have multiple PLC’s on each manufacturing line (between 3-5), and multiple lines in our plants (between 8-20 depending on the plant). We want to track historical tag data from each PLC as the data changes and store it in a table.
Transaction groups is working for one PLC and it’s tags to trigger data collection as the values change. The issue lies in the fact that some tag names are the same between the PLC’s in the plant. The transaction group will not run if there are two tags of the same name, even if they are on different PLC devices.
We want to collect multiple PLC’s tag data in one table as the values change. Ideally each row in the table will represent an updated record from one PLC, with the columns representing the tag values. Each time one of the values change, it makes a new record with all tag values. Is there any way to do this in one table without having to make transaction groups for each PLC on each manufacturing line?
With what you wrote, I have a couple questions:
Are all of the plant logging to the same database or is the database the same name on each site?
How are the tag names the same? Are you just talking about the column name you gave them in the transaction group or the actual tag? To look at them all at once your tag paths would have to be different even if your using OPC addressing. If your creating tags in Ignition then they would still have to be unique in Ignition even if its just a line number that changes.
Did you build your tags using UDT’s?
Is the trigger a single value changes or any of a group of values?
The reason I asked these is if your looking at a group of values to trigger your transaction group you would have to have a way for your transaction group to know which one had a value change in order to collect the data. The issue I see is if 2 lines trigger at the same time, even if you have a way to tell it which one triggered, only one would be recorded.
I think you will have to do either separate transaction groups or you could do a value change script in your UDT, assuming you built one, that grabs the data and creates your entry. Either way is easy to do.
If your tag structure is the same and just has a line number that changes you can create a memory expression value for your line number then use the tag() expression function to get your value through other expressions instead of directly from OPC tags. Doing this you can make it ones then copy it for as many lines as you need.
Doing it through a value change script you can extract the line number from your tag path, assuming it is part of the path, to use for one of the columns you insert into your table, then you can do reads on the other values you need and run a named query to insert the data into your database.
All of this depends on how you have all your tags set up though. But where you listed your issue being that some of the tags have the same name, I’m not sure how that could be an issue since you would have to have a unique path either by your device name or something in your tag path.
Thanks for the help. We ended up solving the problem by creating a transaction group for each PLC, and pointing all the groups to one SQL table. We did this by using common target names between all the tags so that the data ends up in the correct columns, and all the unique tags have their own column. Each time data is recorded from each PLC it creates a new row and all the other fields not related to that PLC just log NULL. This makes our Queries much simpler than using lots of different tables.
Sounds like its going to be a ton of maintenance. Now you have a very wide and tall table, which will work, for awhile. Consider partitioning or Scheduled Events to keep the table cleared out. The data probably belongs in different tables with appropriate foreign keys for querying.
How did you do it? You did a tag to column mapping?