Opc rate Write data for 10ms

            UaVariableNode node = UaVariableNode.builder(getNodeContext()).setNodeId(deviceContext.nodeId(nodeId)).setBrowseName(deviceContext.qualifiedName(formattedName)).setDisplayName(new LocalizedText(formattedName)).setDataType(v.getNodeId()).setTypeDefinition(Identifiers.BaseDataVariableType).setAccessLevel(AccessLevel.READ_ONLY).setUserAccessLevel(AccessLevel.READ_ONLY).build();
      new Thread(() -> {
                    for (int i = 0; i < 100000; i++) {
                        node.setValue(new DataValue(new Variant(-i)));
                        try {
                            Thread.sleep(10);
                        } catch (InterruptedException e) {
                            throw new RuntimeException(e);
                        }
                    }

                }).start();

When reading the tag value, it is not timely. How to achieve this

I've not had consistent success running anything that fast in Ignition. If you are willing to accept occasional longer hiccups from garbage collection, 10-20ms pace should be do-able.

However, I think your real problem is that you are writing values directly into the node. I've only done similar high-speed operations writing to a driver's SubscriptionItem. Without a subscription (tag group pace) to indicate the allowed timing, your writes are probably not propagating. (Subscription pace is defined to mean no faster than given, not this fast.)

There are only a few opc points, but the response is required to be fast. Now the write value is missing in the tag,

Where is the SubscriptionItem configured

You don't create or configure a SubscriptionItem in your driver. Your driver is given a SubscriptionItem by the OPC Server. That item will include the pace you are expected to use.

Your driver should be adding a listener to the DriverSubscriptionModel to be informed when OPC tags are created/destroyed that point at your driver.

Where is DriverSubscriptionModel configured

This is legacy driver API stuff. In the new Device API it's part of the Device interface.

1 Like

@448719222 I'm not sure you understand how OPC UA subscriptions work.

The client requests a publishing interval for the subscription and a sampling interval for the items. When Ignition is the client these parameters are controlled by the rate of Tag Group the OPC tags are in. You will not see values update faster than this.





Where can I subscribe

You already subscribed when you created the "test" tag in the Ignition tag browser.

It subscribed at the rate dictated by the tag group it belongs to.

Your script is just reading the current Ignition tag value, which is only going to update as fast as the tag group rate in the best case. You are not reading directly from the OPC server. If you changed the script to use system.opc.readValue instead you would see the value update more frequently.

1 Like

I'll get there before too long. :sweat_smile:

Probably just in time for it to change in a backwards incompatible way :stuck_out_tongue:

Heh. I'll take my lumps. The OPC interfaces are the easiest parts of my drivers. Doesn't look like that is changing.

i see