jccorreu Posted August 10, 2007 Report Share Posted August 10, 2007 I'm using 7.1 and working on code in which the previous guy put the windows-only timed loop function. I also develop on mac and linux and am wondering if 8.anything has made this for those platforms as well. If not has anyone done it from scratch? thanks james Quote Link to comment
george seifert Posted August 10, 2007 Report Share Posted August 10, 2007 QUOTE(jccorreu @ Aug 9 2007, 11:50 AM) I'm using 7.1 and working on code in which the previous guy put the windows-only timed loop function. I also develop on mac and linux and am wondering if 8.anything has made this for those platforms as well.thanks james You're lucky you don't have timed loops. They're nothing but trouble. Especially if you have more than one. George Quote Link to comment
Neville D Posted August 11, 2007 Report Share Posted August 11, 2007 QUOTE(george seifert @ Aug 9 2007, 10:02 AM) You're lucky you don't have timed loops. They're nothing but trouble. Especially if you have more than one.George Aah, but if you need the new multi-core functionality on LV-RT (or possibly LV) where you can target a specific timed loop to a specific processor core, you are stuck using them. Still scratching my head as to how to implement a state-machine using a timed loop.. does it even make any sense doing that? Neville. Quote Link to comment
crelf Posted August 11, 2007 Report Share Posted August 11, 2007 QUOTE(george seifert @ Aug 10 2007, 03:02 AM) You're lucky you don't have timed loops. They're nothing but trouble. Especially if you have more than one. I don't think it's fair just saying that without either explaining why or linking to somewhere that goes into detail. Quote Link to comment
jccorreu Posted August 12, 2007 Author Report Share Posted August 12, 2007 QUOTE(george seifert @ Aug 9 2007, 11:02 AM) You're lucky you don't have timed loops. They're nothing but trouble. Especially if you have more than one.George I never looked at the timed loop before because it is platform-dependant in 7.x. I won't use platform-dependant functions when I code, unless I have version for each of the platforms I'm developing on/for and then I just call which one is necessary. But I digress. I know next to nothing about the timed loop because of this. Bad form since I've got one as the fundamental loop in the master control program, that I've inheritted from someone who never told me why he wanted to use it. So if you'd point me to some good eduactional source on this it'd be great. And not just some long winded discussion, but something used to teach us newbies. :>) Again the point I really want to emphasize is that I want to replace it. Because I am using 7.1.1, NOT 8.x, It does not work on MAC and Linux, which makes for a very difficult time for me :>) I've already started playing with ways to emulate some of the functionality from scratch which I'll post over the weekend (i think). But if I can avoid doing what someone else has already done, I'd rather. Its a lost opportunity to learn a little more, but then again seeing what more advanced coders do is always teaching me anyway. And they often make much more elegenat clean efficient extensible code. james Quote Link to comment
jccorreu Posted August 17, 2007 Author Report Share Posted August 17, 2007 I never got an answer as to whether or not 8.x has the platfrom-independant timed loop, or if its still a windows-only component. OK so here is my attempt to create from scratch a basic timed loop along the lines of 7.1.1 that is platform independant. As I find more need for functionality I'll add it then. Anyone is welcome to make more of this. Any comments, critiques, suggestions, etc are welcome. IF it becomes useful lets add it to OpenG library. This might belong in a different forum category for here on. james http://forums.lavag.org/index.php?act=attach&type=post&id=6649 Quote Link to comment
jccorreu Posted August 17, 2007 Author Report Share Posted August 17, 2007 ok so the idea of using a while loop to contorl the timing was a bad idea. it takes way too much of the resources doing those continuous loops, and putting a ms wait in there defeats the purpose. here is another go at it using a case for a specified wait. it seems to work better. http://forums.lavag.org/index.php?act=attach&type=post&id=6650 Quote Link to comment
jccorreu Posted August 21, 2007 Author Report Share Posted August 21, 2007 well the case and wait is not going to cut it either. when they are running by themselves with no real program they're ok, but when I attempt to use them in a full scale project with multiple vi's running multiple loops, well it falls short. sometimes there is up to a 30ms pause between the time the wait period is calculated and the time that the wait function is called. i've attempted to get around it as you can see in this .vi but its just not working. i suspect its because of the way the system handles doing multiple processes, cycling amongst them all, and sometimes it hands of the processor to another routine right in the wrong portion of my code. Does anyone know of a way to force labview to go through a section of code without letting any other process interupt? I was hoping putting that little bit in a sequence might, but now I think of it, theres no reason they should have given it that special status. james http://forums.lavag.org/index.php?act=attach&type=post&id=6686 Quote Link to comment
ragglefrock Posted August 21, 2007 Report Share Posted August 21, 2007 QUOTE(Neville D @ Aug 10 2007, 04:51 PM) Aah, but if you need the new multi-core functionality on LV-RT (or possibly LV) where you can target a specific timed loop to a specific processor core, you are stuck using them.Still scratching my head as to how to implement a state-machine using a timed loop.. does it even make any sense doing that? Neville. It only really makes sense if you want to executes states at a specific rate (maybe not very likely), or if you want to run your state machine on a specific processor. In that case you can just set your Timed Loop period to zero and use it somewhat like a regular while loop. There will be some extra overhead in this approach versus a regular while loop. If you want to be able to run your state machine on a specific processor in LV85, another option is to put your existing state machine with a regular while loop inside a single-frame Timed Sequence Structure and set its processor affinity. This is simpler and probably has less overhead than the option above, but this option won't let you dynamically change processors while your state machine executes. Quote Link to comment
Neville D Posted August 21, 2007 Report Share Posted August 21, 2007 QUOTE(jccorreu @ Aug 20 2007, 10:38 AM) Does anyone know of a way to force labview to go through a section of code without letting any other process interupt? I was hoping putting that little bit in a sequence might, but now I think of it, theres no reason they should have given it that special status.james http://forums.lavag.org/index.php?act=attach&type=post&id=6686''>http://forums.lavag.org/index.php?act=attach&type=post&id=6686'>http://forums.lavag.org/index.php?act=attach&type=post&id=6686 Set the priority of the calling VI to subroutine. This will block other threads when it executes though.. Neville. Quote Link to comment
jccorreu Posted August 21, 2007 Author Report Share Posted August 21, 2007 QUOTE(Neville D @ Aug 20 2007, 12:02 PM) Set the priority of the calling VI to subroutine. This will block other threads when it executes though..Neville. Hmm, thanks something new to learn about.... I did come up with yet another alternative. This one using a notifier timeout instead of case, wait, or while. http://forums.lavag.org/index.php?act=attach&type=post&id=6691''>http://forums.lavag.org/index.php?act=attach&type=post&id=6691'>http://forums.lavag.org/index.php?act=attach&type=post&id=6691 Quote Link to comment
Neville D Posted August 22, 2007 Report Share Posted August 22, 2007 QUOTE(jccorreu @ Aug 20 2007, 03:25 PM) I completely missed your earlier question about usefulness of timed loop in a state machine. From waht I can tell the only reason my predecessor chose it was to see if he was going beyond some predetermined about of time, but chosen for what purposes I do not know. Obviously if we had something that required a timely enough execution cycle we'd want to know if it was not happening, but this app does not require such, as of this time anyway. I did come up with yet another alternative. This one using a notifier timeout instead of case, wait, or while. http://forums.lavag.org/index.php?act=attach&type=post&id=6691 In a state machine, you could easily calculate the elapsed time on each state and decide what to do about it (select next state based on this). I don't think you need a "timed loop" structure per se, unless the timing granularity required was very high. The notifier-based approach you have will only work if you have one of these loops. Notifiers of the same type interfere with each other, and cause some of the notifiers to be missed; this is due to performance optimizations in the NI code for notifiers. This is not a bug. You would be better off using a single element Q, instead of the notifier, if you really wanted to implement this architecture. Neville. 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.