# LabVIEW

cancel
Showing results for
Did you mean:

## Algorithim on AC waveform

Hello,

I need some math help.

I am measuring an AC waveform (see atached screenshot).  I need to detect "Events" i.e. a sinusoidal waveform with a different amplitude.  What math would I run to determine this.

Any help would be appreciated.

Thanks

Dan Shangraw, P.E.

Message 1 of 12
(1,714 Views)

## Re: Algorithim on AC waveform

I once had to do something sort of like this for a coding challenge.  I ended up using the RMS Point-To-Point function to perform a moving RMS measurement.  From the RMS measurement, you can detect when the change in amplitude happens.

Correction:  It was the AC & DC Estimator PtByPt VI

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 12
(1,705 Views)

## Re: Algorithim on AC waveform

I was playing around with the RMS measurement point to point.  I was having trouble developing the algorithim for the amplitude change.  Any hints in that direction?

Thanks so much for your help

Dan Shangraw, P.E.

Message 3 of 12
(1,702 Views)

## Re: Algorithm on AC waveform

How about peak detection?  When you detect the peak has changed a substantial amount, you know the amplitude as stepped up.

Message 4 of 12
(1,700 Views)

## Re: Algorithm on AC waveform

Here is what I get when I do an RMS Point to Point.  I tried using Peak detection and no go.

Dan Shangraw, P.E.

Message 5 of 12
(1,695 Views)

## Re: Algorithm on AC waveform

Attach your VI's with the data saved as either a control with default data or a constant.

What do you mean that "peak detection no go".  What have you tried?

RMS is doing averaging.  The question then is how much of a window are you averaging?  You are seeing the effects of the change in amplitude in your graph where the RMS value is beginning to increase.  Since you are averaging over a larger window, the effect is taking some time to come into play.  If you look for the point where the slope of this graph is beginning to increase, that is where you peaks have changed.

Message 6 of 12
(1,675 Views)

## Re: Algorithm on AC waveform

Hello,

Here are the VI's I am using.  The main one is test Count Events.

Any help would be appreciated

Dan Shangraw, P.E.

Message 7 of 12
(1,665 Views)

## Re: Algorithm on AC waveform

Try this. You can see in your output waveform that you have two stair steps. An easy way to detect those stair steps is with a derivative. As your slope changes from 0, you will notice a change in your derivative. I ran the Pt by Pt Derivative function on the output of the Pt by Pt RMS and was able to see two distinct spikes where your RMS is changing. You can run a threshold (just a simple >= function) or a Peak Detector to detect a change in RMS of that magnitiude. You can then run some other code based on whether this value is true or not.

This isn't a perfect solution, but it should get your closer to your goal. You will probably need to run some additional filtering to get some really clean peaks. The Peak Detector can handle some of that for you.

Message 8 of 12
(1,595 Views)

## Re: Algorithm on AC waveform

Hello,

I am playing around with a high pass filter.  I am getting some interesting results.  I will post if this solves my problem.

Thanks

Dan Shangraw, P.E.

Message 9 of 12
(1,591 Views)

## Re: Algorithm on AC waveform

How much noise does your real signal have?

How many cycles (minimum) will occur at each level? How much does the frequency vary?

Lynn

Message 10 of 12
(1,571 Views)