0
Impicit value type conversion
Grisel, Evert-Jan 1 year ago
in IQANdesign
•
updated by Gustav Widén (System support) 12 months ago •
6
Since version 7 I get a "Impicit value type conversion" warning when I use a Derivative function in the activation part of a value log item.
Does anyone have a idea how to solve this?
Customer support service by UserEcho
In the help is stated that it is possible to use the Derivative function as a digital:
You can use both digital and analog channels as operands. If you use an analog channel where a digital value is expected, 0 (zero) equals False and any other value equals True. If you use a digital channel where an analog value is expected, False equals 0 (zero) and True equals 1.
Checking rising and falling edge on Boolean channels, you can use the functions Flank, PositiveFlank and NegativeFlank instead.
I want to log the value if someone change this value, so it's not a boolean value which is changing.
Do you mean that I have to use a Flank function on a analog value?
Sorry, I did not look close enough on the printscreen.
For detecting if a value increased, you can use DerivativeOf(value) > 0
And vice versa, for detecting if a value increased, you can use DerivativeOf(value) < 0
For detecting if a value changed in the last cycle, you can use DerivativeOf(value) <> 0
Compared to the implicit conversion you have now, this does add another calculation object to your expression.
But looking at the example printscreen, you can also save an unnecessary single object by having the DerivativeOf() function look directly at the value.
About this warning:
How about cases when you have Object List component where is Dual object, there is no way to use boolean true or false (only numbers 1 or 0 are possible)? And I have a lot of this kind of components what worked fine previous versions.
Should I now change these all to QCode?
For a more efficient implementation, I suggest using a single object.
With the dual object in the printscreen, you start out with a boolean, then convert it to integer value 1 if it is true and 0 if it false, and then the object list method interprets the nonzero value 1 as True, and value 0 as False.
A single object avoid the unnecessary steps.
With that said, there may be cases when you select another boolean channel, then boolean constants in the dual object would make sense. See Add ability to enter True or False into dual object … / Software / IQAN