Create a Client and Connect to the Server

You create client objects using the results of a query to the Local Discovery Service using opcuaserverinfo, or directly using the host name and port number of the server you are connecting to. In this case, find the server with a name containing 'Quickstart Historical'.

Define Nodes to Read Historical Data

The Quickstart Historical Access Server simulates some historical data for nodes in the namespace. Two sets of data are provided: Sample data, which is a small data set, and Dynamic data, which varies in size depending on when the server was started. Define these nodes using the opcuanode function.

(Server-Specific) Discover When the Server Was Launched

The Quickstart Historical Access server creates a simulated archive of data from the beginning of the hour that the server was started to the start time of the server (for the Dynamic nodes). To provide reasonable time ranges over which to retrieve data, query the server for the start time.

All servers must publish a ServerStatus node which includes information on the start time of the server. You can read this value directly from the OPC server, using the getServerStatus function. Calculate the start and end times of the history stored by the server.

Read Historical Data at Specific Times

You can ask the server to retrieve data at specific times. If the server does not have an archived value for that specific time, an interpolated (or extrapolated) value is returned. Use the readAtTime function to retrieve data each 5 minutes for two hours.

Read the Average value for each 10 second period over 2 minutes. Note how the quality of the data includes Good quality, Bad quality (where there is no data available to perform the calculation), and Uncertain quality (where insufficient data is available to classify it as Good).

This website uses cookies to improve your user experience, personalize content and ads, and analyze website traffic. By continuing to use this website, you consent to our use of cookies. Please see our Privacy Policy to learn more about cookies and how to change your settings.