Data 'quality'

So…

If i sample a sensor for what it is ‘instantaneously’ doing - every x seconds I get a reasonable understanding of the power consumed.
Do I:

  • Average the samples and upload a single value?
  • Sum the data and upload it as kW/H instead of kW?
  • Try to get a sensor that creates a kW/H measurement and upload that instead?

What is ‘better’? What is more ‘accurate’ or representative?

I have the ability to generate some datasets in HomeAssistant - as its the thing doing the collect and publish - so looking for advice on ‘what is better to upload’ and why…

Thanks in advance

Hi @ttrankine. I am sure that there are many others here far better qualified to answer this question than me. So take my advice for what you will.

I assume that the sensor that you are talking about is returning an INSTANTANEOUS value for power ( Watts ). By definition power is an instantaneous value and it can ( may ) change from moment to moment depending on the load on the circuit.

In order to accurately determine the power the sensor would need to know the Voltage ( V ), Current ( I ) and Power Factor ( PF ). The type of sensor that you are using would be a major factor in knowing its intrinsic accuracy.

You can upload both POWER and ENERGY to PVO. The maximum resolution of PVO is in 300 second ( 5 minute ) blocks. You could push values more often but you are limited to the rates set by PVO’s author API Specification — PVOutput documentation and you would only wind up overwriting older data anyway.

You can’t simply SUM the power figures to obtain the ENERGY figure. What you can do is sample the sensor at a certain rate ( up to you ) and calculate an ENERGY value based upon the average POWER figure for that period of time.

EG

Time 0:00 170W
Time 0:05 500W
Time 0:10. 300W
Time 0:15. 475W

In the above example you know the START and END power consumption so you could simply average the POWER figure ( 500 - 170 ) / 2 and multiply by 300s to get ENERGY ( in Joules ) for that interval of time.

If course what you don’t know is if the POWER only shifted to 500W at 4.9999s or at 0.000001s or anything else in between. It could also have risen to 2000W briefly during that 5s block!

The most accurate information really would come from an ENERGY meter that simply tallys that data over time like a utility meter. I think that any attempt to calculate ENERGY from POWER will be less accurate but probably good enough for most cases. The shorter the sample time the smoother your data so if your sensor allows 1s sampling perform 300 samples and update PVO every 5 minutes. I’d be surprised though that in a domestic situation this would really be necessary.

I’m curious to see how you get on and what any other PVO users have to say on the subject.

Grannos.

I guess the increased sampling is trading off ‘how long’ a sensor was at a value - shorter the interval the more likely it is that it was ‘consistent’ for that time window.

So even though the power could go from 10kw to zero kw within a second - the power ‘used’ in that second is unlikely to shift the measurement for the 5min window, hence the way most sampling is done for any industrial system - you sample at a rate that ‘reduces the risk for getting wrong data’ and the ‘forward implication of getting it wrong’

I guess im now wondering how others consider the data they upload.

As for an energy meter - well the mechanical ones are ‘infinite timeslices’ and the digital ones aim to capture a wave - so thats like 360 points for a full wave, at the frequency of the supply, and they just sum. Advanced Power-Line Monitoring Requires a High-Performance, Simultaneous-Sampling ADC | Analog Devices

I guess this is a request to understand the tradeoffs from a electrical engineer perspective and someone who is a maths guru - I am neither :slight_smile:

I guess if you were to sample the sensor every 5 seconds, use the average power for that period to calculate energy consumed and push that figure to PVO you would have to come pretty close to an ‘accurate’ figure. You could compare your calculated figure to that of your supply meter over an extended period of time.

I would think that any weird spikes or variations in instantaneous load should average themselves out over the longer term.

I’d be very interested to hear what a professional EE would have to say on the matter.