Slow On change script

I am only recording changes about every 800 milliseconds.

I have a DINT tag on a Logix controller that should be updating every cycle for 1-3 seconds. I am expecting thousands of changes. The on change script logs this tag value and three other tags at the time of the event.
Tag group:
I have tried Sub and Polling. Sampling of 1ms

Tag:
Deadband is Absolute.
Auto and Discrete.
Sample mode of On Change and Tag Group....

nothing is improving.

The PLC cycle time is about 1.2 ms.

Why is sampling so slow?

That's pretty fast actually.

Can you show this script? Is this a valueChange script on the tag, or a tagChange script on the gateway?

Are you using IA's Logix Driver?

I am only recording changes about every 800 milliseconds.

Do you mean that tag historian is updating every 800 ms?

I have a DINT tag on a Logix controller that should be updating every cycle for 1-3 seconds. I am expecting thousands of changes.

You say below that your PLC scan time is 1.2 ms. You are trying to log one tag and hoping to catch every scan for 3 s?

The on change onChange script logs this tag value and three other tags at the time of the event.

Is this a gateway event script? Can you show the code?

I have tried Sub and Polling. Sampling of 1 ms.

What is the network path between the gateway and the PLC? Are they on the same subnet?

You can't poll a PLC that fast.

Realistically, you need to accumulate changes into a buffer/array and then poll that buffer and process it at a much slower rate.

Look at your device diagnostics. Usually best case response time from the PLC is something like 5ms per request.

3 Likes

PLC Cycle time has no bearing on the answer. What rate is the subscription for the OPC tag in Ignition (typically set via the rate in the tag group)? Ignition is not even going to try to get samples faster than that.

If you set the poll rate (interval, really) to a very small number, it will actually run at the fastest pace the PLC's request-response comms processor can handle (aka "Class 3" comms). Typical response times for the latest processors (L8x family) with a light load is mid-single-digit milliseconds. With much load, low tens of milliseconds.

If you really need to capture events that occur hundreds per second, you will certainly need a ring buffer in the PLC to hold them so an external client (like Ignition) can bulk read from the buffer. Or switch to class 1 communications (aka I/O packets). Or both. (Cough...)

5 Likes

Irose, this was a valueChange script on the tag. We are using the IA Logix Driver.

It is a simple insert to an SQL database for two DINT tags and a DateTime tag.

I would like to get more than 5 of the several thousand scans....

Did you go look at the settings described? Did you go look at the driver diagnostics?

Getting thousands of values per second is non-trivial for request-response drivers. Your desire is utterly unreasonable for "out-of-the-box" operation.

1 Like

Thank you all. I would like to log every 20ms. I didn't know what type of polling limits to expect. I didn't know what setup I should used to get the best response time.

They are on the same subnet on the same switch.

You need a ring buffer in your PLC to hold several seconds worth of your (multi-value) samples. Include a precision timestamp with each sample to place in the DB. You need some rather tricky code in a fast tag change event in Ignition to slurp up the new values in the ring when your index register changes. You need to use multi-row inserts to your DB so that its own round-trip response time doesn't hold you back.

2 Likes

Again thank you for your help. This is always the most helpful and responsive product forum that I have ever experienced. Another reason I always recommend this product. Take care ...