LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Discrete derivative of acquired data?

I've got a DAQ Assistant pulling data from two analog inputs and sending them through an average dc/rms block, then on to a waveform chart.  What I'd like to do is take the discrete derivative of this averaged signal and send it to another chart, but I'm having trouble finding the right set of blocks to convert the signal data from 1-D array to dynamic data.  I did find the convert to dynamic data block, however, I can't figure out how to split the data up such that I can send the right data into the x and x(n-1) inputs of the discrete derivative block.  I'm thinking I need to build an array of each signal, but the amount of data recorded is variable since the averaging time is a control, so I'm thinking the array size would have to be variable too.  I tried searching the forum, but couldn't quite find what I was looking for.  Also, I'm assuming, even though I'm recording from two sources, that I'm getting a 1-D array because the USB-6008 performs SA acquisition, and that the data is staggered.  Am I right for thinking this?
0 Kudos
Message 1 of 7
(3,797 Views)
You problem description is a bit confusing to me. The DAQ Assistant does not return a 1D array. It returns a dynamic data type. If you've got a 1D array, then you've done something to the default data type and it sounds like you've used an incorrect function. If you wired the dynamic data type to the Average DC/RMS function, then you would have an array of waveforms as an output and each waveform y array would only have a single value in it. You could wire each of these values to a PtbyPt Derivitive function. The best thing to do would be to post your code so someone could see exactly what's going on in your program.
0 Kudos
Message 2 of 7
(3,786 Views)
Dennis, you're right, it is dynamic data (I'm still a bit new to this 😕 ).  I'll try to get my code up asap, I'm not on the comp that has the file.  I'll try to explain it a little better in the mean time.

I've setup one DAQ Assistant block to pull data from 2 analog inputs, and output this signal to an average dc/rms block.  From that block, the output signal goes to a waveform chart.  I get both plots on the chart.  I tried splitting the signal, but after extending the number of possible output signals, I only end up with the option to output one signal from the split, so I'm not exactly sure how this set of analog input signals is getting read.  I used one DAQ Assistant block for both input signals because I ran into resource errors when using two individual DAQ Assistants for each signal.  I hope this helps a bit, I'll post the code soon.
0 Kudos
Message 3 of 7
(3,784 Views)
Here's my code.  I'm referring to the event block at the top of the large while loop, under the event "Acquire,"  specifically at the AI0, AI1 DAQ Assistant.  Thanks for all of your help!
0 Kudos
Message 4 of 7
(3,779 Views)
If you want the derivitive of the averaged dc/rms, then look at the mofification I've attached. If you want the derivitive of the raw waveform, place a Time Domain Express VI on the dynamic data before you do the averaged dc/rms. You would then use a graph instead of a chart and with each acquisition you would get a new display.
0 Kudos
Message 5 of 7
(3,757 Views)
Dennis, thanks so much.  I do have a question about the method, though.  When you feed the signals from the index array block to the discrete derivative block, wouldn't that calculate the change from 0 (the initial condition default value) to the element being calculated?  Or am I reading that wrong?
0 Kudos
Message 6 of 7
(3,753 Views)
I don't think the PtByPt functions work that way because of the shift registers that they use. What I think I did miss was wiring up the initialize input of both of them. You might want to do that. Wire a =0 function to the iteration terminal and wire the output to these inputs.
0 Kudos
Message 7 of 7
(3,739 Views)