Power factor measurement

I am working on a project which includes grid connected PV panels. I want to know if power generated from it is more than what load is consuming or less than it. I found that the example of energy monitor using voltage and current measurement in emonLib library useful as it calculates power factor. But I want to know does this example tells us if power factor is leading or lagging?

It doesn’t, and it cannot.

It’s a safe assumption that most of the time, the power factor is lagging, but there’s no guarantee of that. In order to be able to determine whether the power factor is leading or lagging, you need to delay the voltage wave by 90° and multiply that delayed voltage by current in order to get imaginary power. The sign of that is your answer.

At the present time, there’s no sketch here that does that.

If you measure the nett grid power, the sign of real power gives you that information. Power factor does not directly help you there.

Hi Robert
Isn’t powerfactor built into the library? agreed it isn’t very arcuate at low currents


Read the question again! Then look at the maths in emonLib. Real power is signed according to the direction of power flow, apparent power doesn’t have a sign because it comes via two quantities both resulting from a rectification process. So there’s no information in there to give @Amba14 what he asked for.

Thanks guys for your help.
But this is not helping me. I want to work with grid connected solar PV system.
Can anyone suggest a way to find out if I am exporting excess power generated from PV panels to the grid?

I read that the first time. You should read my reply to you again, carefully.
(I have edited it to make it clear that the first part of my answer is about power factor, but power factor leading or lagging has no relevance to the direction of power flow.)