NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Get array of container in LabView

Hi,
How would you go about getting values from a TestStand array of container while in a LabView Code Module?
jackson
0 Kudos
Message 1 of 7
(6,251 Views)
Hi Jackson,

Unfortunately, you will have to access each element of the conatiner individually from within your code module. That is, if you have a container that has a boolean and a string, then you would need to access Locals.MyContainer.Boolean, and Locals.MyContainer.String individually. You can also get the container as a PropertyObject and access individual elements that way.

Bob
0 Kudos
Message 2 of 7
(6,251 Views)
Hi,

Just to expand on bob's answer. I have attached an example I of obtaining values from an array of containers.

The Container is PSUParams which has the following structure.

Channel type string
Voltage type number
Current type number
VoltageLimit type number
OVP type Boolean
OCP type Boolean
Present type Boolean

The VI has the inputs base LookupString, row index and column index.
The outputs are the individual parameters of the PSUParams container.

Hope this helps
Regards
Ray Farmer

False
False
False
Regards
Ray Farmer
Message 3 of 7
(6,251 Views)
Ahh Okay, I didn't know you could use the C [ ] notation when looking up values. Nice. One other question - would it be easier to use the DLL interface with LabView to pass this data in? I haven't looked at what sort of limitations it has on the types of data structures that can be used.

Im starting to lean toward doing things that way anyway, since it would be better programming style to have defined interfaces for the code modules, as opposed to the "just try and guess what data I'm pulling out of the sequence context" ways of the LabView Standard Prototype Adaptor. If it also saved me the hassle of writting put'er and get'er VI's to access each data structure in TestStand, that would be more than enough justification to spend the time to switch over.

jackson
0 Kudos
Message 4 of 7
(6,251 Views)
Hi,

To set and get values from any teststand array you use the form MyArray[x] and not MyArray(x) as this will be treated as calling a function.

Not sure I understand what you are meaning by using a DLL interface.
If you are calling a dll function from your labVIEW VI to get the values of some TestStand variables then I dont understand the logic in doing. If you what to use a DLL Interface then cut out the labVIEW and call the DLL direct from TestStand via the DLL adapter and do your task in C / C++. (If that's an option)

The example I provided was an old subVI I had. I probalby would use a custom step now to handle that situation so that all the information was contained within the step.

Anyway, Good Luck with what you are trying to achiev
e.
Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 5 of 7
(6,251 Views)
What I meant is that you can compile VIs into DLLs. So when calling my VI from TestStand, rather than using the LabView Standard Adapter, I could compile my VI into a DLL and call it using the DLL Flexable Adapter. This way I could pass my data directly to the VI rather than having to write wrappers get and set data from the sequence context.

Unfortunately, I have since found out that TestStand (or LabView) has problems with passing arrays of struct through the DLL interface. So I guess I am stuck with having to either write the wrappers or implement my test as a subsequence.

Oh, and yes I agree that using custom step types is a good way to have all the parameters for a step in one place. That's a good idea.
jackson
0 Kudos
Message 6 of 7
(6,251 Views)
Hi,

Ah, I forgot that you can produce dll's from VI's these days.

I have seen the odd problem relating to LabVIEW DLL's and TestStand. So it might be a good idea just to scan the Toubleshooting and Forum pages.

Regards
Ray Farmer
Regards
Ray Farmer
0 Kudos
Message 7 of 7
(6,251 Views)