Couting parts with a sensor

What do you guys think is the best way to collect produced parts with a sensor?

what i got is a sensor at the end of a line that count boxes, then i got a counter on my PLC
Then on my transaction groups i create an historical group that logs the ACC of the counter
I reset the ACC to 0 with the counter DN when its equal to 0.
what im getting is a lot of 0’s in my DB and sometimes im missing boxes.

I havent found another way to count parts with transaction groups.

Someone have an idea?


How fast are your boxes coming in?

I do sort of the same thing with contamination count buttons, but instead of trying to catch every button press I just have an internal data register in the PLC increment everytime one of the buttons is pressed. Then I made a block transaction group that looks to see when the data register value changes and I stuff that value into the database, then I aggregate later on with a SQL query. It would work good with multiple lines or products because you can call that out in your block group. This is how I have mine set up:

Then I just aggregate over the day with this query:

SELECT Bad_Reason as "Reason", count(Bad_Reason) as "Count" FROM Hotdog_Bad_PKG_Counts where RP1_Running = 1 and t_stamp >= DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0) and t_stamp < DATEADD(day, DATEDIFF(day, 0, GETDATE()), 1) group by Bad_Reason

You could probably do something similar but you have to watch how fast your boxes come in and how quickly your OPC tag is updating and how quickly your transaction group is running. If you get two boxes per OPC read or transaction group cycle then you’ll miss boxes. Otherwise you could still use the incrementing data register and figure out with a bit of scripting how many boxes went past since the last read.

Hopefully that points you in the right direction.

the boxes or parts are coming really fast, sometimes at 200 parts per minute.
I never used block transaction group, not sure if it will work.
I will try this and post if it worked for me.