找回密码
 注册
Simdroid-非首页
查看: 222|回复: 8

[其他] 使用DAQmx采集系统采集数据可以设置缓冲区大小吗?

[复制链接]
发表于 2006-8-25 17:19:24 | 显示全部楼层 |阅读模式 来自 天津
使用DAQ assistent生成的代码没有设置缓冲区大小的函数,有一个函数为DAQmx  configue  input  buffer 可以设置缓冲区大小吗?这里的缓冲区指的是内存上的缓冲区吗?我把它放在了timing函数的前面好像不起作用。请高手指教!
发表于 2006-8-29 12:03:35 | 显示全部楼层 来自 安徽马鞍山
Simdroid开发平台
使用DAQmx时,lv根据你设置的采样速率自动设置缓冲区大小,当然你也可以自己设置!参考DAQmx timing vi的帮助文件!!
 楼主| 发表于 2006-8-29 15:55:19 | 显示全部楼层 来自 天津
在我没有自己设缓冲区大小的时候,采集一会就会出错,提示增大缓冲区,或者降低采样频率,或者增大每次读取的点数,后来我自己设置了很大的缓冲区,还是会出现同样的错误,好像自己设的也不管用,是不是集资的内存不大一定会出现这样的问题啊?
发表于 2006-8-29 22:22:32 | 显示全部楼层 来自 安徽马鞍山
一般情况下,使用DAQmx进行数据采集时lv会自动根据你设置的采样速率来设置缓冲区的大小,除非你自己设置的缓冲区比lv设置的缓冲区大,lv才采用你设置的缓冲区.你仔细看一下task timing.vi的说明,里面有详细的说明,缓冲区大小的设置(连续采集时)是采用你使用max设置的每次读取的数据个数的哪个参数.
一般情况下使用DAQmx进行数据采集时是不会发生溢出的,除非你读取数据的速度非常得慢!!
 楼主| 发表于 2006-8-30 09:36:15 | 显示全部楼层 来自 天津
那里面不只是说了连续采集每次从缓冲区读取的数据个数吗?我没有看到说缓冲区的大小啊
 楼主| 发表于 2006-8-30 09:49:06 | 显示全部楼层 来自 天津
我刚才说得错了,我说得是read函数的功能了。但我仔细看了timing函数的功能还是没有发现和缓冲区大小有关的参数。请指教.
发表于 2006-9-3 09:57:10 | 显示全部楼层 来自 安徽马鞍山
How Is Buffer Size Determined?
Input Tasks
If your acquisition is finite (sample mode on the Timing function/VI set to Finite Samples), NI-DAQmx allocates a buffer equal in size to the value of the samples per channel attribute/property. For example, if you specify samples per channel of 1,000 samples and your application uses two channels, the buffer size would be 2,000 samples. Thus, the buffer is exactly big enough to hold all the samples you want to acquire.

If the acquisition is continuous (sample mode on the Timing function/VI set to Continuous Samples), NI-DAQmx allocates a buffer equal in size to the value of the samples per channel attribute/property, unless that value is less than the value listed in the following table. If the value of the samples per channel attribute/property is less than the value in the table, NI-DAQmx uses the value in the table.

Sample Rate Buffer          Size
no rate specified             10 kS
0–100 S/s                      1 kS
100–10,000 S/s              10 kS
10,000–1,000,000 S/s     100 kS
> 1,000,000 S/s             1 MS

You can override the default buffer size by calling the Input Buffer Config function/VI.

Note  Using very large buffers may result in diminished system performance due to excessive reading and writing between memory and the hard disk. Reducing the size of the buffer or adding more memory to the system may reduce the severity of these problems.

Output Tasks
For generations, the amount of data you write before starting a generation determines the size of the buffer. The first call to a Multiple Samples version of the DAQmx Write function/VI creates a buffer and determines its size.

You also can use the Output Buffer Config function/VI to create an output buffer. If you use this function/VI, you must use it before writing any data.

The samples per channel attribute/property on the Timing function/VI does not determine the buffer size for output. Instead it is the total number of samples to generate. If n is your buffer size, setting samples per channel to 3×n generates the data in the buffer exactly three times. To generate the data exactly once, set samples per channel to n.
你自己再好好看一下吧,lv  help里面的
发表于 2010-10-30 15:36:44 | 显示全部楼层 来自 上海杨浦区
如何确定缓冲区大小?
输入任务
如采样模式为有限采样(定时函数/VI上的采样模式设置为有限采样),NI-DAQmx将划分出一块缓冲区,大小与每通道采样数属性相等。例如,指定每通道采样数为1000,应用程序使用两条通道,则缓冲区大小为2000个采样的大小。因此,缓冲区的大小足够存放要采集的所有样本。

如采样模式为连续采样(定时函数/VI上的采样模式设置为连续采样),NI-DAQmx将划分出一块缓冲区,大小与每通道采样数属性相等,除非缓冲区大小的值比小表所列的值更小。如每通道采样数属性的值小于下表所列的值,NI-DAQmx将使用下表中的值。

采样率 缓冲区大小
未指定速率 10 kS
0–100 S/s 1 kS
100-10,000 S/s 10 kS
10,000-1,000,000 S/s  100 kS
>1,000,000 S/s 1 MS
注:  因为性能原因,连续采集的默认缓冲区大小与启用数据记录时所需缓冲区的大小可能有细微差别。

通过调用输入缓冲配置函数/VI可重写默认缓冲区大小。

当定时函数/VI的采样模式设置为硬件定时单点采集时,NI-DAQmx不会创建缓冲区。

注:  缓冲区过大在内存和硬盘之间产生过量的读写操作会对系统性能造成影响。降低缓冲区的大小或增大系统的内存都是解决上述问题的方法。

输出任务
开始一次新的生成之前需要执行写入操作的数据决定缓冲区的大小。第一次调用“写入”函数/VI的“多采样”实例时会创建一个缓冲区并确定其大小。

也可使用输出缓冲区函数/VI创建一个输出缓冲区。必须在写入数据之前使用该VI。

定时函数/VI的每通道采样数不决定输出缓冲区的大小。反之,它是要生成的采样的总和。如缓冲区大小是n,将每通道采样数设置为3×n,将缓冲区的数据设置为正好3倍。如要生成整一倍的数据,将每通道采样数设置为n。

当定时函数/VI的采样模式设置为硬件定时单点采集时,NI-DAQmx不会创建缓冲区。
回复 不支持

使用道具 举报

发表于 2010-10-30 15:37:38 | 显示全部楼层 来自 上海杨浦区
本帖最后由 scyangyu 于 2010-10-30 15:51 编辑

如果使用DAQmx Timing (VI),可通过samples per channel 来设置缓存大小
specifies the number of samples to acquire or generate for each channel in the task if sample mode is Finite Samples. If sample mode is Continuous Samples, NI-DAQmx uses this value to determine the buffer size.
如果不使用DAQmx Timing (VI),可通过DAQmx Configure Input Buffer.vi或DAQmx Buffer Property Node来设置缓存大小。
回复 不支持

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|小黑屋|联系我们|仿真互动网 ( 京ICP备15048925号-7 )

GMT+8, 2024-3-29 06:01 , Processed in 0.063840 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表