I am trying to monitor my PLC for setpoint changes which don't occur very often.
I am using the "Only evaluate when values have changed" without a "Trigger on Item".
I have about 30 setpoints so this feature works well without having to write PLC code.
The trigger always works when the values change.
My issue is sometimes it inserts a record even though the values haven't changed. This seems like maybe it is somekind of OPC disconnect but I'm not really sure. I get a few random inserts happening at night when the machine is idle but no one is at the machine. I end up with essentially duplicate records (even though no changes occur) every morning when I check.
Not sure what to do to eliminate this (or if its possible). I was thinking about writing code in SQL db to delete these duplicate values via Rollback. Any body else come across this and have any good solutions?
I tend to use scripted inserts instead of transaction groups when triggering is anything other than the simplest value change, or a reliable handshake is required, or complex duplicate detection is required (which generally requires a custom DB query during startup to cache the true last recorded value).
Scripting is a good solution, but not necessarily easy.
Hi. Can you expand on what you mean by "when triggering is anything other than the simplest value change".
My group seems straightforward though there are several values (30 numeric mostly integer values) not just 1 or 2.
I would like to understand what is making Ignition think there is a change in the values (when there isn't).
Just came across this while searching for something. I know this older question.
What I did for something very similar is on my tag
Tag Change Script
If new Value <> old value
Then SQL insert command
Since it is on tag change script it gets triggered when value changes but it checks to see if value actually changes (I believe the tag change script does trigger sometimes due to quality change thus the check to see if new value and old value are different.) This should solve your issue of non change entries.
Here is the code I am using
Had some issues if the value was blank so I check for that and insert "Null" for value
Verify the value did change
Update new value into DB table
Insert row into audit table to see when it was changed + values.