LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

building an array from loop-aquired data

first of all, please don't flame me for being a labview newb, I'm a power student who isn't used to program structure, and I'm still learning.
 
I'm reading from a Yokogawa wattmeter GPIB in Labview 7.0 express, and I can get the data just fine.  I want to collect this data over time, since the variac will be moving the voltage/wattage all over the place as the lab students experiment. 
 
Here's what I have so far:
My output excel file contains only three values, and doesn't create a list of values at all.  My guess is that i'm either using the wrong array function, or that the array is rewriting itself everytime the loop starts over.  If I move it out of the loop, it wouldn't actually write anything to the array until after the loop ends, which doesn't seem like it would help.
 
Any help would be appreciated, thanks!
 
(oh and on a side note, is there a way to speed up the program? Everything is running synchronously, but it still seems rather slow.)
0 Kudos
Message 1 of 4
(2,960 Views)

If you right click on the exit tunnel of the 1D array, select Enable Indexing, This will automatically create a 2D array of all results from every iteration. You would have to change where you have wired into the Write to Spreadsheet File. This will save the data when the while loop finishes. If you want to save as you go, you have to wire a True to the append to file? input of Write to Spreadsheet. Otherwise, you will get a new file each time. Wire a constant or front panel control to the file path input so you don't get asked for it each time the function is called.

The loop rate is pretty much defined by how fast the meter can respond, though if you put the file save inside the loop, that will slow it down even more. There may be settings on the meter that you need to change. I can't make out what model of meter you're using so if you can provide that information, maybe someone who has experience with it can suggest something.

Message 2 of 4
(2,952 Views)

thanks, the index enabling worked perfectly. :3

it's a yokogawa wt130 meter, and i don't believe its the fault of the equipment speed. Like another thread I read, when i first load and start the VI it is fast/realtime speed, but after I run it a few more times it becomes much slower.

 

0 Kudos
Message 3 of 4
(2,946 Views)
A VI like yours which slows down after running for some time is usually experiencing memory re-allocation problems. When you enable indexing to create the array, LabVIEW does not know how big the array will be. As the array grows the memory allocation for the array has to expand and eventually this slows things down.

The way to avoid this is to use Initialize Array outside the loop with the size set to a value greater than or equal to the largest size array you expect to generate. This array is connected to the left terminal of a shift register. Inside the loop use Replace Array Subset to put the new data into the preallocated array.

Lynn
Message 4 of 4
(2,910 Views)