+3
Under review

Add ability to enter True or False into dual object outputs

705David 9 months ago in IQANdesign updated by Gustav Widén (System support) 9 months ago 4

With the release of IQANDesign 7, there's a new warning for implicit value type conversion.

There are lots of cases where we use Dual objects to enable and disable features because it's a cleaner (less lines of code and easier to read) than using And Or and Not math objects.

When we use these dual functions we have used 0 or 1 in a lot of these dual objects which creates an implicit value type conversion warning because it is converting 0 or 1 to a bool.

Since it's possible to already add digital channels to the Dual Object, we think it should be possible to put True or False in them as well. This would allow us to continue using the Dual Object in this manner without the nuisance warnings.


Thanks

Aren't you using the single objects? If you have a dual object you take a boolean condition as input, convert it to an integer if true, and to a different integer if it is false. The object list then converts it back to a boolean. 

In my opinion, the single object and the not() objects are much cleaner. 

I disagree that the Single objects are cleaner in all scenarios. For example if you have an IDC that controls interlocks but there are Options that the vehicle may not have included in the interlocks.

Here is one example where we use Dual objects to simplify this scenario.


Radio Remote control, Fire Suppression, and Collision avoidance are all features that may be enabled or disabled depending on if the vehicle was equipped with them or not.

When the feature is disabled, the Interlock for it will automatically become True.

Image 3888

Here is what the same code without using the Dual Objects would looks like:

Image 3889

This uses more Objects and is harder to follow than the Dual Objects. Unless there is some other way to implement this that I am not seeing.

I see what you mean, when the selected channel is boolean it makes sense to combine with a boolean constant.