10-28-2020 04:52 PM
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.
10-28-2020 11:54 PM
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?
10-29-2020 06:54 AM
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
10-29-2020 11:09 AM
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.
10-29-2020 05:21 PM
Nevermind I found another way to solve it through sequence structures!
10-29-2020 10:47 PM
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.
10-30-2020 12:30 AM
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.
10-30-2020 02:19 PM
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.