Example Code

Retrieving OPC UA Common Operation Level Status Code Messages

Code and Documents

Attachment

Download All

Overview

This example shows a method for retreiving the OPC UA Status Code messages, based on the status code generated by an OPC UA VI.

OPC UA Common Operation Level Status Codes: http://zone.ni.com/reference/en-XX/help/371618J-01/lvmve/opcua_status/

Description

OPC UA VI's have both an error terminal and a status terminal. The status terminal can provide the user with additional information in situations which may result in unexpected behaviour, but not necessarily a LabVIEW error on the error line - it would therefore be useful to be able to access the Status Code Description to be able to provide feedback to the user should there be something they need to be made aware of.

This VI implements this by reading in a tab delimited text file which contains the Status Code table (see link above), and performing basic string array searches to return the relevant status code description message.

Once this message has been retrieved, it could be used by the developer to generate a customer error code through an Error Ring.

Steps to Implement or Execute Code

1) Download Status Codes Text File "Status_Codes.txt"

2) Run the VI

3) Select the Status Codes Text File in the file dialog box

4) An error will occur as the OPC UA Client Read VI is not configured correctly - it is merely included as an example of an OPC UA VI with a status terminal

5) Click stop on the error message, the demonstration section of code will output a status code message to the Tester indicator, based on the constant status code input

Additional Images or Video

Example message for Status Code 2150891520

Status Code Message.PNG

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
RVallieu
Active Participant
Active Participant
on

I don't seem to be able to find the file "Status_Codes.txt" did you forget to upload it?

 

This implementation could be made much faster if you load the text file into a Variant Lookup Table.

 

I would also move the Skip on 0 (Good) into the subVI.

Ryan Vallieu CLA, CLED
Senior Systems Analyst II
NASA Ames Research Center
Contributors