# Real Power greater than Apparent with resistive load

Hi guys,
ive got a weird problem with my setup, im using the emonlib with my arduino mega, a mascot 9V AC-AC adapter and an SCT-000-013 CT.
I have hooked up an electric kettle and I am measuirng the current, voltage, apparent, real power and power factor.
However, Ive noticed that the `emon1.serialprint();` shows a lower apparent power than the real power.
giving a power factor of 1.01
Shown below is a print from the terminal. it should read real power, apparent power, vrms, irms and PF.
Shouldnt the real power be lower than or equal to the apparent, i know if i have a load with a power factor of unity they should be equal. Any ideas guys? Or is it the case that the real power and apprent power are mixed up?
`800.30 794.60 235.03 3.38 1.01`
Appreciate any help.
Thanks

The numbers aren’t mixed up, and real power should never be greater than apparent power. It’s a small error/oversight in the algorithm which means that a slightly different voltage is used for the two power calculations.

Hi Robert,
Thanks for the response, is there any way I can correct this? Or is this just the way the emonlib works? Won’t that make us power factor incorrect?
Thanks
Regards

The easy way is to wait for the tests on the new “continuous” emonLibCM to conclude and then switch to that. That does essentially the same maths but arranged in a different way, and so it’s easy to correct the wrong voltage. You can see here how the amplitude gets changed.

As a temporary ‘fix’, you could introduce a correction by multiplying the real power by 0.99 or thereabouts before the power factor is calculated.

Hi Robert,
Once again thank you for your help.
Oh i see the issue with that alright.
Thanks for the tip about the power factor.
With regards to VA, if i could measure the VA using a power analyser i wonder could I find an offset value to minus away from the reported value from emonlib? Sort of like a VA calibration, id be interested in consistent VA readings that are “good enough” but essentially less that the real power. I do calculate the VAR from the readings by getting the square root of (kva) squared - (kw) squared.
But obviously the VA is higher so the equation doesn’t work out.
Apologies if the response is long and convoluted.
Kind regards

No, the VA reading - if you’ve calibrated current and voltage separately - is accurate, because that uses the voltage samples raw, without them being subject to the phase shifting mechanism. The problem is the extrapolated and (wrong) voltage sample that’s multiplied by the current sample to give you (wrong) average power.

No, equal or greater than. You’ve got VA & power mixed up today.

If you really want vars accurately, then you need to delay the voltage sample by 90° and use that instead to get the value directly - you copy exactly the calculations for real power, but use a set of voltage samples that’s in quadrature with the mains voltage.
If you want a sketch to do (just) that, it’s called the 3-phase PLL, but the phase shift in that is 120° not the 90° you need. It would no doubt be relatively easy to combine the two, and calculate power, VA and vars directly, but I think you’re the first person (not counting @dBC who I believe uses a dedicated energy monitoring i.c. as his front end device) to express a desire to have vars.

Ive calibrated the voltage and current seperately using a 2kW load with a PF of 1 (electric kettle). I was thinking that having a vars function would be nice.
the 3-phase PLL you meniton is that MartinR’s phasecal sketch? Ive tried downloading and installing that library and then loadign the example sketch but it wont compile for my Arduino mega.
I am currently at a loss as to how to modify the 3 phase at 120 to 90.
Once again I thank you for your help and patience.
Thank you
Also, i was going to ask whether i can take the line frequency as a function directly from the emonlib, I know the frequency here in Ireland as with you in the UK should be 50Hz (+/-1% IIRC).
I had a simple 4n25 optoisolator circuit that worked with the mains although potenitally lethal so I tried it with my 9v AC-AC adapter and it doesnt play nice, which is why i asked if the emonlib could do it. I know it measures half cycles but i am not sure how to extract the values.
Thank you

The 3-phase PLL sketch is a development of MartinR’s, but I don’t think it’s been published yet. If you wanted to write your own, you’d start with MartinR’s PLL, and add an array to store a number of voltage samples (like the non-PLL 3-phase sketch does). You choose the number of sample sets per cycle as a multiple of 4, store the voltage samples as they come in, then pick a voltage sample that has been stored for ¼ cycle (= 90°) and use the present sample for power and the delayed one for vars. I can imagine anybody not familiar with the code would have big problems doing that. But having done so, the PLL will also give you line frequency. (And if you plot it and compare against the published values, you can calibrate your crystal!)
You can’t (easily) get frequency from emonLib, although Chaveiro’s emonLibPro is said to measure frequency. I’ve never looked at it, so I can’t confirm anything.