LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ assistant not following looped input

Hi,
 
I'm trying to design a new control system which I want to provide a signal to the tyre test rig I'm working on and then measure the response of the tyre.
 
The output signal is a simple sine wave, but I want to test a range of frequencies (specifically 5-15 Hz in 0.1Hz intervals) so I have created a loop to do this, with the DAQ Assistance in the middle.
 
When I run the VI, the first frequency (5Hz) is input to the rig and it oscillates the tyre as expected. However, the problem is that although the loop steps onto the next frequency (5.1Hz) correctly as can be seen with a probe, the output signal itself remains at 5Hz.
 
To try and work out what was going on I made a much simpler VI with the standard DAQ Assistance with the frequency input hooked upto a slider. When run, the rig oscillates the tyre at the default value. When the slider is moved it takes approx 6-7 seconds for the rig to respond, but it does then oscillate at the new frequency.
 
This delay is something that was not preset with the old control system, so I can only assume comes from the software. This delay I could cope with (although if I can get rid of it that would be nice!), but the main issue is with the loop not updating the output signal.
 
If anyone could have a look at my attached VIs and advise me where I may be going wrong (maybe a bit tricky without the hardware present I admit) then that would be much appreciated.
 
Many thanks,
 
Ian Haigh
 
P.S. InputOutput.vi is the main program. The other 2 VIs are ones I have adapted from standard to achieve the desired sampling rate control.
0 Kudos
Message 1 of 5
(3,388 Views)
Consider the waveform you are creating with the "Simulate Signal" block.
 
At 5Hz, you have a sampling rate of 500 samples/sec and you are generating 5000 samples. (at least with the default values in the controls when I opened them) That's a 10 second waveform you're sending to the analog output buffer. Combine this with the 5 second delay you have in the "Time Delay" block, and I think we may have found the source of the delayed response.
 
Take the Time Delay out and let the VI run and you'll see the analog output will always generate all 5000 samples, which should take 10 seconds. So changing the input frequency will not have any effect until all of the current waveform has been generated and the loop goes to its next iteration.
 
Try generating a single cycle of the waveform (500 sample at 500S/sec) and let the loop run without any Time Delay block. You can do this because the DAQmx driver will release control of the VI while the hardware is generating the waveform. This should let you update the frequency quicker.
 
Let us know how it works out or if I've missed the point.
 
Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 5
(3,386 Views)

I forgot to mention that there is an Example VI that ships with LabVIEW called "Cont Gen Voltage Wfm-Int Clk-Variable Rate.vi" that shows a good way to continuously generate a waveform and update the frequency on demand without interruption.

Look in the Example Finder under Hardware Input and Output>DAQmx>Analog Generation.

Ed



Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 3 of 5
(3,387 Views)

Thanks for the assistance Ed,

The signal was designed to run for 10 cycles to gain a better representation of the data at each frequency, and the 5 second time delay was put in so that the rig had a short time to settle between each frequency so that the data was not 'contaminated' with resonances from previous frequencies.

To try and get the output stepping through, I tried reducing the number of a cycles to 1, and getting rid of the time delay as you suggested but neither of these worked. Depending on the number of samples taken, the loop iterates at the correct speed (5000 samples takes 10 secs) but the problem is still the DAQ assistant updating the output signal.

I think you're probably along the right lines when you talk about the DAQmx driver releasing control of the VI at the appropriate times. Could you point me in the direction of some more resources about this?

I've also attached the slider test I was walking about. This samples at the default frequencies and has no delay, yet still takes 6-7 seconds for the rig to respond. Could it be something to do with whether sampling is for N samples or continuous?

Many thanks for your help,

Ian

0 Kudos
Message 4 of 5
(3,362 Views)

I think the problem is still with the waveform you are sending to the DAQ card.

Try a different approach using the example I pointed to in my last post. You should be able to use that pretty much as is. You'll just need to figure out a way to chage the frequency at the correct time. I think you'll have a lot beter luck using this setup.

Here's a FAQ that has a lot of info about how the DAQmx driver was built and some of the reasons NI did what they did.

Ed



Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 5 of 5
(3,349 Views)