Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

averageing a continuous signal

Hi there,  I want to be able to be able to get an average of a continuous signal.  What I have is the DAQ assistant reading 5 signals (all voltage signals) from an SCXI 1001 module continuously.  Four of these signals are translated into pressures and then used in a mass flow calculation, and are quite noisy. I need to get an average to smooth this out.  I have created a for loop so that it will calculate a set number of mass flows and then average the outputs outside of the loop.  This does not seem to be working as it is taking the same signal input for each loop instead of using a new, updated value from the data aquisition module.  I have tried increasing the sample rate in the DAQ assistant in case the loop was going too quick for a new value to be generated but this doesn't solve the problem...it just makes it go faster!  Is there any way to get this loop to pick up a new value each time it loops and then average the results? I have attached the VI (called tidy final one) so that it makes more sense as it is quite hard to explain what I mean!

 

Any help with this problem would be greatly appreciated,  I have also tried using the DAQ code from scratch which works well for one signal but I can't make it work with more signals, I'll attach what I have done there too as maybe there's an easy way to extend this to more signals. 

 

Sorry for the REALLY long post.

Thanks, Anna

Download All
0 Kudos
Message 1 of 6
(3,117 Views)

Hi Anna,

 

To exend the DAQ code to more than one signal all you need to do is copy it and change the input line for each task.  The five tasks will then run in paralel.  If you need to synchronise these tasks you can run them off an external clock if you have one in any of your modules.  For an example of how to do this please take a look in the NI example finder then follow hardwear input and output>>DAQmx>>Analog Measurements>>Voltage>>Cont Acq&Graph Voltage-ExtClk.vi

 

If you have no external clock there will be a similar example using an internal clock in the folder.

 

I hope that answers your questions but if you have any problems implementing the example I will be glad to help.

 

 

Regards,

 

 

Tom

Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 2 of 6
(3,107 Views)

Hi Thomas

 

Thanks for helping me out.  I already tried what you said but it doesn't seem to work, it'll only read from one channel at a time, the other (I've only tried two channels to start off with) comes up with an error - "error -50103 occured at DAQmx read...........". 

 

I also tried putting multiple channels on the physical channels input to the DAQmx create channel, but I am unable to use "from custom scale" as my units as each channel has a different calibration curve and I am unsure as to how I can extract from the array the average value of each channel and then apply the calibration equation.  Any thoughts?

 

Many thanks

Anna

0 Kudos
Message 3 of 6
(3,089 Views)

Hi Anna,

 

The 50103 error means you are trying to access the same hardwear device from different tasks, for some reason I assumed you were using different devices, sorry about that! 

 

You are going down the correct route using multiple channels in one task.  To extract the array average value you need to output the read data as a 2D array.  You can then index the array using the function from the array pallet.   You will need an index array function for each channel and to wire in a constant for each index, remember the array is indexed from 0!  This will leave you with a 1D array for each channel that you can wire into the mean vi.  This will output a dbl which you can then apply your calibration equation too.

 

I hope this has helped,

 

Regards,

 

 

Tom

Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 4 of 6
(3,086 Views)

Well that seems to have done the trick! 

 

Thank you so much, I've been tearing my hair out about that one for a while now 🙂

Anna x

 

 

 

0 Kudos
Message 5 of 6
(3,080 Views)

I'm glad to have helped and wish you the best of luck in your application.

 

 

Tom

Applications Engineer
National Instruments UK & Ireland
0 Kudos
Message 6 of 6
(3,076 Views)