Virtual Feeds not adding up

Hello,

I have a Virtual Feed that is a sum of two other realtime feeds. If I look at the current value of the virtual feed at any time, it appears to be the correct value (Feed1 + Feed 2). However, if I look at any historical data, the Virtual Feed is no longer the sum of Feed1 and Feed2. See the below table for an example of what I’m seeing.

Time	  Virtual  Feed	Delta	Feed 1	Feed 2	Sum	Delta
1499731200	966.7	0	588.9	357.7	946.6	0
1499817600	969.2	2.5	591.3	360	    951.3	4.7
1499904000	971.7	2.5	593.8	362.3	956.1	4.8
1499990400	974.2	2.5	596.3	364.7	961 	4.9
1500076800	976.7	2.5	598.8	367	    965.8	4.8
1500163200	979.3	2.6	601.3	369.4	970.7	4.9
1500249600	980.6	1.3	603.9	371.8	975.7	5
1500336000	981.8	1.2	606.4	374.3	980.7	5

There are a couple threads here at the community that are similar to what I’m experiencing, but those threads don’t have any solutions. Hopefully we can put this to bed with this thread.

ETA: I’m running EmonCMS 9.8.7 on my home server with the VirtualFeed.php from 9.7.5 since the commit for 9.8.2 was broken. Looks like there are some very recent commits for this, but I’m not ready to go master unless there’s a really good reason.

Thanks all.

Some quick questions:
What is the engine of that feed1 and feed2?
How are you acquiring that data shown on the table at that timestamps? Export?

Hi! Glad to speak to The Man on this one. :slight_smile:

The feeds are both phpfina with 5 minute intervals.

The data in the table is from the built in Data Viewer (https://server.com/emoncms/graph/[feed_id]). I select the three feeds (Feed1, Feed2, and Virtual), set my Fixed Interval to 86400, then click the “Show CSV Output” button. I then copied into a spreadsheet to manually calculate the sum of Feed1 and Feed 2 and calculate the deltas.

Thanks!

I think I figured out at least one issue. And, as usual, it’s user error. :sweat_smile:

I was using a “Source Feed” as my first feed into the Virtual Feed, but the second feed was a “+feed” instead of a “+source feed”. So now the math looks a lot better. However, the math is still off a little bit throughout the time series. And the last interval is off by a lot.

This is with 3600s interval:

Time	VirtualFeed	Delta	Feed 1	Feed 2	Sum	Delta
1500400800	984.7	0	608.3	376.0	984.3	0
1500408000	985.1	0.4	608.5	376.2	984.7	0.4
1500415200	985.5	0.4	608.7	376.4	985.1	0.4
1500422400	985.9	0.4	608.9	376.6	985.5	0.4
1500429600	986.3	0.4	609.1	376.8	985.9	0.4
1500436800	986.7	0.4	609.3	377.0	986.3	0.4
1500444000	987.0	0.3	609.5	377.2	986.7	0.4
1500451200	987.4	0.4	609.7	377.4	987.1	0.4
1500458400	987.6	1	609.9	377.5	987.4	1
1500465600	987.8	0.2	610.1	377.7	987.8	0.4

And this is the same time series as my original post, just with the “+source feed” instead of “+feed”

Time	VirtualFeed	Delta	Feed 1	Feed 2	Sum	Delta
1499731200	951.3	0	588.9	357.7	946.6	0
1499817600	956.1	4.8	591.3	360.0	951.3	4.7
1499904000	961.0	4.9	593.8	362.3	956.1	4.8
1499990400	965.8	4.8	596.3	364.7	961.0	4.9
1500076800	970.7	4.9	598.8	367.0	965.8	4.8
1500163200	975.7	5	601.3	369.4	970.7	4.9
1500249600	980.6	4.9	603.9	371.8	975.7	5
1500336000	983.1	2.5	606.4	374.3	980.7	5

Allright then, small variations are ok due to averaging of the calculations with virtual feeds.

Agreed. The issue with the end of the data set means all my delta graphs look strange at the end though:

I’d like to get to the bottom of that if possible.

Thanks.

ETA: I wonder if this goes away if I am able to use the Graph module with Virtual feeds instead of using one of the old visualizations (bargraph in this case). Right now the Graph module only lets me use PHPFina and PHPTimeseries.

More adventures in user error: after figuring out that a) I didn’t have the Graph module installed properly and b) the Graph module DOES work with Virtual Feeds (just have to use a fixed interval instead of “daily”), I think I’m set.

Thanks!