LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

New files are automatically created every hour to store the data being collected by the NI cDAQ

Solved!
Go to solution

NI DAQ collection device is always in the running state. When I start to click the Run button, vi program automatically creates a file, and data is automatically imported into this file every 10 minutes. After 1 hour, the file is automatically closed and a new file is automatically created, and the collected data is imported into the new file every 10 minutes. Until 1 hour later the new file is automatically closed again and another new file is created, and the process is repeated repeatedly. Until I stop running this program, this is the vi program I do, but I can not achieve the above mentioned things, I hope there is a big man to help me, thank you

0 Kudos
Message 1 of 21
(1,357 Views)

Hi laixx,

 


@laixx wrote:

I can not achieve the above mentioned things,


You need to implement all your requirements!

 

Until then:

  • You need to keep the TDMS file reference in a shift register!
  • Only open/close the file when needed (like "every new hour")!
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 21
(1,348 Views)

I don't understand what you mean. I once tried to keep the TDMS file reference in a shift register, but it didn't work, so I don't know how to use the shift register correctly in my vi program?

0 Kudos
Message 3 of 21
(1,326 Views)

Hi lai,

 


@laixx wrote:

I don't understand what you mean. I once tried to keep the TDMS file reference in a shift register, but it didn't work, so I don't know how to use the shift register correctly in my vi program?


This is a simple sketch:

You need to add proper initialization and error handling…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 21
(1,304 Views)

 

IMG_20230613_172249.jpg

 Thank you for your reply, but there is an error in the vi program

0 Kudos
Message 5 of 21
(1,285 Views)

Hi Lai,

 

there is an uninitialized output tunnel.

My snippet shows how to handle that correctly!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 21
(1,278 Views)

What NI chassis are you using? I would like to run a simulation. So you want to be able to create new file every  (1) hour. Is that right? I just want to make sure I clearly understand what you need help with. If it's so, I think I can help with that. 

0 Kudos
Message 7 of 21
(1,267 Views)
Solution
Accepted by topic author laixx

Much easier way to do this.

  1. Use the built in logging features of DAQmx.
  2. Use your sample rate times 3600 (seconds in an hour) to tell DAQmx logging how big you want each file.
  3. Every hour from your acquisition start DAQmx will start a new file. (Test it by changing 3600 to 10, you will see a new file every 10 seconds)

snip.png

Message 8 of 21
(1,242 Views)

Mcduff, you are awesome. Thanks for sharing this. 

0 Kudos
Message 9 of 21
(1,234 Views)

Due to jet lag, did not reply in time, thank you very much for your help, this is really great, I have some additional questions, I hope you can get the answer, may I first click on the VI program run button, vI program running for a period of time after clicking the VI program abort button, a total of 10 files generated. A second click on the VI program's run button will not overwrite the previous 10 files, but will continue to generate new files after the first 10 files

0 Kudos
Message 10 of 21
(1,190 Views)