View Issue Details

IDProjectCategoryView StatusLast Update
0009127CTT UA Scripts1 - Script Issuepublic2023-10-05 14:20
ReporterJouni Aro Assigned ToPaul Hunkar  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionno change required 
Product Version1.04.501 
Summary0009127: Data Access Semantic Changes tests have wrong assumptions
Description

The Data Access Semantic Changes tests are expecting that the change in variable semantics trigger an immediate Data Change Notification before the new value is updated according to the new semantics. This is against the specification and the whole idea of the bit.

The specification says (Part 4. 7.39, Table 180):

”SemanticsChanged

Indicates that the semantics of the associated data value have changed. Clients should not process the data value until they re-read the metadata associated with the Variable.

Servers should set this bit if the metadata has changed in way that could cause application errors if the Client does not re-read the metadata. For example, a change to the engineering units could create problems if the Client uses the value to perform calculations.”

Steps To Reproduce

Assuming the following measurements being made

25 C
78 F (=25.6 C)

the assumption is that the server sends two values

25 / Good
78 / Good / SemanticsChanged

However, the Data Access Semantic Changes 001.js changes the EngineeringUnits, but does not change the value and verifies that the server sends a data change with SemanticsChanged.

So, in practice, it expects that the server would send in this case

25 / Good
25 / Good / SemanticsChanged
78 / Good

which would make the client interpret the measurements as

25 C
25 F
78 F

which was exactly the danger to avoid

Additional Information

There are several Data Access Semantic Changes scripts that change different semantics, EURange, InstrumentRange, etc, and the same problem applies to all of them.

TagsNo tags attached.
Files Affected

Activities

Paul Hunkar

2023-09-01 15:08

administrator   ~0019951

I don't agree with your discussion - since this is assumming processing of the system. When the EU information changes - if the value also needs to be change they should be locked together. A client that is just reading the EU - get a new EU when it changes - he would then mis-interpret the value. When the server set the bit - the value should also have been set- if it needs to be updated - if the logic in the server does not trigger a new value(because it did not change - the EU change is such that the resulting value in the same - it is -40 degrees out side - the value in C and F is the same - the bit is still set when the EU was updated and an new report is generated.

we don't think anything needs to be changed

Jouni Aro

2023-09-01 16:48

reporter   ~0019954

Well, that sounds all nice and clean, but we don't have a mechanism in OPC UA that would enable me to distinguish between the situations where the semantic change will be accompanied with a value change (sooner or later) or not.

My assumption is that if the Engineering Units is changed from C to F, the value always needs to be updated as well. Assuming something else can be very dangerous at worst.

The whole idea with the SemanticsChanged bit is to tell that if the server configuration has been changed while the client is monitoring data changes in a way that requires the client to update it's understanding of the values , the client can notice it and avoid interpreting the new value with old semantics. If the client is not expected to react to the unit change, since it does not really affect the interpretation of the values, there is also no need for this bit to be sent.

Meaning, in your case, if the server is expected to send the following data to the client:

25 C
25 F (Semantics Changed)

we don't really need to send the Semantic Change or the same value again at all.

The main reason for the SemanticsChanged bit is to avoid the situation, when the server really starts sending values in a different ballpark as in my original example.

OK, let's assume you are actually expecting this, instead:

0 m
0 yd (Semantic Change)
1 yd

Why is it important or even necessary to send the value 0 with Semantic Change? If it is OK to use 0 with 'm', it is as OK to use it with 'yd'. So, I can as well send

0 m
1 yd (Semantic Change)

And this is what we are doing, when we get the new sample that changes in value.

And finally, let's assume that the change of units really comes from a client application (as happens with the CTT) and it should be accompanied with a value change. For example:

25 C
77 F

Who is responsible of doing the unit conversion (25->77). Should the server expect the client to write it and if it doesn't, should the server be clever enough to do this conversion? Or if the client is supposed to do it, how does it know that it should send a new value as well, when it only wants to tell the server that I would actually want to see these measurements in F instead of C?

Or if the client only changes the units, how is the server supposed to know that it may apply it with the current value that used to be in different units? (and why would it then need to send the old value with new units?)

Anyways, our implementation in the SDK follows the above logic and is safe in every case: it marks the SemanticsChange bit to be added to the next value change. This leaves it up for anybody to provide the new value. Only after that will we report the new data change. That means we will never send an unexpected value (25 F) in case the real sample in F is expected in a few seconds (which we don't know).

The usual assumption is that this kind of unit changes cannot be made safely from client applications and my expectation is that this is server internal configuration since the server knows the values that it is updating and their proper units. So the assumption is that within the server the units are changed first and the value update will shortly proceed. If the server is capable of using different units, it must also be capable of doing the conversions. Since we don't have such functionality built in, I expect that the applications written with the SDK will take care of it. So, I can only mark the Semantic Change and expect that the application will update the value shortly. I don't need to do anything special for that.

Paul Hunkar

2023-10-05 14:20

administrator   ~0020096

As discussed in UA working group - no change required

Paul Hunkar

2023-10-05 14:20

administrator   ~0020097

Agreed in call

Issue History

Date Modified Username Field Change
2023-08-31 09:16 Jouni Aro New Issue
2023-09-01 15:08 Paul Hunkar Assigned To => Paul Hunkar
2023-09-01 15:08 Paul Hunkar Status new => feedback
2023-09-01 15:08 Paul Hunkar Note Added: 0019951
2023-09-01 16:48 Jouni Aro Note Added: 0019954
2023-09-01 16:48 Jouni Aro Status feedback => assigned
2023-10-05 14:20 Paul Hunkar Status assigned => resolved
2023-10-05 14:20 Paul Hunkar Resolution open => no change required
2023-10-05 14:20 Paul Hunkar Note Added: 0020096
2023-10-05 14:20 Paul Hunkar Status resolved => closed
2023-10-05 14:20 Paul Hunkar Note Added: 0020097