Community
OpenEnergyMonitor

OpenEnergyMonitor Community

kWh to power yields 0

Hi, I have the following problem: a gas meter gives me cumulative kWh readings that increase at hourly intervals, like this:

I want to calculate the hourly consumption based on the above input, which I am trying to do using the “kWh to power” function". However all I get is a flat line at zero.

Anyone any ideas?

What is your emoncms setup? Is REDIS running?

As the data feed is hourly, I’d suggest using PHPTIMESERIES feed or else set the PHPFINA feed interval to be 1 hour (in seconds). It just means it will update hourly, but not when the Input updates then.

Other thing, is this a counter or kWh? The counter on a gas meter is M² and the conversion factor will be stated on your bills (warning the conversion factor changes).

Hi Brian,

my emoncms setup is an emonpi SD card image implementation. I assume it has REDIS on it and running, I have run this and got a PONG

$ redis-cli ping
PONG

I have tried both PHPTIMESERIES and PHPFINA with different intervals for the feeds, neither work.

I’m not sure then. I created a kWh to Pwr feed on one of my inputs and it works fine. @TrystanLea will be the person to help.

Frank can you post a screen grab of the input processing for that input?

yes sure, here it is:

you can see as instructed by Brian I have tried both engines. Referring to the picture at the top of the post, could it be that the algorithm has a problem with the step increases happening exactly on the hour? Well almost, the increase occurs between 30 and 40 seconds after the hour.

That all looks pretty straight forward, I cannot see why it wouldn’t work. I just took a quick look at the process code and there’s nothing particularly odd

Try doing the maths of the process with some real values, it looks like it’s flying close to the limits of a float in PHP as IIRC when we last checked it was accurate to 7 digits, 3600000.0 is 7 digits. It will depend on the update interval too small increase and long interval could get rounded down to zero perhaps?

If you’re familiar with redis-cli you can check the content of process:kwhtopower:$feedid from the command line between updates.

No not AFAIK.

HI Paul, thanks for your help. Unfortunately I know nothing about REDIS. I’ll try and dive into it. Is the REDIS code for the kwhtopower process somewhere on Gihub or elsewhere described?

I am also hopeful that there is another way of achieving what I want to do. What I actually need to do is create a feed whose value is the difference between the latest value and the value a feed and the value of 1 hour ago, i.e.:

Feed_2 = Feed_1(now) - Feed_1(now-1h)

What could be the easiest way of doing this with emoncms? It would be very desirable if there is a way because numerical differentiation is one of the most elementary processes in dealing with energy data timeseries. Apart from possible scaling, kwh_to_power is straightforward differentiation, whereas power_to_kWh is numerical integration, the inverse of differentiation.

The pulse_count_to_pulse_increment process will do what you want, ignore the “pulse” and just treat it like a “count_to_increment” process. It the data is arriving hourly, the “hourly” aspect is taken care of.

I have just tried this and it does not work either. It gives me the original input values as a feed.

Try adding a log2feed immediately after it to get the difference. It needs to record the current count to do the next calculation. Since this feed will record the inputs you do not need the first log2feed, so you still have 2 feeds, the log2feed just goes after rather than before the “difference” calculating process.

How often are you posting new kWh values @franknfurther? The problem with the kWh to power input processor is that the kWh value needs to increment during the post interval for it to work, so for example, if you are posting every 10s and the kWh value only increments every second reading like this, you would get the following output:

time  kwh     power
00s   10.00   0
10s   10.00   0
20s   10.01   3600 W
30s   10.01   0 W
40s   10.02   3600 W
50s   10.02   0 W

If you can slow down the rate at which you post new kWh values to once an hour, it should give better results I think.

Hourly it seems.

Hi guys, thank you for your help. The challenge seems to be that the values of teh gas meter are fed to emoncms every 10 seconds, although they only change every hour, on the hour. The 10 second data interval has to do with the other values from the same data source that are changing continuously, such as current and power.

Apart from the pulse difference and the kwh_to_power I have also experimented with the rate_of_change function. This kind of seems to work, at least in the strict sense of how the function was designed:

How would I be able to turn the spikes into hourly values reflecting the hourly increase of the meter? I dont think I’ll be able to slow down the data source as Trystan suggests, because of the other data coming from the same source. Or can I? Or is there a way to convert the 10s data into hourly data first?

You could, but it would require some complicated code changes for your emonPi’s Atmel '328P sketch, which is where the analogue processing and the pulse count is handled. And that could give rise to problems when you update.

What you would need to do is separate the gas meter pulses from the standard Node 5 output, and create a new NodeID (say ‘6’) with only the gas meter pulses in it, and arrange to send that every hour to emonCMS. You’d have Node 5 with the powers etc updating every 10 s as now, and Node 6 with only the pulse count updating every hour.

@borpin What about adding a Pi Zero W to handle just the gas meter pulses - sending every hour?

How are you feeding the values to Emoncms?

I am using an EmonHUB Raspberry Pi with a python interfacer script that I wrote myself to read out a (Dutch) smart meter. I am also running an Arduino with EmonTMX shield connected with USB to the EmonHUB Pi for getting the currents of all three phases. I am also running EmonHUB on two Raspberry Pi Zeros to get the data of two SMA solar inverters via bluetooth.

The EmonCMS I am using now is running on a separate Pi using the preconfigured SD card because after many tries I have given up installing EmonCMS on an Ubuntu server.

So why not simply send the update once an hour (when it increments)? Do you send it via MQTT?

Odd, I run on Ubuntu and mine was simple to install and works perfectly.

That would be nice, but I am unsure as to where in Emonhub I would set it to update every hour instead of every 10s. The role of MQTT unfortunately totally eludes me…

Intriguing … which installation process/procedure did you use?

Set it in your interfacer. Store the previous value and if it hasn’t changed then don’t send it on.

I did exactly this in the Pulse interfacer