The purpose of this OPC V3 method is to provide an extremely easy way for simple applications to obtain OPC data. Programmers should be aware that in most servers, the design of the Group based OPC interfaces will provide much better performance than this method. In terms of performance, the user of this method should assume that it will behave as if he were to create a group, add the items, perform a single read or write and then delete the group.
Visual Basic (Declaration) | |
---|---|
Public Overloads Function Read( _ ByVal itemIDs() As String, _ ByVal maxAge As Integer _ ) As ItemValue() |
C# | |
---|---|
public ItemValue[] Read( string[] itemIDs, int maxAge ) |
Parameters
- itemIDs
- A list of fully qualified ItemIDs. These might be obtained from OpcServer.Browse()
- maxAge
- A “staleness” for all items, requested in milliseconds. The server will calculate, for each requested item, the number of milliseconds between “now” and the timestamp on each item. For each item that has not been updated within the last MaxAge milliseconds, must be obtained from the underlying device. Or if the item is not available from the cache, it will also need to be obtained from the underlying device. A max age of 0 is equivalent to OPC_DS_DEVICE and a max age of 0xFFFFFFFF is equivalent to OPC_DS_CACHE. Without existence of a cache the server will always read from device. In this case MaxAge is not relevant. Some servers maintain a global cache for all clients. If the needed item is in this global cache, it is expected that the server makes use of it to check the MaxAge value. Servers should not automatically create or change the caching of an item based on a Read call with MaxAge.
(Note: Since this is a INT32 of milliseconds, the largest MaxAge value would be approximately 24 days).
Return Value
returned value, quality, timestamp and error information.In case of errors an OPCException is thrown.
Error accessing individual items are reported in the returned ItemValue object.
Error accessing individual items are reported in the returned ItemValue object.