NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

multithreading in teststand

Solved!
Go to solution
In teststand 3.5  are we able to make a custom step as seperate thread with out placing in subsequence or not?
If we are able to  do so, can anyone help me the process in making that.
 
thanks & regards,
 
K.Praveen
0 Kudos
Message 1 of 9
(7,539 Views)

Hi there,

Not quite sure what you are asking.  Basically you want a step to run in a new thread without having to place it in a sub sequence and select the Run In New Thread option?  Is that correct?

What is your step doing?  Is it a call to a code module?  Is it a Statement Step?  A call Executable step?  If it's a call to a code module and that code module happens to be LabVIEW then you can simply use the Run VI Asynchronously step type.  Instert Step>> LabVIEW Utility >> Run VI Asynchronously.  Asynchronously basically means in a new thread.  I haven't seen this for any of the other Adapters. 

What you are asking is possibly doable but honestly the simplest thing is just to use a subsequence.  Is there a reason you can't do the subsequence? 

Basically what you would have to do is when you create a new step type then you'll have to have some substeps that call into the TestStand API and make that step run in a seperate thread.  Although I can't verify this is possible at the moment because I haven't tried I do believe it will be something similar.

Let me know how ambitious you are and I'll play around with it a little.

Regards,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 9
(7,535 Views)
hi,
 
 First thanks for your reply,
 
 what  I wanted was, i made a custom step which runs LabVIEW  module.when this step is running  i wanted it to run as seperate thread. but this custom step in a sequence is called at regular intervals, where every time i wanted it to run as seperate thread. 
One way to do is to make this as a subsequence and run as a seperate thread.
I wanted to know the in-order to make a single step as seperate thread is it possible that we can directly assign it to run as seperate thread or not. Making a subsequence, for a single custom step which is regularly used is not the right way i think. 
I didnt use much of the multithreading concept, and examples which i have gone through which deal with multithreading concept have seperate subsequence even for a single custom step.
Can you help me in getting a better solution.
0 Kudos
Message 3 of 9
(7,526 Views)

Hi,

You cannot directly assign a normal step to run in a new thread.  Just the Sequence Call step.  However, the Run VI Asynchronously does run a VI in a new thread.  You may just want to customize that step to run your code.  Too bad you don't have TS 4.0 because then you could use code templates.  And you wouldn't have to go through the pain of maintaining custom steps. 

I'm playing around with it now and will let you know what I find.

Regards,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
Message 4 of 9
(7,520 Views)
can you tell me how TS-4 Code templetes help in solving the problem..
I just wanted to know this because if i use TS-4 in future.
0 Kudos
Message 5 of 9
(7,518 Views)
Solution
Accepted by topic author Sury@
Well, they don't help solve your particular problem but basically you can set a step to call a code module and set up a bunch of properties just how you want them.  Then you drag it into a code templates window and everytime you need to use that same setup you simply drag the step from your code templates window into your sequence file.  All the properties are set for you.  It's awesome!!  🙂
 
Ok so I've been investigating your issue and it looks like the Run VI Asynchronously step does call a subsequence that runs in a new thread.  So it looks like you want to copy the Run VI Asynchronously step to your custom palette (MyTypes.ini) and then copy the copy.  (this is how you have to create custom step types from existing NI step types.  double copying.  this is because if you don't double copy you will end up pointing back to the original or some crap like that.  Just trust me on this.  copy the copy and then delete the first copy).  So now in MyTypes.ini you should have a step type called NI_RunVIAsynchronously_2 step type.  Rename it if you wish.  Then you can expand that step type and you'll see a VI Module sub property.  And then a VI Call sub property under that.  Under there you will see all the settings to call your VI.  Set those up correctly and especially the Show Fornt Panel to true.  Now you have a new step type that will run in a new thread and call your LabVIEW code.  The only kicker here is that it is still calling subsequence but that is all underneath the hood so in your sequence you'll simply see one step.  I propose this is the simplest way to do what you want. 
 
Let me know if you have any questions as this gets a bit tricky.  It's pretty intuitive once you get in there and start monkeying around.
 
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 6 of 9
(7,514 Views)
I just want to correct the terminology being used here in order to avoid confusion. The feature jiggawax is talking about is called templates, and what he is explaining is how to create a step template. There is another feature of TestStand called code templates that is perhaps less widely used which allows you to specify a template to use when selecting the "create code" option in some of the adapter module specification UIs.

So basically

Code Templates - the templates for the create code feature of the adapters.
Templates - a place to store commonly used and preconfigured steps, sequences, and variables.

Sorry that these are named so similarly 🙂

Hope this helps avoid confusion,
-Doug
0 Kudos
Message 7 of 9
(7,462 Views)
Thanks for the clarification Doug.
 
You will not have the Templates unless you have 4.0 however.  I was describing creating a custom step type.  Which is what you'll have to do for 3.5.
 
Regards,


Message Edited by ~jiggawax~ on 04-11-2008 10:23 AM
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 8 of 9
(7,458 Views)
thanks for your information on multithreading issue.
 
0 Kudos
Message 9 of 9
(7,424 Views)