OPC UA HistoryRead: Resolving Five-Minute Sample Requests

Jason IP2 min read
OPC / OPC UAOther ManufacturerTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

Raw Reads Do Not Define a Sample Rate

HistoryReadRaw returns the values stored between the requested start and end times. The server or underlying historian determines when those values were sampled and stored; the client cannot impose a five-minute interval on a raw history read.

numValuesPerNode limits how many results the server returns in one response. It does not distribute results evenly across the time range. If additional stored values exist, continue the read using the returned continuation point.

History operation Interval behavior Result limit
HistoryReadRaw Returns stored values; no client-defined resampling numValuesPerNode limits each response
HistoryReadProcessed Applies a resample interval and aggregate Produces aggregate results from available raw history

Configure a Five-Minute Processed Read

When the server supports HistoryReadProcessed, set the start time to 10:00, the end time to 14:00, and the resample interval to five minutes. This four-hour range contains 48 five-minute intervals. Select the aggregate according to the value required at each interval boundary.

Aggregate Supported behavior
StartBound Returns the value and status at each interval's start time using Simple Bounding Values.
EndBound Returns the value and status at each interval's end time using Simple Bounding Values; use it when the required sample is the last value at the interval boundary.
Minimum2 Returns the minimum good value for each interval, includes Simple Bounding Values, and ignores bad values during computation.

The evidence contains a contradictory statement describing Maximum2 as returning a minimum. Do not use that statement to select the aggregate; verify Maximum2 behavior against OPC UA Part 13 and the server's supported aggregate definitions.

Handle Servers Without Processed History

A server can support HistoryReadRaw without implementing HistoryReadProcessed. In that case, the client must retrieve raw stored values and perform the required five-minute selection or calculation itself. The available evidence does not define the interpolation or boundary algorithm for that client-side fallback, so establish those rules explicitly before implementation.

  1. Issue the raw history request for 10:00 through 14:00.
  2. Process every continuation point until the server returns no additional raw values.
  3. Apply the application's defined five-minute boundary and quality-handling rules to the complete raw result set.
  4. Verify that the output represents 48 intervals and that its timestamps follow the selected start-bound or end-bound convention.

Do not set numValuesPerNode to 48 expecting one result every five minutes. That setting can truncate a response after 48 stored values regardless of their timestamp spacing.

FAQ

Does numValuesPerNode set the OPC UA history sample rate?

No. In HistoryReadRaw, it limits the number of values in one response; use continuation points to retrieve the remaining stored values.

How do I request OPC UA history every five minutes?

Use HistoryReadProcessed with the required start time, end time, five-minute resample interval, and an appropriate aggregate such as StartBound or EndBound.

What if the OPC UA server does not support HistoryReadProcessed?

Read all stored values with HistoryReadRaw, follow every continuation point, and perform the five-minute resampling in the client using explicitly defined boundary, interpolation, and quality rules.

Back to blog