Moving average filter w / continuous data acquisition

I'm looking to filter multiple signals of noisey. I am currently using a NI9203 w / a cDAQ-9174 sampling to 1000 Hz. I use DAQmx vi to start the task and acquire the signal. I tried using coefficients.vi smoothing filter combined with IIF filter.vi (Avg.png movement) it seems to work for simulated signals and recorded data. However, when I try to use this configuration for an average of real time it cut everything just all signals to zero.  I looked into the use of shift registers, but to get the necessary result, it seems that I have to use hundreds of items.

In the end, I'm trying to filter the signal to get a constant more of reading for the user. For example during operation, the user needs to review the current state of the values in real time. It's currently difficult when the noise indicates the values of +/-100 changing every 100ms.

For any help or suggestion would be appreciated, thanks in advance.

Thank you all for the help and advice. I have attached the vi that I used to solve the problem, one of my major problems was not timing DAQmx using. Attaché in 2012 and 2013.

Tags: NI Software

Similar Questions

  • Excerpts from continuous data acquisition

    Hello

    I want to make an acquisition of continuous data with a NEITHER-6133 @ 1ms per channel. The data must be stored on hard disk. At the same time, I want to take excerpts from acquisition to calculate different values. The acquisition of the extract must be triggert by an external digital trigger.  Are there examples, which combine continuous data collection and collection excerpts?

    Thank you very much.

    Best regards

    Michael

    System

    Windows 7

    LabVIEW 2012

    NOR-6133

    Thanks to the support of NOR-Germany, I found a solution for me:

    1.) continuous trigger switch

    Connect 2) the trigger for the signal to a digital i/o

    3.) synchronize AI and DIO

    Excerpt 4.) the samples needed by the search within the digital waveform pattern

    Result:

    The example shows 4 IA channels Cup (tested on Win7, NI PCI-6115, 4 channels each 5. MECH / s) and calculation on extracts from each channel signal triggered parts.

  • Moving average filter

    Hello. I want to do a mobile medium filter for my VI. I did a basic FIR filter... but I have not a clue how to make a filter means mobile.
    + I want a button to play the input wav file... How can I do this?

    This is the vi:

    My tip for a moving average is to use the FIR filter with specific coefficients.

    Regarding your wav file playback, discover the graphics and the sound palette.  I have little experience with them, but I know that there is a screw there to read your wav file.

  • I32 flipping index iteration continuous data acquisition

    I'm doing some continuous data streaming with Labview FPGA and periodically generate a trigger signal

    the timestamp after a number fixed iterations.

    The strategy I would try was to review the iteration index in the timed loop and whenever he tipped a fixed number I would generate a trigger of the FPGA.

    I tried to find out what happens when you get to 0x7FFFFFFF samples on the register of I32 and apparently

    the index does not roll... It just remains to count max once reached it.

    Is there a way to derail the index on a timed loop? Otherwise I wil just add another

    U32 variable and increment it each cycle and let it roll on.

    the iteration count does not roll.  Therefore at this historic moment, but just use a registry node, local or feedback shift instead.

  • Continuous data acquisition and real-time analysis

    Hi all

    It is a VI for the continuous acquisition of an ECG signal. As far as I understand that the analog read DAQmx VI must be placed inside a while loop so it can acquire the data permanently, I need perform filtering and analysis of the wave in real time. How I implemented the block schema means that data stays int the while loop, and AFAIK the data will be transferred on through the tunnels of data once the loop ends the execution, it clearly isn't real-time data processing.

    The only way I can think to fixing this problem is by placing another loop that covers the screw scene filtering and using some sort of registeing shift to transmit the data in the second while loop. My question is whether or not it would introduce some sort of delay, and weather or not it would be supposed to be the treatment in real time. Wouldn't be better to place all the screws (aquicition and filtering) inside a while loop? or it is a bad programming practice. Other features I need to do is back up the data I na file, but only when the user wants to do.

    Any advice would be appreciated.

    You have two options:

    • A. as you said, you can place the code inside your current while loop to perform the treatment.  If you're smart, you won't need to put one another while loop inside your existing (nested loops).  But it totally depends on the type of treatment that you do.

    • B. create a second parallel loop to perform the treatment.  This would be separate processes to ensure that the treatment is not obstacle to your purchase.  For more information, see here .

    Your choice really depends on the transformation that you plan to perform.  If it's much the processor, this could introduce delays as you said.

    I would recommend that you start at any place in the first loop and see if your DAQ buffer overruns (you can monitor the rear of the buffer during operation).  If so, you should decouple the process in separate loops.

    In what concerns or not ' it would be considered as real time processing ' is a trick question.  Most of the people on these forums say that your system is NEVER in real time because you're using a desktop PC to perform processing (note: I guess it's the code that runs on a laptop or desktop?).  It is not a deterministic systemand your data is already "old" by the time wherever he leaves your DAQ buffer.  But the answer to your question really depends on how you define "real time processing".  Many lay it will set as the treatment of 'live' data... but what is "actual data"?

  • Continuous data acquisition programming

    I wrote a program that I use to get the measurements continuously to a load with the DAQ assistant (attached) cell. I want to measure load values every 0.5 seconds and record each value using Scripture in the action file. I'm having some problems with getting the output file, I need. The parameters of the DAQ assistant are:

    -Continuous measurement

    -2 Hz sampling frequency

    samples - 1800

    - and a waiting period of 900 seconds

    I want to be able to hit stop them at any time and at the end of the program. However, what is happening is that the program continues to operate until the 900 seconds is over. Is it because I made it clear to get samples of 1800? If I leave it blank, it defines a number itself. I read somewhere that the definition of the value-1 allows an infinite number of samples, but that returned an error.

    Another question, I'll have, it's that if I allow the program to run after the timeout I put, it inserts a header after every sequence of timeout. I can't understand what is with wrong with my code, thanks for any help.

    Basic arithmetic. 1800 samples/2Samples/s = 900 seconds.

    Why accumulate so many samples at once? Reduce the number of samples at 2 and just wait 1 second for the Stop button to be recognized.

    If you don't want a header for each segment, then uncheck that in writing to the configuration of the action file.

  • 2-channel continuous data acquisition

    Hello

    I wonder how I could acquire signals of 2 channels at all times. I tried to find an example of vi but could not find one. In the vi below, I copied the same functions that work for a single channel, but it does not work.

    Best regards

    Ninjatovitch

    It should be Dev1 / ai0:1 as described above where ai0 is channel 0 and ai1 is channel one. They are separated by a ':' that specifies the range. Take a look at the following:

    What is the syntax for strings of physical channel in DAQmx?

  • digital triggering of stop/start of analog data acquisition

    I want to use a signal from a digital line to start and stop analog data acquisition. The signal can change levels several times during a race of the VI so I have to start and stop several times data acquisition and store each session data in a different file.

    I tried to play with the following screw: digital triggering of break, DigitalStartandStopTrigger and ContAcq_DigTrig. None of them doesn't seem to work for my configuration. I also do continuous data acquisition so I can't use a reference. I use PCI 6259 DAQ.

    I used the "P0" pins rather than PFI pin on the grid BNC-2090. I know... stupid enough.

  • exponential response moving average stage fpga

    Hey guys,.

    I have a problem with my filter, the exponential weighted moving average filter (IIR 1 st order.). Excerpt from the book: understand the digital signal processing (Richard Lyons) I have the following formula, calculate the frequency of 3dB (CF) of alpha. Alpha is the parameter to control the filter.

    Differential equation of the filter: y [n] = x [n] * alpha + (1 - alpha) * y [n-1]

    Relationship between CF and alpha: alpha = cos(2fc/fs) - 1 + sqrt [cos²(2fc/fs) - 4 * cos(2fc/fs) + 3]

    If I now choose a frequency of 3 dB from 0, 0794Hz (time constant (TC) = 2 s) alpha = 0,00169621. (fs = 94)

    For a filter command 1st IIR, the rise time (your) of the stepresponse (from 10% to 90%) is: ta = 2, 2 * TC which translates your = 4, 4S.

    But if I simulate the step response, my rise time is about 3 times this value at 14.

    I can't explain why the response of my filter is so much different. For my Moving Average filter, the calculated and simulated rise time are equal.

    I have the vi that is performed on the attached FPGA. Maybe someone can find a mistake...

    Greetz

    Slev1n

    Hey ZX81.

    Thank you very much for your detailed answer.

    Regarding the issue with the rise time, I think I've found the error. You might be right, that the formula is not correct, or which is most probably misunderstood by me and put in the wrong context.

    When I was cycling home from work I remembered a practical function of labview: 'coefficients.vi filter smoothing' here you only need to define tau/TC and fs and it calculates the numerator and the denominator for the moving average exponential and the moving average. Offering it is alpha I could compare the result of the formula I've used and there was a big difference. LabVIEW uses the following formula: alpha = 1 - exp (-1 /(fs*TC)). With this formula, TC = 2 s is equal to alpha = 0, 0053.

    And with this alpha my simulation works! Risetime 4.4 s

    Quote you: "in general, at this stage, I have maturities adjust alpha until my results matching what I wanted and move." I would like to do the same thing, but as it's my thesis I have to solve such things

    Now, back to the rounded questions. I understand that the small values are a more serious problem. This filter is used in a Lock In, the values are going to be REALLY small. But I've already tested on our measuring device and it works, to that effect, I'll test your version as well, but if I get no problems, I guess I keep to the 40bits. Simulating the following configuration, caused an error of 2.3%. 57 bits using reduced the error less than 1%. I think that 40bits should be sufficient.

    Alpha = 0, 000335693 entry = 1, 19209E-7

    And regarding resources, I have no worries. Although using a myrio ultimately I still have a lot of DSP Slices for the multiplication and 10% in flip flops.

    So I guess that this matter is resolved. Thanks for your great help and interesting reflections.

    Kind regards

    Slev1n

  • Mobile average filter

    Hello

    I'm designing moving average filter. But I'm confused, and I need to filter the 4 channels in the FPGA of the cRIO. If a body help me please. Any suggestion are welcome about the position. I use the 9220 OR and I want to filter 4 channels permanently inside the FPGA.

    Lookng forward to answer yor.

    Thanks in advance...

    I would do something like that.  I used an array of size 4, you must replace these constants with the length of the table you want.  Please keep in mind that an FPGA must have an array of fixed length.

  • Real-time display at the high frequency of data acquisition with continuous recording

    Hi all

    I encountered a problem and you need help.

    I collect tensions and corresponding currents via a card PCI-6221. While acquiriing data, I would like to see the values on a XY graph, so that I can also check current vs only voltage/current / time. In addition, data should be recorded on the acquisition.

    First, I create hannels to analog input with the Virutal DAQmx channel create, then I set the sampling frequency and the mode and begin the tasks. The DAQmx.Read is placed in a while loop. Because of the high noise to signal, I want to average for example every 200 points of the current and acquired for this draw versus the average acquisition time or average voltage. The recording of the data should also appear in the while loop.

    The first thing, I thought, was to run in continuous Mode data acquisition and utilization for example 10 k s/s sampling frequency. The DAQmx.Read is set to 1 D Wfm N Chan N Samp (there are 4 channels in total) and the number of samples per channel for example is 1000 to avoid the errors/subscribe for more of the buffer. Each of these packages of 1000 samples should be separatet (I use Index Array at the moment). After gaining separate waveforms out of table 1 d of waveforms, I extracted the value of Y to get items of waveform. The error that results must then be treated to get average values.

    But how to get these averages without delaying my code?

    My idea/concern is this: I've read 1000 samples after about 0.1 s. These then are divded into single waveforms, time information are subtracted, a sort of loop to sprawl is used (I don't know how this exactly), the data are transferred to a XY Chart and saved to a .dat file. After all that's happened (I hope I understood correctly the flow of data within a while loop), the code in the while loop again then 1000 samples read and are processed.

    But if the treatment was too long the DAQmx.Read runs too late and cycle to cycle, reading buffer behind the generation of data on the card PCI-6221.

    This concern is reasonable? And how can I get around this? Does anyone know a way to average and save the data?

    I mean, the first thing that I would consider increasing the number of samples per channel, but this also increases the duration of the data processing.

    The other question is on the calendar. If I understand correctly, the timestamp is generated once when the task starts (with the DAQmxStartTask) and the time difference betweeen the datapoints is then computed by 1 divded by the sampling frequency. However, if the treatment takes considerable time, how can I make sure, that this error does not accumulate?

    I'm sorry for the long plain text!

    You can find my attached example-vi(only to show roughly what I was thinking, I know there are two averaging-functions and the rate are not correctly set now).

    Best wishes and thank you in advance,

    MR. KSE

    PS: I should add: imagine the acquisition of data running on a really old and slow PC, for example a Pentium III.

    PPS: I do not know why, but I can't reach my vi...


  • Average data acquisition alternating window 25sec

    Hello

    I am relatively new to programming and LABVIEW and was hoping to get help.

    I am analyzing the retinal potential obtained in answer to Flash (ON and OFF) model 120 LEDS (simultaneously)

    The rate at which the LED on and OFF depends on a pulse of squares of 1 Hz and 5V amp (from the device).

    I use USB-6009 to convert analog signals.

    Data are collected for 50-100 scans (LEDs go ON and OFF), is - 25-50 s of data collection. Followed by a break (no data genuine collected) from 25 to 100 seconds, after which a new cycle/game data are collected for the next dry 25-50 and so on.   Sampling rate = 1000 Hz (1ms/point).

    My goal is to perform an average of data collected with the timestamp.  Display the waveform of flood and averaged over the waveform graph and write the data on average in an Excel with a time stamp.

    Attached is a diagram of what I expect, I need a direction to start and move forward.

    Help, please

    Thank you.

    Hi Lana89,

    Since this is a simple data acquisition task, you can go through the sample data acqusiition and move forward.

    Kind regards

    SrikrishnaNF

  • The moving average of the data file

    Hello

    I'm doing a Subvi, which has jumps in the data points.

    The algorithm:

    -build an array of samples (of size round(FPS/2))

    -Take the average

    -subtract the data of the table of average points: = absolute difference (medium-sized data point).

    -compare the difference threshold: If difference > = point, then add 1 to the counter.

    The Subvi (jump detect) is intended to be used in a larger vi, and I need to make sure that it works. But it doesn't now.

    When the vi works and everything is calculated, it does not count the jumps that are visible on the ground.

    Any ideas what I am doing worng?

    Thank you

    The exsist problem in your loop in your Subvi. At this stage you are iterating FPS/2 size of the array, and you only show the last value of all of your calculations. Unless the last value is reported as a jump, it will not be saved. You can easily fix this by putting registers at offset on your loop for, the only question is do something with your Boolean indicator. You can index the Boolean values, and then make a chart or works, but this part is up to you.

  • How .vi DAQmx Read (analog 2D NChan DBL NSamp) to acquire continuous data?

    I try to get the .vi DAQmx Read (analog 2D NChan DBL NSamp) to acquire data continuously.  The 'help' indicates I need to wire the number of samples per channel-1, but it doesn't seem to work for my application.  If I have the wiring to any number greater than 0, the data collection works, but is not continuous.  I enclose the code (Sept15_MainPanel_WorkingBaselines_ApplyBaselines and Calibration.vi) and a Subvi (Collect_Baselines.vi) if someone wants to take a look.

    Here's what I'm trying to do:

    I use a unit NI USB-6009 to collect analog voltages of load cells 2 (channel 0 and channel 1) and 2 displacement transducers (channel 2 and 3).  The main panel of the VI contains a listbox with 4 options - 'Check EMG channel', "Collect base lines," "Collect Data" and "end of program".  'Collect base lines' 'End of program' work and I'm working on writing code to "Collect data".

    For the option "Basic collection", 2500 samples are read from 4 channels described above and 2500 samples are averaged.  This works.

    The option "Data collection" - I would like to that data from 4 channels to acquire permanently.  Finally, for the option of data collection, data acquisition stops when channel 0 detects the force of 200 N - so I will not always have a finite number of samples read.  The time it takes to reach the value of this force will be different for each test.

    -How can I get continuous samples for my 4 channel?  Is .vi DAQmx Read (analog 2D NChan DBL NSamp) function badly and if yes, what should I use?

    Thanks in advance for any ideas or advice.

    Esther

    First, in case 1, you need not the structure of flat sequence.  The son of the error and data properly will dictate the flow of execution.  Then, in State 2, you must initialize the shift register, unless you want to keep the data is accumulated each time that you run the vi.  The reason why you don't see all the data here is because you have - 1 wired for the number of samples per input channel.  You must connect a number here, even if you are taking continuous samples.  The service needs to know how much sample to gather at one time.  If you put-1 here, the number of samples per channel must be set up in the synchronization function DAQmx (sample clock).  If you specify a number here, then you put-1 in playback function.  The DAQ hardware will read continuously, you must retrieve the data from time to time, so you must specify the number of samples.  By reading inside a loop, it will continue to read until the stop function is encountered.  I guess that the Clear function acts as a stop.  But you must always indicate playback vi how many samples to read and return on each iteration of the loop.

    The documentation is a little misleading.  He warns that a - 1 will cause a continuous reading.  But the pads are so big, he can not read continuously forever without losing data.  If you specify a finite number, playback in a loop, and he will read this number and return the data (empty the internal buffer) at each iteration of the loop.  Continuous means that you just call the start function once.  He will read at each iteration of the loop until the stop function (or clear) is called.

    Here is the difference between the setting of the Timing DAQmx function for continuous or finished reading: finite samples requires a tenure, he reads the finite number of samples, and it's done.  It requires another start to read more data.  Continues to read requires only a start.  It still reads a finite number of samples, but when this is done, you can retrieve the data by calling the read function until he could continue.  After the reading, you don't have to call for new start.  Look at it this way.  Start is what starts the collection of data, not the read function.  Just read empty buffers in your data feed.  The data acquisition continues in continuous mode, but you must call read again to get the data on the pads.  If you specify basically buffer size when you set the number of samples per channel.

  • Moving average and keep indexing

    Hi all

    Many members share so nice VI for the execution of moving average. But if the measure deliver (NaN) it will be a problem in this case, specifically. When

    the processing of the data is in real time mode. So please can help me to handle this.

    Here I try to do, its works well, but when I insert it to the acquisition in time real and treatment he puts a lot of problems.

    Thank you.

    some methods more...

    What are you going to measure? Just curious

Maybe you are looking for

  • How to detect this problem

    Hello I know that the program is over, but how do I know if I had this problem? Today, I have been unable to connect normally to my mac (I used secure starting to connect). I keep getting these messages: 30/05/16 3:22:45.770 PM WindowServer [506]: co

  • After update 10.11.2 to 10.11.3 Programms folder is emptymand very slow system

    Hello I'm upgrading to OS X 10.11.2 10.11.3 yesterday. After the update my record programs was empty-no programs were there. The saw that all my files as downloads were empty, too. I opened the time Mashine to try a restore. It was awful slow. I went

  • Re: Play Peek-a-Boo with USB - driver problem

    Hello So far, I had no problem with my laptop and windows 7 (32 bit), but there was a problem from the start. my system was not able to detect all the drivers, for the moment, I got 2 unidentified "base system devices. At least one of them has got to

  • RACIALLY DISPARAGING DICTIONARY ENTRIES

    Why do the IPhone dictionary for "ignorant" entries and the expletive "*" mentions and Hat are inaccurate and racially derogatory to African-Americans?

  • Partition Recovery