From c4bc1a8cce0099f36078525e88f60ee022662b1d Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Sat, 10 Dec 2011 18:59:58 +0000 Subject: filter out 'bad' values git-svn-id: https://svn.spreadspace.org/mur.sat@218 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- tools/solarmeter/solarmeter_plot.py | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/tools/solarmeter/solarmeter_plot.py b/tools/solarmeter/solarmeter_plot.py index 9e0d1fa..856dd47 100755 --- a/tools/solarmeter/solarmeter_plot.py +++ b/tools/solarmeter/solarmeter_plot.py @@ -21,15 +21,24 @@ def autom(panelid, u, i): measurements[panelid]=[] measurements[panelid].append( (float(u), float(i) * 1e-3) ) -def getm_rp(panelid): +def getm_ui(panelid, limit_voltage=100): """ get measurements load over power @param subject name of solarpanelcells series @returns tuple of lists: (list(r values), list(p values)) """ global measurements - return zip(* sorted(list(set(map( lambda (u,i): (u/i, u*i), filter(lambda (u,i): i > 0.0, measurements[panelid]) ))))) + return zip(* sorted(list(set(filter(lambda (u,i): i > 0.0 and u < limit_voltage, measurements[panelid]) )))) + +def getm_rp(panelid, limit_voltage=100): + """ get measurements load over power + @param subject name of solarpanelcells series + @returns tuple of lists: (list(r values), list(p values)) + """ + global measurements + return zip(* sorted(list(set(map( lambda (u,i): (u/i, u*i), filter(lambda (u,i): i > 0.0 and u < limit_voltage, measurements[panelid]) ))))) lre = re.compile(r"(\d)\s+([+-]?\d+(?:\.\d+)?)\s+([+-]?\d+(?:\.\d+)?)") +#lre = re.compile(r"(\d)\s+([+-]?\d+.\d+)\s+([+-]?\d+\.\d+)") with open(sys.argv[1], "rb") as fh: for line in fh: m = lre.match(line) @@ -40,6 +49,22 @@ with open(sys.argv[1], "rb") as fh: panelids = range(0,8) +pylab.figure(0) +pylab.xlabel('Spannung [V]') +pylab.ylabel('Strom [A]') +pylab.xscale('linear') +pylab.yscale('linear') +pylab.title("U/I Plot") +pylab.grid(True) +for id in panelids: + try: + (u, i) = getm_ui(id, limit_voltage=9) + except ValueError: + continue + pylab.plot(u,i, label=str(id)) + pylab.hold(True) +pylab.legend() + pylab.figure(1) pylab.xlabel('Widerstand [Ohm]') pylab.ylabel('Leistung [W]') @@ -49,7 +74,7 @@ pylab.title("Leistungsanpassung") pylab.grid(True) for id in panelids: try: - (r, p) = getm_rp(id) + (r, p) = getm_rp(id, limit_voltage=9) except ValueError: continue pylab.plot(r,p, label=str(id)) -- cgit v1.2.3