OVERVIEW - we created a scale on a conveyor that weighs our products as the product moves over two load cells. I'm trying to record the peak value of the scale output tag every 5 seconds. I've been reading as much as I can in the forum and there seems to be several ways. I've tried a little code but I'm just learning.
CURRENT SETUP - I've created a transaction group with tag values as "Event meters" for each lb. 10 thru 40 lbs. I've played with the scan class of each of the tags to see what speed worked best. This works to a point. Every once in a while, the same tag will record (MySql) a data point then one second later it'll record another. This means the same product is getting weighed twice with usually different weights. The event meter works great. Should I use a query to weed out the stuff I don't want or go a totally different way?
SOLUTION - Open to ideas for pointing me in the right direction.
This really needs to be PLC code. I would normally max value trap running as fast as fresh scale values arrive. Use some near-zero threshold to copy to a holding register and then reset the max value for the next package. Probably bump a "new value" odometer at that point, too, for Ignition to watch for changes. When the odometer is bumped, read and record the holding register.
Thank you! I'm learning more in Studio 5000 so I'll take a look at what you're suggesting and give you an update.
It's been a while, but I still wanted to let you know I was able to capture the scale peak value by modifying the PLC program. I'm sure there's probably a better way of doing this but it works. First, I added a Timer On Delay (TON), then a Greater Than (GRT), a Move (MOV) and then a Reset (RES).
In Ignition I used a transaction group to send the peak value to a table. I then use a named query to fill a bar chart, a numeric label to display the most recent weight, and the most common weight.