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.

Use of EasyDAClient throws VS 2017 exception

More
09 Jan 2018 20:31 #5847 by bobday
I placed a breakpoint and stepped through the code until the form opened. Still have an empty Textbox.

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

More
09 Jan 2018 19:29 #5845 by support
Thank you.

Does the code that is supposed to fill in the textbox actually run? Can you put a breakpoint there?

It might seem silly, but I am asking this because the after changing to ReadItem, the .ToString() actually never returns an empty string. The ReadItem return a DAVtq object (value/timestamp/quality) taht always has "something" in it.

Or, the ReadItem can throw an exception. Isn't it the case, and the exception is somehow swollen? Again, stepping through the code should show whether it has made it successfully past the line with ReadItem or not.

Regards

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

More
09 Jan 2018 19:09 #5844 by bobday
Connectivity Explorer shows the correct value for the Item. see attachment

I used the same 3 parameters for easyDAClient1.ReadItem() as I did for easyDAClient1.ReadItemValue(), hope this is correct.

Still had an empty textbox when the app ran.
Attachments:

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

More
09 Jan 2018 18:25 #5843 by support
1) How do you know that the behavior is not correct? I.e. how do you know that the string variable in the server is not, in fact, empty?

2) What result do you get in Connectivity Explorer when you view the actual item, and not the "Item Value" property (see my previous post)

3) In order to rule out any errors that are hidden, can you replace ReadItemValue with just ReadItem in your code, temporarily?

Best regards

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

More
09 Jan 2018 17:47 #5842 by bobday
When I run the app nothing happens, no errors, the textbox remains blank. The textbox updated with the demo server just fine.

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

More
09 Jan 2018 17:35 #5841 by support
Regarding the picture from the Connectivity Explorer: In that picture, you are not actually displaying the value of the item. You are displaying the "Item Value" property of the item, which is a different thing. I know it might be confusing, but it is simply so. OPC Properties are not meant to be used for efficient access, and in fact they may not work like this with many servers, unless you are actually using the same item in the regular way.

So what you are showing in the Connectivity Explorer is different from what the code snippet does.

In order to do the same as the code in the Connectivity Explorer, you need to click on the "GVL" node in the left pane (the tree), and the select the "MyString" from the list in the right pane.

Best regards

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

More
09 Jan 2018 17:31 #5840 by support
Please elaborate on what it means "it does not work". An exception? What is the error message? Etc.

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

More
09 Jan 2018 16:17 #5836 by bobday
My client on my computer located on the same network as the Parker PAC controller. I used the Connectivity Explorer (see attachment) to confirm naming of vars.

This code still dosen't work:
textBox1.Text = easyDAClient1.ReadItemValue("192.168.2.82", "CoDeSysOPCDA", "PAC.Application.GVL.MyString").ToString();
Attachments:

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

More
08 Jan 2018 17:38 #5832 by support
The simplest way to read an OPC item would be:
object value = easyDAClient.ReadItemValue("192.168.10.20", "someProgId", "MyVar")
To the second argument: You will have to supply the so-called ProgID of the server. It should be in its documentation, or it is possible to figure it out by browsing (see below).

The third argument is known as ItemID in OPC world. Be careful as it is usually qualified in some way (the syntax is server dependent). So while it is possible the it is simply "MyVar", it is usually longer, e.g. "Device1.Block1.MyVar". Check with the server documentation, or use e.g. the COnnectivity Explorer tool that comes with QuickOPC to connect to the server and browse for the items; it will show the full Item IDs in the info pane below the node tree.

If your client is remote to the server, you are likely to encounter DCOM configuration issues. That's a huge area that cannot be described in one paragraph.

Best regards

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

More
08 Jan 2018 15:33 #5829 by bobday
The demo works now.

Can you please show me an example of how I use easyDAClient to reference my server on a PAC controller. Lets assume the controller is at 192.168.10.20 and the variable is MyVar.

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

Moderators: support
Time to create page: 0.063 seconds