LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Collecting Data Simultaneously with DAQmx

Hi,

 

I am creating a Data Acquisition system for a wind tunnel that composes of using analog input for pressures, and a modbus communication for the power measurements. The problem is that I am using a digital input signal to measure the RPM's, and the data that is being sent into the array does not match the corresponding values at that period of time. Is there a way that I can output the RPM's into the array at the same time as when the analog daqmx is sending information to the array? Thank you, I have attached a vi below.

0 Kudos
Message 1 of 8
(1,412 Views)

Your VI confuses me a bit.

 

You have 2 For Loops that will only run 3 times.  But they will NOT run at the same time because the 2nd loop has to wait for the first loop to finish because of data dependencies.  I think that is where your problem is because the first For Loop has a counter and the second one has Modbus and Analog Inputs.

 

Inside that 2nd For Loop, you have two For Loops that run in parallel.  I'm not sure why you open and close the Modbus client inside the 2nd For Loop.  Why not open when the program begins and close it after it ends.

 

Why don't you have the contents of your two For Loops in series inside the same For Loop?

Message 2 of 8
(1,360 Views)

A few more overview thoughts for you, don't have time to expand into all details.

 

1. Correlating data from DAQ devices with data from communications interfaces is not always trivial.  Early in the project, be sure you understand the requirements for timing uncertainty of the comms data relative to your DAQ data.  If this dips down into smallish fractions of a second, be prepared for extra learning and work to get it right.

 

2. There are fairly straightforward ways to sync your AI and CTR tasks and data with hardware-level precision.  This part needn't be a significant obstacle.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 3 of 8
(1,348 Views)

I have attempted to do what you recommended, however I used a while loop instead. The problem seems to be fixed with it, however the the frequency is adding after each while loop is ended (running continuously), if I move the counter input as a individual while loop, it would not do this.

0 Kudos
Message 4 of 8
(1,331 Views)

Nevermind I found another way to solve it through sequence structures!

0 Kudos
Message 5 of 8
(1,319 Views)

I don't see what you are saying here.  I see a calculation of frequency being calculated on every iteration of the While Loop which is appended to the end of the array.

 

Whenever someone says a sequence structure solved their problem, I get a little worried.  Don't get me wrong, sequence structures do have their place.  But they are usually abused more than they are used properly.

0 Kudos
Message 6 of 8
(1,303 Views)

Hi RavensFan, thank you for your help. Originally my code does a calculation for the frequency for each iteration of the while loop, but on the next iteration, the frequency that is calculated is using the total count instead of the difference count..., which means the rpm adds on each iteration.

0 Kudos
Message 7 of 8
(1,297 Views)

Well, if you take the current iteration's count and put it in a shift register, in the next iteration you can take that iteration's count and subtract the value from the shift register to get the difference between iterations.

 

It looks like that is what you are already doing with the blue wire, so I don't know why your aren't getting what you think you should be getting.

0 Kudos
Message 8 of 8
(1,284 Views)