OPCFoundation / UA-.NETStandard

OPC Unified Architecture .NET Standard
Other
1.92k stars 936 forks source link

Is it possible to read Tag meta data via UA client #1247

Closed albrookesplowman closed 3 years ago

albrookesplowman commented 3 years ago

[ ] Bug [ ] Enhancement [ ] Compliance [x] Question [ ] Help wanted

Is it possible to read Tag configuration via the UA client? For example, the range, deadband etc... of each Tag in the OPC server

Many thanks

AlinMoldovean commented 3 years ago

Hello @albrookesplowman ,

In case your question is about the analog data type nodes, you can read the properties like EURange or EngineeringUnits by browsing and reading the property nodes attached to the variable. image

albrookesplowman commented 3 years ago

So is this information readily available from any OPC server? We have developed an client which connects to a OPC Server via the Matrikon Tunneller but I am trying to see whether we can get this information from the OPC server or whether it has be configured on the client side for our 6000 signals... I have had a look around the internet but can't find any information about what information is available from an OPC server

AlinMoldovean commented 3 years ago

@albrookesplowman ,

An OPC UA Server will expose the mandatory properties for different type of AnalogType variable nodes. Please make sure you are not dealing in your case with a Classical OPC Server instead of an OPC UA Server.

albrookesplowman commented 3 years ago

Yes, we are dealing with a UA server - the matrikon tunneller wraps a classic server into a UA server - as far as I am aware :) Do you know the call that we can use to obtain this information on nodes and is there an example in this repository? Many thanks for all your help ....

AlinMoldovean commented 3 years ago

@albrookesplowman ,

Having the NodeId of a variable node, you need to do the following operations:

ZbynekZ commented 3 years ago

@AlinMoldoevan, why do you recommend doing the browse and searching through the returned collection? Isn't the TranslateBrowsePathsToNodeIds service designed just to do that, more effectively?

albrookesplowman commented 3 years ago

@ZbynekZ - how do I use that one? And I can give them both a try.....

ZbynekZ commented 3 years ago

For TranslateBrowsePathsToNodeIds , see https://reference.opcfoundation.org/v104/Core/docs/Part4/5.8.4/ . Basically, in your case, you will specify a browse path (https://reference.opcfoundation.org/v104/Core/DataTypes/BrowsePath/ ) which will have the node ID of the variable node as startingNode, and just one element in the relativePath (https://reference.opcfoundation.org/v104/Core/DataTypes/RelativePath/ ) . This single element (https://reference.opcfoundation.org/v104/Core/DataTypes/RelativePathElement/ ) will specify HasProperty as referenceTypeId, isInverse = false, includeSubtypes = true, and targetName will be the QualifiedName of the property you are looking for.

AlinMoldovean commented 3 years ago

Hi @ZbynekZ ,

Using TranslateBrowsePathsToNodeIds instead of Browse is more efficient indeed. Browse has the advantage that it gives you all the existing references (including properties) in one call.

albrookesplowman commented 3 years ago

@ZbynekZ / @AlinMoldovean - Would it be something like

      BrowsePathCollection browsePaths = new BrowsePathCollection();
      BrowsePathResultCollection results = new BrowsePathResultCollection();
      DiagnosticInfoCollection diagnostics = new DiagnosticInfoCollection();

      foreach (var r in references)
      {
        BrowsePath browsePath = new BrowsePath
        {
          StartingNode = (NodeId)r.NodeId,
          RelativePath = new RelativePath
          {
            Elements = new RelativePathElementCollection
            {
              new RelativePathElement
              {
                IsInverse = false,
                IncludeSubtypes = true,
                TargetName = "EURange"
              }
            }
          }
        };

        browsePaths.Add(browsePath);
      }

      SessionConnection.OpcUaClientSession.TranslateBrowsePathsToNodeIds(browsePaths.ToArray(), out results, out diagnostics);
ZbynekZ commented 3 years ago

Yes, in principle, something like that. I do not know whether "(NodeId)r.NodeId" is correct, because I do not know what type is your "references" input, but hopefully that's correct too.

albrookesplowman commented 3 years ago

@ZbynekZ - am i right in thinking that I can then use the results array to read the actual values using the ReadValue call?

ZbynekZ commented 3 years ago

Yes but not directly - you need to get the node IDs from the results array of TranslateBrowsePathsToNodeIds (they are in the targetId-s), and then construct the arguments for Read with them.

albrookesplowman commented 3 years ago

@ZbynekZ - I seem to be getting a Bad_NoMatch for a request for EURange for the Tag I am after which I assume means that it doesn't exist... Is this correct?

ZbynekZ commented 3 years ago

It means that it doesn't exist, if you have specified all arguments correctly and the server doesn't have a bug... I suggest that you check it in some other OPC UA client such as UAExpert.

tukotech commented 3 years ago

@albrookesplowman if I may go back to the original question which was read the range, engineering units etc. This might be server specific.

For example, a DCS/SCADA system that implements FF Specs that implement AI (Analog Input Function) block will have the range and engineering units as part of the function block. An AI function block may provide the engineering unit like: AI1/XD_SCALE.UNITS AI1/XD_SCALE.EU0 AI1/XD_SCALE.EU100

What was the Matrikon connected to?

albrookesplowman commented 3 years ago

@tukotech - many thanks for the information. At the moment we are using the Matrikon UA Tunneller to wrapper around a OPC classic server so that we can connect to it as a UA client. We are developing a system that will either connect direct to a UA server or to other servers using the Matrikon Tunneller software. I do not currently have any further information about the OPC server that is at the other end of the tunnel but I will try and find out. We are about to deploy a test around a OPC DA server (again via the Tunneller software) so I will be able to do some further tests with that too.

Do you know how to read the information if the DCS implements FF Specs? Is there a means of getting this information?

tukotech commented 3 years ago

@albrookesplowman I only have access to Emerson's DeltaV DCS and yes DeltaV exposes data via ISA-95 equipment model and the control modules supports FF specs model.