LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I input two signals on the same channel?

Solved!
Go to solution

Hello
I want to measure two signals that come into DAQ using a displacement sensor. One is a normal signal, the other is a delayed signal.
So I'm going to use the difference between the two signals to get displacement for a certain period of time.
I think it would be possible if it was used for time delay, but I don't know what to do.
I'd appreciate it if you could let me know if there's any other way.

0 Kudos
Message 1 of 6
(3,947 Views)

Hi Donggeun91,

 

It's not clear to me if you have two inputs, or if you have one input and want to compare the value at two points in time?

 

If the first, then you'll either need some separate electronics or two input channels for your DAQ device.

 

If the second (I think this might be more likely?) then you can store the data as your program runs, and after "a certain period of time" you'll have both X(t=0) and X(t=certainTime), and can calculate X(t=T)-X(t=0).

A possible tool for this might be a circular buffer, in which you can take the difference between the first and last elements, and rotate the buffer as you acquire data.

Circular buffers are pretty straightforward when acquiring a single point at a time, but become a bit fiddly if you're acquiring a block of data and the block size might not be an integer fraction of the buffer size (so either anticipate this, or avoid that situation).


GCentral
Message 2 of 6
(3,938 Views)

hi,

 

cbutcher is right, your question is not really clear...

 

I understand you have two signals of the form x(t) and y(t) where y(t) = x(t-x) and you want to calculate the x for a certain period? if so you can messure both of the channels at the same time and then you can use the signal processing toolkit to calculate the delay... 

 

A

---------------------------------------------------

Projektingenieur
Restbust, Simulations and HiL development
Custom Device Developer
0 Kudos
Message 3 of 6
(3,889 Views)

Thank you for your answers.
First of all, the second case you mentioned is correct.
Second, the code I made is the most basic DAQ input.

You told me to use a circulating buffer, but I don't know what to do no matter how hard I try.
Do I have to use 'wait vi' to use this?
An error occurred when using 'Wait for DAQmx completion vi'.
If you don't mind, can I ask you for an example?

Thank you.

0 Kudos
Message 4 of 6
(3,832 Views)
Solution
Accepted by topic author donggeun91

Sure - here's an example showing two ways to create a circular buffer when you receive one point per iteration:

cbutcher_0-1616642001122.png

In the Shift Register, I start with an initialized array of 20 "NaN" elements. Then I replace the first element with a value, and rotate the array so it moves into the last position. The array scrolls from right to left, with new points appearing on the right side of the Graph.

 

Below the Shift Register, I use the "Data Queue Pt-by-Pt" VI to handle this for me. Conveniently, this VI also outputs the "eliminated element", that is, the oldest point which was deleted to make space for the new element.

You could use this to calculate a difference, if the size of the buffer is equal to your desired delay.

cbutcher_1-1616642217191.png

 

For the more general case, you probably want to use the first method (with Shift Register) if you have more than one point at a time (although you can in principle use the Pt-by-Pt if you place a For loop around it and autoindex your array chunk).

You can also Index Array on the "current queue" output (attached here to the Waveform Graph) to get points from different offsets in time. For the shift register, do the same with the array wire you have between the registers.

 

 


GCentral
Message 5 of 6
(3,824 Views)

Thanks to you, I was able to complete coding.
Thank you for letting me learn your great knowledge.

0 Kudos
Message 6 of 6
(3,810 Views)