04-29-2009 05:18 PM
Hi There,
I am fairly new with Labview, but expert in simulink dSPACE. I have designed a model reference adaptive controller with one AI, one AO and a reference generator. I have used signal generators from the simulation function tools.
I have tried to design everything in LabVIEW and run it from a USB 6229 hardware. I get the signals in and out and have the ability to see them in oscilloscope and in the computer monitor.
The problem is that the signals are very slow. A MRAC requires to run very fast but the changes in the hardware signal appear in the scope very late.
I guess there is a problem with setting. I appreciate if anybody can help me set the timing so that the analog signals up to 10KHz are read and written fast. I have attached the file to this post.
Thanks and Regards,
-Afshin
05-01-2009 10:51 AM
Hi Afshin,
How slow are you seeing the output on the USB 6229? Are you seeing the whole sine wave, or are you just seeing random points of the sine wave? You are generating an array of sine values on every iteration of the simulation loop and the step size for the simulation loop is 0.0001 sec. This may not work. Try using the Sine Signal function which comes with Simulation instead (Functions Palette >> Control Design & Simulation >> Simulation >> Signal Generation >> Sine Signal). This generates a point-by-point sine wave. In the DAQ Assistant step, you can then configure it to output 1 sample at a time instead of N samples.
I hope this helps.
05-01-2009 07:35 PM
Thanks Vivek,
With the current setting I can see a complete sine wave in the output and also can read signals. Actually there is not problem with that. The problem is that when I change the (for example amplitude) the results in the hardware output will appear after seconds. Maybe I am loading the buffer too much. I tried to write 2 samples at a time but no help and no improvement. When I changed it to one sample at a time and used sine waveform generator, it eases the process but I see the changes every second. The hardware output is updated every second. This is not working for controls and no matter what the frequency I set, I see the hardware output at 3.5 Hz. If I decrease the step size the controller diverges.
What is a normal setup for realtime measurement, process and generation. I tried a simple PI control system as example. It runs very fast in simulation but as soon as I add the read and write to the hardware (I used one sample and traditional channel config, read/write, and clear) the system slows down almost down to zero Hz.
Please advice,
Thanks,
-Afshin
05-04-2009 11:11 PM
Hello Afshin,
I am aware that you have opened a new service request with us regarding this issue. We will continue to assist you through e-mail and phone. At the moment, it still looks like the issue could be related to one of the following:
Sending an array of values in every iteration of the loop instead of sending a sine wave point by point
Express VIs take more time than using the low-level DAQmx VIs
Also, if your application needs a close-to-deterministic response, I would consider using LabVIEW real-time on a real-time system.