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.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- GetPropertyValue Performance Problem
GetPropertyValue Performance Problem
Please Log in or Create an account to join the conversation.
Thank you.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
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.
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.
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 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.
Please Log in or Create an account to join the conversation.
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.
- Forum
- Discussions
- QuickOPC-Classic in COM
- Reading, Writing, Subscriptions, Property Access
- GetPropertyValue Performance Problem