Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

X_Value in output does not equal 1/(Sample Rate)

Dear Member,

 

I noticed that X_Values in the output do not reflect the sampling frequency, which is defined in the DAQ Assistant.  No matter how the sampling frequency is set, the X_Values are 1.000, 2.000, ... at the increment of 1.000.

 

The duration of the program corresponds to # of sample * Sampling Frequency (seconds).

 

Is the code missing anything here?

 

Thank you very much for your feedback.

 

Peter

0 Kudos
Message 1 of 5
(3,292 Views)

Did you post the right VI? There are no X_Values or anything reporting the sampling frequency.  All your indicators are scalars so they only show one value, probably the first or last value.

 

Lynn

0 Kudos
Message 2 of 5
(3,289 Views)

Dear Lynn

 

As you mention, the indicator only shows values at the start/end of an excecution.  I agree that there's no X_Values in this screen.

The goal of this program is to collect voltage data (10 samples at 10Hz) and output an LVM file.

I attached an outputfile (test01) with values of X_Value and Delta_X from the program.

The X_Values are separated by 1.0000 "unit", which I believe is second.

The program runs for a very short time, so I think that the timings are correct.

 

I am relatively a newbie in LabVIEW, so please bare with me.

Thank you for the feedback.

 

Peter

0 Kudos
Message 3 of 5
(3,279 Views)

Peter,

 

It took some digging but I think I figured out why you lose the X-Values.

 

The DAQ Assistant outputs an array of waveforms concealed in the Dynamic Data Type.  Those waveforms have dt values of 0.01s., which is how you have the DAQ Assistant set (100 Hz and 10 samples). The Formula Express VI expects the {evil} DDT as inputs. The V input has the data from the DAQ Assistant with the correct dt. Because the other four inputs are scalars, the Formula Express VI converst them into DDT and then to arrays of waveforms. The default conversion has dt =1.0.  The dt value (and t0 - which does not matter in this case) for the output are derived from the Tref input. I suspect that it chose Tref because it was defined first (as X1) in the configure Formula dialog.

 

You can open the front panel of Express VIs and then look at the block diagram to see what they are doing internally.  Often they are quite messy because they have so many options.  If you dig deep enough, you can usually figure out what they are doing.

 

I am not generally a fan of Express VIs because they hide so many little things which come back to haunt you later.  The attached VI has code which replaces the Formula Express VI with LabVIEW primitives and functions. This writes the data to the file with the correct times:

 

modified file.png

 

Lynn

0 Kudos
Message 4 of 5
(3,274 Views)

Dear Lynn,

Thank you very much for your help.

I think I understand little bit of what you are trying to explain, how Express VI defined the dt and got "confused" from scalar variables...

This error stems from my laziness 😞 

I copied and pasted the Formula tool from a test program and redefined variables in another VI.

That's probably why you saw Tref originally assigned to X1 variable, then reassined to other...

I made a fresh Formula and the timing (X_Value and Delta X) is now correctly stored. 

 

I have to agree with you about the nature of Express VI...  Any canned sotfware is a black box and may bites you sometimes.

My goal is to learn how to write at a "lower level" rather than using Express, Assistant, etc.

Until I familiarize myself with LabVIEW environment, it's easier for me to get things running with the canned code.

 

Thank you very much again, and your help was greatly appreciated!

 

Peter

 

 

0 Kudos
Message 5 of 5
(3,268 Views)