LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to add a counter to an existing analog input TDMS file

Currently I have the attached vi which runs a mobile instrumentation rack which we move between test cells. (repurposed from a previous solution)

 

I want to add a flow meter (which runs as a counter task in max) but I'm not sure how to implement it so that logs into the same TDMS file as the one on the vi.

I can duplicate the code and have a separate TDMS file, but this obviously isn't ideal. 

Could someone point me in the right direction for how to have multiple tasks in max logging to a single TDMS file.

0 Kudos
Message 1 of 17
(1,593 Views)

Hi LVIEWPQ,

 


@LVIEWPQ wrote:

I can duplicate the code and have a separate TDMS file, but this obviously isn't ideal. 

Could someone point me in the right direction for how to have multiple tasks in max logging to a single TDMS file.


AFAIK each DAQmx task maintains its own TDMS log file. Obviously not ideal in your situation

(Have you tried to use the same file for both tasks? Which error did you get?)

 

Other option:

Don't use the DAQmx logging feature, but save the data to TDMS with your own routine. Then you can stream any data you like to your file…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 17
(1,583 Views)

@GerdW wrote:

Hi LVIEWPQ,

 


@LVIEWPQ wrote:

I can duplicate the code and have a separate TDMS file, but this obviously isn't ideal. 

Could someone point me in the right direction for how to have multiple tasks in max logging to a single TDMS file.


AFAIK each DAQmx task maintains its own TDMS log file. Obviously not ideal in your situation

(Have you tried to use the same file for both tasks? Which error did you get?)

 

Other option:

Don't use the DAQmx logging feature, but save the data to TDMS with your own routine. Then you can stream any data you like to your file…


Hi Gerd,

 

Thanks for the swift response.

 

I have tried using the same file previously, it fails to run due to both tasks trying to lock the file for writing, not sure what the actual error code is, it was a while ago, I just know it wasn't possible. 

 

What would be the best way to set up 2 different DAQ tasks to log to TDMS then?

 

I struggled previously to get multiple tasks to log to a single TDMS file.

If you have an example of this, it would make life a lot easier, and something I could extrapolate in future for additional requirements of the system.

0 Kudos
Message 3 of 17
(1,575 Views)

Hi LVIEWPQ,

 


@LVIEWPQ wrote:
What would be the best way to set up 2 different DAQ tasks to log to TDMS then?
  • You define both tasks without logging.
  • You read the data from both tasks.
  • You write the data to the same TDMS file (and maybe using different groups) using the TDMSWrite function…

As you can define different groups within one TDMS file you can log different amounts of data (channels, samplerate) into one file…

Best regards,
GerdW


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

I still get the -2539 Error saying it's locked by another process. 

 

I feel like I need a way of merging the two data types before writing to the TDMS file. 

 

0 Kudos
Message 5 of 17
(1,540 Views)
0 Kudos
Message 6 of 17
(1,533 Views)

@cordm wrote:

There is an example for logging from multiple tasks: https://forums.ni.com/t5/Example-Code/TDMS-Data-Logging-From-Multiple-DAQmx-Tasks-in-LabVIEW/ta-p/37...


This example highlights the issue I'm facing very well. 

I data set is a 1D Waveform, the other is a 1D DBL, I need a way to combine the two data types to be able to store them. 

0 Kudos
Message 7 of 17
(1,525 Views)

Hi LVIEWPQ,

 


@LVIEWPQ wrote:
I data set is a 1D Waveform, the other is a 1D DBL, I need a way to combine the two data types to be able to store them. 

You can easily convert an 1D DBL array into a waveform, then you could append that waveform to your 1D array of waveforms…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 17
(1,496 Views)

@GerdW wrote:

Hi LVIEWPQ,

 


@LVIEWPQ wrote:
I data set is a 1D Waveform, the other is a 1D DBL, I need a way to combine the two data types to be able to store them. 

You can easily convert an 1D DBL array into a waveform, then you could append that waveform to your 1D array of waveforms…


 

Which functions would I use to do this? 

I've tried Bundle, and build array, and there's nothing obvious when searching that converts to waveform? 

0 Kudos
Message 9 of 17
(1,493 Views)

snip.png

 

or change the type of DAQmx Read.vi

cordm_1-1691068172967.png

 

 

0 Kudos
Message 10 of 17
(1,479 Views)