10-19-2008 08:29 PM
Hi,
I am trying to create a one time lag time in the attached program and I am having a little trouble. What I am trying to do is have a 6 second lag time before each case structure is executed. So, for example, if I put the slide on -1, then it executes the -1 case, but waits six seconds, but only waits six seconds once, then the program continues to run at the 100ms rate specified. I am able to get a six second delay time programmed in, but it delays running the case for every input, I only want it to do it once, then keep running at the fast rate, not wait six seconds. Basically what this is is a lag time program that will wait six seconds before it starts to take measurements, but I have simplified it for this question using the random number generator. Also, it will need to wait six seconds every time it is recalled....in other words:
Input: -1
Wait 6 seconds
Record at 100 ms rate, then suddenly, value becomes +1
wait 6 seconds
Record at 100 ms rate, then suddenly, value becomes -1 again
wait 6 seconds
Record at 100 ms rate.......
I hope this makes some sense. Any help I can get would be much appreciated. I am just a beginner, so go easy on me.
Tim
10-20-2008 02:44 AM
Hi VTStudent - it makes sense!
Have a look at the attached VI. It uses an event structure to detect new Selection (and Stop button) - the long (6 second) wait is also handled by the event-structure. After a new selection and wait, Wait MS multiple determines 100ms logging interval.
One of the things this provides is the ability to quit the app immediately even during the 6 sec wait, however, there are many other approaches. If you were interested in a reliable logging period, you were right to use the Wait MS Mulitple instead of Wait MS (or event-timeout) - then again, the "Timed Loop" (either For Loop or While Loop) may be of interest.
Cheers!
10-20-2008 03:04 AM
Hi VT
I have done some modification to your VI. It may work for your requirment just check and let me know.
10-20-2008 04:05 AM
Hi,
VT Student here again. I am not able to look at either of your programs because I only have Labview 8.0. Can you save the program as 8.0 so I can take a look at them? Sorry for that, upgrades cost a little bit of money here, so for a student that is tough.
Thank you.
10-20-2008 04:21 AM
10-20-2008 04:34 AM
Whoa!
Was about to re-write in L.V 7.1 - but don't need to now,
Thanks AutoTEC!
10-21-2008 10:48 AM
Hi,
For some reason, I am still not able to see tbd's solution to my dilemma, it is still telling me that the program is written in a newer version of Labview. Is it possible to save it as 8.0 so I can check it out? Again, thank you so much for your help.
VT Student.
10-21-2008 11:03 AM
Akshath,
I guess I am not understanding your program, I'm sorry, again, remember, I am a beginner, so not too skilled at this stuff. I am going to provide a scenario of my problem and see if what I am trying to do is even possible.
I am using fast response solenoid valves to collect air samples. I am able to write a program that will open the valves based on the sign of a number (i.e. -, + or zero), however, I don't need instantaneous opening of the valve because of the length of the tube that is being used. In other words, the air being sampled needs at least six seconds to reach the point of sampling before I should be taking a sample of the plug of air associated with the sign (-, + or zero). So, if I have a sign of -1, I need to count six then sample, and keep sampling as long as the sign is negative. If the sign suddenly changes to +1 then back to -1, I need to count to 6, take a short plug of the air, then continue sampling the negative air. I know this sounds a bit crazy, but it is a lag time program accounting for the amount of time it takes a plug of air to reach the point of sampling based on the tube length. The lag time is pre-calculated as six seconds, so now I just need to figure out haow to get the valves to work after the fact.....sort of like delayed resopnse or something.
Hope this makes sense. And again, I am so appreciative of your help.
Tim
10-21-2008 11:13 AM
10-22-2008 12:10 AM
Hi VT,
Change the range of the slide to -1 and +1.
1. Enter 6000 milliseconds in the millisecond control and run the code.
2. As you said when its in -1 it will wait for 6 seconds and then starts sampling at the rate of 100 milliseconds.
3. If you change the scale range from -1 to +1 then back to -1 it will wait for 6seconds again and starts sampling.
Hope this how you wanted, i think it may clear you.
Can u post the complied code of your application so i could give you a better solution.
Regards
Akshath.
(appreciate the answers by giving KUDOS)
Click on the star....... sky is not the limit.