mike5 Posted May 10, 2010 Report Share Posted May 10, 2010 Hi all. We have a project where parallel loops are needed, but also setting priority for each loop is a requirement. At first it seemed that "Timed loops" are an answer to these problems, since they support priority, but "Timed loops" have other problems with the code that doesn't execute quickly enough. So, in short I am looking for a solution that would give me the ability to set priorities for parallel loops and also support arbitrary execution time for each iteration. Thanks in advance, Mike Quote Link to comment
Grampa_of_Oliva_n_Eden Posted May 10, 2010 Report Share Posted May 10, 2010 Hi all. We have a project where parallel loops are needed, but also setting priority for each loop is a requirement. At first it seemed that "Timed loops" are an answer to these problems, since they support priority, but "Timed loops" have other problems with the code that doesn't execute quickly enough. So, in short I am looking for a solution that would give me the ability to set priorities for parallel loops and also support arbitrary execution time for each iteration. Thanks in advance, Mike I would first investigate making the code that does not run fast enough run faster, so the timed loop can be used. Ben Quote Link to comment
mike5 Posted May 10, 2010 Author Report Share Posted May 10, 2010 Unfortunately the code is a framework thingy, so code could later be added that simply would not finish in the required amount of time Mike5 Quote Link to comment
Grampa_of_Oliva_n_Eden Posted May 10, 2010 Report Share Posted May 10, 2010 Unfortunately the code is a framework thingy, so code could later be added that simply would not finish in the required amount of time Mike5 Well there is no way to optimize a thingy so moving on... What did you mean when you wrote " support arbitrary execution time for each iteration" since they will be executing thingys? If you get more specific about what you are up too... Ben Quote Link to comment
David Wisti Posted May 10, 2010 Report Share Posted May 10, 2010 What about using a timed sequence instead of a timed loop? Quote Link to comment
Ryan Podsim Posted May 10, 2010 Report Share Posted May 10, 2010 Why not place each parallel loop in separate subVIs and set the execution priority of the subVI? Quote Link to comment
ShaunR Posted May 10, 2010 Report Share Posted May 10, 2010 Why not place each parallel loop in separate subVIs and set the execution priority of the subVI? You have to do a bit more than that to force LV to run certain vi's is certain threads. This is where "Threadconfig.vi" comes into its own. vi.lib\utility\sysinfo\threadconfig.vi It all gets a bit tricky from here on in as you need to manually manage what vi's are going into which execution systems and at what priorities. Most of what you need to know is in this thread (no pun intended...lol) Loop Timing & Execution difference 1 Quote Link to comment
mike5 Posted May 11, 2010 Author Report Share Posted May 11, 2010 Well, I'm glad I have some options (setting VI/process priority was on my list as well, but I was looking for all possible options), but to answer some other questions as well. Regarding "arbitrary execution time" - as we all know, things change in a live system. Sometimes the application has to log some things, and sometimes it doesn't, so unless you are really doing just one specific thing on a real-time system, you don't really know how long an iteration may last. As I already stated, I am aware of the VI priority, but that only offers me 5 priorities with one that I think it's best avoided (the RT one). Timed loop offers 65535 priorities, but maybe 4 will be enough after all. I'll look into the thread that ShaunR suggested and hopefully find what I need there. Thank you all for your help, and if you have any other ideas, please keep them coming Mike Quote Link to comment
mike5 Posted May 11, 2010 Author Report Share Posted May 11, 2010 (edited) Also, I'd like to add that I would like to set/change the priority at run-time. Is this at all possible with execution priority? Thanks, Mike Edited May 11, 2010 by mike5 Quote Link to comment
mike5 Posted May 11, 2010 Author Report Share Posted May 11, 2010 I see that setting the VI execution priority is not an option, since two instances of an object can not set the priority of the same VI to different values. Also, setting priority on a reentrant VI is not possible at all, since as soon as you open a VI reference with the option "Prepare for reentrant run" changing of priority is not possible. So, if I want to use priorities, then I need a Timed loop. So, my other question, can I somehow configure a Timed loop so that it runs as quickly as possible but still finish each iteration, even if some iterations take longer then the allocated period? I have been reading documentation and performing different tests all day, but so far it seems that this is not possible. Thanks, Mike Quote Link to comment
Grampa_of_Oliva_n_Eden Posted May 11, 2010 Report Share Posted May 11, 2010 I see that setting the VI execution priority is not an option, since two instances of an object can not set the priority of the same VI to different values. Also, setting priority on a reentrant VI is not possible at all, since as soon as you open a VI reference with the option "Prepare for reentrant run" changing of priority is not possible. So, if I want to use priorities, then I need a Timed loop. So, my other question, can I somehow configure a Timed loop so that it runs as quickly as possible but still finish each iteration, even if some iterations take longer then the allocated period? I have been reading documentation and performing different tests all day, but so far it seems that this is not possible. Thanks, Mike In reply #5 above above David recomended a Timed Sequence. THat gives you multiple levels of priority and as well. Ben Quote Link to comment
mike5 Posted May 11, 2010 Author Report Share Posted May 11, 2010 I didn't think that timed sequence behaves any different to Timed loop (except that it has multiple frames). I'll investigate it, thanks. Quote Link to comment
MViControl Posted May 26, 2010 Report Share Posted May 26, 2010 According to LV manual, you can put wait function in each loop and use the time interval for each wait function to set priority of loops, the smaller interval you set the higher priority the loop get. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.