I have a few groups that are setup to log a change to the db when the condition goes from low to high. (Event meter) All works well until (some) change is made to a group item (any) and saved. The meter then resets to zero. What is causing this?
Just to clarify, the item actually is set up as an event meter, and the group is set to… update a row? Or insert a new row?
If the item is an event meter, the current value is stored in memory. When the group is modified, it is reloaded, and that value goes back to 0. The only way around this would be to set the item to “bi-directional, db wins”, assuming you’re updating the last row. When you do this, the value from the db (the last event count) will be written to the item on group start, causing it to start where you left off.
Let me know if your setup makes this impossible.
Table action = update/select first. There is only one row in the table that is constantly updated.I have changed the items to Bi-directional db wins. The group is set for opc to db. Only two items in the group.
I noticed today that these items are resetting on their own. This is still an issue.
The resets are only occurring when the group is edited, or at other times? Could you export the group and post it here? If the event meter item is bi-dir db wins, it definitely should get updated- but maybe in my mockup I’m missing something about your group.
Here is the export:
The resets are happening on a save and randomly running normal
Switch Monitor.xml (5.4 KB)
The group looks fine. However, I’ve been looking around, and it appears that the count will get reset if the data quality goes bad. This is wrong, and it should hold it’s last value when the underlying data becomes good again. I suspect if you look at your logs around the times that the value goes back to 0, you’ll see timeouts or other problems connecting to the PLC.
If not, the only other thing that comes to mind is that another group is writing to the same table. However, it seems much more likely the that the data quality is blipping out for a bit.
As for the reset when the group is saved, the bi-dir setting should handle that, but perhaps there’s something with the timing of when the good value comes in from the plc that’s tripping this other issue.
What version of Ignition are you running? We should be able to get an update out quickly for the SQL Bridge module to prevent the quality based reset.
I’ve back ported the fix to 7.2 for the quality issue that I suspect is causing your issues. We haven’t confirmed for sure that this is what you’re running into, but it seems likely: if the data quality goes bad (because the PLC connection times out, or something similar happens), it could possibly reset the event meter value. Similarly, I think that if the value takes some time to go good on startup (more than 1 cycle of the group), the same bug could cause the initial value from the db (set by the bi-dir mode) to get reset.
You can download the module here: SQL Bridge-module_5-2-12.modl
You can upgrade the module on the fly by going to Config>Modules in the gateway, although you’ll likely need to restart the designer. And of course, all of your groups will stop for a little bit as the module restarts.
Let me know if you have any problems, or if this doesn’t help.
I should also note that this fix will be included in 7.4.1 as well.