Skip to content

OPC UA Historical Data

Hello,

I have a PLCnext that acts a an OPC UA server and has a task with a cycle time of 2ms. I also have a WindowsPC with an application (which I am developing using .NET framework / OPC Foundation library) which acts as a client and needs to exchange data with the PLC.

I have for example 3 variables (of type Struct) in my PLCnext which when they change, I want to notify my client on the PC but I need it to be fast and not lose any variable changes during the communication.

Do you think I can achieve this with DataLogger of PLCnext? How do I access the history of a variable using OPC UA?

Also, is there a system variable which I can use to know when there is an active OPA UA connection to my PLCnext? I want to hide some buttons on the interface when a client is connected to my PLC.

Thank you for your time in advance.

Comments

  • Hello.

    A standard OPC UA DA (data access) subscription will not be able to retrieve all the data values for a variable that changes (potentially) every 2ms. The possible subscription update rates are listed here:

    https://www.plcnext.help/te/Communication_interfaces/OPC_UA/OPCUA_Monitored_Item_and_Subscription.htm

    In this case, I think you're on the right track - the datalogger on the PLCnext Control device can store all the data values, and then those values can be retrieved by an OPC UA HDA client. You can test this using the HDA client in UaExpert - there is a tutorial here:


    To do something similar in your own application, you will need to implement an OPC UA HDA client (not a DA client).

     is there a system variable which I can use to know when there is an active OPA UA connection to my PLCnext?

    No, not in PLCnext Engineer, as far as I'm aware. There is probably something in the Server Diagnostics that could help, for example this data item in server namespace 0 :

    i=2277 [Server_ServerDiagnostics_ServerDiagnosticsSummary_CurrentSessionCount]

    You can read that value using the OPC UA Client in the PLC, and put the value in a PLCnext Engineer variable.

Sign In or Register to comment.