Estimating phase shift

I've built an energy monitor based on the code here, but using a PIC instead of an Arduino. I'm sending the measurements to my PC using an RF solutions SmartAlpha wireless module, and the readings get saved in a SQL Server database on the PC. The SmartAlpha has an RS-232 interface, which makes it fairly easy  to use both on the PIC and the PC. The measurement is interrupt driven with samples occurring at exactly 180 microseconds.

My question is about the value of PHASECAL I'm using to allow for any phase shift between voltage and current measurements. With PHASECAL=0, I'm getting a power factor of 99.9% measuring a 3KW fan heater, and 99.8% at 1.5KW.

I didn't expect a similar phase shift to that obtained on the Arduino design, because the PIC ADC is sampling voltage and current simultaneously. All the same, I was expecting some phase differences between the voltage and current sensors. I'm using the SCT-013 current sensor and the Ideal Power voltage transformer from this web site.

But it appears  that I don't need any phase correction, at least at these power levels.

Am I correct in assuming that a fan heater is purely resistive?

dBC's picture

Re: Estimating phase shift

Am I correct in assuming that a fan heater is purely resistive?

The fan part is probably a bit inductive, but compared to that massive heating element it's probably very small.

Robert Wall's picture

Re: Estimating phase shift

The time difference between readings is only part of the problem. Each sensor also has its own phase shift - see the reports - and if you're lucky they will be approximately equal and then you will indeed need no correction. The bad news is phase shift isn't constant.

arnoldh's picture

Re: Estimating phase shift

if you're lucky they will be approximately equal

Well, yes, I was expecting more relative error introduced by the two sensors, but it does depend on the sensors, and it would appear I got quite lucky:-)

The first measurement was on a single fan heater at 12A. I've now measured the supply current  from the electricity company's meter, progressively switching on more appliances up to 50A.

With only a few appliance on standby, the power factor was 97% to 98% at 0.7A. But the fridge was also on, presumably inductive. Then I put the freezer on and the power factor dropped quite a bit more to 80% at 1.6A. The only conclusion I can draw here is that there were a lot of inductive devices operating, and I couldn't draw any reliable conclusion about introduced phase errors.

As I switched heaters and lights on the power factor improved until at 50A it was 99.6%. Maybe if I'd switched the freezer and fridge off there would have been a further marginal improvement.

So I'm fairly happy with PHASECAL=0 with the sensors I'm using throughout the power range. It will probably be accurate enough for my purposes, and I wouldn't know how to measure phase error more accurately anyway.

Thanks for both your responses.

chaveiro's picture

Re: Estimating phase shift

I dont understad your units %?

 

"Power factor is by definition a dimensionless number between -1 and 1. When power factor is equal to 0, the energy flow is entirely reactive, and stored energy in the load returns to the source on each cycle.

When the power factor is 1, all the energy supplied by the source is consumed by the load.

Power factors are usually stated as "leading" or "lagging" to show the sign of the phase angle.

Capacitive loads are leading (current leads voltage), and inductive loads are lagging (current lags voltage)."

 

Robert Wall's picture

Re: Estimating phase shift

A percentage is a dimensionless number, too. The way power factor is calculated in the standard library, it is impossible to know whether it is leading or lagging.

arnoldh's picture

Re: Estimating phase shift

 I dont understand your units %?

I was using the power factor I obtained for a resistive load as a measure of how well the phase calibration was working. So writing 99.6% instead 0.996 seemed more descriptive to me. But probably I should have stayed with 0.996.

 

chaveiro's picture

Re: Estimating phase shift

No problem, your descriptions are much correct. It's normal a good CT sensor to not induce much measurable lagging if working with the correct burden resistor.

For curiosity, if you can export a few cycles of raw data you may draw a graph of voltage and current and  observe what's going on with the phase shifting in different conditions.

 

Two questions, what PIC are you using and are ADC channels read in paralel at once?

 

There is another 'easy' way to measure power factor.

If implemented with timers and zerocross hardware, it's very precise.
In software only, may not be very precise with few samples per cycle but will show lagging and leading conditions as well.

See this pdf :

http://www.pserc.wisc.edu/documents/general_information/presentations/pr...

 

 

Robert Wall's picture

Re: Estimating phase shift

Beware, p.f. = cosφ is only true for perfect sine waves. It has no meaning as soon as any harmonics are present. On the other hand, p.f. = real power ÷ apparent power is always correct because it is the definition.

chaveiro's picture

Re: Estimating phase shift

p.f. = real power ÷ apparent power is always correct because it is the definition.

 

Robert, i'm afraid that definition is not  correct for non-sinusoidal waves either. It's real difficult to get exact PF in this waves.

Some literature: http://cdn.intechopen.com/pdfs/20700/InTech-Power_quality_measurement_un...

 

The analog power meter chips uses other techniques to measure kVar and power factor, uses cached cycle measuremets shifted 90º. Must be interesting to read some old pdf of their power meter product line.

arnoldh's picture

Re: Estimating phase shift

Two questions, what PIC are you using and does ADC channel are read in paralel at once?

I'm using a 16 bit PIC24EP256MC202. There are 16 ADC pins. They can all be sampled sequentially, or you can have simultaneous sampling of pairs of pins , or simultaneous sampling of 4 pins. I'm sampling 4 VI pairs,  generating an interrupt and processing these while the next 4 pairs are being sampled.

I did plot voltage and current a couple of weeks ago from the digitally filtered ADC readings, not a scope. I wasn't sure what to make of it, but I was relieved to find the OpenEnergyMonitor software processed it OK.

Thanks for the link

 

dBC's picture

Re: Estimating phase shift

There's a fairly readable summary here of how  various energy measuring ICs approach this:

http://www.digikey.com/us/en/techzone/energy-harvesting/resources/articl...

Robert Wall's picture

Re: Estimating phase shift

p.f. = real power ÷ apparent power is always correct because it is the definition.

"Robert, i'm afraid that definition is not  correct for non-sinusoidal waves either. It's real difficult to get exact PF in this waves."

According to Prof. Morton B.Sc., C.Eng., F.I.E.E., M.I.E.R.E  it is. See Advanced Electrical Engineering, A.H.Morton, Pitman Paperbacks (ISBN 273 40172 6), page 110,  equation 4.11

Even Wikipedia has got it right.

I cannot see any conflict with that definition and any in the paper you cite, the only reference that is applicable is equation 65 where is defined as active power and S is the apparent power; which agrees exactly with my definition.

chaveiro's picture

Re: Estimating phase shift

Robert, that book dates 1968? Science got more precise since then.

The link i posted explains what happens in today noisy appliances:
"Harmonic currents are not accompanied by harmonic voltage, so average (real) power in harmonics is almost zero.
pf = average power / apparent power (decreases)"

Also there is a screenshot of a professional measurement equipment that proves this on page 22, .

I do agree that for what we use pf value, the formula is precise more then enough.

 

Arnoldh, you got a decent processor, with that capabilities it's the most precise custom power meter implementation i've seen recently.

If you are in to opensource it, try to maximize samples per second and prepare the code for 3 phases, do all calculations, P,S,V,I,VAR,PF,Hz and it may be next sucessor of the arduino design that main problem is precision of adc and speed.

The implementation dBc pointed out on his link to calculate VAR just requires a little ram to cache past samples.

There are other pds (from analog) that explains the same principle more or less the same way. I will post links when i find it.

dBC's picture

Re: Estimating phase shift

arnoldh's picture

Re: Estimating phase shift

try to maximize samples per second

I think I could probably get more samples and still have time to process them. I use the integer arithmetic version of calcVI. I'm using a processor instruction frequency of 40Mhz and taking about 100 sample pairs per cycle for a 50Hz cycle. When I measured it, here was certainly processing time to spare, and I could probably process more sample pairs per cycle. I'm actually quite happy with the results I'm getting for my purposes, but I will check some time if I can increase the number of samples.

prepare the code for 3 phases

I've not thought about how to do this with this PIC, and have no means of testing it. However this processor has sampling from alternate inputs, so it's probably not too difficult.

it may be next sucessor of the arduino design that main problem is precision of adc and speed.
I know nothing about Arduinos apart from a brief browse of the literature. But my impression is that they provide more for the user, and you have to do much more for yourself if you're using a PIC. So I'm not sure how suitable they would be as part of the mainstream design on this site. However they do have a lot of flexibility and are cheap. They're probably worth a look if you're trying to improve performance.

If you are in to opensource it
If there was sufficient interest I could consider posting the code as is, but as I said I can't test 3 phases.

Robert Wall's picture

Re: Estimating phase shift

Sorry, arnoldh, if Sr. Chaveiro is badly off-topic here. I'd started to respond but frankly it isn't worth the trouble.

chaveiro's picture

Re: Estimating phase shift

arnoldh: If it serves your pourpuse it's fine then. If ever release it as opensource, the target may not be in this forum but may be usefull for someone else in the net. github.com is good for it.

The cycle wave you post is not round in the top, was it under high load?
I've observed similar distortion when i was testing and clipped adc for some points at max adc value.

 

dBC, yes that's the pdf. Thks.

 

 

Rob: Huh?

dBC's picture

Re: Estimating phase shift

The link i posted explains what happens in today noisy appliances:
"Harmonic currents are not accompanied by harmonic voltage, so average (real) power in harmonics is almost zero.
pf = average power / apparent power (decreases)"

I don't think that's changing the 1968 definition of PF is it?  If anything, it seems to be re-stating it and then using it to explain why PF drops with harmonic currents.   Harmonic currents have little impact on the numerator, but increase the denominator, hence they cause PF to drop.

john.b's picture

Re: Estimating phase shift

I think in the interests of not misleading others Chaveiro should edit his statements about power factor definition as it is clearly wrong.  Robert has correctly stated that Power Factor = Real Power / Apparent Power and cited references to that fact. 

Just because that reference comes from 1968, doesn't in any way degrade its validity.  There are probably many earlier references that could be given, all of which will confirm as do the current IEEE standard definitions (Ref) that Power Factor = Real Power / Apparent Power.

Ref

1459-2010 - IEEE Standard Definitions for the Measurement of Electric Power Quantities Under Sinusoidal, Nonsinusoidal, Balanced, or Unbalanced Conditions

or http://eprints.uad.ac.id/153/1/IEEE-Trial-Use-Standard.pdf for a superseded version

chaveiro's picture

Re: Estimating phase shift

The thread is about non sinusoidal waves.
The definition is correct, but as i pointed out will give wrong figures for irregular nos-sinusoidal waves with high THD content. 
Back in 1968 they wore less minded of this.
Many money is spend on R&D with DSPs and fast microcontroller to get the right calculations.

Thus IEEE Std 1459 states it in notes:

dBC's picture

Re: Estimating phase shift

I think that's just saying it's hard to measure real power under those conditions (as we've all observed).

The formula for power factor remains Real Power / Apparent Power regardless of the shape of the signals.  Clearly the answer you get is only as good as the values you feed in.   If your equipment is not good at measuring Real Power under those circumstances, then yes, your PF will also be out.... the old adage, garbage in -> garbage out.

john.b's picture

Re: Estimating phase shift

Chaveiro,

You are confusing definitions with measuring techniques.

The definition for power factor is clear, its man made and the objective is to relate Real Power with Apparent Power via a ratio.  How PF is calculated from measured data is something else. 

By way of an example: A meter is defined from the wave length of light in a vacuum.  However if you choose to measure length using a tape measure, rule or ultrasonic device that doesn't change the definition does it?

Perhaps it is your use of English (no criticism intended) that is leading to confusion.  But if you are going to try to correct experienced experts like Robert, you need to be careful and precise in your statements.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.