
Total Demand is plotted with units on the left. Spinning reserve and wind generation are plotted with units on the right. The first graph is for the previous day and the second is for the previous week.
I was interested in the power demand in Texas and found a page at ERCOT that provided real time information updated once a minute. The problem was that this did not give any idea of trends and I could not locate a web site that provided a graph. So it was time to write some code to do it myself. Since I had done something like this before for the old Earthlink news servers, I decided to put up a web page with a plot of the data in case someone else might find it interesting.
The first step was to grab the data. For this I used a program I found.
The only problem here is that the data is embedded in HTML tables which makes it tricky to extract. I have used many programming languages but Perl seemed the best choice here even though I am at best a dabbler. I found the Treebuilder package and it really helped. But if ERCOT ever changes the format of this web page, it will almost certainly break my code and require changes. Once I extracted the data I appended it to a data file as a single line.
To automate the process I built a shell script and scheduled it to run every five minutes using cron.
Now that I have the data all that is left is to plot it. For this I use gnuplot. It is easy to feed gnuplot a command file to generate the plot and create an image. All that is left is to upload it to the server. Another simple shell script for ftp does the job here. Once again I use cron to automate the process of generating a plot once a day and uploading it.
The only downside of this is that in order to collect data continuously, I need to leave my computer on all the time. One of these days I will move my web pages from the free Earthlink server to a more capable site. Then I should be able to move all of this to the server.