Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run a VI automatically & continuously

Solved!
Go to solution

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!

 

VI

0 Kudos
Message 1 of 8
(4,086 Views)

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).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 8
(4,078 Views)

Thanks, I will try to make some change according to what you said.

0 Kudos
Message 3 of 8
(4,072 Views)

Hi Crossrulz,

 

I rebuilt the VI following your suggestion. It works alright at present.

 

VI2.png

0 Kudos
Message 4 of 8
(4,064 Views)

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?

 

VI2.png

0 Kudos
Message 5 of 8
(4,053 Views)
Solution
Accepted by topic author stan1860

Actually, I meant something like this:


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 6 of 8
(4,040 Views)

0 Kudos
Message 7 of 8
(4,019 Views)

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.

0 Kudos
Message 8 of 8
(3,837 Views)