UA HistoryRead

Unified Architecture topics related to OPC UA Specification, compliant behavior and any technical issues of OPC UA, like Security, Information Model, Companion Specs DI, PLCopen, ADI, ...

Moderator: Support Team

Post Reply
sandeepraj
Full Member
Full Member
Posts: 6
Joined: 03 Jul 2013, 08:09

UA HistoryRead

Post by sandeepraj »

Hi,

I'm trying to read the historical values of a node. The requirement is to fetch all the value between a particular timestamp with a given sample rate. For Ex: Start time - 10:00 hrs End time - 14:00 hrs, sample rate = 00:05(every 5 mins).
How to get the values for every 5 mins starting 10:00 hrs ? Can I use ReadRawModifiedDetails with numValuesPerNode = 48 (every 5 mins across 4 hrs will be a total of 48 values) ?

- Sandeep

dammmatt
Administrator
Administrator
Posts: 2
Joined: 02 Apr 2008, 03:32

Re: UA HistoryRead

Post by dammmatt »

Hi Sandeep,

History data is sampled and stored with a rate defined by the OPC UA server or the underlying historian system.

The HistoryReadRaw gives you all stored values between start time and end time. There is no way to define a sampling by the client in HistoryReadRaw. NumValuesPerNode is just a way to limit the number of results in one response and to use continuation point to continue read if more data is available.

HistoryReadProcessed gives you a way to calculate values based on the available raw data. In HistoryReadProcessed you can define
- Start time
- End time
- Resample interval
- Aggregate function

If you specify Start time - 10:00 hrs End time - 14:00 hrs and a resample interval of 5min, the server will return your expected number of values. The aggregate functions StartBound or EndBound will give you the expected behavior.

The StartBound Aggregate returns the value and status at the StartTime for the interval by calculating the Simple Bounding Values for the interval.
The EndBound Aggregate returns the value and status at the EndTime for the interval by calculating the Simple Bounding Values for the interval.

But you should take into account that not all servers supporting HistoryReadRaw do also support HistoryReadProcessed. You should think about a fallback to HistoryReadRaw in you client.

Matthias

sandeepraj
Full Member
Full Member
Posts: 6
Joined: 03 Jul 2013, 08:09

Re: UA HistoryRead

Post by sandeepraj »

Hi Matthias,

Thanks a lot for your response !
Yes, the server i'm trying to read from does not support HistoryReadProcessed(not yet implemented). So I'm forced to use HistoryReadRaw! :-\

-Sandeep

sandeepraj
Full Member
Full Member
Posts: 6
Joined: 03 Jul 2013, 08:09

Re: UA HistoryRead

Post by sandeepraj »

Hi Matthias,

Yesterday while researching further, I came across Aggregates. Minimum2 & Maximum2 which uses stepped interpolation for bounds and for non existent values. Also, I think we can specify a sample as well. Can I use them for my requirement ? Can you pls throw some light on their usage ?

-Sandeep

dammmatt
Administrator
Administrator
Posts: 2
Joined: 02 Apr 2008, 03:32

Re: UA HistoryRead

Post by dammmatt »

Hi Sandeep,

Like mentioned in my previous post, the aggregate EndBound is the right choice if you want to get the last value in the resample interval defined in HistoryReadProcessed.

If you use the aggregate Minimum2 you get the minimum value in the resample interval defined in HistoryReadProcessed.
From OPC UA part 13:
The Minimum2 Aggregate retrieves the minimum good value for each interval as defined for Minimum except that Simple Bounding Values are included. The Simple Bounding Values for the interval are found according to the definition of Simple Bounding Values (see Clause 3.5.10). Any bad values are ignored in the computation. The Aggregate StatusCode will be determined using the StatusCode Calculation (See Clause 5.4.3) for time based aggregates. If a bounding value is returned then the status will indicate, Raw, Calculated or Interpolated.

If you use the aggregate Maximum2 you get the minimum value in the resample interval defined in HistoryReadProcessed.

Matthias

Post Reply