06-21-2006 11:17 AM - edited 06-21-2006 11:17 AM
Message Edited by JohnnyF on 06-21-2006 11:22 AM
06-22-2006 01:19 PM
Hello JohnnyF,
If you do a test of just the acquisition part with the DAQ Assistant acquiring at the same rate and number of samples, do you see the same behavior? I do not see anything in the VI, but it is large so I couldn't follow everything. Watch out for those global variables 🙂
Can you give us an idea of what happens to the data when it become erroneous? Do you get any errors? Is your cycle frequency the sampling frequency in your program, or is it the frequency of your potentiometers? If it is the frequency of the potentiometers, what is the frequency? Remember that you have to sample at a rate at least 10 times greater than the frequency of the signal you are measuring to accurately acquire the shape of that signal of interest.
Regards,
Laura
06-23-2006 07:39 AM
06-26-2006 11:41 AM
Hi Johnny,
If you are only able to take one sample per cycle, then you are most likely always missing the peak value you are interested in. What I would recommend is a different architecture for the analog input portion of your program. It looks like you have a while loop that does the analog input and output with DAQ Assistants, and then also does some data analysis and displays to the front panel. You need to do a continuous hardware-timed operation and not a single point software operation that samples once per cycle. If you set up your DAQ Assistant to be continuous at 100 Hz and to read multiple samples at a time, does this pose a problem for your program? Are you trying to only find the peak value? You can use the amplitude and level measurements Express VI to find the peak of a data set, and then use that as an input to your calculations. Or, if you need all of your data points to be inputs to your calculations, you can use array manipulation instead of performing an operation on one point at a time. You can always use a for loop to auto-index your arrays so that you can do point by point calculations.
If you find that the portion of your code that performs the calculations and does the analog output does not run fast enough for the analog input, you can use two separate while loops. One would do the analog input and the second would do AO and calculations. You can pass the data between the two using queues. If you do a search in the NI Example Finder for "queues" you will find examples of this method which allows you to pass data between two concurrently running while loops, without losing any data.
Also, the sample rate you should use will depend on the width of this peak value. If it is not very wide, you may have to sample faster.
Regards,
Laura
06-26-2006 12:28 PM
06-26-2006 01:50 PM
06-27-2006 10:53 AM
Hi Johnny,
You are not enqueueing any elements, so the data is not being passed. You need to use Obtain Queue to create the queue, Enqueue Element to add data to the queue, Dequeue Element to remove it, and Release Queue when the program is finished to release the reference. Currently, you are only using Obtain Queue and Dequeue Element. The best example of this in the Example Finder is Queue Basics.vi.
Hope this helps!
Laura
06-27-2006 12:34 PM
06-27-2006 01:01 PM
Hi Johnny,
As long as you are following the structure in that example you should be fine. I don't see anything else that might be going wrong. Can you post your modified code?
Thanks,
Laura
06-27-2006 02:00 PM