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.

Excel Read and Write

More
11 Dec 2015 08:20 #3724 by support
Replied by support on topic Excel Read and Write
I have not tested your code, but I have reviewed it and I believe it should work.

Also note that the EndpointDescriptor and NodeDescriptor are object properties that can be set as a whole. You could therefore e.g. create just one EndpointDescriptor before the loop and assign it as a whole; and you could create one NodeDescriptor inside the loop, and then assign it to the read parameters and to the write parameters. I think, however, that the differences between these approaches are just minor, thus you should not be concerned too much, and do it any way you prefer.

Best regards

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

More
11 Dec 2015 08:06 - 11 Dec 2015 08:17 #3723 by stkewors
Replied by stkewors on topic Excel Read and Write
Hello,

I hoped to save some code lines by creating an object for both, read and write. I need to write but also to read the same variable(s) on the S7-300. As you said, Read and Write with the same node.

For example (My code now):

Write object:

Dim Write_Anfangswert_1: Set Write_Anfangswert_1 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAWriteArguments")
Write_Anfangswert_1.EndpointDescriptor.UrlString = server
Write_Anfangswert_1.NodeDescriptor.NodeId.ExpandedText = node_id_prefix & Schritt_x & "Anfangswert"
...
...

Read object:
Dim Read_Anfangswert_1: Set Read_Anfangswert_1 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments")
Read_Anfangswert_1.EndpointDescriptor.UrlString = server
Read_Anfangswert_1.NodeDescriptor.NodeId.ExpandedText = node_id_prefix & Schritt_x & "Anfangswert"
...
...
 
Set parameters_write(0) = Write_Anfangswert_1
Set parameters_read (0) = Read_Anfangswert_1
...
...

So I am going to change the code to this (to save code lines):
Dim Write_Anfangswert_1: Set Write_Anfangswert_1 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAWriteArguments")
 
Dim Read_Anfangswert_1: Set Read_Anfangswert_1 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments")
...
...
 
Set parameters_write(0) = Write_Anfangswert_1
Set parameters_read (0) = Read_Anfangswert_1
...
...
 
For i = 0 To UBound(parameters_write) 
 
parameters_write(i).EndpointDescriptor.UrlString = server
parameters_write(i).NodeDescriptor.NodeId.ExpandedText = node_id_prefix & Schritt_x & "Anfangswert"
 
parameters_read(i).EndpointDescriptor.UrlString = server
parameters_read(i).NodeDescriptor.NodeId.ExpandedText = node_id_prefix & Schritt_x & "Anfangswert"
 
Next

Hope that works

best regards

Kevin
Last edit: 11 Dec 2015 08:17 by support. Reason: code formatting

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

More
10 Dec 2015 16:25 - 10 Dec 2015 16:25 #3722 by support
Replied by support on topic Excel Read and Write
Read and Write are different operations, and need somewhat different inputs. For example, to do a Read, you can specify parameters such as maximum value age - which makes no sense for Write. On the other hand, arguments for Write must include the value to be written.

There are commonalities as well (such as the endpoint and node descriptors), but if you need to do Read and Write with the same node, it should be no problem to fill in these common properties with the same values.

What are you trying to achieve?

Best regards
Last edit: 10 Dec 2015 16:25 by support.

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

More
10 Dec 2015 09:52 #3721 by stkewors
Hello,

at the moment i am validating an OPC UA connection to a S7-300 via Excel (VBA).

Is there a possibility to create an Object with an "UA_Read_and_Write" Argument instead of just an UAWrite or UA Read Argument

My current code for multipleWrite (UAWriteArgument, cutout):
Dim Write_Anfangswert_1: Set Write_Anfangswert_1 = CreateObject("OpcLabs.EasyOpc.UA.OperationModel.UAWriteArguments")

Thank you in advance

best regards

Kevin

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

Moderators: support
Time to create page: 0.069 seconds