NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing variables using LabView's User Interface

Using Labveiw 7.0 & TestStand 3.0
 
If I have a sequence with  Locals.number or Fileglobal.number or Stationglobal.number. 
Is there a way to access these TestStand variables using Labviews User Interface during runtime?
 
 
I looked at:
TestStand Reference Manual, Chapter 9: Creating Custom Operator Interfaces
TestStand, Using Labview with TestStand,Chapter 6:Creating Custom User Interfaces in Labview
TestStand Help
TestStand User Interface Controls Reference Poster
API Reference Poster
 
Didn't help.
 
I tried getting a SequenceContext using the ExecutionViewMgr, then use Labview's TestStand - Get Property Value.vi to get the variable, but I get error -97.
0 Kudos
Message 1 of 6
(5,685 Views)

It is easy to access a sequence variable using the LabView adapter.

I am assuming that you want to call a LabView module from an executing TestStand sequence and that you want to pass the sequence variable (local, file global, station global) as an input parameter to the VI.

 

  1. Select the LabView Adapter.
  2. Insert an Action Step into your sequence.
  3. Specify the Step Module. (Ctrl + M)
  4. Enter the VI Pathname.
  5. Select Edit VI…
  6. LabView will be launched and the VI front panel will be displayed.
  7. Insert a Numeric Control.
  8. Right Click on the VI  Icon on the upper right corner of the window and from the context menu select “Show Connector”
  9. Add a new input Terminal and link the terminal to the new control.
  10. Save the VI.
  11. Go back to the Specify Module dialog in TestStand and select ‘Reload Prototype’.
  12. You will see that a new variable is displayed corresponding to the control that you just created.
  13. Go to the Value Field and assign “Locals.number” or whatever numeric variable you want.
  14. Click ok and run the sequence.
  15. When the step is executed the value in your variable is assigned to the corresponding numeric control in your LabView User Interface.

 

You can also create an output connector and pass the value of the variable as an output parameter once the step is executed.

 

I hope this helps.

0 Kudos
Message 2 of 6
(5,672 Views)
Thank you for the advise, but mis-unnderstnading. I know how to do what you discribed.
 
I am using Labview's Operator Interface to run a sequence. It uses TestStands User Interface Controls in a Labview vi (exe file) to run a sequence. TestStand provides a Simple Operator Interface that will just run a sequence. I want to be able to access the TestStand's variables (Locals, FileGlobals or StationGlobal)s using the User Interface Controls.
 
I have this test that runs 80 times. I want to stop it by setting a flag in the goto loop. I was trying to use a Labview button and TestStands Set Property.vi in the Simple Operator Inface.exe, but it wasn't working. I am thinking I have to use a TestStand control (button) not a Labview control.
0 Kudos
Message 3 of 6
(5,673 Views)
Hello, The correct method that you should use to access a running Sequence's properties from an Operator Interface is a technique called UI Messaging. Look in the "Config Event CallBacks" VI. This uses the "Register ActiveX Events" node to register events that the TestStand engine is constantly firing. These events are captured by the OS and can be handled in LV. Using the node mentioned above, you can register the event of any ActiveX object and handle that event by executing a subVI whose reference you pass to the node as well. Whenever the that event occurs, LV will run the code in that subVI. You can also pass data into the subVI. There is a "Thread" method that allows you to post a customer UI Message (an activeX event for the TS engine) that can be captured and handled in the LV OI. Using this method (ie RunState.Thread.PostCustomUIMessageEx), you can also pass data from TS to the OI.

Therefore, if you want to effect a TestStand variable from the OI, post a customer UI Message to the OI with a reference to the sequencecontext (ie: ThisContext). In the handler that is set up in the OI (ie: the callback subVI), pass in whatever control values and/or control references you need and use them to modify the contents of the running sequence's sequencecontext variables using the SetVal VIs as you normally would within a simple code module.

There is a very good example explaining how to use UIMessages called, "How to Work with UIMessages in TestStand 3.0", that can be found at: "http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=C42F09BEA4C15AD2E034080020E74861&p_node=%20DZ52220&p_source=External".

A more advanced example called, "Mulitple StatusBars to Monitor Parallel Executions using UIMessages", can normally be found at: "http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=EE1203FF2C816868E0340003BA7CCD71&p_node= DZ52218"; however, it is not available at the moment because it is currently under review. I will attach the zip file to this post (if it is not too large).

The TestStand class has a half a chapter devoted to the subject of UI Messages. If you can arrange to take the course or can get your hands on a course manual, it is TestStand II: Customization Chapter 5 (the second half), exercise 5-2.

Hope this helps. Please let me know if you have any spefic questions about UI Messages that I can help with. Take care!

Regards,

Aaron B.
National Instruments
0 Kudos
Message 4 of 6
(5,644 Views)
Thanks for the help!
0 Kudos
Message 5 of 6
(5,642 Views)

Option1:

 

You can modify the Station Global variables at run time by simply getting a reference to the Engine from the Application Manager (GetEngine) and after that getting a reference to the Station Globals directly from the Engine (Globals). From the Globals Object call the SetValNumber Method in order to set the desired global value.

Remember that once you set the Global it will keep its value even after the execution is done. So you have to find a way to reset it within your sequence.

 

Option 2:

 

You could also have your loop in a different sequence and use a sequence call step to call it.

You would configure the sequence call step to run the sequence in a new execution.

The entry point may be Single Pass.

Make sure that the Ignore Termination flag is set to true in the step.

Step Properties -> Run Options-> Ignore Termination.

 

In this way you could terminate the Loop whenever you want by simply clicking on the terminate execution button.

I personally think that this solution would be cleaner.

 

Check the attached files. 😉

 

Best Regards.

Message 6 of 6
(5,638 Views)