LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Waveforms obtained from Convert from Dynamic Data shows Number of Samples as 1 only. How to increase it to the actual value?

I am using SI estimate transfer function model.vi to get the transfer function of a system. I am getting the data from serial port and saving it as a waveform file by using Convert from Dynamic Data and then Build Waveform and next Write to a Waveform File.

But when i run the saved files error 20003 occurs which says the number of samples must be > 0.

 

I then simultaneously stored the data in a lvm file using write to measurement file and it showed the number of samples as 1 only though there were many readings.

I am attaching the concerned VI, waveform file (the one with no extension) & the lvm file too.

 

Please advise me.

Thanks in advance.

0 Kudos
Message 1 of 3
(2,892 Views)

You have several problems with your VI, many of which are common to beginners with LabVIEW.

 

1. You should initialize the serial port outside the loop rather than re-initializing very time through the loop.  Similarly, the VISA session should be closed after you exit the loop.  Use a shift register to pass the VISA Resource Name.

2. Since you have a pre-defined number of iterations, use a for loop in place of the while loop.

3. You collect at most one data point (scalar) on each iteration. Then you convert it to an array of waveforms which gets saved to one file and the data point gets written to another.  It would probably be better to collect all your data points into an array and then writhe that to the file(s) outside the loop.

4. What happens if the Bytes at Port = 0 or is greater than the number which can be converted to an I32?

5. Do you ever get any errors?  Have you checked for errors from the File Write VIs?

 

Lynn

0 Kudos
Message 2 of 3
(2,885 Views)

Thanks Lynn.

 

I applied your suggestions regarding moving VISA Configure Serial Port and VISA Close out of the loop & changed the while loop to for loop.

 

I tried writing the waveform file outside the loop but it still does not solves the problem of number of samples > 0.

 

Errors during VISA Read dont affect the writing of waveform file. In such cases it still writes garbage value.

 

I checked but no errors occuring in File Write VI's.

 

I am attaching the modified VI according to your suggestion.

 

I am also attaching a VI, which creates a waveform file which runs on SI estimate transfer function model.vi and the error of number of samples > 0 does not occurs.

 

 

0 Kudos
Message 3 of 3
(2,868 Views)