Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

readProcessed (opcua)

Read aggregate data from nodes of an OPC UA server

Syntax

UaData = readProcessed(UaClient,NodeList,AggregateFn,AggrInterval,StartTime,EndTime)
UaData = readProcessed(NodeList,AggregateFn,AggrInterval,StartTime,EndTime)

Description

UaData = readProcessed(UaClient,NodeList,AggregateFn,AggrInterval,StartTime,EndTime) reads processed historical data from the nodes given by NodeList. NodeList must be an array of OPC UA node objects, which you can create using getNamespace, browseNamespace, or opcuanode. The interval between StartTime and EndTime (which can be datetime variables or date numbers) is split into intervals of AggrInterval, a MATLAB duration variable or a double representing the interval in seconds. For each interval of time, the server calculates a processed value based on the AggregateFn requested. AggregateFn can be specified as a character vector or as an AggregateFnId object. A client stores the available Aggregates for a server in the AggregateFunctions property. For a description of Aggregate functions, see opc.ua.AggregateFnId.

UaData is returned as a vector of OPC UA data objects. If readProcessed fails to retrieve historical data for a given node, that node is not included in the returned OPC UA data object, and a warning is issued. If all requested nodes fail, an error is generated.

UaData = readProcessed(NodeList,AggregateFn,AggrInterval,StartTime,EndTime) reads from the nodes identified by NodeList. All nodes must be of the same connected client.

OPC UA servers provide historical data only from nodes of type Variable. If you attempt to read values from an Object node, no data is returned for that node, and the status for that node is set to Bad:AttributeNotSupported, a warning is issued, and the node is not included in the returned UaData object.

Examples

Retrieve the average value for each 10 minute interval of the current day from a local server.

uaClnt = opcua('localhost', 62550);
connect(uaClnt);
nodeId = '1:Quickstarts.HistoricalAccessServer.Data.Dynamic.Double.txt';
nodeList = opcuanode(2, nodeId, uaClnt);
dataObj = readProcessed(uaClnt,nodeList,'Average',minutes(10),datetime('today'),datetime('now'));

Introduced in R2015b

Was this topic helpful?