LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to simulate time column created by Write to Measurement File

I don't believe that. Post an image of the block diagram, please. Dynamic Data is a black wire. Waveform data is orange.
0 Kudos
Message 11 of 16
(1,138 Views)

Dennis,

 

I guess you are write, it isn't dynamic. I thought the stripe line was. I still don't know how to input it into a logging feature. I'm about the try the TDMS logging VI to see if I can do better with that. Here is a snapshot of what I have been talking about. Pardon how condensed it is. I tried to fit it into a snapshot.VI.png

0 Kudos
Message 12 of 16
(1,127 Views)
You are converting to a 2D DBL array and throwing away everything except the data. Have you tried the Export Waveform to Spreadsheet? The Write to Measurement File will also work. Otherwise, use the Get Waveform Components and create a time array or just write the t0 and dt separately. The tdms format will also work.
0 Kudos
Message 13 of 16
(1,117 Views)

@NIerrors wrote:

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?


Sorry, I'm attending a conference, so can't always respond "quickly".  Your Producer loop should consist of a DAQmx Read function that feeds its output (which should be an array of samples, so that the loop naturally "fires" at a reasonable rate, say from 1-10 times per second) directly into a Queue (to be sent to the Consumer).  This means that the Producer loop has nothing else to detain it, so you can expect that it will reliably fire "on time".

 

Contrast this with having additional code that tries to write the data to a file inside the same loop.  The writing cannot start until the data are present (obviously), so the time required before you can finish the loop and take the next sample is increased by the (possibly variable, and OS-dependent) time it takes to do the write to disk.  No guarantee that you will have "an accurate time column".

 

There are a variety of ways you can choose to write your data to a file.  Some are very fast, some embed additional "meta-data" that makes it easier to get the data back out without having to know the format of the data going in, some are inherently "human-readable" (text), others are only "machine-readable" (binary).  There are a number of discussions about the pros and cons of the various LabVIEW Data Formats in the LabVIEW Help -- you can also probably find useful information by doing a Web search for LabVIEW File Formats.

 

Just because an NI Support Engineer suggests something doesn't mean it is the optimal method for you.

 

Also, you do not need 46 Create Virtual Channel functions.  I haven't looked at your VI recently, but if you create a Task, you can designate the channels that the Task utilizes.  For example, if you have a 32-channel Analog Input device, you can specify that you want to acquire samples from Channels 0 .. 31.  The only "catch" is when you treat channels as a group this way, you need to use a single time base for all of them.  Note that you can have individual scaling on a per-channel basis -- experiment with Task creation (you can do this in MAX or from the LabVIEW Project, New/Task).

 

Bob Schor

0 Kudos
Message 14 of 16
(1,111 Views)

Bob,

 

The producer/Consumer while it looks complex, did sound very nice, but the limitation of not a constant sample rate makes it unusable for me. I never would have thought providing a time column would have been this difficult. I completely took the Write to a Measurement File VI for granted.

0 Kudos
Message 15 of 16
(1,066 Views)

Hi NIerrors,

 

Just to clarify, what do you mean by "sample rate" in this case? You should still be able to sample from your DAQ cards at a constant rate, even if you are acquiring and processing data using a producer/consumer architecture.

 

I would also recommend reviewing the documentation on the waveform data type, if you haven't already. It seems like it should be useful for your application: http://digital.ni.com/public.nsf/allkb/B965F316364DE17B862572DF00363B10

Tom D.
Staff Software Engineer
NI
0 Kudos
Message 16 of 16
(1,045 Views)