Closed neustupa closed 3 years ago
RE: How can I access the value of the specific Node directly? i=2258 or ns=0;i=2258 is the current time.
Console.WriteLine("Read value : {0}", session.ReadValue(new NodeId("i=2258")).Value);
RE: I found an example using NodeId but I struggle to recognize what the NodeId is really? Have you used the OPC DCOM? If yes, similar to a tag. Note that node ID in UA is much more complex and richer. A node can represent a branch (in a node hierarchy) or primitive data like INT or complex data type.
RE: How can I determine the NodeId if I know the structure of the datablock? What would you consider datablock?
RE: Is it something I can find in the OPC Server? The node IDs? Yes, you can for example use UA Expert to browse for NodeIDs
RE: I need to examine a value of the specific Node once a 100ms Note that most servers update the runtime value as defined by the publishing interval (RevisedPublishingInterval response from the server). You can figure this out using UA Expert as well. Reading faster than publishing rate may not help - so test your server. For example DeltaV OPC UA Server (workstation) can do 500ms the fastest.
Hi @AlinMoldovean.
Thank you for the response.
Thank you for the direct ReadValue()
method example.
I am not using OPC DCOM. Frankly, I did not know it till you mentioned it. I have a OPC UA Server (KEP ServerEX 6) where I can see the data blocks I can access. Image Attached.
By a KEP Server Quick Client utility I can read the values of the block (node, tag). Sorry I am still hazy on the right terminology. Next image.
Is the ItemID column the NodeId I should use to read a value?
I found this question on StackOverflow: Using OPC UA .NET read “Channel1.Device1.Tag1” value from Kepserver
and according to that post I should be able to use something like:
DataValue dv1 = session.ReadValue("ns=2;s=Siemens S7-1500.WS150-160.DB_VisionControl.S160_165.Outputs.SeatInS165");
for the node (tag) highlighted above.
Is that correct or not?
And can you please explain what are ns
, s
and i
parameters in ReadValue
method used for?
Again thank you in advance for any help.
@neustupa the application OPC Quick Client is an OPC DCOM client! On top of my head, KEP ServerEx 6 can be both an OPC UA server and an OPC DA COM server.
I am not sure if Kepware have an OPC UA client, I have used the following and it should help you investigating what is exposed by the OPC UA Server:
RE: ns That's shortcut for namespace
RE: s That is a node ID using string format
RE: i Node ID using integer format
If you use UA Expert it should show you the node ID (which includes the namespace and format (string, integer, UUID, etc)
This is the default KEP Server Ex 6 OPC UA Configuration
This shows the noded IDs configured for the KEP Server Ex
By the way, if you had a chance to check Softing Client (https://data-intelligence.softing.com/us/products/opc-software-platform/opc-ua-demo-client/) it should have introduction material related to OPC UA.
And if you don't have further questions may you please close this ticket?
@neustupa if you don't have further questions may I request to kindly close this ticket?
Oh. Sorry. Forgot to close this one. Thank you @AlinMoldovean and @tukotech for your help. I managed to to make the solution work, just as it was described.
Hi. First of all - I am really new to OPC UA. I browse the Samples and Workshops but I struggle to find the simple way to write to a single node the desired value I want.
For now I was able to build and run a simple OPC UA Client application base entirely on NetCoreConsoleClient example. I can browse all the parts of the data block which I have access to using the
Session
object and itsBrowse
method. Then using theforeach
cycle i can loop throughReferenceDescriptionCollection
. Then I can access the inner structure of the data block find the Node I want to go in using comparation withDisplayName.Text
and using another foreach cycle go inside and so on.My question is: How can I access the value of the specific Node directly? I found an example using NodeId but I struggle to recognize what the NodeId is really? How can I determine the NodeId if I know the structure of the datablock? Is it something I can find in the OPC Server?
My usecase is quite simple: I need to examine a value of the specific Node once a 100ms and if it changes I need to read some more Nodes' values and then write a response using another Node.
I just need a kick to my butt in the right direction. Thank you very much for any help.
Kind regards,
Zdeněk Neustupa