Professional OPC
Development Tools

logos

Online Forums

Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.

Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.

Do not use the Contact page for technical issues.

GetPropertyValue Performance Problem

More
09 Oct 2013 08:51 #1459 by support
Thank you for feedback - I am very glad to hear it :)

Please Log in or Create an account to join the conversation.

More
07 Oct 2013 19:12 #1456 by jgyenese
The new version is lightning fast.
Thank you.

Please Log in or Create an account to join the conversation.

More
01 Oct 2013 05:10 #1447 by support
Alright, thank you for update.

Please Log in or Create an account to join the conversation.

More
30 Sep 2013 18:39 #1446 by jgyenese
I will try the updated version and report back on the performance.

I do apologize for reporting the second issue when it was actually a problem in our code. We were not always checking for exceptions before accessing results(i).Value.

Thank you for your assistance.

Please Log in or Create an account to join the conversation.

More
30 Sep 2013 06:38 #1445 by support
Interestingly, I have tried to reproduce the first issue now (the slow-down), and could not reproduce it either.

But I took the opportunity to implement a long-overdue change to GetPropertyValue/GetMultiplePropertyValues that improves their performance. The improvement is most significant with GetPropertyValue, but there is some improvement with GetMultiplePropertyValues as well.

The new build with this modification, labeled 5.22.397.1, is now the public build on the Web (in the download area). Please give it a try.

Please Log in or Create an account to join the conversation.

More
28 Sep 2013 14:08 #1444 by support
I have tried to reproduce the 2nd problem you mentioned, but I still think that GetMultiplePropertyValues indicates the errors correctly, i.e. as documented. It does not throw an exception if something is wrong. It returns the information about the problem in each element of the result array. You must, however, first check whether the operation was successful for each element - you cannot e.g. access the Value property if it not there.

Here is a small VBScript that I have used to verify this:
Rem This example shows how to get value of multiple OPC properties, and handle errors.
 
Option Explicit
 
Const Timestamp = 4
Const AccessRights = 5
Const SomeInvalidPropertyId = 999111
 
Dim EasyDAClient: Set EasyDAClient = CreateObject("OPCLabs.EasyDAClient.5.2")
Dim results: results = EasyDAClient.GetMultiplePropertyValues("", "OPCLabs.KitServer.2", _
    Array("Simulation.Random", "SomeInvalidItem", "Trends.Ramp (1 min)", "Trends.Ramp (1 min)"), _
    Array(Timestamp, AccessRights, SomeInvalidPropertyId, AccessRights))
 
Dim i: For i = LBound(results) To UBound(results)
    If results(i).Exception Is Nothing Then 
        WScript.Echo "results(" & i & ").Value: " & results(i).Value
    Else
        WScript.Echo "results(" & i & ").Exception.Message: " & results(i).Exception.Message
    End If
Next

and here is its output:
results(0).Value: 1/1/1601 2:00:00 AM
results(1).Exception.Message: The item is no longer available in the server address space.
results(2).Exception.Message: The server does not recognize the passed property ID.
results(3).Value: 3

Please Log in or Create an account to join the conversation.

More
27 Sep 2013 02:20 #1442 by jgyenese
I tried using GetMultipleProptertyValues and found a similar performance difference between calling it after a read vs before - it took 25 times longer after a read. The good news it that it is much faster than calling GetPropertyValue in a loop.

More information to share - if you try to read the property values before reading any item values, the performance does not slow down after subsequent value reads.

I did find a problem though. According to the documentation "This method [GetMultipleProptertyValues] does not throw an exception in case of OPC operation failures. Instead, the eventual exception related to each property is returned in Exception property of each returned ValueResult element." This is not correct, GetMultipleProptertyValues does indeed throw exceptions if you request a property value the server does not recognize.

Please Log in or Create an account to join the conversation.

More
26 Sep 2013 22:36 #1441 by support
I will have a look at it. There will be a relation to the subscription that ReadItem internally creates, in expectation of further ReadItem-s coming in. This can be changed by a configuration. And, more importantly, GetMultiplePropertyValues should be used, instead of calling GetPropertyValue in a loop. There will be something else to it as well, but that will need further investigation.

Please Log in or Create an account to join the conversation.

More
26 Sep 2013 21:57 #1440 by jgyenese
The performance of GetPropertyValue slows down by a factor of 25 if it is preceeded by a call to ReadItemValue.

For example, open a new VB6 application project and paste the following code in the Form_Load event.
    Dim results
    Dim prop
    Dim key
    Dim val
    Dim EasyDAClient
    Dim tStart As Single
    Dim tEnd As Single
 
    Set EasyDAClient = CreateObject("OPCLabs.EasyDAClient.5.2")
 
    'val = EasyDAClient.ReadItemValue("", "OPCLabs.KitServer.2", "Simulation.ReadValue_I4")
 
    Set results = EasyDAClient.BrowseProperties("", "OPCLabs.KitServer.2", "Simulation.ReadValue_I4")
    tStart = Timer
    For Each key In results.Keys
        Set prop = results.Item(key)
        val = EasyDAClient.GetPropertyValue("", "OPCLabs.KitServer.2", "Simulation.ReadValue_I4", prop.PropertyId)
    Next
    tEnd = Timer
    MsgBox "Elapsed time = " & CStr(tEnd - tStart) & " seconds."

Run the code and I get an elapsed time of about 2.63 seconds.
Uncomment the "val = EasyDAClient.ReadItemValue(...)" line and I get 65 seconds.

Using version 5.22.322.1 of QuickOPC, VB6 SP6, and Windows 7 x64.

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.056 seconds