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.

omron opc reading and writing variables

More
29 Nov 2022 11:03 #11255 by Fietta
Ok

that's the code

Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
Dim COMINCAZIONEOPCUA As String
Dim ATTRIBUTO_REQCOMMAND As UANodeDescriptor
Dim VAL_INT As Int32
VAL_INT = Val(TextBox4.Text)
COMUNICAZIONEOPCUA = "opc.tcp://172.16.253.6:4840"
ATTRIBUTO_REQCOMMAND = "nsu=http://Rxx5/UA ;ns=4;i=1168"
client.WriteValue(COMUNICAZIONEOPCUA, ATTRIBUTO_REQCOMMAND, VAL_INT)
End Sub

that's the error:

OpcLabs.EasyOpc.UA.OperationModel.UAException: An OPC-UA operation failure with error ID 'Opc.UA.ServiceResult=0x80740000' occurred, originating from 'OpcLabs.EasyOpcUA' and with depth of 1. The inner OPC-UA service exception with service result 'BadTypeMismatch' contains details about the problem. ---> OpcLabs.EasyOpc.UA.UAServiceException: OPC UA service result - {BadTypeMismatch}. The value supplied for the attribute is not of the same type as the attribute's value.
+ The attribute Id used was 'Value'.
+ The node descriptor used was: NodeId="nsu=http://Rxx5/UA ;ns=4;i=1168".
+ The client method called (or event/callback invoked) was 'WriteMultiple[1]'.

that's the screen

Attachments:

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

More
29 Nov 2022 10:38 #11254 by support
Hello.

1. Please post the piece of code that does the Write, and the parts around it that make it clear which data type is used etc.

2. Please post here the full error message you are getting.

3. Please use the Connectivity Explorer to browse to the node you are trying to write to, select it, and then post the screenshot of Connectivity Explorer here.

Thank you

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

More
29 Nov 2022 10:33 #11253 by Fietta
Hi,

as you sad it was a firewall problems, sorry if i reply only now but yesterday i was very busy

now the other error i get is when in try to write a value in a variable and the error is " BadTypeMismatch "

i thought it was caused by different data type, i try to write an int32 data, but still error

the data type declared by quickopc for the variable is BaseDataVariableType, i don't understand what type is it
The following user(s) said Thank You: support

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

More
26 Nov 2022 17:21 #11244 by support
Hello.

Are you saying that you cannot communicate at all (you always get this error now), or that you sometimes get the error and sometimes it works?
Also, please report the actual error you are getting. What you have posted are log entries, which are actually quite useful as well, but you should always start with reporting the actual error.

The error can have various causes, such as:
- server configuration problem; server not running, or not listening on the given address & port,
- firewall blocking the access,
- network disruptions.

Depending on whether this is permanent or transient error, if the above does not help, I can then provide further instructions on how to investigate.
Best regards
The following user(s) said Thank You: Fietta

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

More
25 Nov 2022 15:49 #11243 by Fietta
Hi, i was trying to communicate with different plc butvsome error occured and i don't understand what to do, the errore are:

Warning(6201): The status subscription for an OPC-UA session on endpoint URL "opc.tcp://172.22.10.25:4840" is in failure. Further such warnings on this session will not be logged. UA SDK error (Opc.UA.ServiceResult=0x80820000) in 'DiscoveryClient.GetEndpoints'. OPC UA service result - {BadTcpInternalError}. Error establishing a connection. + The error occurred when preselecting an endpoint for discovery URL "opc.tcp://172.22.10.25:4840". + Connection attempt #6; last connected at 01/01/0001 00:00:00 (local); unconnected for 04:34:17.9530000.

Warning(4022): The OPC-UA client session with connect sequence number 6 failed to connect to endpoint URL "opc.tcp://172.22.10.25:4840". UA SDK error (Opc.UA.ServiceResult=0x80820000) in 'DiscoveryClient.GetEndpoints'. OPC UA service result - {BadTcpInternalError}. Error establishing a connection. + The error occurred when preselecting an endpoint for discovery URL "opc.tcp://172.22.10.25:4840". + Connection attempt #6; last connected at 01/01/0001 00:00:00 (local); unconnected for 04:34:17.9530000.

Can you help me? Really thank you

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

More
22 Nov 2022 10:57 #11231 by Fietta
I tried to create a new project and the error is gone, so at the moment i'm ok, i will try to write some value now,

really thanks for your help

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

More
22 Nov 2022 09:48 #11228 by support
Hello,

please clarify what you mean. Are you getting some error? If so, what is the error message? And, what is the full text of your program currently?

Thank you

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

More
22 Nov 2022 08:43 #11227 by Fietta
Thank you, now the node id is clear, the next issues is the declaration of the client

Dim client = New EasyUAClient()

i tried to create this variable but i think i miss something to do

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

More
21 Nov 2022 16:15 #11224 by support
Hello,

the AttributeId is not such a big deal, in 99% of the cases what you need is UAAttributeId.Value, and that is a default that does not have to specified anyway.
But, the second argument to ReadValue should describe the UA *node* you want to read. In most cases, this is done by specifying the Node ID in its expanded string form.

Try this:

1. Start the Connectivity Explorer application that comes with QuickOPC (to get it you need to use the QuickOPC installer, not just the NuGet packages; or, it can be run from here: kb.opclabs.com/Tool_Downloads#Connectivity_Explorer ).
2. In the "Point Editor" tool window, under "Points (Composite) -> OPC Unified Architecture (Client-Server) Points", double-click on "< Double click to: Add OPC UA Endpoint >".
3. In the text area for the new node, enter opc.tcp://192.168.1.251:4840 , and press Enter.
4. Expand the new node. If the connection succeeds, you will see various nodes in a tree, and will be able to browse through them.
5. Whenever you select some node in the OPC UA server, the node info pane (below the tree) will show the title "OPC-UA Node", and some details about the node. What you are looking for is the first line, labeled "Node Id". Copy the text in there into your program (there is even a little icon do the Copy), and make it (as a string) the 2nd argument to your ReadValue call.

For example, with our sample server, you may see



and for the selected "Int16Value" node, your second argument to the ReadValue method would be "nsu=http://test.org/UA/Data/ ;ns=2;i=10847". With your server, the Node Id will be different, of course.

If your OPC Server enforces security, the connection may fail and there will be extra steps to do. This is expected, and if it happens and you do not know what to do, report the behavior and I will help to resolve it too.

Best regards
Attachments:

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

More
21 Nov 2022 15:21 - 21 Nov 2022 16:03 #11223 by Fietta
Hi,

is the first time for me using opc ua communication and i'm having some issues whit my Omron PLC:

i have write some lines of code to read a variable but i don't understand whta value i have to set for the Attribute, i have tried whit the name of the variable but nothing, this is the code:

Private client As EasyUAClient


 
Private value As Object
 
Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles Button2.Click
Dim COMUNICATIONOPCUA As String
Dim ATTRIBUTE As UAAttributeId
 
COMINCAZIONEOPCUA = "opc.tcp://192.168.1.251:4840"
ATTRIBUTE = 1
value = client.ReadValue(COUNICATIONOPCUA, ATTRIBUTE)
 
End Sub
 


have i do some mistakes somewhere?

Really thanks to everyone who will help me
Last edit: 21 Nov 2022 16:03 by support.

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

Moderators: support
Time to create page: 0.082 seconds