LabVIEW OPC DataSocket Update Rate Setting

Updated Dec 18, 2023

Environment

Software

  • LabVIEW

Other

  • LabVIEW DataSocket
  • OPC Server

  • I am using LabVIEW DataSockets to access data from an OPC Server.  I know the data on the OPC Server is updating at a rate faster than 10Hz (10 times a second), but my DataSocket Read is only running at 10 reads a second when it is placed in a loop without any timing.  How can I read more quickly from my DataSocket?
  • I am reading data from an OPC Server using LabVIEW DataSockets, the update rate from my reads is slower than what I need.  How can I read from the OPC Server at the rate that the data is being updated on the server?
  • How can I get my DataSocket reads from an OPC Server to occur faster than every 100ms?  I do not have any timeout wired into the DataSocket read and there is no time delay or wait in my read loop.

There are two things you can do to change your rate of reading from an OPC Server when using the DataSocket Read function:
 
  • Append updaterate to the DataSocket URL
    To change your rate of reading and set your maximum update rate on your reader, you can add ?updaterate=rate_in_ms to the end of your opc url that goes into the URL terminal of the DataSocket Open function .  
    For example, if your url is opc://ni.opc.demo.server then you would make it opc://ni.opc.demo.server?updaterate=20 if you want to set your maximum DataSocket read rate to 20 milliseconds.
 
  • Set ms timeout on DataSocket Read VI
    One of the inputs into the DataSocket Read VI is ms timeout.  This value sets how slowly the VI could possibly run in milliseconds. If we set this value to a number smaller than how quickly we can read from the OPC Server or how quickly the OPC Server values update, then we will start pulling stale values.