10-05-2007 07:32 AM
10-05-2007 07:53 AM
10-05-2007 08:11 AM
I have to convert an integer number to an enumerator because I use, for example, the index of a loop for the case selector.
Sometimes I also have a computation and the result must be converted to the enumeration.
Sometimes I have stored data in an other format and a part of it must be extracted and converted to an enumeration.
So, why you want me to avoid the conversion? Is it really something that difficult or extraordinary unusual?
Anyway, thank for the reply!
10-05-2007 08:23 AM
@FritzFranz wrote:
"I have to convert an integer number to an enumerator because I use, for example, the index of a loop for the case selector. " This can still be done but the case structure must be in a subvi.
"Sometimes I also have a computation and the result must be converted to the enumeration." Why convert, if you put your code in a subvi you don't have to convert because the enum control will take an integer input and do the correct case based on the integer input. lets say that you set up an enum in a subvi that is setup like this.
- Something : 0
- Something elsee : 99
If you wire in an integer value of 99 to the subvi the enum will take it in and process the case for 99.
"Sometimes I have stored data in an other format and a part of it must be extracted and converted to an enumeration." What type of format?
"So, why you want me to avoid the conversion? Is it really something that difficult or extraordinary unusual?" To many conversions of any kind will bring a program to its knees no matter how well it is written or how readable it is. I am just trying to get you to strucure your code so that you will not have to do so many different kinds of converions.
10-05-2007 09:24 AM
Thank you for helping me structuring my code!
I do not want to use subvis because they have a significant overhead on real time targets (on the same order as the type cast).
And also the code would not be more readable if every thin is in subvi's.
10-05-2007 09:56 AM
10-14-2007 10:25 AM
10-14-2007 11:12 AM - edited 10-14-2007 11:12 AM
Hi Fritz,
I am either not following you or you are onto simething I want to know more about.
What kind of target are you uisng and are you saying you are taking anoticable performance hit from code like this?
Could you post some example code that demonstrates your concern so we can take a closer look, please?
Regarding the ";DNI_IntToEnum.vi" VI that dwisti mentioned.
Yes that comes with the SDE and is used to type cast the iteration count to the target states. Rumour has it that it and any other VI that is named such that it starts with ";D" is Jeff K winking at you.
Ben
Message Edited by Ben on 10-14-2007 11:13 AM
10-14-2007 11:50 AM
...yes on a normal desktop pc with LabVIEW RT 7.1 we noticed a significant time overhead used by the type cast operator as in your example. We found this with the execution trace toolkit and we were somehow happy because we could increase the speed of our rt-application but on the other side the code is not that readable anymore...
10-14-2007 02:22 PM