Logging Stale Data From Ignition?

I have a question about data logging from Ignition. We are currently logging data using Python Code that we call from a Tag Change SCript. The Script is called from the Tag Change Script and we request tags from Ignition and log the Data into a MySQL Database. We ahve found that the script runsvery fast and we end up logging data that is not yet updated by Kepware to Ignition. So, the trigger is fast. Some of the points we are logging are strings from the PLC and the update to Ignition Appears to be slow even though we have a 100 millisecond scan class. We have tried bypassing Ignition in the scripting using the Call Direct to the OPC Server system.opc.readvalue and it helps but still does not get all the correct data 100% of the time. I’m trying to not use delay timers in the PLC since it will not be gauranteed that the data is updated.

Any suggestion what I cando to ensure the Tag is cuurently updated prior to logging into the database?

Any suggestions will be helpful.

I think you might have to investigate what can be done in Kepware to make sure all the values you’re interested in are updated “atomically”. It sounds like values are received from Kepware as they’re updated, and not all your values are updating as fast as you’d like.

One thing you can try is slowing down the scan class in Ignition to maybe 500ms or 1000ms. But then in Kepware turn off the option that makes it use the client’s requested rate and force it to keep updating at 100ms.

I’ve done all of that. I even put my logging into a different scan class that was fast and all other tags into the default 1000 millisecond class. I then configured a seperate Channel in Kepware with it’s own Dedicated Ethernet Port from the PLC and it didn’t resolve the issue. I still had to put a time delay in the plc to allow Ignition to get the tag update before triggering the Logging. Looks like I’m stuck with an undeterminsitic time delay in my PLC code, yuck!

Hi,
Sounds like you’re trying to log things way faster than I’ve ever attempted :open_mouth: .

Just had one thought though, how about implementing a queue in your PLC code? I’m assuming you are trying to deal with ‘bursts’ of information. A queue with a FIFO structure might be a good way of letting your PLC do what it needs to do as fast as it needs to while ignition is chugging away at the back end popping off (and logging datavalues) as soon as it can. You could even have the PLC store the time stamps in if it was important that the exact timing be retained. You’re already most of the way there with your tag change script (just have it set a tag to signal the PLC to pop the next value into the tag)

Alternatively as a second idea, if it is a continuous scenario i (i.e. bottling plant) it may be more efficient to be storing the results into blocks of addresses in the PLC (i.e. datafiles) and these can be more efficiently read by OPC as a bulk transfer (rather than just polling one tag really fast to see if it has changed). The second idea could mean that you could get your process to go a lot faster if need be.

Cheers

Alex