11-29-2013 12:00 PM
Hi,
I want to create the Low Pass Filter Tester with TestStand. I want to generate sine wave with frequency form 1 to 1k Hz and read amplitude before and after the filter. First of all I have to ensure synchronisation between DAQ read and DAQ write[ http://i79.photobucket.com/albums/j122/thor_tory/1_zpsab4a4c00.png~original ]. I already used a bit modified examplary sine wave generator to analog output VI and read from analog input VI. I put them as subVIs into one VI and then called it in TestStand although the read apmlitude was in many cases not even close to the generated amplitude (like the read was performed too soon). I put all subvis one by one, I also tried flat sequence structure but it was not ok because it stopped in first stage while generating sine wave.
Have you any idea how to make synchronisation between generating signal and acquiring amplitude? And what to match it to given frequency (value of frequency is increased in TestStand)?
Michał
Solved! Go to Solution.
12-02-2013 04:03 AM
Hi Michal,
My suggestion is to start from the following example https://decibel.ni.com/content/docs/DOC-8023
Later, you should make the generation and acquisition finite, so that the execution of this VI will stop and return back to TestStand and just have to add a subVI that will process the waveforms acquired in LabVIEW. You can add another subVI in the same VI with acquisition, no need to pass the waveform data to TestStand and back to LabVIEW.
Best regards,
IR
12-03-2013 04:28 AM
Thanks for showing me that example, I have somehow problems finding it myself :S What is the difference in using that built in clock?like in this example:https://decibel.ni.com/content/docs/DOC-26326
Having set the acquisition finite I get an error:
Possible reason(s): Attempted to read a sample beyond the final sample acquired. The acquisition has stopped, therefore the sample specified by the combination of position and offset will never be available. Specify a position and offset which selects a sample up to, but not beyond, the final sample acquired. The final sample acquired can be determined by querying the total samples acquired after an acquisition has stopped. Attempted to Read Sample: 50 Property: RelativeTo Corresponding Value: Current Read Position Property: Offset Corresponding Value: 0 Task Name: _unnamedTask<4F>
I've been changing all the values but I keep on getting that error. Is there any way to make everything dependent on the frequency of generated signal(I know it is:) )? I mean like sine wave f = 100Hz
so the f_sampling = f * 2.5 (to prevent aliasing), same thing with samples to read, does the amount of them have to be the same for every channel?
Michał
12-03-2013 04:44 AM
Hi Michal,
Firstly, as the error states, that you are trying to read the samples that are not being yet acquired. If you have a finite acquisition, you should adapt the examples to acqurie finite number of samples.
You can do that by removing the while structure and use it either in a For loop or simply specifying the total number of samples you want to acquire.
Secondly, you are right with the Nyquist theorem, you should sample at least twice faster than the maximum frequency. Why do you want the generation and acquisition to be dependent with every frequency you output? Is it possible to go with the following case scenario:calculate the sampling acquisition and generation with the maximum frequency possible?
I recommend you to have a look in the following manual, there are chapters that explains how the Analog Input and Output work on X Series boards.
Also, I found a very nice white paper that explains the synchronization between AI and AO.http://www.ni.com/white-paper/3615/en/
Best regards,
IR
12-03-2013 05:23 AM
(...)Secondly, you are right with the Nyquist theorem, you should sample at least twice faster than the maximum frequency. Why do you want the generation and acquisition to be dependent with every frequency you output? Is it possible to go with the following case scenario:calculate the sampling acquisition and generation with the maximum frequency possible?
(...)
What I want to do is to change the input frequency of the sine wave, that will be done in TestStand sequence and passed as a parameter to the VI. I want to be certain that for each given frequency I will obtain true value of the amplitude of the signal. So I'll be able to gather the data before and after the filter for frequency in range 1 Hz - 1 kHz with step 10 Hz and plot its frequency response.
While talking about removing loop did you mean to remove it entirely, it does not touch the generation of the sine wave?
Michał
12-03-2013 05:28 AM
Hi,
Let me see if I understand correctly:
You want to pass data from TestStand to LabVIEW as f1, f2 and you will do a sweep between the two frequencies (f1,f2)?
Or, you want to have a stept that for any give frequency you will generate a finite amount of samples and the VI will return the amplitude and the frequency measured and you will call this step "n" times from TestStand and at the end of n steps you will plot the result?
Basically, for "n"step as frequency sweep you can do it at once in LabVIEW or you can do n times the same step with different frequencies.
How do you want to build it?
Best regards,
IR
12-03-2013 06:05 AM
12-03-2013 06:23 AM
12-03-2013 07:36 AM
Hi Michal,
Please do not duplicate forums posts, I have also found that you posted the same question http://forums.ni.com/t5/LabVIEW/DAQ-signal-generation-and-read/m-p/2645433#M789588
Also, to answer your question:
In order to make an example from continuous to finite, you have to change the constant at the Timing VI but also to remove the while loop.
Please use the following tutorial http://www.ni.com/white-paper/3615/en/ it is very well described how can you sychronize AI and AO.
Basically, in the figure2, you have the complete flow of application needed, the only thing you have to change is the frequency of the sinewave.
Best regards,
IR
12-04-2013 07:33 AM
Ion,
Sorry for doubling the topics but I thought that none would answer.. Perhaps I formulated the topic incorrectly and then You came with help.
Thanks for almost ready program. It seems to solve the problem. I'll test it on university as soon as I can. Then I'll let know, here. Should I worry about the samples per channel in DAQmx Timing block or it will always generate the full period of sine? At home I simulate the card and it is always same wave(A=10V; some frequency) and full period is read. I tried to follow: http://www.ni.com/white-paper/3698/en/#toc3 in order to simulate different signal but it says like the card is busy (while the data is 'generated' in signal express). It looks like I will have to wait till then.
Michał