Register to reply

RMS of Fundamental Component

by jegues
Tags: component, fundamental
Share this thread:
jegues
#1
Jul6-14, 03:25 PM
jegues's Avatar
P: 1,089
Every 50μs I have access to one sample of an unknown peroidic input signal and I am looking to calculate the RMS of the fundamental component. Is there any convenient ways one can think of doing this?
Phys.Org News Partner Engineering news on Phys.org
Printing the metals of the future
New gadget helps the vision-impaired to read graphs
3D printing helps designers build a better brick
NascentOxygen
#2
Jul6-14, 07:47 PM
HW Helper
Thanks
P: 5,152
Quote Quote by jegues View Post
Every 50μs I have access to one sample of an unknown peroidic input signal and I am looking to calculate the RMS of the fundamental component. Is there any convenient ways one can think of doing this?
The implication being that 50μs sampling is sufficient to adequately represent the waveform for this purpose?

Are you wanting to perform the task in software or as a hardware implementation?
jegues
#3
Jul6-14, 08:43 PM
jegues's Avatar
P: 1,089
Quote Quote by NascentOxygen View Post
The implication being that 50μs sampling is sufficient to adequately represent the waveform for this purpose?
Yes.

Quote Quote by NascentOxygen View Post
Are you wanting to perform the task in software or as a hardware implementation?
In software. One limitation is that the code used to do so must be executed to completion every 50μs timestep.

Any ideas?

NascentOxygen
#4
Jul6-14, 11:05 PM
HW Helper
Thanks
P: 5,152
RMS of Fundamental Component

Quote Quote by jegues View Post
Yes.


In software. One limitation is that the code used to do so must be executed to completion every 50μs timestep.

Any ideas?
But if the waveform is periodic, there will be only one answer, one RMS value. Once that is established, to acceptable tolerance, what is there to update every 50μs?

You have no prior knowledge whether the cyclic period extends for some days, hours, or just milliseconds?? Your software will first have to establish this, undoubtedly.

What is the source of such a signal?
jegues
#5
Jul7-14, 08:06 AM
jegues's Avatar
P: 1,089
Quote Quote by NascentOxygen View Post
But if the waveform is periodic, there will be only one answer, one RMS value. Once that is established, to acceptable tolerance, what is there to update every 50μs?
We are preforming the calculation every 50μs so the results appear in "real-time". This means that if the periodic waveform suddenly changes the RMS of the fundamental will change with it.

Quote Quote by NascentOxygen View Post
You have no prior knowledge whether the cyclic period extends for some days, hours, or just milliseconds?? Your software will first have to establish this, undoubtedly.
Does the problem become more manageable if I have the user provide the frequency of their periodic signal?

Quote Quote by NascentOxygen View Post
What is the source of such a signal?
The input for example, could be either a voltage or current in a simulated circuit, or perhaps even a control signal in a control system.

Look forward to your thoughts.
anorlunda
#6
Jul7-14, 08:52 AM
P: 171
But the RMS value is only defined for an integer number of whole cycles. If the period of the waveform you're measuring is longer than 50μs, then your goals are contradictory.

My suggestion to redefine "real time" to mean something longer than one complete cycle of the waveform, and calculate RMS at that interval.

You could define a rolling mean with a buffer big enough to hold one cycle's worth of samples. With each new sample,drop the oldest and add the newest. But if you did that, the definition of what your measurement means would be squishy and not worth the trouble. Your real problem is a bogus definition of "real time"

Oh yes, you said fundamental component too. To do that you need to use a low pass filter on the samples before calculating the RMS. The filter will add some phase shift (time delay) that could be large compared to 50μs, further clouding what a "real time" RMS at 50μs intervals would mean.
NascentOxygen
#7
Jul7-14, 09:56 AM
HW Helper
Thanks
P: 5,152
Quote Quote by jegues View Post
Does the problem become more manageable if I have the user provide the frequency of their periodic signal?
If you know the frequency of the fundamental you'll know where to set your z domain filter to separate the fundamental from its harmonics. If you know the period, you know how many samples are needed to compute over, if using the FFT.

It's probably going to become relevant to your considerations: approximately what per cent of the total power is contained in the fundamental?
Averagesupernova
#8
Jul7-14, 09:57 AM
P: 2,499
There is a bit of confusion here. RMS means the Root of the Mean of the Square(s). Since the word "Mean" is included it implies storing a number of samples to later be averaged. With a sine wave this is only necessary for one cycle. But it is implied in post #5 that the signal can suddenly change. So this means storing for longer. How is 'real time' to be defined? The OP hasn't said just what type of results are expected. Generally one has expectations of what the results will be before attempting to measure. Technically, "real-time" would not be averaged in any way. An analog scope displays voltage in real-time and the result is a graph.
sophiecentaur
#9
Jul7-14, 11:02 AM
Sci Advisor
PF Gold
sophiecentaur's Avatar
P: 11,925
If you want to do a good 'running' frequency analysis of your signal then you will need a long sequence of samples, suitably windowed or you could end up with some embarrassing artefacts - I could imagine two possible 'fundamentals' could emerge, for instance. How many sample intervals can you afford to wait before the analysis and what sort of frequency range are you expecting for the input waveform?
jegues
#10
Jul7-14, 12:28 PM
jegues's Avatar
P: 1,089
Quote Quote by Averagesupernova View Post
How is 'real time' to be defined? The OP hasn't said just what type of results are expected. Generally one has expectations of what the results will be before attempting to measure.
Assume we have an unknown peroidic input signal that we can obtain samples of every 50μs timestep. (We have the ability to access the input every 50μs timestep, that doesn't mean we HAVE too)

Assume that we know beforehand that the fundamental of this input signal equivalent to,

[tex]M_{1}sin(1t)[/tex]

Then we expect the output (i.e. the RMS of the fundamental component) to be,
[tex]\frac{M_{1}}{\sqrt{2}}[/tex]

Now if the input signal were to suddenly change such that the fundamental of this altered input signal is equivalent to,


[tex]M_{2}sin(1t)[/tex]


Then we expect the output (i.e. the RMS of the fundamental component) to be,
[tex]\frac{M_{2}}{\sqrt{2}}[/tex]

and so on for any arbitrary periodic input.

I would like to have my output transition from say,

[tex]\frac{M_{1}}{2}[/tex]

to,


[tex]\frac{M_{2}}{2}[/tex]

as quickly as possible.

Is it more clear what I am trying to achieve?
anorlunda
#11
Jul7-14, 12:56 PM
P: 171
A sudden jump from M1 to M2 makes the signal non-sinusoidal which conflicts with your assumptions. Root-mean-square only has meaning for whole cycles, it has no instantaneous meaning.

If you report a change in RMS because just one sample deviated, then you may falsely report a momentary spike as representing a whole cycle's change in RMS value. In other words, reporting RMS measurements the way you propose will amplify noise.

If you filter the data to only fundamental frequency, then the momentary spike will be eliminated from the data and there will be no change to report after the first sample.

If the change is not a momentary spike, but rather a sustained change, then you must gather many samples from one or several whole cycles before jumping to the conclusion that the change should be reported. That means delaying the measurement until you are sure it's valid.

The problem is not with algorithm, it is with your requirements.
jegues
#12
Jul7-14, 01:07 PM
jegues's Avatar
P: 1,089
Quote Quote by anorlunda View Post
A sudden jump from M1 to M2 makes the signal non-sinusoidal which conflicts with your assumptions. Root-mean-square only has meaning for whole cycles, it has no instantaneous meaning.
I specifically used the wording,


as quickly as possible.
above because this could mean a cycle later.
sophiecentaur
#13
Jul7-14, 01:22 PM
Sci Advisor
PF Gold
sophiecentaur's Avatar
P: 11,925
Quote Quote by jegues View Post
I specifically used the wording,




above because this could mean a cycle later.
You will find it difficult to determine the period with just one cycle - particularly if the frequency is changing. How would you analyse the signal and identify the peak of the fundamental of a squarish wave? There may be a fundamental flaw in your basic requirement if I understand your description properly. Is the waveform 'almost sinusoidal' or is it very complex? If it complex, you will need to look at it over more than one cycle to identify the period.

I think the reaction against your idea of "real time" requirement is a bit nit picking. It seems reasonable enough to me if you can accept some delay. Every measurement takes some time - there is always some built-in delay. I suspect you really mean a continuous series of measurements, rather than 'batch processing. The delay that is involved will depend upon several factors - including the ones already mentioned, like number of cycles involved in the processing and the nature of the waveform.
NascentOxygen
#14
Jul7-14, 11:47 PM
HW Helper
Thanks
P: 5,152
If you know ahead of time the frequency of the fundamental and it's fixed for each source, the simplest solution would be to pass the signal through an analog LPF specific to that source and connect the filter's (sine-wave) output directly to a voltmeter. Maybe use capacitive coupling to the filter to remove any DC component.

I'm curious to learn why you wish to disregard the power in the harmonic content? Also, is there likely to be appreciable noise on the signal? Should this be allowed for?
sophiecentaur
#15
Jul8-14, 03:51 AM
Sci Advisor
PF Gold
sophiecentaur's Avatar
P: 11,925
You're certainly right that noise could be a fresh can of worms and increase the processing time significantly.
anorlunda
#16
Jul8-14, 06:41 AM
P: 171
Here is the original question.

Quote Quote by jegues View Post
Every 50μs I have access to one sample of an unknown peroidic input signal and I am looking to calculate the RMS of the fundamental component. Is there any convenient ways one can think of doing this?
Your question makes it sound like you want to do a new RMS calculation every 50μs. Later in the thread, you said something very different.

Why don't you start again from scratch? Tell in more detail what you do know about the frequency range and noise in the signal and what you hope to accomplish in terms of frequency of RMS calculations and tolerance for noise. If it is 100% unknown, then there is no answer. Then try to state your question more clearly. What do you expect from this forum short of the code?
jegues
#17
Jul8-14, 03:45 PM
jegues's Avatar
P: 1,089
Quote Quote by anorlunda View Post
Why don't you start again from scratch? Tell in more detail what you do know about the frequency range and noise in the signal
I am trying to make the program work for the most general set of signals possible, so I'm intentionally not making any assumptions about what is known about the frequency range or noise in the input signal. The one limitation that is known is that the maximum rate at which I can sample the input signal is every 50μs.

Does assuming the fundamental frequency is within the range 0Hz < f < 1000Hz simplify the problem at all?

Quote Quote by anorlunda View Post
and what you hope to accomplish in terms of frequency of RMS calculations and tolerance for noise.
I want to calculate the RMS of only the fundamental component after every cycle of the input signal.
sophiecentaur
#18
Jul8-14, 04:14 PM
Sci Advisor
PF Gold
sophiecentaur's Avatar
P: 11,925
Quote Quote by jegues View Post
I am trying to make the program work for the most general set of signals possible, so I'm intentionally not making any assumptions about what is known about the frequency range or noise in the input signal. The one limitation that is known is that the maximum rate at which I can sample the input signal is every 50μs.

Does assuming the fundamental frequency is within the range 0Hz < f < 1000Hz simplify the problem at all?



I want to calculate the RMS of only the fundamental component after every cycle of the input signal.
And what do you suppose that any answer you might get would actually correspond to? When you use the term "fundamental" you are implying (to be strict) the period of a sine wave of infinite length. Truncating an infinite train of sine waves is a form of Modulation. This will introduce uncertainty into the 'frequency' of any fundamental sin wave (spreading the spectrum from a single line into a band of frequencies. If you have a periodic looking signal for which the time between maxima is uncertain, all you could tell would be the sum of the squares of samples between the peaks. Not really a useful piece of information and it would not represent a true RMS value of any particular continuous wave.

I have a feeling that you need to get a bit more familiar with the basics of this stuff before you launch out on this exercise. Any routine you write could well yield some numerical values but they would have no meaning - or at least the numbers would need to be interpreted carefully because they cannot be a true 'RMS of a fundamental'.

You say you want your routine to work on a perfectly 'general' set of signals. What sort of interpretation would you expect if your particular signal consisted of the sum of two sine waves, of equal amplitude and different frequencies? What if your signal was part of a low pass filtered long pseudorandom sequence? What would be the fundamental frequency of that? (Answer = 1/(total repeat length of the sequence)

It just ain't that simple, you see. (Unless you are prepared to be much more specific about the actual nature of your signal).


Register to reply

Related Discussions
Finding the angle given positive x component and negative y component Introductory Physics Homework 5
Splitting a vector into a rowspace component and a nullspace component Calculus & Beyond Homework 2
Proving covariant component is physical component times scaling factor Calculus & Beyond Homework 1
Any notation for component-by-component vector multiplication? General Math 12
Splitting wave equation into x-component and y-component Classical Physics 16