LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

AI Single Scan.vi

Hi.

I am developing a PID controller for our little jet engine. I put AI Single Scan.vi in a for loop for data acquisition purpose with an analog output VI. I wanted record data after each executtion of the for loop. So, I tried to put a data output VI inside of the for loop. But, when I tried to put the data output VI, which writes data to a disc, inside of the for loop, LabVIEW did not allow me to put it inside the for loop. So, I put the data output VI out side the for loop and the data output VI writes all data at once after the final for loop execution. Is there any way to write the data after each for loop?


Airo
0 Kudos
Message 1 of 5
(3,241 Views)
It`s not clear what you mean by "LabVIEW did not allow me to put it inside the for loop", but I think I understand.

If the input connector of this "data output VI" is an array, connecting it to a single data point will produce a broken wire. To fix this there are two possibilities.....

Change the sub-VI to accept a single point at a time and then save each point as they are passed to the vi.

Secondly, simply insert a "build array" in the wire just before it enters the sub-vi. Depending on how the VI handles the data, this might be the easiest way to "trick" the VI into thinking it`s saving an array when it`s actually only saving a single value.

Hope this helps

Shane
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 2 of 5
(3,241 Views)
Shane,

OK. I should not say "LabVIEW did not allow me to put it inside the for loop". I will explain the situation. My VI collects a set of data (1D array) for each for loop execution by using "AI Single Scan.vi". My VI will make some decision and give some analog output according to the collected data. Right now, the data output VI (Write to Spread Sheet File.vi) is located outside of the for loop because the data output VI tries to open a new file for every for loop (this is what I meant by saying "LabVIEW did not allow me to put it inside the for loop") and executes one set (one scan) of writing data to the specified file. Putting it inside of the for loop, I will get just one line (scan) of data output after my VI finishes the last for loop. Inste
ad of putiing the output VI inside of the for loop, putting it inside gives me a 2D array of the entire data covering all the information from the start to end. But, if the data collection gets long and the size of data gets large, I thought there will be memory issue or something I do not want. So, I thought that being able to open the data file at the very beginning of the entire data collection outside of the for loop and write each 1D array (1 scan) for each for loop inside of the for loop is a good idea. In short, I want to do writing the data to the data file and the data collection at the same time. Any suggestion?


Airo
0 Kudos
Message 3 of 5
(3,241 Views)
Ah, OK, I understand now.

I`m assuming you`re inputting the valid path for the save file each loop, otherwise a dialog will pop up every iteration....

You need to make sure the boolean input "Append to file" is set to true so that the file isn`t written from scratch each time the loop runs.

Then it should work.

Shane
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 4 of 5
(3,241 Views)
Shane,


Problem solved. Thank you for your help.


Airo
0 Kudos
Message 5 of 5
(3,241 Views)