01/29/2021
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.
05/30/2017
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.
01/29/2021
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.
05/30/2017
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).
1 Guest(s)