question about btmon and solar

Post any 3rd party software here.
Post Reply
Peter_V
Posts: 23
Joined: Sat Feb 19, 2011 10:03 am

question about btmon and solar

Post by Peter_V » Fri Jan 18, 2013 1:03 pm

I'm using an ECM-1240 and btmon to monitor my solar array that uses Enphase micro inverters.

I've figured out how to use rrdtool to create graphs, etc. But I've noticed that the ch2 readings never go negative. Since I doubt the array is actually producing 2 watts all through the night I figure I'm doing something wrong.

here is my config.cfg
[source]
device_type = ecm1240
serial_read = true
serial_port = /dev/ttyS1
[rrd]
rrd_out = true
rrd_dir = /var/rrd

and the perl script I'm using to read channel 2 (solar)
#! /usr/bin/perl

use lib qw( /usr/lib/perl );

use RRDs;
my $start=time;
my $rrd="/var/rrd/313895_ch2_aws.rrd";
my $name = $0;
$name =~ s/.*\///g;
$name =~ s/\.pl.*//g;


RRDs::graph "graphs/solar.png",
"--title", "Solar Production",
"--start", "now-1d",
"--end", "now",
"--lower-limit=0",
"--interlace",
"--imgformat","PNG",
"--width=1080",
"--height=400",
"DEF:a=$rrd:ch2_aws:AVERAGE",
"DEF:b=$rrd:ch2_aws:MIN",
"DEF:c=$rrd:ch2_aws:MAX",
"CDEF:sa=a,2,*",
"CDEF:tt=a,1800,/",
"CDEF:sn=b,2,*",
"CDEF:sx=c,2,*",
"VDEF:tot=tt,TOTAL",
"VDEF:max=sx,MAXIMUM",
"VDEF:min=sn,MINIMUM",
"AREA:sa#ffcc00:Watts",
"LINE1:sn#0022e9:Minimum \\n",
"GPRINT:tot:Total Daily Production %2.3lf%sWh \\l",
"GPRINT:max:Peak Power %2.2lf%sWh",
"GPRINT:min:Minimum Power %2.2lf%sWh",
;

if ($ERROR = RRDs::error) {
die "ERROR: $ERROR\n";
};

The daily totals are off by a bit, which I figure is due to small accuracy error, but I want to make sure it's not counting power draw at night as power production before I try to adjust for the error.

FWIW: I'm using a single CT on the 240V breaker from the inverters. I've checked the Gain X2 on the ECM configuration, but the ECM-1240 still reads like it's on a 120V breaker. So I'm scaling the power when I'm producing the graphs.
mwall
Posts: 140
Joined: Wed Dec 07, 2011 6:25 pm

Re: question about btmon and solar

Post by mwall » Fri Jan 18, 2013 1:25 pm

btmon saves the watt-second counter values to rrd files, so the values will always be positive and will eventually wrap around to zero.

to calculate net power/energy you must calculate using the absolute and polarized watt-second counters:

wh = (aws - 2*pws) / 3600

in your case, the absolute watt-second counter is here:

/var/rrd/313895_ch2_aws.rrd

and there should be a corresponding polarized counter here:

/var/rrd/313895_ch2_pws.rrd

so in your graph you want something like the following:

...
"DEF:awsavg=$rrd1:ch2_aws:AVERAGE",
"DEF:awsmin=$rrd1:ch2_aws:MIN",
"DEF:awsmax=$rrd1:ch2_aws:MAX",
"DEF:pwsavg=$rrd2:ch2_pws:AVERAGE",
"DEF:pwsmin=$rrd2:ch2_pws:MIN",
"DEF:pwsmax=$rrd2:ch2_pws:MAX",
"CDEF:a=awsavg,2,pwsavg,*,-,3600,/",
...
Peter_V
Posts: 23
Joined: Sat Feb 19, 2011 10:03 am

Re: question about btmon and solar

Post by Peter_V » Fri Jan 18, 2013 2:43 pm

First off, thank you Matt for creating btmon. Great job!

I wasn't really clear on what the three different databases were for (a vs aws vs pws), so your explanation helped a lot.

I think you had an error in your CDEF statement
"CDEF:a=awsavg,2,pwsavg,*,-,3600,/",

(updated)
Never mind I was wrong, that works perfectly.

The problem now is that the pws database is mostly nothing but zeros even at night. Occasionally I see a small value in it, but it's not consistant even at night it's mostly zero.
Post Reply