LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

lag time

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

0 Kudos
Message 1 of 16
(4,296 Views)

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.Smiley Wink 

 

Cheers!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
Message 2 of 16
(4,279 Views)

Hi VT

I have done some modification to your VI. It may work for your requirment just check and let me know. 

Regards
Aks

(Appreciate answers by giving KUDOS)
Hit the stars.............. sky is not the limit.
Message 3 of 16
(4,276 Views)

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.

0 Kudos
Message 4 of 16
(4,265 Views)

Hi,

 

Here the Vi's in 8.0

Download All
Message 5 of 16
(4,262 Views)

Whoa!

Was about to re-write in L.V 7.1 - but don't need to now,

 

Thanks AutoTEC!Smiley Happy

 

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
Message 6 of 16
(4,259 Views)

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.

0 Kudos
Message 7 of 16
(4,201 Views)

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

0 Kudos
Message 8 of 16
(4,199 Views)
It was actually saved only back to LV 8.5.  Here it is in LV 8.0
Message 9 of 16
(4,196 Views)

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. 

Regards
Aks

(Appreciate answers by giving KUDOS)
Hit the stars.............. sky is not the limit.
Message 10 of 16
(4,176 Views)