mstoeger Posted September 19, 2008 Report Share Posted September 19, 2008 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 Quote Link to comment
Antoine Chalons Posted September 19, 2008 Report Share Posted September 19, 2008 QUOTE (mstoeger @ Sep 18 2008, 10:02 AM) 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 There was an interesting NI webcast recently, it was called : Tips for Maximizing DAQ Throughput and Performance it was giving good advice on how to set up a task that has to run continuously. There are also many tutorial and webcasts about DAQmx. Hope this helps Quote Link to comment
Ben Zimmer Posted September 22, 2008 Report Share Posted September 22, 2008 QUOTE (mstoeger @ Sep 18 2008, 04:02 AM) 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 Martin, This is one of my favourite questions! I deal with this as a critical portion of our LabVIEW training material, and my favorite solution is to build a circular buffer storage mechanism with a functional global. 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. There's a snippet of the concept here: All the best, Ben Quote Link to comment
jdunham Posted September 23, 2008 Report Share Posted September 23, 2008 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. Quote Link to comment
mstoeger Posted September 23, 2008 Author Report Share Posted September 23, 2008 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 Quote Link to comment
jdunham Posted September 23, 2008 Report Share Posted September 23, 2008 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.