LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquiring two input signals simultaneously

Hi,
I have an LVDT and a force sensor (both attached to a motor) plugged into my SC board and I am trying to read out & save the output data from both sensors simultaneously while the motor is in motion. The SC-2350 board is connected to the laptop via DAQCard 6036E . Two questions:
          1) in my block diagram, the DAQ assistant blocks for both sensors are wired to their respective waveform graphs (one for the LVDT signal and one for the force signal), the whole being included in a while loop (which remains true until the motor stops moving). When running the program, only one signal is read out at a time and I have no control on which signal is transmitted (this seems to occur in a random fashion). Do I need to "link"/synchronize the two DAQ assistants in some ways so that both signals will appear simultaneously? If so, how would it be possible?
          2) ideally, I'd like to read out both input signals on the same graph (with 2 different y-scales but the same time scale) to observe the phase shift. I tried to "bundle" the two data output coming from the two DAQ assistants but it resulted in an error saying that the two outputs were of different types. Is there a way to plot these two physical quantities on the same graph even though they're different and come from different sensors?

Thanks for your help!

Thibault.
0 Kudos
Message 1 of 12
(7,801 Views)
You are making things much more complicated than they have to be. You only need 1 DAQ Assistant. After selecting one channel and configuring it in the assistant, click the add channels on the top of the window. Wire the output of the assistant to a single graph. On the block diagram, right on the Y axis scale and select Create Duplicate. You can then right click on one of them and select Swap Sides if you wish. Then, in the plot legend, click on the plot you want to assign to the new scale and select Y scale. You'll get a list of the Y axis names.
0 Kudos
Message 2 of 12
(7,795 Views)
Yes, indeed, it's much simpler! Thanks!

Thibault.
0 Kudos
Message 3 of 12
(7,767 Views)

Hi..

I thought, i make the project same as you did thibault. My purposes is also same. I need to read from two sensor device with different measurenment (both are positioning sensor one is linear one is angle). I want to know the phase difference from both sensor. But i got a problem here. I don't understand the explanation that dennis told you. Add channels?? is it work?? Because when i tried that i could not read from different measurenment sensor. And how about if use low level VI not express VI? Could i use producer/ consumer template.

Thanks for your help

 

Regards

-Keep Learning-
0 Kudos
Message 4 of 12
(7,639 Views)
Hi St4mp

Which part are you having trouble with?
Have you been able to create 2 channels using the DAQ Assistant?
Please follow Dennis's Instructions carefully, if your applications is the same as Thibault

I like your Signature -Keep Learning-
Van L
NI Applications Engineer
0 Kudos
Message 5 of 12
(7,612 Views)
Hi Van_L,
 
I don't have same application as Thibault but i have same purposes. As i thought in my first massege, I want to detect two signals from two sensors and compare it so i could get the phase different.
 
The problem was I can't create 2 Channels using one DAQ assistant express vi. There are failure when i do exact what dennis said. The counter did not change when i click add button although i had chosse different counter. And i can't change the second task, the task was same as the first one. What is wrong? is it means i must use 2 DAQ.
 
About my signature, It is just my job as a sutdent Smiley Wink
 
Thank you very much for your kindness.
 
Regards,
 
Dani
-Keep Learning-
0 Kudos
Message 6 of 12
(7,596 Views)
Hello Dani,

I assume, based on your position sensors and the image you posted, that you are using counters to acquire your data. Is this correct? If so, it is important to note that you cannot add multiple counter operations to a single task because they have different timing requirements and all channels in a single task must share the same timing and triggering. In fact, if you attempt to add a second counter channel to a DAQ Assistant for a counter operation, you will receive the following error when you try to close the configuration window:



So, you will have to use two different tasks to acquire your counter data. You can do this either by using two separate DAQ Assistants or by using two different tasks in the NI-DAQmx sub-VIs in LabVIEW. Since you are trying to compare the phase difference between the two measurements, you will also need to synchronize the operations so that you are reading from both counters simultaneously. There are several resources online which discuss synchronizing counters, and I have linked some that I thought might be useful below:

KnowledgeBase 1JPES6LL: How Do I Synchronize a Buffered Quadrature Encoder Measurement to a Signal

KnowledgeBase 3GGATSCC:
Hardware Counter Start Trigger for Counter Synchronization

It would probably be easier to use the NI-DAQmx Sub-VIs to implement this synchronization because they give you more control over specific parameters of your task. You can use the NI Example Finder to browse some examples which use the NI-DAQmx sub-VIs for counters. You can open the NI Example Finder by going to Help>>Find Examples... in LabVIEW. Once in the NI Example Finder, you can find the counter examples by selecting the Browse tab and navigating to Hardware Input and Output>>DAQmx>>Counter Measurements; then you can select the Position category (shown below) to find the Position measurement examples.



Let us know if you have any other questions about taking position measurements.


Message Edited by Matt A on 04-09-2008 03:55 PM

Matt Anderson

Hardware Services Marketing Manager
National Instruments
Download All
Message 7 of 12
(7,553 Views)
Hallo Matt,
 
Sorry for late respond, I have much homework that i should do first...
 
You are absolutly right.. The error that i got was like you said and i already solved it because of your explanation.. It was very helpfull.. Thank you very much.. Now i have already get the data that i want from both sensors..
 
But i got another problem now, how to measurre the phase different between that two sensor? Should i use two buffer to get the data and calculated by using producer/consummer loop or do you have better idea?
 
Best regards,
 
Dani
-Keep Learning-
0 Kudos
Message 8 of 12
(7,503 Views)
Hello Dani,

Choosing the right architecture for your application depends a lot on what you are trying to accomplish. You mentioned that you wanted to calculate the phase difference between two sensors, so the next question would be this: what do you want to do with the data once you have got it? Do you want to display the phase difference? Do you need to keep historical information or do you only want to know the current phase difference? Do you need to store this data to a file after you have calculated it? All these factors will help you choose the right framework for your program. In general, the producer/consumer architecture is best suited for applications where the acquisition is high throughput (high speed or high channel count) and requires a great deal of processing capability. By placing the data acquisition in the producer loop and the processing in the consumer loop, we allow independent software timing, which means that the data acquisition can occur as fast as it needs to and the data can be queued for later processing. However, if you are acquiring at lower rates this architecture may not be necessary.

In regards to your sensors, I have a couple questions about what you are trying to accomplish. In your first post you mention that you are acquiring position from two sensors (one linear and one angular). However, you have also mentioned that you are trying to measure the phase difference between the two sensors. I am wondering how you want to determine phase difference since one of the encoders is angular (measures rotational angle) and one is linear (measures linear distance)? Do you mean that you would like to measure the phase difference between the A and B signals on the two encoders? If so, you would not be able to use the position task to perform this action because the position tasks merely look at the difference between the A & B signals and do not necessarily consider the phase of the difference (they assume a 90 degree phase shift). This tutorial about encoders explains the concept in more detail. If this is the type of operation you are trying to perform, you may want to consider another method for taking your measurement. Either using multiple counters to compare the A & B signals on each encoder, or using an analog input channel to acquire the raw voltage are possibilities for this type of operation. If you could provide some more details about exactly what you are trying to measure, I might be able to provide a more detailed recommendation about how to proceed.

Matt Anderson

Hardware Services Marketing Manager
National Instruments
0 Kudos
Message 9 of 12
(7,463 Views)
Hi Matt,
 
Thank you very much for your fast response.
 
It's true that i want to acquiring position from two sensor (one is linear and angular), calculated it to get the phase different, displayed both signal in the graph and in the end save the file in excel (i think all was posible with LabVIEW but until now i didn't know how to do it). Smiley Sad
 
I want to determine the phase different from the two sensor, but not from each channels of the sensor. I want to get data from two sensor at same time stamp and compare it with the time so i could get the velocity diagram. The phase different that i want to measure is the phase different between the velocity diagram from both sensor. What i think is when this is a system that the component are connected each other. The velocity diagram will be same (is it true?) and i could get the right phase different.
 
About the data acquisition i think it is high speed application, because  the size of the encoder are small, the circle endoder was fast enough (although it's depend on the speed of the motor), and i also want to get all data in each time stamp so i could calculated the velocity with right calculation. when the data acquisition was not fast i think i would lost data and the calculation will be wrong.
 
If you need more information let me know. Smiley Happy
 
Best Regards,
 
Dani
-Keep Learning-
0 Kudos
Message 10 of 12
(7,425 Views)