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.
- Basics — Historical Models — 5 Conceptual Models HistoryRead
- Quick Start — History — SDK API At a Glance
- Example — Exporting Historical Data — Import in batches + Export to Excel
5 Modes HistoryRead
| Pattern | Applicable | SDK API |
|---|---|---|
| ReadRawModified (raw) | All points within the interval | ua.ReadHistory(nodeId, startTime, endTime, maxValues) |
| ReadAtTime | Interpolation at Specified Times | ua.ReadHistoryAtTime(nodeId, times, useSimpleBounds) |
| ReadProcessed (Aggregation) | Aggregated Results | ua.ReadHistoryProcessed(nodeId, start, end, processingInterval, aggregateNodeId) |
| ReadEvents | Event History | ua.ReadHistoryEvents(nodeId, start, end, maxEvents) |
| ReadRawModified (modified) | Includes revision history | ua.ReadHistoryModified(nodeId, start, end, maxValues, returnBounds) |
HistoryUpdate
| Operations | SDK API |
|---|---|
| Insert / Replace / Update / Remove Data | ua.UpdateHistory(nodeId, updateType, values) |
| Delete by Range | ua.DeleteHistoryRange(nodeId, start, end, deleteModifiedToo) |
| Insert Annotation | Not currently available |
| Delete Events | Not 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:
| Constants | NodeId | Note |
|---|---|---|
| Average | i=2342 | Arithmetic Mean of Values in an Interval |
| Minimum | i=2346 | Minimum Value in the Interval |
| Maximum | i=2347 | Maximum value in the interval |
| Count | i=2352 | Number of data points with a "Good" status within the interval |
| Total | i=2348 | Sum of Values in an Interval (Algebraic Sum) |
| StandardDeviationSample | i=11427 | Sample standard deviation |
| TimeAverage | i=11285 | Time-Weighted Average |
| Range | i=2353 | Within the interval (Max − Min) |
| Delta | i=11286 | End 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
ReadHistoryProcessedaggregation for high-frequency raw data; pull fewer raw data points. - The history read operation does not currently support resuming a read; use
maxValuesto control the number of records returned per request (0= unlimited; the upper limit is determined by the server).