Brultech ECM-1240 Software Development

I don't quite understand what you mean by "dynamic" when referencing wattzon.
I also had to modify phpgraphlib.php to handle all the data on the line chart.
I should have been more clear - By dynamic, I mean zoom in and zoom out. I did see your page and how you use the javascript, but I just haven't got that far yet. I was thinking of re-building basically what you did to view the data from pyecm. Maybe it is worthwhile to change pyecm to have the same DB structure so they work with what you have made (if you're willing to share it) - but it does seem that you are using flat files from what I could see.

I also had to change phpgraphlib to make it display more and put less labels on the x axis.
 
I don't quite understand what you mean by "dynamic" when referencing wattzon.
I also had to modify phpgraphlib.php to handle all the data on the line chart.
I should have been more clear - By dynamic, I mean zoom in and zoom out. I did see your page and how you use the javascript, but I just haven't got that far yet. I was thinking of re-building basically what you did to view the data from pyecm. Maybe it is worthwhile to change pyecm to have the same DB structure so they work with what you have made (if you're willing to share it) - but it does seem that you are using flat files from what I could see.

I also had to change phpgraphlib to make it display more and put less labels on the x axis.

After I went back and looked at the Wattzon charts I thought that might be what you meant.

My PHP looks just about like what's posted above, except that I am using flat files. I have a separate php file for each "timeframe" (minute, hour, day, month) and then just wrap it all with the following java script. I just kind of dabble in javascript/php so I'm not sure how to make the zoom type stuff work, but someone good with javascript should be able to figure it out. Modifying what I have to work with the DB file would be easy and that's probably what I should have done, but the flat files were easy to create and debug.
[codebox]script type="text/javascript" language="JavaScript">
<!--

var byhour_src = 'byhour.php?DAY=0&MONTH=0&YEAR=2009&';
var byday_src = 'byday.php?MONTH=0&YEAR=2009&';
var bymonth_src = 'bymonth.php?YEAR=2009&';

function refreshImages() {
var now = new Date();
document.getElementById("stripchart").src = 'energy.php?' + now.getTime();
document.getElementById("byhour").src = byhour_src + now.getTime();
document.getElementById("byday").src = byday_src + now.getTime();
document.getElementById("bymonth").src = bymonth_src + now.getTime();
setTimeout('refreshImages()', 25000); // Refresh in 25 seconds
}

function ChangeDate() {
var now = new Date();
var mon = 1 + document.getElementById("month_selection").selectedIndex;
var day = document.getElementById("day_selection").value;

byday_src = 'byday.php?MONTH=' + mon + '&YEAR=2009&';
document.getElementById("byday").src = byday_src + now.getTime();


byhour_src = 'byhour.php?DAY=' + day + '&MONTH=' + mon + '&YEAR=2009&';
document.getElementById("byhour").src = byhour_src + now.getTime();
}

<body onLoad="setTimeout('refreshImages()', 25000)">

<p>
<img id="byhour" src="byhour.php?DAY=0&MONTH=0&YEAR=2009" />
</p>
<p>
<img id="byday" src="byday.php?MONTH=0&YEAR=2009" />
</p>
<p>
<img id="bymonth" src="bymonth.php?YEAR=2009" />
</p>[/codebox]

The ChangeDate function just reads the user selections from the lists boxes on the page.

My PHP scripts read the arguments for DAY, MONTH, YEAR and use those to determine which flat file to read. It would be really easy to change so that it defines the SQL query instead. If my system would let me log into it remotely, I'd post one of the php scripts too.

To make the zoom type stuff work, it would be just a matter of somehow building the right arguments for an SQL query from the selection made with the mouse.

The other idea I've had in the back of my head is for the javascript to query for the data itself and somehow build what's needed for the phpgraphlib code to work without having to use multiple files or the flat files. Just haven't had time to experiment with it.
 
I don't quite understand what you mean by "dynamic" when referencing wattzon.
I also had to modify phpgraphlib.php to handle all the data on the line chart.
I should have been more clear - By dynamic, I mean zoom in and zoom out. I did see your page and how you use the javascript, but I just haven't got that far yet. I was thinking of re-building basically what you did to view the data from pyecm. Maybe it is worthwhile to change pyecm to have the same DB structure so they work with what you have made (if you're willing to share it) - but it does seem that you are using flat files from what I could see.

I also had to change phpgraphlib to make it display more and put less labels on the x axis.

After I went back and looked at the Wattzon charts I thought that might be what you meant.

My PHP looks just about like what's posted above, except that I am using flat files. I have a separate php file for each "timeframe" (minute, hour, day, month) and then just wrap it all with the following java script. I just kind of dabble in javascript/php so I'm not sure how to make the zoom type stuff work, but someone good with javascript should be able to figure it out. Modifying what I have to work with the DB file would be easy and that's probably what I should have done, but the flat files were easy to create and debug.
[codebox]script type="text/javascript" language="JavaScript">
<!--

var byhour_src = 'byhour.php?DAY=0&MONTH=0&YEAR=2009&';
var byday_src = 'byday.php?MONTH=0&YEAR=2009&';
var bymonth_src = 'bymonth.php?YEAR=2009&';

function refreshImages() {
var now = new Date();
document.getElementById("stripchart").src = 'energy.php?' + now.getTime();
document.getElementById("byhour").src = byhour_src + now.getTime();
document.getElementById("byday").src = byday_src + now.getTime();
document.getElementById("bymonth").src = bymonth_src + now.getTime();
setTimeout('refreshImages()', 25000); // Refresh in 25 seconds
}

function ChangeDate() {
var now = new Date();
var mon = 1 + document.getElementById("month_selection").selectedIndex;
var day = document.getElementById("day_selection").value;

byday_src = 'byday.php?MONTH=' + mon + '&YEAR=2009&';
document.getElementById("byday").src = byday_src + now.getTime();


byhour_src = 'byhour.php?DAY=' + day + '&MONTH=' + mon + '&YEAR=2009&';
document.getElementById("byhour").src = byhour_src + now.getTime();
}

<body onLoad="setTimeout('refreshImages()', 25000)">

<p>
<img id="byhour" src="byhour.php?DAY=0&MONTH=0&YEAR=2009" />
</p>
<p>
<img id="byday" src="byday.php?MONTH=0&YEAR=2009" />
</p>
<p>
<img id="bymonth" src="bymonth.php?YEAR=2009" />
</p>[/codebox]

The ChangeDate function just reads the user selections from the lists boxes on the page.

My PHP scripts read the arguments for DAY, MONTH, YEAR and use those to determine which flat file to read. It would be really easy to change so that it defines the SQL query instead. If my system would let me log into it remotely, I'd post one of the php scripts too.

To make the zoom type stuff work, it would be just a matter of somehow building the right arguments for an SQL query from the selection made with the mouse.

The other idea I've had in the back of my head is for the javascript to query for the data itself and somehow build what's needed for the phpgraphlib code to work without having to use multiple files or the flat files. Just haven't had time to experiment with it.
 
Thanks for finding this and pointing it out. I meant to respond sooner but other things got in the way. Anyway, yesterday I spent a bit of time and used this to generate graphs very similar to what I have with phpgraphlib. I'm even able to use the same data files, although this looks like it would work better if the data was coming from a database instead of my flat files.

The advantages of flot seem to be that it's an all JavaScript solution (is that really and advantage?), it doesn't have the data size limitation that phpgraphlib does, and it has support for selecting and zooming. I haven't played with the selecting zooming feature yet.

The script isn't finished and will most likely break on June 1st because May is currently hard coded into it. You can view page source to see all my currently ugly JavaScript.

http://www.bobshome.net/flot/power.html


Check this out:
Home: http://code.google.com/p/flot/
Example: http://people.iola.dk/olau/flot/examples/zooming.html

I might have to play with this tonight.
 
I also have a few things working with flot, but nothing I want to post yet.

I came to a similar spot using flot. I have a .php file that querys the MySQL DB generated by pyecm and returns JSON that can plug right into flot. I also have a version that takes a time range as parameters. Right now, I need to expand that file to summarize the data depending on the time range. I found that if you try to do more than a few days worth of data the query takes a while and the JSON is large. I have a crude version that returns summarized hourly data if the range is greater than a day.

MySQL->JSON is the hardest part and I'm relearning a lot of things in the process.

After further examination, it appears that wattzon uses flot! I was able to scrape the site and plug in my own data, but obviously a lot of things are broken.

I'm not ready to post either of these, but if you are interested in anything I have mentioned above or are willing to work on it with me, let me know.

My plan so far is:
Improve the query to summarize depending on the time range
add simple buttons to change the range of the resulting flot graph
take the next step to zoomable graphs (requires some AJAX knowledge I'm still not good at)
add auto-refreshing data
add the ability to add/remove channels on the fly
 
I also have a few things working with flot, but nothing I want to post yet.

I came to a similar spot using flot. I have a .php file that querys the MySQL DB generated by pyecm and returns JSON that can plug right into flot. I also have a version that takes a time range as parameters. Right now, I need to expand that file to summarize the data depending on the time range. I found that if you try to do more than a few days worth of data the query takes a while and the JSON is large. I have a crude version that returns summarized hourly data if the range is greater than a day.

MySQL->JSON is the hardest part and I'm relearning a lot of things in the process.

I'd be interested to learn what's hard about this part and what you've had to do to get it working. It sounds like you're making real good progress. I've been thinking about moving my data from the flat files into a MySQL database. I have MySQL running for other things so it's mostly a matter of creating the tables and some basic code to insert the records.


I'm not ready to post either of these, but if you are interested in anything I have mentioned above or are willing to work on it with me, let me know.

My plan so far is:
Improve the query to summarize depending on the time range
add simple buttons to change the range of the resulting flot graph
take the next step to zoomable graphs (requires some AJAX knowledge I'm still not good at)
add auto-refreshing data
add the ability to add/remove channels on the fly

I think it makes sense to share as much as possible. No sense both of us having to figure out all the same things independently. I like your list and have a similar one in my head. I have made progress on some of things like the auto-refreshing.

Can you share what your MySQL table(s) look like? Since I haven't created any tables yet, if I can make mine similar, it would make it a lot easier to share the web code.

I did fix up my javascript to handle the dates better so it should pull the right data over day/month changes. I also played around a bit with the range selection for zoom (no zoom yet). You can select a range on the line chart and it will pop up an alert with the time range selected. That part was pretty easy.

My biggest challenge is having time to work on any of this at all.
 
The hard part about json to mysql was just the learning curve. I've attached 2 files. In test.php, I open the database and get the data, then take the brute force method or getting json output. index.html was taken from one of flot's examples, so there is some extra stuff that doesn't work. As for database format, I just use what pyecm uses by default. It is watt-seconds stored every minute by channel. I have another .php that returns data summarized by hour, but it's really rough - but it's all done with SQL.
 

Attachments

Well, I downloaded all the tenholde stuff, and it's pretty darn slick. However, to integrate nicely with CQC, I think I'm going to need something in a web page. The ecmcharts don't do that, right? It's its own application, right?
 
tenEcmCharts is a windows application. It can run on any (or all) computers on your network and gets its data from tenEcmServer for real-time charts, and the database maintained by tenEcmDbLogger for historic charts.

Their is a plugin for HomeSeer that provides a real-time chart via the HomeSeer web server. I plan on significantly enhancing the web-based graphic package available via HomeSeer.

I would like to build a package of charts similar to the ones in tenEcmCharts that would be available via the web, but I do not know what platform to use that would be universally used as a web server. HomeSeer has its own web-server, but for a CQC installation (of which I know only what I just read on their web page), how would web pages be served?

tenholde

Well, I downloaded all the tenholde stuff, and it's pretty darn slick. However, to integrate nicely with CQC, I think I'm going to need something in a web page. The ecmcharts don't do that, right? It's its own application, right?
 
Another possible option for interfacing to other environments might be to create a charting application that generates an image file of the chart. The image file is then used by your application. The charting application could get its parameters from the command line, from a parameters file, or perhaps it could run as an automation server and provide a charting object for scripting languages?

Thoughts?

Anyone know of a freeware, embeddable html server?

tenholde

tenEcmCharts is a windows application. It can run on any (or all) computers on your network and gets its data from tenEcmServer for real-time charts, and the database maintained by tenEcmDbLogger for historic charts.

Their is a plugin for HomeSeer that provides a real-time chart via the HomeSeer web server. I plan on significantly enhancing the web-based graphic package available via HomeSeer.

I would like to build a package of charts similar to the ones in tenEcmCharts that would be available via the web, but I do not know what platform to use that would be universally used as a web server. HomeSeer has its own web-server, but for a CQC installation (of which I know only what I just read on their web page), how would web pages be served?

tenholde

Well, I downloaded all the tenholde stuff, and it's pretty darn slick. However, to integrate nicely with CQC, I think I'm going to need something in a web page. The ecmcharts don't do that, right? It's its own application, right?
 
I would like to build a package of charts similar to the ones in tenEcmCharts that would be available via the web, but I do not know what platform to use that would be universally used as a web server. HomeSeer has its own web-server, but for a CQC installation (of which I know only what I just read on their web page), how would web pages be served?

I don't know enough to be able to give more details than this, but I know CQC has its own web-server also.
 
Has anyone figured out how to get this into RRD yet? RRD is perfect for this sort of thing because it has data aggregation for old data so you don't fill your database with millions of records, and you can generate some really pretty graphs and charts with it.
 
I will begin work shortly on a version of tenEcmCharts that will have a web server built in for viewing EcmCharts anywhere.

I'm almost finished with a new version of tenEcmServer that will support two ECMs simultaneously. If anyone can help test, let me know.

tenholde

Has anyone figured out how to get this into RRD yet? RRD is perfect for this sort of thing because it has data aggregation for old data so you don't fill your database with millions of records, and you can generate some really pretty graphs and charts with it.
 
Back
Top