LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

python node with daqmx read

Solved!
Go to solution

Hi ;

 

I am working on the python node in labview and can I use it in an acquisition program, I wrote a python script to create a new file every 1000 points; this works if I'm in finished mode without a while loop; but I want it to also run in continue mode in a while loop?

the problem here is that I don't have all the data.

thanks in advance

Download All
0 Kudos
Message 1 of 16
(493 Views)

Here are a few suggestions:

  1. Specify the number of points to read for each iteration of the while loop; I suggest 100 ms of data, for 1000 Hz sample rate -> 100 points.
  2. Right click the Python Node input and select Marshal to Numpy array. This is much faster than the normal input.
  3. You are writing a test file which is slow and doing it serially with your data collect. Either break apart your DAQ and File write into two separate loops, ie, Producer-Consumer Pattern or ...
  4. Use the built in logging feature of DAQmx, this also allows you to break up your files into a specified size. The files are TDMS but you can write a post processing routine to convert to test.
Message 2 of 16
(454 Views)

Hello, thank you for your feedback


for note 4 is there functionality in labview to define the size of files?

because I want to create new files every 1s, but I haven't managed to program it in labview

Do you have a solution to offer me please sir

0 Kudos
Message 3 of 16
(436 Views)

hi ,

for segestion 3, I have a problem that the data is not recorded, the files are created but it is empty although I am able to trace the data continuously in the graph

What is the problem in your opinion?

 

0 Kudos
Message 4 of 16
(431 Views)

Hi Amelie,

 


@ameletudiante99 wrote:

I have a problem that the data is not recorded, the files are created but it is empty although I am able to trace the data continuously in the graph

What is the problem in your opinion?


  • Is the TDMS file still empty after stopping the VI?
  • Why don't you read the suggested 100 samples per iteration (or any other defined number of samples?
  • Why do you wire a waveform to an Enqueue when the queue is defined for "1D DBL array"?
  • Did you debug your VI? Do you receive any data at all in the consumer loop?
  • Is the error/problem in your producer-consumer scheme or is it in the Python call?

 

You need to debug on your own, we cannot debug/run/edit your images with LabVIEW!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 16
(423 Views)

yes it is always empty, it is created but it remains empty


when I define 100 samples the files only read 100 samples even though I acquired for more time.

yes I can visualize the data in the consumer loop, if only the loop is not working correctly

 

 

0 Kudos
Message 6 of 16
(419 Views)

Hi Amelie,

 


@ameletudiante99 wrote:

yes it is always empty, it is created but it remains empty


Do you get any errors for the TDMS functions? That would explain the empty TDMS file…

 


@ameletudiante99 wrote:

yes I can visualize the data in the consumer loop


So DAQmx does work and the producer-consumer scheme also is working.

When your Python script doesn't save your data then the problem is probably inside the Python script…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 16
(410 Views)

@ameletudiante99 wrote:

Hello, thank you for your feedback


for note 4 is there functionality in labview to define the size of files?

because I want to create new files every 1s, but I haven't managed to program it in labview

Do you have a solution to offer me please sir


Don't have LabVIEW on this computer; will not have access for a few hours or more, but look at this thread for a solution to the TDMS file size. You will have to change it from every hour to every second.

0 Kudos
Message 8 of 16
(399 Views)

In your DAQmx read node set the read number of samples to 100 ms of data.

 

See this for how to do it. You are reading whenever samples are available, too much overhead in this mode.

 

https://forums.ni.com/t5/LabVIEW/NI-Daq-device-analog-input-onboard-buffer-continuous-acquisition/m-...

0 Kudos
Message 9 of 16
(395 Views)

Good morning ,


thank you for your response, that solves my problem

I wonder is there another way to record only the data of one channel out of 4?

For the other 3 channels I don't want to separate the files because I'm doing subsampling so I won't have large files

0 Kudos
Message 10 of 16
(353 Views)