LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing LabView Task in a TestStand sequence

Hi everyone,

 

I’m facing this strange behaviour of my Vis called in a TestStand Sequence. In order to activate and stop the Audio and the Digital IO when I need, I have created these VI which exchange the task during a Teststand sequence. Which it looks like this:

Zuc_Lab_0-1730189390344.png

 

I can’t understand why sometimes these Vis throw different errors on the Tasks passed as it is wrong or missing but I don’t get why. I’m using a USB-6211 device.

Is there something that I’m missing or I’m doing wrong? I don’t know what else to do for facing the problem.

 

Best Regards,

Zuc

Download All
0 Kudos
Message 1 of 11
(226 Views)

Tasks, like any other reference in LabVIEW, are destroyed when the VI that created them is closed. One way to deal with this, that I'm aware of, is to create a continuously running VI to create the task then close that VI when no longer needed. 

0 Kudos
Message 2 of 11
(181 Views)

A better way is to have a session manager that continuous runs to keep the task alive and other VIs can query from this session manager and use the session, this way the DAQmx tasks exchange is totally on LabVIEW layer and not passed through TestStand

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 3 of 11
(170 Views)

Probably I have forgotten to mention that, as you can see from the VIs, the Task is an output. So, the VI generates the task which is saved inside a TS FileGlobals variable which is then passed as an input for the VI which is in charge of closing that task. Is this way of programming wrong?

 

Best Regards,

Zuc

0 Kudos
Message 4 of 11
(147 Views)

Hi,

 

Thank you for the advice but what is a session manager and how or where I can find more information about it? I have never heard of a session manager but for what? For being continuously connected with the USB-6211 device?

 

Best Regards,

Zuc

0 Kudos
Message 5 of 11
(145 Views)

@santo_13 wrote:

A better way is to have a session manager that continuous runs to keep the task alive and other VIs can query from this session manager and use the session, this way the DAQmx tasks exchange is totally on LabVIEW layer and not passed through TestStand


Not quite! 😉

The absolute simplest way is to:

  • Create the DAQmx Task and save it in the LabVIEW Project that TestStand will use.
  • Create the Using VIs in the same LabVIEW Project simply using Tasks Channels and Scales by CONSTANT on the BD.
  • Call the Task user VIs Through the LabVIEW Project context in TestStand. The DAQmx constants are in the lvproj file as xml so the vi needs to be in the project context to see the definition in the lvproj xml file

I've said it before (and it is worth repeating) DAQmx Tasks, Scales etc... need only be created ONCE! Preferably,  during development and almost never need to be created at runtime!!!!

 

A TestStand Step that Creates a Task is just poor practice. 


"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 11
(134 Views)

You can also use state machine kind of design.  Merge all VIs into one, and use shift register for the DAQmx Task.

No need to pass the task to/from TestStand.

 

 

George Zou
0 Kudos
Message 7 of 11
(123 Views)

Hi,

 

can you make an example of that? How can i shift task between generation on digital or analogical channel?

 

Best Regards,

Zuc

0 Kudos
Message 8 of 11
(113 Views)

Drop the attached png file to a diagram to create VI.

 

George Zou
0 Kudos
Message 9 of 11
(107 Views)

@zou wrote:

Drop the attached png file to a diagram to create VI.

 


That USR can get stale if TestStand Step or Sequence load options are set to unload.  But, a Task persisted to a lvproj (or NI MAX) is always defined and usable with even lower latency than programmatically created Tasks (it streamlines the validation of the Task)

 

Or, "Just do what I said."


"Should be" isn't "Is" -Jay
0 Kudos
Message 10 of 11
(95 Views)