Calculate carbon equivilant script

No replies
Lincolnshire, United Kingdom
Joined: 24 May 2010

I have been exploring lua and plugboard and creating some scripts, here is one that calculates the carbon equivilant of the electricity consumed with a 1 minute update.

The source of the data in this script is ch.1 on a currentcost device:-


Note that I have an instance of "1" configured and that if you do not use this configuration you will have to change this.

If you use more than one channel then you need to change to use and if you are playing with the beta with the eco manager support then this would become ch.H

The factor is a 5 year rolling average factor for total CO2 equivilant is derived from the "August 2011 Guidelines to Defra/DECC’s Greenhouse Gas Conversion Factors for Company Reporting" available from .

The relevant factors are in table 3c of Annex 3. I am using the data for 2009 Grid Rolling Average, Total Direct GHG, ie 0.52462

As you will see in the table this gives factors for the components, ie CO2, CH4, and N20 as well, but when I tried to add those extra endpoints to the script it failed

The resulting data is a subuid of plugboard and I post this to pachube on feed 1867, datastream 1. (I never could get the AMEE calcs to work properly)

My lack of experience with lua prevents me from adding the component calculations and in addition I get at least one bsc message with ? and at least one with a 0 value on startup. In addition I had problems dividing by 1000 (!) and had to kludge it ,so any help or sugestions with these issues will be most welcome.


greenhouseApplet.lua811 bytes
Hardware Info