LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I'm stuck inside my Functional Global

Solved!
Go to solution

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.

0 Kudos
Message 1 of 6
(3,090 Views)

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. 

0 Kudos
Message 2 of 6
(3,077 Views)
Solution
Accepted by topic author deskpilot

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 6
(3,072 Views)

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.

0 Kudos
Message 4 of 6
(3,068 Views)

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

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 6
(3,063 Views)
A much better solution to this problem is to use a single-element queue instead of an action engine.  This scalability is one of the advantages the single-element queue has over the functional global.  You will still need to write accessor functions (the down side of single-element queues), but you won't need a variant transform.
0 Kudos
Message 6 of 6
(3,017 Views)