Page 1 of 1

Adding extra data to web page using CGI scripts

Posted: Sun 17 Jul 2011 3:41 pm
by geowarm
On my site there is now extra solar data displayed on the front page. This has been extracted from the monthly log file and uses two cgi scripts called at the server when the web page is refreshed. It may be of interest to others so I'm offering a brief description for what it's worth.

I have a PV panel array and was interested in working out daily total Kw-hrs/sqm solar radiation. As I know the Kw output at peak sun for my panel I can then use this figure to estimate how much electricity I'm outputing to the grid each day(and how much dosh I'm earning!). The monthly log includes an instantaneous w/m2 solar radiation value so I use this to estimate the daily total. As I log every 10 minutes I simply add up all the logged values and divide by 6000 to get a rough Kw-hrs/sqm.

The step involved are:
1. Add my extractCumulus.cgi to the server cgi-bin.
2. Add executer.cgi - a utility I found many years ago, it gets the output of the above script and puts it in the index.htm web page.
3. Add the following line to indexT.htm at the point you want to insert the data
<script type="text/javascript" src="http://www.mecol.co.uk/cgi-bin/executer ... "></script>
4. Configure the Cumulus Internet page to upload the monthly file to the cgi-bin. Sadly you also have to do this at the start of each month for each new log file, I can't fathom a way to automate this. Let me me know if you can see a way. Maybe I'll generate empty files for the next year, upload them all and let Cumulus over-write them as it generates a new monthly log (if you're reading this Steve, you might like to comment as to whether it's likely to cause any problem)

Call a Web Update from within Cumulus to generate a new index.htm from indexT.htm then refresh the weather station web page, the data should be there. I've also copied yesterday's sunshine hours from the log file.

A word of warning! Getting server-side scripts to work can be difficult, server software varies. Make sure you back up anything you change so you can go back if things don't work out. I suspect the above won't work for the first day of the month, I don't know yet as I've only been on air a week or so. I'll worry about it when it happens!

This technique can easily be extended to do lots more data analysis & display. As with any software, get something that works, then progress slowly taking lots of backups.

There may be a slicker way, if you know of one please let me know.

The two cgi's should be attached in a zip.

Geo Meadows
http://www.mecol.co.uk/weather
v1.9.2 (build 1003)

Re: Adding extra data to web page using CGI scripts

Posted: Sun 17 Jul 2011 3:46 pm
by geowarm
Forgot to say, you need to change the web address, and possibly the paths, in
<script type="text/javascript" src="http://www.mecol.co.uk/cgi-bin/executer ... "></script>
from mecol.co.uk to your own. If you call executor on my server you'll be thrown off!
Geo