Jump to content

read continuousely from daqmx


mstoeger

Recommended Posts

Hi,

I am looking for the best solution to first read continuousely multiple channels/multiple samples/waveforms all 1 seconds and build afterwards longer waveforms (for example 300 sec) - and the same again and again (as the program is doing unattended monitoring work).

In my opinion this is a very simple task, but the solution is not as trivial. I tried different ways, but these all seem to be a little bit complicated, therefore I ask for some good (and proven) ideas.

Thanks for your help

Martin

Link to comment

QUOTE (Ben Zimmer @ Sep 21 2008, 12:55 PM)

This is a bit of an advanced notion, but is a great solution to the question: how to acquire "essentially" forever. Once you wrap your mind around how to do this, I'd wager you use the circular buffer over and over in all of your projects. I know I do.

If you're using DAQmx, it has a circular buffer built in. If you set the acquisition to "continuous" it will acquire forever (not sure what happens when you roll over an I64, but at 1Hz, you won't live to see it).

There should be plenty of DAQmx examples you can use. If you need fancier access to specific points of the built-in circular buffer, you can have better control with DAQmx property nodes. Try out some of the examples and then post more questions if you hit a stumbling block.

If you are using other hardware, especially non-NI products, then Ben is right; you may have to write your own circular buffer.

Link to comment

QUOTE (jdunham @ Sep 22 2008, 07:02 AM)

If you're using DAQmx, it has a circular buffer built in. If you set the acquisition to "continuous" it will acquire forever (not sure what happens when you roll over an I64, but at 1Hz, you won't live to see it).

There should be plenty of DAQmx examples you can use. If you need fancier access to specific points of the built-in circular buffer, you can have better control with DAQmx property nodes. Try out some of the examples and then post more questions if you hit a stumbling block.

If you are using other hardware, especially non-NI products, then Ben is right; you may have to write your own circular buffer.

OK, first of all I'll take a closer look to all available examples. As I am using NI-Hardware, it's possibel to use all features of daqmx.

But I'd like to discribe the probelm a little more detailed:

The datatype "waveform" has advantages: dt, channel names and scales and other attributes are the easiest solution to keep this information when converting data to other NON-NI-data and/or file formats.

When reading data once per second, I can start with applying filters, check limits and so on. After retrieving for example 300 reads I start with other calculations: fft, etc. And the last step is to store a piece of data with a "duration" of 300 sec into one file (or export it to another file format).

At the moment I prepare an array for y-data of all channels for 300 sec, get waveform components, and after finishing read no. 300 I build an array of waveforms again.

Sure, there are other possibilities: Get the date as 2D-array and not as waveform, take use of the function append waveforms, enlarge the daqmx buffer and read only all 300 sec., ...

But I wonder, that there is not a proven, much simpler way. Because I think, this is a just usual task.

In this way, I'll try to find the best solution - and when I'm satisfied with the result, I will share it here.

Martin

Link to comment

QUOTE (mstoeger @ Sep 22 2008, 01:13 AM)

The datatype "waveform" has advantages: dt, channel names and scales and other attributes are the easiest solution to keep this information when converting data to other NON-NI-data and/or file formats.

When reading data once per second, I can start with applying filters, check limits and so on. After retrieving for example 300 reads I start with other calculations: fft, etc. And the last step is to store a piece of data with a "duration" of 300 sec into one file (or export it to another file format).

At the moment I prepare an array for y-data of all channels for 300 sec, get waveform components, and after finishing read no. 300 I build an array of waveforms again.

Sure, there are other possibilities: Get the date as 2D-array and not as waveform, take use of the function append waveforms, enlarge the daqmx buffer and read only all 300 sec., ...

But I wonder, that there is not a proven, much simpler way. Because I think, this is a just usual task.

Yes, You just need DAQmx Read.vi, and set the polymorphic selector to Analog -> Multiple Channels -> Mulitple Samples -> 1D Waveform

and you will get an array of Waveform datatypes with one element for each of your channels. Before you execute that, get a DAQmx Read property node and set the "relative to" and "offset" properties to the desired value and you should be all set. You're right that this is simple and usual.

Good luck

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.