LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving data to different vi

Heey everyone,

 

I got a small problem, i made a programm which is able communicate with a spider8 (DAQ). Now im trying to save all the data gained from the spider8 to a TDM-file. Let me explain my programm:

 

Once i started the programm it goes into a stacked sequence. In this stacked sequence has four sequences (0...3) :

1. it first sets up a measurement,

2. then it starts the measurement,

3. the third sequence is reading the values of the sensors,

4. the fourth and last sequence is closing the measurement.

 

This stacked sequence continues until i press the stop button. A finished measurement with this programm looks like this: (this is the front panel of the programm)

[IMG]http://i35.tinypic.com/2evrxbl.jpg[/IMG]

 

Now i want to save that data into an other vi, this other vi saves the data into a tdm-file.

I first made this:

[IMG]http://i38.tinypic.com/34j9280.jpg[/IMG]

This is the blockdiagram of the programm, you can see the third stacked sequence (= nr.2) and how i thought it would work to save all the data. I configured the programm so that it only reads 10 values per "loop". Unfortunally the write data vi is programmed to overwrite the data if the file already excist. The write data.vi saves everytime it is called, this is everytime the stacked seqence is in the third sequence. Now my programm only saves every 10 values, then overwrites it with the next 10 values, then again until I pressed stop.

 

Summary:

The programm will eventually only save the last 10 values.

I want to save all the values, so when i read the saved data it looks just like the chart on the front panel.

 

 

I hope that some labview-pros/experts can help me out 😛

 

Thanks everyone:D!

Message Edited by Grasman on 10-30-2009 09:39 AM
--------------------------------------------------
Currently using labview 8.2.1
0 Kudos
Message 1 of 8
(3,533 Views)
The link doesnt return any image. Try attaching them
0 Kudos
Message 2 of 8
(3,525 Views)
Well you might want to also think of another format for you program for instance instead of using the stacked sequence use the state machine
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 3 of 8
(3,518 Views)

lol, sorry 😛

 

Frontpanel=leukers

Blockdiagram=leukers-bd

--------------------------------------------------
Currently using labview 8.2.1
Download All
0 Kudos
Message 4 of 8
(3,515 Views)

@ harrold, i see what you mean but then i probably still have the same problem.

Altough i will try the statemachine soon, just to see if it gives any difference 😉

--------------------------------------------------
Currently using labview 8.2.1
0 Kudos
Message 5 of 8
(3,512 Views)
The images don't show how you have implemented the write to file. Also, why don't you use a queue implementation to save the values to memory and then write all values to file at some particular time interval. This will help reduce the file writes and lead to better reading of data. Have a look at the Producer/Consumer Design Pattern in File -> New... Post your project and VIs if possible and we should be able to help you better.
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 6 of 8
(3,484 Views)

Grasman wrote:

This is the blockdiagram of the programm, you can see the third stacked sequence (= nr.2) and how i thought it would work to save all the data. I configured the programm so that it only reads 10 values per "loop". Unfortunally the write data vi is programmed to overwrite the data if the file already excist. The write data.vi saves everytime it is called, this is everytime the stacked seqence is in the third sequence. Now my programm only saves every 10 values, then overwrites it with the next 10 values, then again until I pressed stop.

 

Summary:

The programm will eventually only save the last 10 values.

I want to save all the values, so when i read the saved data it looks just like the chart on the front panel.


Unless I'm missing something, I have to ask: why don't you just fix the Write Data VI? Such as having an input to provide an option to append rather than overwrite.

0 Kudos
Message 7 of 8
(3,476 Views)
thanks for your support everyone, smercurio i followed your tip and it worked. I attached all the vi`s i used to this post. well now i have a new problem 😛 now im able to read the data and even save the data, but that was just for 1 sensor. Now I have to do the same but then for max. 8 sensors.As i said before in this threat my vi reads and saves the data in the third sequence. The data it gives is an 2D-array (sgl). When i use only 1 sensor, the 2D-array only gets filled with the data from that one sensor. But when i start to use 2 or more sensors, the data is mixed in the array.

I wrote a program for the use of 2 sensors: This program is able to read in this 2D-array and create two sub-arrays (both 1D) which contain the data of the sensors. (this vi is also attached to this reply; array-test.vi)

The only problem for this program is that when I want to use it in a different program, the two output arrays don`t reinitialize back to default. This means that when I use the program and the two sub-arrays are made, if I want to use the program after that again the arrays still contain the information from the previous use. 

My other question is, how do i seperate all the signals (max. 😎 from the 2D-array. This 2D-array gets filled like this:

In this example I`m using 3 channels/sensors, and i programmed the main vi (leukers2.vi) that it reads only 2 values per time.

 

                  Colomns:

Row1:    1: Channel0;  2: Channel1;  3:Channel2;  4:Channel0;  5:Channel1;  6:Channel2;  7:Channel0;   etc..

Row2:    1: Channel0;  2: Channel1;  3:Channel2;  4:Channel0;  5:Channel1;  6:Channel2;  7:Channel0;   etc..

Row3:     -                            -                         -                       -                             -                       -                              -    

 

The number of rows depends on the number of values it reads per time, in this case it reads 2 values per time, this means 2 rows per colomn. As you can see the spider8.vi`s first read in values for the first channel (channel0), then for the second, then for the third, and then it repeats itself until i press the stopbutton.

In the vi array-test.vi you can see how I solved this problem with two sensors, maybe you people know how to solve this with more then 2 sensors (max 8 sensors).

 

Thanks alot everyone!

 

--------------------------------------------------
Currently using labview 8.2.1
Download All
0 Kudos
Message 8 of 8
(3,403 Views)