11-06-2008 07:35 AM
I have an array of Time values associate with Voltage values that I want to use to control a Anolog Votage Out Device (PXI-6251) using DAQmx. The array contains 1,000 elements. The time values are NOT evenly spaced, the rate changes through the array. The array is output once, timed to other processes.
My problem is I haven't been able to locate a reference on how to handle the timing variability in the array. If time was equally spaced I could use a loop....
The attached showes the array, first row is time (ms) and the second row is voltage (volts).
Can someone point me in the right direction?
David
11-06-2008 08:06 AM
David,
there is no real good chance in solving this directly. Since the unit of time is ms, a simple singlepoint generation will not be fast enough.
If you create a finit generation task, the values will be generated in a time pattern with equal spaces. So this is not usable for you as well.
So the easiest solution could be to interpolate the output to match equal time spaces and then use that array of interpolated values as output data.
But that might not work out since the values always depend very much on the interpolation type you have chosen (linear, polynominal,...).
Other solutions would be switching the hardware to something like FPGA. But i think that is not worth the effort. So please try out interpolation first.
hope this helps,
Norbert
11-06-2008 10:10 AM
Norbert,
Well that certainly helps and confirms my fears!
Can you give me some pointers on how to interpolate the array I have to equal time spaces? Then how do I output that NEW array with DAQmx? What minimum time interval can I hope to work with between elements?
Many thanks,
David
11-06-2008 10:18 AM - edited 11-06-2008 10:21 AM
David,
if you have only Base version of LabVIEW, this will be a time consuming task.
If you have either Full or Professional, you will find interpolation-functions in the mathematic palette.
I am not sure which ones serves you best, but i'd startexperimenting with Interpolate 2D.
hope this helps,
Norbert
[Edit]: You could also use a polynominal fit on your voltage values. You will get a function describing the voltage over time. But you will have to modify this function to take care of the variation of time spacing. If you have a function describing your voltage over your (nonconstant) timestamps, you can simply create values for constant timeslices for your voltage.
11-06-2008 11:23 AM
Norbert,
I have Full LavView so the mathematics palette is available and I have started working with that....
Part two of the question was (is): Then how do I output that NEW array with DAQmx? What minimum time interval can I hope to work with between elements?. (And get good voltage output control)
The DAQmx controlling with the array is what is completely new to me.
Thanks again,
David
11-07-2008 02:20 AM
David,
DAQmx requires a 1D-array for each channel as data if the generation is finite or continuous (so not single-point).
So you have to define a Delta-T for your signal, take the interpolated values for n*Delta-T and create a new array out of those values. Pass this to the DAQmx write.
Please refer to the DAQmx examples shipped with the DAQmx if you want to know more about how to work with DAQmx.
hope this helps,
Norbert