Skip to main content

Historical Access(Part 11)

Historical Access (Part 11) defines how to access historical data stored in the server-side "Historian." This is the Historical Data Access (HDA) capability and is not the same as Server High Availability. For a detailed explanation of this concept, see Basics → Historical Models.

Further Reading

5 Modes HistoryRead​

PatternApplicableSDK API
ReadRawModified (raw)All points within the intervalua.ReadHistory(nodeId, startTime, endTime, maxValues)
ReadAtTimeInterpolation at Specified Timesua.ReadHistoryAtTime(nodeId, times, useSimpleBounds)
ReadProcessed (Aggregation)Aggregated Resultsua.ReadHistoryProcessed(nodeId, start, end, processingInterval, aggregateNodeId)
ReadEventsEvent Historyua.ReadHistoryEvents(nodeId, start, end, maxEvents)
ReadRawModified (modified)Includes revision historyua.ReadHistoryModified(nodeId, start, end, maxValues, returnBounds)

HistoryUpdate​

OperationsSDK API
Insert / Replace / Update / Remove Dataua.UpdateHistory(nodeId, updateType, values)
Delete by Rangeua.DeleteHistoryRange(nodeId, start, end, deleteModifiedToo)
Insert AnnotationNot currently available
Delete EventsNot currently available

updateType Take the four members HistoryUpdateType of: Insert(1) / Replace(2) / Update(3) / Remove(4). In this Remove case values, only the SourceTimestamp is used to locate the point to be deleted; the value field is ignored.

Node: Historizing​

The Attribute 20 (Historizing) attribute of the Variable node indicates whether logging is enabled. The server will reject the request if the node does not have sufficient access permissions for HistoryRead.

Aggregates​

Currently SDK available aggregate functions NodeId:

ConstantsNodeIdNote
Averagei=2342Arithmetic Mean of Values in an Interval
Minimumi=2346Minimum Value in the Interval
Maximumi=2347Maximum value in the interval
Counti=2352Number of data points with a "Good" status within the interval
Totali=2348Sum of Values in an Interval (Algebraic Sum)
StandardDeviationSamplei=11427Sample standard deviation
TimeAveragei=11285Time-Weighted Average
Rangei=2353Within the interval (Max − Min)
Deltai=11286End of Interval − Start of Interval

Example: "Check the hourly average temperature over the past 24 hours":

var values = ua.ReadHistoryProcessed(
nodeId: "ns=2;s=Temperature",
start: yesterday,
end: today,
processingInterval: TimeSpan.FromHours(1),
aggregateNodeId: HistoryAggregate.Average);

Performance Recommendations​

  • Use ReadHistoryProcessed aggregation for high-frequency raw data; pull fewer raw data points.
  • The history read operation does not currently support resuming a read; use maxValues to control the number of records returned per request (0 = unlimited; the upper limit is determined by the server).