NI cdaq. Read timeout: Only x scans were read.
5 次查看(过去 30 天)
显示 更早的评论
I have a NI cdaq chassis with a voltage input card mounted, which is running at 48000 samples/s for 4 channels. I also have a voltage output card running at 20000 samples/s.
I'm running it in a DataAcquisition interface, where I use the ScansAvailableFcnCount and ScansAvailableFcn, to have the accusition running in the background and read the data whenever the ScansAvailableFcn triggers, using:
data = read(s1,48000,"OutputFormat","Matrix");
When I run the code I get a read timeout warning.
Warning: Read timeout: Only x scans were read.
Where x is the number of scans read out of the total. I expect 48000 samples but I only get between 9000 and 19000.
Am I sampling to fast or how can I get the full 48000 samples out?
0 个评论
回答(1 个)
arushi
2024-8-9,6:24
Hi Emil,
I understand that you are using a National Instruments CompactDAQ system with a voltage input card operating at 48,000 samples per second and a voltage output card operating at 20,000 samples per second. You are using a DataAcquisition interface to read the data when a certain function triggers. However, you are experiencing a read timeout warning and are only able to read between 9,000 and 19,000 samples out of the expected 48,000.
The warning you're seeing is typically caused when the `read` function is not able to retrieve data as quickly as it's being generated by the data acquisition hardware. This can happen if the data acquisition rate is too high, or if the computer is not able to process the data quickly enough.
Here are some things you can try to resolve this issue:
1. Reduce the sample rate: If your hardware and application can tolerate a lower sample rate, this is the simplest solution. Reducing the sample rate will give the `read` function more time to retrieve each batch of data.
2. Increase the buffer size: The buffer size determines how much data can be stored on the hardware before it needs to be retrieved by the `read` function. If the buffer size is too small, data may be overwritten before it can be retrieved. You can increase the buffer size using the ‘InBufferSize’ property of the ‘DataAcquisition’ object.
3. Optimize the ‘ScansAvailableFcn’: The ‘ScansAvailableFcn’ is called whenever a certain number of scans are available. If this function is doing a lot of work, it may be slowing down the rate at which data can be retrieved. Try to make this function as efficient as possible and consider moving any non-critical processing to another part of your code.
4. Increase the read timeout: The read timeout is the maximum amount of time the ‘read’ function will wait for data to become available before it returns a warning. You can increase this timeout using the ‘ReadTimeout’ property of the ‘DataAcquisition’ object.
5. Use a dedicated thread for reading: If your application is multi-threaded, you might consider dedicating one thread to continuously read data from the buffer. This can help to ensure that data is read as quickly as it becomes available.
Please refer to the following MATLAB Documentation link to know more about Data Acquisition Toolbox:
Hope this helps.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 National Instruments Frame Grabbers 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!