LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

simple squares instead of numbers in saved file

Hello,
I have a very strange situation. I have a program, which was working properly for same time.
Today I make measurements for 8 input channels and want to save data into files (Write to Spreadsheet File.vi) - 8 files for 8 channels. And 7 files have data, but the first channel file has only squares. At the same case, program does demodulation to find amplitudes for all channels, include 1st.
I am in surprise.
0 Kudos
Message 1 of 8
(3,538 Views)
I think the local variable "Detected amplitudes" (array) may be the problem. You have two instances of it, one connected to the MEASURED SIGNALS: strings and one connected to the OUTPUT SIGNAL: strings. I think you wanted to connect Detected Amplitude (scalar) to the OUTPUT SIGNAL: strings.

This is one example why locals should be avoided. Wiring the signals directly would have prevented this problem. Also I think you can eliminate the sequence structure. Except for the Delete Files? dialog, everything else is handled by dataflow.

Lynn
0 Kudos
Message 2 of 8
(3,514 Views)

May be I understand you wrongly,

but I don't want to save any exp data from locals. Locals are used only to save info file.

Also, I don't want to save any data from Detected Amplitude/Phase. They are for visual checking the measurement process.

I want to save raw measured data - it means, each of 8 input files has measured amplitude in a lot of instances. The demodulation is done later using different method, not in LabVIEW. That's why, locals are not important at all.

Also, to me the strangest thing, that only 1 input channel file is wrong, other 7 are right. But they have the same type of connection and everything was right for a lot of time. Also, if to use Probe - it shows the values of array in this channel through the whole period of measurement, it means, as I think, problem is not in wrong measurement, but in wrong displaying it. But, why?

 

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

A couple of coding tips.  You can expand the index array function downward so that you can get multple elements at once out of one function.  With no constants wired in, it would give you element 0, 1, 2, .... for as many inputs as you have dragged it down.  The unbundle by name function.  You can drag that down as well to get multiple values out of one function, then you can select which elements of the cluster you want.  This will save the creating memory copies by branching the waveform wires before hand.

There is probably a lot of room for looping and doing other indexing array functions in the program.Smiley Wink

0 Kudos
Message 4 of 8
(3,482 Views)
I agree that your results cannot be explained with logic, it should format all numbers correctly.
 
You have way too much duplicate code, it is way too explicit. Most can be operated directly on the arrays or insude autoindexing loops.
 
Here's a quick draft for a few parts (see image):
  1. To take successive differences, you could take that array and subtract the subset from 1-end. It will automatically be one shorter.
  2. For the spreadsheet operations, you can do everything in a loop with a singe instance of the code.

Also your complex formating operations can de done with a single "format into string", with all these extra text part of the format.

Message Edited by altenbach on 10-26-2007 06:10 PM

0 Kudos
Message 5 of 8
(3,480 Views)

Thank you very much for your replies. I will work on your tips.

to altenbach:

I suppose, that separate threads mean that the data are read simultaneously (not considering the time delay due to ADC switching between channels, which is possible to calibrate very well (we use PCI 6052E with only 1 ADC)). If using a loop can say, that the channels are read simultaneously? We need to have as much precise measurements as possible.

Anna

Message Edited by mikhaylova_anna on 10-26-2007 09:38 PM

0 Kudos
Message 6 of 8
(3,467 Views)


@mikhaylova_anna wrote:

 

I suppose, that separate threads mean that the data are read simultaneously (not considering the time delay due to ADC switching between channels, which is possible to calibrate very well (we use PCI 6052E with only 1 ADC)). If using a loop can say, that the channels are read simultaneously? We need to have as much precise measurements as possible.


I'm not sure what threads you are referring to here.  But the channels are being read simultaneously when you have your DAQmx task set up to do multiple channels multiple samples.  Or at least as simultaneously as a card with 1 ADC can handle.  Once the data is collected, then you are just programmatically sequencing through it for analysis with the most efficient code possible.
0 Kudos
Message 7 of 8
(3,460 Views)

I did not touch the DAQ parts. the only thing that is done in the loop is the writing to the various numbered files.

Most likely, your hardware can only write one file at any given time so it does not make sense to try to write them in parallel anyway. Think about it!

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