Import vs Export

I’m just puzzled as to how we can determine whether power is being imported or exported when we use calcVI in the emon.lib.
I understand we’ll need a voltage to compare with but using calcVI will always come up with a positive answer. So with this in mind - the direction of the CT used in examples is meaningless - am I correct?
I can see that we need to determine the direction of current before we can decide whether we’re importing or exporting.
Thanks in advance

Sorry, but no, it won’t.

And no again to that, I’m afraid. Take a look at Resources > Building Blocks > An Introduction to AC Power, where the relationship between voltage and current is explained.

Hi Robert and thanks for your response
The maths in calculating Irms involves the squaring of the values involved and squaring negative numbers always produce a positive result. So calcVI will always result in a positive number.
Yep I agree with the theory in the building blocks but in practice one has to determine firstly that the current being measured is of opposite polarity to the voltage for the determination of export or import. In my opinion the simple use of calcVI won’t do this. I wonder if you might help me by writing a sketch that would convince me.


CalcVI does not actually return a value, it calculates several class members. So which did you have in mind, and can you explain in detail how you arrived at that conclusion? I think you have not read and understood the maths accurately. I suggest you need to go back and look again at the source code of emonLib.

Hi Robert
OK I guess I was only looking at the calculations for apparent power and reading again your Intro to AC power again - I should be looking for Real Power instead to see the import/export values.
as you say There are many parameters we can measure regarding energy use in AC systems. Each one has its merits. For the household energy metering, real power is likely to be the most useful value, as it is tells you how much power all your appliances are actually consuming, and it is what the utility bills you for.
Thanks for your guidance