LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to simulate time column created by Write to Measurement File

I have always used Write to Measurement File VI. This creates a X sample rate column that my workplace has grown accustom to. My new data acquisition system is very hardware demanding, and it doesn't seem to work correctly. I switched to writing to a text file, but now I do not have a time column. I believe this is due to the conversion of Dynamic data to an array. Is there another way to log my data? Timing is critical

 

Hardware: 2 - USB cDAQ 9178 chassis

                    6 - NI9227 cards

                    4 - NI9229 cards

0 Kudos
Message 1 of 16
(3,790 Views)
You should be using the waveform data type. This can be returned by the normal DAQmx Read function or selecting that with the Convert from Dynamic Data function. Best to get rid of the training wheels if you are using the DAQ Assistant. Better to use tdms logging instead of text files is a concern and use a producer/consumer architecture.
0 Kudos
Message 2 of 16
(3,773 Views)

You might be asking the Wrong Question.  Maybe the problem is that you are doing acquisition and data saving sequentially rather than in parallel, taking advantage of LabVIEW's Data Flow model that lets tasks (such as Acquisition and File I/O) where considerable amount of time is spent without burdening the CPU (because hardware such as disks, DMA channels, acquisition boards, etc. are handling the tasks).

 

Consider the Producer/Consumer Design Pattern that allows you to save data (even to a Measurement File) in parallel with DAQmx Reads.  You can find a Template for this pattern by opening a new VI with File/New ... (the dots are important), then looking for the Producer/Consumer template.  Get that "write data to disk" function out of the DAQ loop!

 

Bob Schor

0 Kudos
Message 3 of 16
(3,767 Views)

I completely agree that using the waveform data would be better. It has all the information that I need. I just don't know how. I believe the converting from Dynamic to Array is where I lose stuff. This is my attempt to "remove the training wheels" I am not using DAQ Assistant, and this is the first time not using Write to Measurement File sub VI. Using text files just appeared to me to be the next step. I will attempt to look at producer/consumer architecture which I currently do not know what it even is :).

0 Kudos
Message 4 of 16
(3,740 Views)

Bob,

 

You bring up an interesting point about gathering data in parallel rather than sequentially. Please remember I just used an example so I by no means claim that I understand what I am doing. Does this mean that I should write a separate create a channel for every channel? There will be around 46 channels. Thank you for showing me how to get to the producer/consumer template. I will look into this. Hopefully this will also explain how to gether in parallel as well. thanks for the advice, and if there is any more please advise.

 

the "write data to disk" was included in the loop to get continuous samples. It was suggested from NI support, and appeared to be working. Can you please elaborate on why this is bad?

0 Kudos
Message 5 of 16
(3,733 Views)

I have another question. Won't I have to worry about synchronization using a producer/consumer architecture? Would I still be able to produce data at a constant rate with an accurate time column?

0 Kudos
Message 6 of 16
(3,719 Views)
If you aren't using the DAQ Assistant, then selecting a waveform is just a right click option of the DAQmx Read. Of course, you must avoid any Express VIs that use the evil dynamic data. I can't look at your VI right now.

The Write to Measurement File is just pretty slow, typically.

With a producer, synchronization is better since the main loop does nothing except acquire at a constant rate.
0 Kudos
Message 7 of 16
(3,712 Views)

So I shouldn't use dynamic data? Dynamic data has been my problem so far. To my knowledge dynamic data stores the data, but also the channel characteristics. This is why I thought it was desirable. I don't know of any way to take that dynamic data to log though. When I log I lose the channel characteristics.

 

What I need is to log at a constant rate. Data needs to have channel name, time column, and data collected. What data type should I be using?

0 Kudos
Message 8 of 16
(3,702 Views)
As already said, waveform data type. Channel name is an attribute.
0 Kudos
Message 9 of 16
(3,691 Views)

Dennis,

 

I am confused. I am using Daqmx 1DWfm, but it outputs dynamic data which you said to stay away from. How do I use the waveform, but have it output a different form of data?

0 Kudos
Message 10 of 16
(3,676 Views)