02-01-2024 08:01 PM
Hello,
I was able to use the timed loop to pull motor and encoder data with provided Zaber VI and DAQ Asistant for the encoder. I worked all well for customized period up until 14ms. 15ms to 1000ms, it worked great. It gave me the correct amount of samples. But when I changed the period to 14ms, I suddenly lose half of the samples.
For a 10s measurement, with 14ms of period. I am expected around 700 data points. But I can only get around 400. I have no idea where the issue is. Could someone take a look at my VI and help me with this?
Thank you all in advance!
02-01-2024 09:23 PM
It is difficult to figure out what you are doing. You did include your VI (thank you for that), but failed to include all of the VIs (i.e. the entire Project, best done by compressing the Project file by right-clicking it, selecting "Send to:", then "Compressed (zipped) folder", and attaching the resulting .zip file).
It would help to describe the I/O system. I see reference to COM3. I cannot open your DAQ Assistant to learn how you have configured DAQmx to acquire data. What is your DAQ device, what are the parameters of data acquisition (including timing, number of samples, etc.).
I have a few suggestions that go directly to improving the speed of data acquisition.
We look forward to more information.
Bob Schor
02-02-2024 08:31 AM
I generally think the Timed Structure should not be used in a Windows environment. It rarely solves problems and often causes more. Change that to a normal While loop. The DAQ and instrument communication will limit the loop rate.
You also have the issue of an ever-growing array that will slow down your loop. I recommend using DAQmx Configure Logging to make DAQmx save the data to a TDMS file for you. This is even more efficient than a Producer/Consumer setup as it bypasses many software layers. Granted, you need to use the actual DAQmx API instead of the DAQ Assistant to do this.
02-02-2024 11:45 AM
Hello, Bob_Schor and crossrulz
Thank you for the detailed explanation. Let me explain my VI a bit. I will inlcude details this time.
1. The VI I uploaded was the only VI I had. The DAQ Assistant is configured to read the angular position of a quadrature encoder with 2000 cycles per revolution. (Figure 1). I also enabled TDMS logging with this feature (log and read).
2. The Motor (Zaber Motor) is connected to the computer with DAQ through COM3 (USB connection). I am trying to synchronize the motion of the encoder with the motion of the motor. (encoder 1 rev, motor 0.5 rev)
3. My DAQ device is PCIE 6353. I am trying to achieve more than1khz sampling of encoder position and motor position. (The more the better).
4. You mentioned with DAQ Assitant the time delay will be large, but I can get 133 samples within 1ms, but the time stamps are all the same. (Figure 2).
5. I used time loop to "lock" the loop frequency. I tried to do it with wait(ms), but it was not working well.
6. Would having a buffer help with data logging? Since I will be storing data in a loop with shift register, and I need that data for finding the difference between the motor and the encoder.
Yes, I will go through the tutorial and test both the consumer/producer and DAQmx way of tdms logging.
Hope to hear more suggestions!
02-02-2024 11:59 AM - edited 02-02-2024 12:17 PM
Hello yfei2000,
Edit: I spoke with my colleagues and understand that you are already in touch with them and that the below would not be applicable based on your connection.
-----
Can you say if you are using the X-USBDC USB to RS232 cable supplied by Zaber? If so, there's a way to optimize the response timing by adjusting the latency through device manager. See here for a quick GIF showing the process.
Can you say what Zaber controller model you are using?
Best regards,
Mike McDonald
Zaber Technologies
Applications Engineering