Transaction Group Trigger

Issue with duplicate writes to database and triggered tag has not changed.

I am monitoring production benders and want to write the partno, Cycle time, and a few other variables to the database when the part count increments on the machine. It seems to be working about 95% of the time but then it begins to duplicate the records. sometime more than 10 times.

Setting:

I want to discard when the part count is 0 as that is the operator changing over. As soon and the part count >= to 1 it will write the values. This seems to work without issue but then I get duplicates.

What am I doing wrong?

You are both monitoring for multiple tags to change (they don't necessarily change simultaneously), and the trigger is not limited to once per active status.

I recommend you use a single trigger tag that only ever increments on the PLC side. Trigger when it changes (any change). Use OPC Read mode to force all the non-trigger values to be explicitly read from the PLC after the trigger change. Ensure the PLC changes the trigger counter last.

1 Like

Should I uncheck "only evaluate when values have changed" ? and only use the "Execute this group on trigger" with "Active on value change" checked? I need to make sure the part count is not 0

I don't think you can check that and use value change. You would have to make sure the PLC set that back to zero in between cycles.

Or, check that PartCount is ≠ 0 in a database trigger, not in Ignition.

Hello jmr, so many months after did you find a solution? I have the same problem.

This thread did not solve the issue. it just stopped duplicating but now it has started to duplicate the count again after I added a new transaction group (ie machine that is in its own group)
I am not writing anything to the PLC only reading the machines.
Did you ever solve your issue?

Ok I figured it out. the Trigger on the part number change was working but I was looking at the database to find the last Part No, Part Count, and Timestamp to update my calculation. The problem is that sometime the data is stored before forwarding to the database so the last record I was looking at in the database is old and not really the last transaction.
How can I store the last triggers values in Ignition so that I can do my expressions to calculate the Cycle Time, change over time, or Downtime.

Example of what I am doing.
Context. The machine counters are different between all my factory machines this one only has a total running count and I am not able to make changes to the PLC.

PartCount = (Triggered Expression)

if({[~]Memory_LastPartNo}={Machine/PartNo_Formated},{[~]Memory_LastPartCount}+1,1)

Memory_LastPartCount (Triggered Expression)

{[~]PartCount}

Memory_LastPartNo = (OPC TAG)

{Machine/PartNo_Formated}

Memory_LastPartCaptureTime = (Triggered Expression)

NOW()

RealCycleTime = (Run-Always Expression)

secondsBetween({[~]Memory_LastPartCaptureTime},Now())

MyCycle Time = (Run-Always Expression)

(if({[~]ChangeOverTime}+{[~]Downtime}>0,0,if({[~]RealCycleTime}>900,0,{[~]RealCycleTime})))

ChangeOverTime = (Run-Always Expression)

if(({[~]Memory_LastPartNo}!={Machine/PartNo}),if({[~]RealCycleTime}<90,0,if({[~]RealCycleTime}<7200,{[~]RealCycleTime},0)),0)

Downtime =(Run-Always Expression)

if({[~]RealCycleTime}>175,if(({[~]Memory_LastPartNo}!={Crippa 980MX1/PartNo_Formated}),0,if({[~]RealCycleTime}<7200,{[~]RealCycleTime},0)),0)

I have tried to create a Memory Tag to store the last transaction data, but I am unable to figure out how to write the values to the Memory tags when the trigger activates.
Currently the Memory_LastPartNo is changing when the OPC tag changes even though it should only update on the triggered expression.

Prevent trigger cuase by group start CHECKED

Trigger condition

Active on value change CHECKED

The database part was working for a long time but as soon as I added another machine, I believe it started storing data before sending to the database which has now changed the way everything was working.