05-09-2012 03:52 AM
Hello,
I am trying to run a reentrant SubVI multiple times on same time (on cRIO RT Controller). How is it possible programmatically? Attached pic explains what I need to do. Upper one is what I need to do programmatically. At the bottom I tried it in for loop,but of course it is not true, because it waits SubVI to execute next.
I have read those:
http://forums.ni.com/t5/LabVIEW/Community-Nugget-1-29-2007/m-p/469822?query.id=2981219#M226491
But I don't think it is possible with cRIO.
Can anyone help please?
Thanks in advance.
05-09-2012 10:41 AM
Won't this do the same thing? No re-entrant required. If there is additional code, what's wrong with your upper case?
05-09-2012 11:44 AM
Thanks for reply.
But I gave an example. I am actually trying something else and I need to run reentrant subvi parallel programmatically. This is my main problem. I just attached that picture to explain my problem better. Besides that code is senseless. 😃
Input array length can be change. it can be 50 for example. I don't want to put 50 (or maximum length it can be) reentrant SubVI . I just want to start execute 50 of them parallel in for loop . But I don't know how to do it on cRIO RT controller.
05-09-2012 11:51 AM
Ok, makes a little more sense now. I think you'll want to use VI scripting. Open a reference to your reentrant VI and use Invoke Nodes to Set Control Values and Run VI for each instance in a loop. Make sure you understand what the various options and flags mean for each of these nodes. You'll need to set the reentrant option on the Open VI Reference node also.
05-09-2012 12:31 PM
Ok thanks for help. I have tried it.. I hope it will also work for RT. I will try tomorrow.
05-10-2012 02:01 AM
I can't do it on cRIO. When I give the VI path it returns:
"Not A Refnum
Refnum (in hex): 0x00000000"
Is it really possible to give a VI path on RT Controller? If so how should I do it? This is the path I gave for the SubVI: "MyHostCode_subVIs\PID\SetValueIndex.vi"
(PID is virtual folder on controller)
And I think it won't be a solution to my problem. Because I need to get outputs in array with the same index I give the inputs.
I have a loop at 1Khz. I have to run quantity of "N" reentrant SubVI at 1Khz.
And I see this way increases my loop time. (It changes around 50ms - 700ms)
When I run 5 reentrant SubVI parellely, it works good (Upper code). So now I need to do it programmatically.
I attached the code I tried.
Any help is appreciated.
05-10-2012 07:59 AM
I forgot that the VIs are deployed to the cRIO. The path would change. Try this thread, looks like it should work.
05-11-2012 03:41 AM
Thanks for the link.
I also tried it. And it didn't work at first. Then I deploy the SubVI manually then it worked, and doesn't matter if I give the name of the VI or full path.
But this doesn't fix the issue. I have 2 problem with this code.
1.) When I put this code to my control loop, it makes the loop very slow even though I set the "Wait Until Done" to false. I need to run this loop at 1 Khz.
(I get good result when I put 5 SubVIs manually)
2.) I can't get outputs of SubVI. Because I need to set WaitUntillDone to True.
I need to get outputs same index with the execution sequence of the SubVIs.
05-14-2012 01:44 PM
Hi Tidus,
Would you be able to post a screenshot of your updated code so we can better understand why deployment of a single subVI does not work but with 5 there is no problem? Thanks!
05-15-2012 03:23 AM
Hello,
I have attached the code I have tried. Left side of the screenshot is what I need to do parallel in for loop. Right side of the screenshot is that I tried to do it with invoke methods. I normally should set Wait untill done to false to run parallely. If I set it to false I can't get the outputs. So probably I should set the outputs in the subVI with the index number to a global variable. But loop rate is problem here. When I dynamicaly load the SubVI, it increases my loop time compared to the left code.
I also tried parallel for loop, but I didn't notice any difference between normal and parallel for loop. I can limit my code up to 20 SubVI's but I just wanna know if there is a way to do left part of the screenshot programmatically with the same efficient?
Thanks.