Amps, VA, pf, Hz


Made the switch to storing VA in the datalog instead of pf. Since then, everything has fallen into place. I’ve got a branch working where you can specify units of Amps, VA, pf, Hz, Watts, Volts, kW, kWh and that’s what comes out of the calculator. The values can be used to upload to Emoncms or influxDB or plotted in the local graph. The averages are accurate over any time interval.

The algorithm allows adding and subtracting inputs as before, so if you wanted to know the power factor of your mains with the air-conditioner off, you can subtract the AC from the main in calculator and get the resultant pf. Same with Amps and the others.

Only downside now is that my year old datalog doesn’t have the VA so I can’t look back on it.


If the Iotawatt can produce kWh and log to the SD card and log to influxDB that would be a great feature.

I have been using a continuous query in influxDB with the integral function to produce kWh but would prefer not to do this. I also use Grafana for graphing as it is powerful and looks good.

One thing I would like to do is show a cumulative kWh graph for example as consumption (or generation) grows during the day but to this then needs to reset at the start of the next day. I can’t see how to do this with influx or Grafana, trying to learn kapacitor as it should be capable but the scripting language is a bit obscure.

PVoutput has good standard graphs for a growing cumulative kWh graph as below.


@Giraffe, I use the following query to generate a cumulative kWh graph. The 2380 is an offset to sync up with my electricity meter:

SELECT cumulative_sum(integral("value",1000h)) + 2380 FROM "house_power" WHERE $timeFilter GROUP BY time($__interval) fill(null)


@overeasy, I think the ability to select units is a great addition and looking forward to trying it out! Only suggestion would be to have a mechanism to “sync” the kWh field with the electricity meter reading when required (e.g. on initial installation of the iotawatt or if you get a new electricity meter). Perhaps, allowing to overwrite the last kWh value via the iotawatt UI and have it continue to aggregate and publish from that value onward would work?

As a side note, the drift against meter has only been around 0.4% over the last 6 months which is pretty good in my book!


Awesome! That’s well under the 1% of a typical revenue grade meter. My question is which is the more accurate, the IoTaWatt or the Meter?

Overnight my bench system has been recording the newly added VA in the datalog and I took a look at a couple of these new outputs:

Here’s a plot of frequency vs voltage. Trystan Lea at OEM had pointed me at a UK website some time back that showed how frequency was related to load there. I think I see something similar here.

I know it looks like a mess, but keep in mind that the range of voltage covers about 2 volts and the range of frequency is about .04 Hz (0.07%). Nevertheless, if you squint a little, the larger voltage swings seem to correlate with frequency.

Here’s power factor. For convenience, I keep the bench test system monitoring my desktop computer with a couple of solid core CTs. I’ve seen the pf go up and down in real-time, but this just puts it in perspective:

I’ll get Amps working today, and make it all work in the real-time status screen.


Not sure that frequency would vary with load due to anything happening at a local level.

At a whole of network level (eg country or state wide) the frequency is will change where there is a sudden significant mismatch between generation and load that is not immediately compensated for.

Locally the voltage would drop as load increases and visa versa due to the source impedance of the network at your particular location.

A falling (or climbing) frequency outside of system stability design is a scary thing for a network operator - means there is going to be a blackout that affects all or large parts of the country.


Brilliant. SQL is very powerful in the hands of somebody that knows how to use all that power (not me).

Have made some good progress with your help.


This doesn’t work for power factor. It has been enlightening for me to try it and figure that out. The PF using recorded va works fine for one ct, but you can’t do math on it. The result appears to be meaningless. I think I undestand why but will leave it to a power engineer to explain it in proper terminology.

Seems to work fine for VA, Amps, Watts, kW, kWh.


Just trying to help but from memory this might help. Happy for anyone to jump in and correct if I am wrong.

VA and Amps are vector quantities so you can not add them together (linearly) if they are not in phase but must use vector addition. If the circuits have a different power factor then VA and Amps will not be in phase for the different circuits. Power factor can then be calculated from the vector sum of the two loads.

For example

Circuit 1
VA = 100
so can calculate pf = 0.9 and Var=43.59 (VA is hypotenuse and Watts and Var are other sides of right angle power triangle)

Circuit 2
Watts = 5
so can calculate pf=0.5 and Var =8.66

Circuit 1 + Circuit 2
Can add Watts = 95
Can add Var = 52.25
and can then calculate VA as hypotenuse of triangle = 108.42
and can then calculate pf as 95/108.42 = 0.876

The answer is not 100 + 10 = 110 VA so adding circuits is difficult as vector maths is needed.


Thanks Paul,

You seem to have put me on the right track. I did some reading today and have coded what is essentially your solution. It gets a little more complicated because I’m trying to evaluate arbitrary calculator expressions with algorithms to do the right thing for the units specified. It worked OK before for a single value using W and VA, but the problem came with multiple inputs. That’s something I see as necessary to allow aggregating the three lines of a three-phase installation. The Watts can be simply added together, but getting a combined VA and power factor is the basic goal of this math. The vector addition seems to work and I have found several papers that support the method.

All bets are off with operators other than addition, but that’s OK. Not being strong in the math for this, I intend to do some empirical testing to validate.


I was only thinking single phase but calculating VA for a 3 phase installation will be important as some billing has a VA component and monitoring and managing VA will be important to reduce your bill. The single VA and pf calculated is actually the single phase equivalence value as each leg of the three phases actually has its own VA and pf which will be different unless the load is exactly balanced (unlikely).

A single phase equivalent for amps is not a particularly useful number. Watts is easy as its just a straight addition, Vars is the same.

As a recently semi-retired power systems electrical engineer Its a while since I have had to calculate values from first principles, been doing more managing than engineering for too long. Will need to breakout my uni text books if it gets any harder.