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 VBA in Excel to access OPC UA data

More
01 Mar 2018 13:41 #6089 by Monks
Given the same items, would the single step VBA code look like this?

Private Sub TEST3()
' Create EasyOPC-DA component
Dim EasyDAClient As New EasyDAClient

' Read item value and display it
Range("A1").Value = EasyDAClient.ReadItemValue("", "opc.tcp://192.168.10.19:4841", "CollapseStatus")
End Sub

Is it better to monitor all 4 items selectively using the single step code 4 times, or is it better to use the multiple argument code example, I listed previously?

Thanks

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

More
01 Mar 2018 12:58 #6088 by support
Hello,
the line you asked about would look like this:

MonitoredItemArguments1.NodeDescriptor.NodeId.ExpandedText = "ns=6;s=::AsGlobalPV:gPLC.Status.CollapseStatus"

and so on, for other variables.

Some things to note:
- "6" is a namespace index, but the server can, at least theoretically, change the namespace index between sessions. It is therefore advisable to use the namespace URI instead ("nsu="). More about this: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...indices%20in%20Node%20Ids.html .
- Using the Connectivity Explorer, as I have recommended earlier, would give you the correct syntax right away, plus it would have the namespace URI in it as well.

Best regards

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

More
01 Mar 2018 12:52 - 01 Mar 2018 12:52 #6087 by support
From: C.
Sent: Wednesday, February 28, 2018 8:28 PM
To: Z.
Subject: FW: IR welder meeting notes

Below is a screen shot of the OPC UA items coming from our B&R controller. Given this information and the server address I provided before.

How would the Quick OPC VBA code be written (below in red)?

MonitoredItemArguments1.EndpointDescriptor.UrlString = " opc.tcp://192.168.10.19:4841"
MonitoredItemArguments1.NodeDescriptor.NodeId.ExpandedText = "nsu=?????"

I wasn’t sure how to post screen shots in the forum[...].
Thanks
C.

From: G.
Sent: Wednesday, February 28, 2018 1:27 PM
To: C.
Cc: ...
Subject: RE: IR welder meeting notes

C.,

Here is a screen capture from a program that I use to look at OPC UA tags.
On the bottom left is the address space for the tags.
On the right is the information from the tags themselves.






The OPC UA server is a B&R embedded server/client.
There is nothing unique or special about the server so if you are setting something up that does not have a specific driver for B&R then use a generic OPC UA client driver.


The main nodeID would be as follows:



G.
Attachments:
Last edit: 01 Mar 2018 12:52 by support.

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

More
27 Feb 2018 20:13 #6082 by Monks
The company that sold us a custom welder is Dukane. I'm trying to find what type of server they are using along with the node values of the items being sent.
Chris

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

More
27 Feb 2018 19:38 #6081 by support
Apparently you also succeeded in posting to the forum, I have merged the two topics into one now.

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

More
27 Feb 2018 19:35 #6080 by support
Yes, the first argument to the ReadValue method will be "opc.tcp://192.168.10.19:4841", in your case.

The second argument is a bit more complicated. Basically yes, the values there (Node IDs or browse paths) are dependent on the concrete OPC server and its configuration.

It is possible that the Node IDs will be derived from the tag names you listed, but they can also differ. You can, however, figure that out easily by using some OPC UA client with browsing capability (or do it from the code, but that would only complicate matters if you plan to hard-code them). QuickOPC comes with several demo applications that can do that, but one of them stands out: Run the Connectivity Explorer (opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...l#Connectivity%20Explorer.html ), add the OPC UA server, and then you should see the tree of nodes, and below them, the Node IDs that can you can then copy/paste to the program (opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...frame.html#Point%20Editor.html ).

Some more information to this: opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...Information%20in%20OPC-UA.html .

You may run into OPC UA certificate exchange issues when connecting (especially the first time). If that happens, let me know. Are you using Kepware server?

Best regards

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

More
27 Feb 2018 19:25 - 27 Feb 2018 19:26 #6079 by support
From: C.
Sent: Tuesday, February 27, 2018 7:24 PM
To: Z.
Subject: RE: OPC Labs Contact Form - [...]

[...]

My question is:
Your website lists the following code example for VBA:
' Create EasyOPC-UA component
   Dim Client As New EasyUAClient
 
   ' Read node value and display it
   Range("A1").Value =   
       Client.ReadValue("http://localhost:51211/UA/SampleServer", 
       "nsu=http://test.org/UA/Data/;i=10853")
How do I adapt the following information for my server to the code above? I assume the server address (in bold) goes inside the first set of parentheses above? How do I call the 4 items below in the second set of parentheses after the comma? Do I need node values from the supplier or can I just use the text written below?

Server address: opc.tcp://192.168.10.19:4841

The following tags are provided:

CollapseStatus – Boolean – Good = 1
ActualCollapse – Real – Collapse distance of the weld
Done – Boolean – Weld is done = 1
FixtureNumber – Integer – Number of the fixture at the join station

Thanks
C.
Last edit: 27 Feb 2018 19:26 by support.

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

More
27 Feb 2018 18:42 #6078 by Monks
My question is:
Your website lists the following code example for VBA:
' Create EasyOPC-UA component
Dim Client As New EasyUAClient

' Read node value and display it
Range("A1").Value =
Client.ReadValue("http://localhost:51211/UA/SampleServer",
"nsu=http://test.org/UA/Data/;i=10853")

How do I adapt the following information for my server to the code above? I assume the server address (in bold) goes inside the first set of parentheses above? How do I call the 4 items below in the second set of parentheses after the comma? Do I need node values from the supplier or can I just use the text as written below?

Server address: opc.tcp://192.168.10.19:4841

The following tags are provided:

CollapseStatus – Boolean – Good = 1
ActualCollapse – Real – Collapse distance of the weld
Done – Boolean – Weld is done = 1
FixtureNumber – Integer – Number of the fixture at the join station

Thanks
Chris

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

Moderators: support
Time to create page: 0.063 seconds