11-20-2012 01:18 PM - edited 11-20-2012 01:37 PM
Hi all,
I am looking a method to enable my VI to run continuously and automatically.
In my current VI, each time the pre-set “Time has Elapsed” is reached, say 200 seconds, the program will stop running and save the data in a file. After that the program stops, until the start button is clicked.
Now, I am trying to modify the VI. It is expected to work similarly. But every 200 seconds, the “Time has Elapsed” can be automatically reset and then start accounting from 0 again. During this procedure, the program will save the data of every time period into a separate file. By doing so, the VI can run continuously and automatically. It means every 200 s, a data file will be generated automatically. Only if someone stops it, it will run forever.
My VI is shown below. I know it has something to do with the "Elapsed Time', but how can make some modifications? Thanks!
Solved! Go to Solution.
11-20-2012 01:45 PM
You probably want to put a while loop around your current code. Then you need to reset your elasped time when the inner while loop is on the 0th iteration. Stop the main while loop with a stop button. You should probably have the inner while loop stop with the stop button as well instead of finishing the 200s (that can be a long wait).
11-20-2012 03:12 PM
Thanks, I will try to make some change according to what you said.
11-20-2012 04:46 PM
11-20-2012 06:49 PM
Is this what you mean? Is there anything else I need to add to make sure it works properly? I have attached the original file.
I rebuilt the VI following your suggestion. It works alright at present. The new VI looks as following. Here the target time is assigned with 10 s in "Elapsed Time", its output of "Time has elapsed" is fed to "Reset" of "Elapsed Time2". The target time in "Elapsed Time2" is assigned with 10X100, where 100 means I want to run this operation for 100 times.
The only thing I worry about is whether the recorded data can be successfully saved into the file? It seems that there is no time gap between the inner while loop and outer while loop. Do I need to add component like "waiting" to make sure the data are saved before executing next round?
11-21-2012 06:34 AM - edited 11-21-2012 06:34 AM
Actually, I meant something like this:
11-21-2012 02:12 PM
Hi, crossrulz, it works very well. Great thanks for UR help.
07-17-2013 02:02 PM
Hi crossrulz,
Thanks again for the VI you helped to build. It is working very much. I did a lot of data acquisition with it.
Now a question comes to me on how I can add certain time of delay between each data acquiring. I plan to acquire the data for 10 seconds, rest for 20 seconds, and then the VI will automatically restart to acquire the data for 10 seconds, then rest for 20 seconds. This process will repeat over and over again, until stopped manually.
Do you have any suggestions based on previous VI?
Thanks in advance for your kind help.