Community
OpenEnergyMonitor

Community

Feature Request: Windowed Energy Display Statistics

Tags: #<Tag:0x00007f6e0f96b340> #<Tag:0x00007f6e0f96ae90> #<Tag:0x00007f6e0f96a788> #<Tag:0x00007f6e0f96a3c8> #<Tag:0x00007f6e0f969f90>

As a manufacturing company, we are routinely analyzing the embodied energy of the products we make. We have Emon sensors installed on all of our machinery and equipment and are using EmonCMS to log and graph. Frequently we have the need to look at how much energy a specific operation required or even just what we used that afternoon. The Wh logging functionality is very handy, but to pull out specific moments requires cutting and pasting values and using a calculator to determine how much energy was used in a given time span.

In one of the current visualizations there is displayed below the graph some very useful figures: quality, min, max, mean, and std deviations. It would be extremely useful for the statistics to show how much energy is displayed in the current window assuming that the source is watts. We are interested in developing this functionality ourselves but could use some guidance for a starting point.

How do we go about modifying the GRAPH visualization to display the energy integral expressed as Wh?

-Berkeley

Here’s a screen shot at what we’re looking at doing.

1 Like

Good idea + enjoying reading your posts and love what your doing with SolarMill!

If you add another line here as below that should do it:
https://github.com/emoncms/graph/blob/master/graph2.js#L491

(mean power in watts x time_in_window in seconds) / 3600 Joules in 1 watt hour

out += "<td>"+((feedlist[z].stats.mean * time_in_window) / 3600).toFixed(dp)+"</td>";
2 Likes

The table titles are set here:

1 Like

Looking to implement these changes now and came across a question. Where are these files located on the EmonPi? We installed using the pre-built image.

-Berkeley Fergusson

Do a search via the terminal command and you’ll find both files:

[email protected]:~ $ sudo find / -iname graph2.js
/var/www/emoncms/Modules/graph/graph2.js
[email protected]:~ $ 
[email protected]:~ $ sudo find / -iname view.php
/var/www/emoncms/Modules/graph/view.php
/home/pi/postprocess/mainserver/postprocess/view.php
[email protected]:~ $ 

ignore the post processing file.

Found view.php, but we don’t have a graph2.js on our pi just a graph1.js

Ugh! This is probably over my head. We’ll probably need help from @TrystanLea or @glyn.hudson. What directory did you find “graph1.js”?

Run this command and let us know the results:

ls /boot | grep emonSD

I do not get any results at all with that command.

graph2.js is part of the optional graph module, do you have that installed?

It is in the same directory that our view.php and your graph2.js are in.

/var/www/emoncms/Modules/graph/

If you have a graph directory in emoncms/Modules then you do have the graph module installed but if graph2.js isn’t there it is not up to date.

if you cd into the emoncms/Modules/graph directory and run a git pull you should find it after that.

That did it graph2.js is there now. Made the changes and also added some other stuff. For now it’s up to the user to decide what the “Int” value means, and whether or not the “Wh” and “kWh” values are relevant or not.

Starting at line 491 in graph2.js
out += "<td>"+feedlist[z].stats.stdev.toFixed(dp)+"</td>"; out += "<td>"+((feedlist[z].stats.mean * time_in_window)).toFixed(dp)+"</td>"; out += "<td>"+((feedlist[z].stats.mean * time_in_window) / 3600).toFixed(dp)+"</td>"; out += "<td>"+((feedlist[z].stats.mean * time_in_window) / 3600000).toFixed(dp)+"</td>"; for (var i=0; i<11; i++) out += "<option>"+i+"</option>";

Link to fork: https://github.com/solarmill/graph

Thanks for the help everyone!

-Berkeley Fergusson

2 Likes