NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing variables between LabVIEW and TestStand

Solved!
Go to solution

Hello,

 

I am just learning how to use TestStand and while there is a wealth of resources available, I am still finding myself at a loss on how to pass variables between TS and LV, leaving me to think that there's a small fundamental thing that I am missing which is likely since I have about a weeks worth of experience with LabVIEW and about a days worth of experience with TestStand.

 

I took a look at the "Passing Clusters to Code Modules" example in the TestStand examples (I'm using TS 2016 if that matters) since I figured that would be fairly ideal for what I'm hoping to. In this case, I'm hoping to be able to pass a string (a file path) to LabVIEW and have the VI be able to take that string and use it as part of a command for System Exec.VI.  I'd then like to be able to pass back strings to TestStand to show to the user if an error is encountered, but I figured I should get the first part working.

 

I guess my question is what should I expect to be seeing in the Passing Clusters to Code Modules example? The watch window shows all the local variables set to what ContainerOut has in the Variables pane, but I don't see any sort update on the assoicated LabVIEW front panels (VI1.vi and VI2.vi). Should I be? 

 

I looked at some other forum threads here and here, as well as the KnowledgeBase document here, but was unable to recreate their solutions. It seems the connector pane would be a viable way to go, but I am uncertain about how one actually creates and utilizes it. According to this document it makes it seem like it should be fairly straightforward to makes those terminals, but I'm still missing a key step. I was able to follow all the steps on the KnowledgeBase document, and execute the sequence, but then did not have any idea if it worked or not; I have the report show me the values of the variables that I set, but I have no idea if it actually did anything with the LabVIEW VI or not or how I could see that.

 

Please let me know if you need any other information or clarifaction about what I am asking.

 

Thank you for your time,
JColvin

Digilent, a National Instruments Company

0 Kudos
Message 1 of 8
(5,196 Views)

First, I think it's funny that an NI employee has to use the forums like the rest of us.  I assumed you would be at a level above and beyond platinum level support.

 

Based on your question, you're only sending a path, so clusters don't seem to be necessary.  You can use the native LabVIEW path input and the native TestStand path (which is a string, and hopefully you've done all of your escape characters correctly). 

 

To see what gets passed into the LabVIEW VI, I would add a breakpoint at that step and then trace into the VI so that you can see what input it got from TestStand.  Incidentally, TestStand can natively call an executable similar to System Exec, so you might want to give that a try too.

 

Pulido Technologies LLC

Message 2 of 8
(5,159 Views)

By default when you open the two VIs for edit the input controls will contain 0, empty string, empty array, boolean False.

 

If you set a breakpoint on the first VI and step into this VI when you execute the Sequnce, you should seen that the data that was defined in locals.ContainerOut should have been passed into Cluster of VI1 ie 64, "Default String", Array of two elements set to 1 and 2, Boolean set to True. Execute the VI and the individual items will be passed back to TestStand. The second VI (VI2) will be passed these individual values and return it back into Locals.ContainerIn (which was initially set to 0, "", empy array, False)

 

Hope this helps to answer your question.

 

Regards

Ray

Message 3 of 8
(5,110 Views)

Hi pulidotech,

 

Thanks for taking the time to respond to me. You're right in that I could've gone and gotten some internal support from NI, but I personally choose to post on the forum since I like forums and figured that since I usually encourage other people who contact Digilent to post on the Digilent forums, I could try out the NI forum for myself. I'm definitely impressed by the community that's here.

 

Adding the breakpoint was definitely helpful to pause and see what all variables were updating in the watch window. I'm not quite sure what you mean by trace into the VI though. I guess I'm imaginging some similar to highlight execution mode where I can see the values being passed along inside the block diagram, and I have tracing enabled in TestStand (under the Execute tab) but perhaps I'm missing something.

 

I'll have to take a look into calling an executable from TestStand since I think that could be really helpful long term.

 

Thanks,
JColvin

0 Kudos
Message 4 of 8
(5,092 Views)

Hi RaymondFarmer,

 

Thanks for taking the time to respond to me. I'm seeing all that data in the watch window now with the breakpoint included. I had originally missed in the VI that it added some text to the string that was sent back to TestStand. I guess what was throwing me off initially was that in the second VI (VI2), I had expected to be able to put some values in the front panel and then when I ran the VI through TestStand that I would be able to read those values, but it seems that it doesn't quite work that way.

 

Instead, I would have to have the LabVIEW code generate a particular value and then present that as an indicator for TestStand to read, correct?

 

Thanks,
JColvin

0 Kudos
Message 5 of 8
(5,089 Views)

To trace into the VI, when you're at your breakpoint, you can click on "Step Into", which (at least in my TestStand) is next to my stop button.  Then, your VI should open and you have the choice of running the VI (feel free to highlight execution, probe, breakpoint, or whatever) and then returning back to TestStand.

 

Pulido Technologies LLC

Message 6 of 8
(5,085 Views)
Solution
Accepted by topic author JColvin

If you want to enter some values, then you will need to create a dialog vi eg

Dialog.png

 

front panel.png

 

The OK button will allow the new values to be passed to the output terminals.

A Cancel Button will just pass the original values through to the output without alteration. The VI will close when either the OK or Cancel buttons have been pressed.

 

Regards

Ray

 

 

Message 7 of 8
(5,070 Views)

Hi Ray,

 

Thank you for your response. I was having some trouble getting the user input working on the front panel working, but after re-starting TestStand, everything started working the way I expected and I now have my project working the way I want it to.

 

Thanks,
JColvin

0 Kudos
Message 8 of 8
(5,025 Views)