03-24-2009 08:43 AM
I am at the end of a revamp on my main acquisition setup, and would like to tie it all together with this FG. I have 13 different values that are stored in a file, I would like to read them out of the file into a FG so that they can be dispersed at proper locations.
The problem is that there are 9 different data types within the 13 values, and I cannot figure out a way to get just one value out at a given location (by setting an enum constant), other than having at least 9 indicators. I've attached an picture of what I'm trying to do, but obviously the variant doesn't work because I can't wire that to the input of VI's that are expecting doubles, daq channels, etc...
I played around with dynamically loaded VI's, but didn't get anywhere, and am thinking that object oriented programming is the only way to go, but I'm not familiar with it. I also haven't made this into a project yet, although I will probably do that anyway to create an .exe down the road.
Solved! Go to Solution.
03-24-2009 08:55 AM
If you were to go with object-oriented then your cluster would essentially become a class and you would create accessor functions for each class member. You could do the same thing without creating classes by simply creating a separate VI to read/write each cluster member. Basically, have a VI for each enum value. These accessor functions would provide the correct datatype output. You would not even need to use variants.
One suggestion I would make regarding your code it to put the unbundling inside the case structure so you unbundle the specific item you want. There's little point in unbundling items that won't be used.
03-24-2009 09:01 AM
Although LVOOP would work your AE version just needs turned inside out and wrapped up (short answer).
Create actions and an associated wrapper VI for each action. In the warpper for "value1" it should call the AE with an action like "Get Value1" and return this value from the AE to the calling wrapper using a variant indicator. The wrapper (which knows what type of data to expect) in turn casts that varinat as the proper data type.
That should get you there.
Ben
03-24-2009 09:11 AM
Thanks for the input. I'm thinking lvoop is too steep of a learning curve for the result that I would get.
Using Ben's suggestion, I think I would have one Action Engine that I write to, and then seperate VI's, one for reading each variable?
I think I was there awhile ago, but decided there had to be some way to do it all with one Functional Global.
03-24-2009 09:20 AM
deskpilot wrote:Thanks for the input. I'm thinking lvoop is too steep of a learning curve for the result that I would get.
Using Ben's suggestion, I think I would have one Action Engine that I write to, and then seperate VI's, one for reading each variable?
I think I was there awhile ago, but decided there had to be some way to do it all with one Functional Global.
Yup!
Ben
03-25-2009 07:32 AM