Logging flow totals

I have a dump scale that’s measuring flow rate of a stream of rice which has a accumulator to poll. Right now I am using Wonderware to poll every hour and take the current total and previous total and move the difference to a database and the current value to a register for a reference for the next hour, basically a totalizer.

I would like to do the same thing in Ignition but don’t know if it would be better to use a script that runs at the hour as in Wonderware or if this is something that could be done in a transaction group.

Personally, I’d go with a transaction group. That way, if you happen to lose connection to the database, the Store and Forward engine will hold the entries for you until it restored.

Just my 51-cent’s worth (adjusting for inflation). :wink:

This is my mockup transaction group with three items:



last_flow reads the last entry in the database.


total_flow reads from the SQL_Tag. In this case, it’s from the SLC Simulator.:


delta_flow is the difference between the two:


My usual preference is to log both the accumulator value and the delta value. That way, you can have an extra bit of historical data to play with.

I actually just figured this out about 30 mins before you posted. I did it pretty much the same way except where I created the reference tags. I like your way better, it’s better organized.

I created a SQLTag for reference which is a query

SELECT COALESCE (Headriceaccum,0) FROM reportingsandbox ORDER BY reportingsandbox_ndx DESC LIMIT 1;

Then in the transaction group I log the accumulated, reference and calculated total every hour.

The added bonus I discovered using transaction groups is I can build a sql table like I need for a report without having to do a bunch of sql scripting.