DataType of values returned from HistoryRead (ReadRawModifiedDetails)|OPC UA Standard|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
DataType of values returned from HistoryRead (ReadRawModifiedDetails)
Avatar
saurla
New Member
Members
Forum Posts: 2
Member Since:
01/29/2021
sp_UserOfflineSmall Offline
1
11/30/2023 - 05:07
sp_Permalink sp_Print

Hi.

I'm trying to figure out how the HistoryRead should behave regarding DataTypes of returned DataValue Values inside the HistoryData. I did not find answer to this from the specification. It just stated that the actual data can be compressed or just raw data collected from the item.

So what should be the DataType of the returned Values? Should it be the same as the DataType of the variable node? Or can it be different? Can there be mixed DataTypes in the returned DataValue array? If the DataType should match the DataType of the variable node, then what DataType should be used for abstract DataTypes (Integer, UInteger, Number, etc.)?

If this is already specified in the specification could someone point me to the correct chapter? If not then I think this should be clarified so that server developers would know what to return and clients would know what kind of data to expect.

Avatar
Randy Armstrong
Admin
Forum Posts: 1457
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
11/30/2023 - 14:40
sp_Permalink sp_Print

The DataValues should have the DataType of the Value that is stored in the archive. Generally this is the same as the associated Variable but DataType can change over time so historical Values can have a different type than the current values.

The same is true for the ValueRank.

At given point in time the DataType in the DataValue and the value of DataType/ValueRank must match.

Avatar
saurla
New Member
Members
Forum Posts: 2
Member Since:
01/29/2021
sp_UserOfflineSmall Offline
3
12/04/2023 - 01:11
sp_Permalink sp_Print

Hi.

Thanks for the answer. So if the DataType of the Variable is Double and ValueRank is Scalar then the archived DataValue DataType must be Double and ValueRank Scalar? Or can the server decide to archive the value with different DataType from the Variable nodes DataType? You say generally archived values DataType is same as the associated Variable. Is this a hard requirement by the specification or just a guideline?

I'm thinking this from the clients perspective. If the Variable DataType/ValueRank has always been Double/Scalar then can the client safely assume that DataType/ValueRank of the DataValue from the HistoryRead is Double/Scalar? For example in the C# Opc.Ua.Core library the Value inside DataValue is of type object and the client needs to cast it to the correct type. Is it safe to do this cast without checking DataType/ValueRank of each returned DataValue if you know the Variable nodes DataType/ValueRank has always been Double/Scalar.

Avatar
Randy Armstrong
Admin
Forum Posts: 1457
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
4
12/04/2023 - 03:14
sp_Permalink sp_Print

1) Servers mess up no matter what the spec says so clients always need to be prepared for mismatch. They can report it as a type mismatch or some other error but they need to handle the case gracefully (i.e. don't blindly cast values without checking the type first).

2) What I said is it required that DataType/ValueRank match the DataValue at any given point in time. However, the DataType/ValueRank from yesterday may not be the same as it is today the the DataType in the Value can change over time. If you know the DataType/ValueRank never changes then all values for archived for that Variable will have the same DataType in the DataValue (unless the server is misconfigured/buggy).

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online:
Guest(s) 13
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1354
Posts: 4590