我正在通过NI开发的nidaqmx模块构建一些脚本例程。 我使用2个NI PXI 44-98(32通道)采集卡
我们希望开发一个长时间(10小时)的监测实验,采样率为200k Hz
目前,我正在努力克服python的固有限制和Nidaqmx模块的逻辑
到目前为止,我已经用有限数量的传感器编写了一个连续采集程序
import nidaqmx
from nidaqmx.constants import AcquisitionType
import matplotlib.pyplot as plt
import numpy as np
sample_time = 600 # units = seconds
s_freq = 200000
num_samples = sample_time*s_freq
dt = 1/s_freq
print('go acquisition !')
with nidaqmx.Task() as task:
task.ai_channels.add_ai_accel_chan("PXI1Slot2_3/ai1:3",
sensitivity=10000.0,
max_val=1,
min_val=-1)
task.timing.cfg_samp_clk_timing(s_freq,
sample_mode = AcquisitionType.CONTINUOUS)
data = task.read(number_of_samples_per_channel=num_samples, timeout = nidaqmx.constants.WAIT_INFINITELY)
print('I do it right !')
但使用这个非常简单的例程,我无法记录监视>;10分钟。python的内存不足,无法使用它。这对我来说是完全合乎逻辑的
我在NI网站上查看缓冲区逻辑,但我不清楚如何在这里实现它
我不明白我如何才能适应这个小例程,即每X MB任务记录的数据写入磁盘,同时仍然监视并清空“data”目录以避免溢出,我在stackoverflow上没有看到一些正确的答案
如果你已经遇到了这个问题,你有了解决方案,我很感兴趣
谢谢你的阅读
我不知道你是否解决了你的问题,或者停止了尝试,不管怎样,这都是一个基本的解决方案。我使用以太网控制的NI 9234卡,并使用csv写入存储数据:
所以。。。5个月后,但我希望这会有所帮助
相关问题 更多 >
编程相关推荐