Community
OpenEnergyMonitor

Community

Error in calculation using +input function

Hi,
We use emoncms to log daily data sent from Elster A1140 meters, via ftp and the emoncms API.

It all works smoothly but I am stumped on an error that is happening using the +input function to sum a number of inputs.

When looking at the processes for the relevant node under the input tab, the sum of the ‘latest values’ for the three feeds is different to the value being recorded by the ‘log to feed’ process. e.g. 14.65 + 6 + 30.01= 50.66, but log to feed is showing 41.05.

Log to feed is set up as realtime and 10s values.

I have tried to cut and paste a screenshot below.

I am sure it is something simple but can’t figure it out!

Thanks for your help.

I’m not an emonCMS expert, but I would bet on timing. If you look back at the previous values, you will probably be able to assemble a set (recorded at different instants) that does add up.

I think the recommendation is to use “+feed” rather than “+input”.

1 Like

Interesting, I think +input should work ok in this context. I think this is timing as @Robert.Wall suggests, the feed value may be the last value rather than the result of the sum of the current value, the feed itself should be ok though…

Thank you Robert and Trystan.

The code runs every 24 hours so I have set up a new Log to Feed feed using +feed, and also one with PHPTimeseries rather than PHPFina. All feeds are otherwise set up as realtime, PHPFina and 10s. I will check tomorrow and see if that makes any difference.

If timing is the issue, I am not sure how to stagger or ‘slow down’ processes. Would changing the Feed Interval make any difference?

@Trystan I have tried a few permutations of the previous values and can’t find a way of reproducing the 41.05 value if that is what you mean?

I have made the graph and new feeds public here:
https://emoncms.org/dashboard/view?id=55822

Hmm. 3 different results, none of which are right!

11.48+0+6.8= 18.28. Instead we have 32.13 (+input), 26.13 (+feed), 52.26 (+feed, PHP timeseries)

Is there any way of accessing a log of how the calculation is being made by emoncms?

I wonder if redis has anything to do with this.
Shall we log an issue on github?

Thanks Dan. How should I go about logging it on Github?

As you can see in the chart, the results are close to the correct totals, but always slightly off. Node 8 kWh 2 uses +input and node 9 kWh 3 uses +feed, and they are pretty close to each other, but not identical. Ignore kWh4 as I set it up wrong.

It’s unlikely this would be forgotten about, but just in case…

To be sure, this is emonCMS on a rPi/Linux you’re using, and not emonCMS.org, correct?

1 Like

Thanks Dan. It is emoncms.org. Data is sent from Elster A1140 meters, via ftp and the emoncms API.

Good question re emoncms.org @danbates, Are you posting the data to emoncms in one request? Which API are you using? @Repower

Hi Trystan- The data is sent as 1 request per data point, via JSON. It works fine for the logging but does seem to affect the processing. What would you recommend trying?

Ok great, would you be able to try combining into a single input/post request?

E.g:

https://emoncms.org/input/post?node=emontx&fulljson={"val1":100,"val2":200,"val3":300}

I will ask our programmer to try that. Just so I understand- will we still be able to create individual feeds for the individual values? They are daily values for separate installations so need distinct feeds. Thanks!

Yes, the only difference is that the data all comes in at once and so we can ensure that the calculations are being made on the latest input values rather than what might be a combination of new and old giving confusing results…

Thanks Trystan. I’ve switched back to this thread here as we used a different approach to solve the calculation errors.

Thanks again for your help

1 Like