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.

Reading a OPC Structure in s7 1500 with VB.net

More
27 May 2022 12:20 #10916 by support
Hello,

it is not clear what problem you have. You wrote " the next part gave me error and even cant compill.". Which part? And if it does not compile, what is the error you are getting? (Note that to me, I think it is syntactically correct). If it compiles but does not behave as it should in the runtime, what is the observed behavior, and what is the expected behavior? (www.opclabs.com/forum/announcements12/2365-rules-for-forum-posts )

When dealing with subscription, "publish" is always enabled. If you want the data, subscribe. If you do not want the data, unsubscribe.

Best regards

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

More
26 May 2022 12:38 - 26 May 2022 16:03 #10907 by GusoXXL
Hello guys, im doing a code to read data from my OPC-UA server in the s7 1500.

The problems is not subscribing to a variable, the problem is subscribing to an structure of variables in the OPC-Server. The structure is similar to this:
1.-A group: Registros procesados
Inside of it we find 4 groups:
2.-Registros_ATV_izq, Registros_ATV_drch, Registros_PM1 and Registros_PM1
Then inside the ATV_izq we can find 40 variables
3.-40 variables

So to be clear, for example the structure to read the data from one variable in the Registros procesados ATV Izq is like this: "ns=3;s=""Registros_procesados"".""Registros_ATV_Izda"".""Counter encoder value"""

So now, i have done a part of code to subscribe to the group instead variable by variable cause this maybe gets some time so i have done this code but right now is not working, any help?
            Dim EndPoint As UAEndpointDescriptor = "opc.tcp://10.1.0.128:4840"      'Conexión con el servidor OPC-UA
            Dim Client_OPC = New EasyUAClient()  'Creación del objeto cliente y su conexión
            Dim Attribute_Data As UAAttributeData
            Dim Timestamp As String
 
            Dim Node_Descriptor As UANodeDescriptor = "ns=3;s=""Registros_procesados"".""Registros_ATV_Izda"""
            Dim NodeElementCollection As UANodeElementCollection
 
            AddHandler Client_OPC.DataChangeNotification, AddressOf Client_OPC_DataChangeNotification
 
           NodeElementCollection = Client_OPC.BrowseDataVariables(endpointDescriptor:=EndPoint, nodeDescriptor:="ns=3;s=""Registros_originales"".""valores_ATV_Izda""")
            [b]Console.WriteLine(NodeElementCollection)[/b]
            Dim MonitoredItemArgumentsArray() As EasyUAMonitoredItemArguments = NodeElementCollection.Select(Function(element) New EasyUAMonitoredItemArguments(Nothing, endpointDescriptor:=EndPoint, element)).ToArray()
            Client_OPC.SubscribeMultipleMonitoredItems(MonitoredItemArgumentsArray)

The part in bold gave me back info about the nodes inside the group but the next part gave me error and even cant compill.
Can you help me?

Pd: also i want to ask how can i set that the publish interval is enable? i know is by defaul enable but any command to set enable or unenable?

Thanks
Last edit: 26 May 2022 16:03 by support. Reason: code formatting

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

Moderators: support
Time to create page: 0.052 seconds