summaryrefslogtreecommitdiff
path: root/tools/solarmeter/solarmeter_plot.py
diff options
context:
space:
mode:
authorBernhard Tittelbach <xro@realraum.at>2011-12-10 18:42:59 +0000
committerBernhard Tittelbach <xro@realraum.at>2011-12-10 18:42:59 +0000
commite4243718126891cd607dabf7405c0e987b4670d8 (patch)
tree3da0819fdca4fa7a1b41118f8615882165332624 /tools/solarmeter/solarmeter_plot.py
parentmeasurements (diff)
solarmeter poti sweep
git-svn-id: https://svn.spreadspace.org/mur.sat@217 7de4ea59-55d0-425e-a1af-a3118ea81d4c
Diffstat (limited to 'tools/solarmeter/solarmeter_plot.py')
-rwxr-xr-xtools/solarmeter/solarmeter_plot.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/tools/solarmeter/solarmeter_plot.py b/tools/solarmeter/solarmeter_plot.py
new file mode 100755
index 0000000..9e0d1fa
--- /dev/null
+++ b/tools/solarmeter/solarmeter_plot.py
@@ -0,0 +1,59 @@
+#!/usr/bin/python -OO
+# -*- coding: utf-8 -*-
+
+import numpy as np
+import pylab, sys, os, re
+
+if len(sys.argv) < 2 or not os.path.isfile(sys.argv[1]):
+ sys.exit(1)
+
+measurements={}
+
+def autom(panelid, u, i):
+ """ Add Measurments to dict
+ @param panelid id of solarcell panel
+ @param u measured voltage in volts
+ @param i remasured current in milli ampere
+ """
+ global measurements
+ panelid = int(panelid)
+ if not panelid in measurements:
+ measurements[panelid]=[]
+ measurements[panelid].append( (float(u), float(i) * 1e-3) )
+
+def getm_rp(panelid):
+ """ 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]) )))))
+
+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)
+ if m:
+ autom(*m.group(1,2,3))
+
+#print measurements
+
+panelids = range(0,8)
+
+pylab.figure(1)
+pylab.xlabel('Widerstand [Ohm]')
+pylab.ylabel('Leistung [W]')
+pylab.xscale('log', basex=10)
+pylab.yscale('log', basey=10)
+pylab.title("Leistungsanpassung")
+pylab.grid(True)
+for id in panelids:
+ try:
+ (r, p) = getm_rp(id)
+ except ValueError:
+ continue
+ pylab.plot(r,p, label=str(id))
+ pylab.hold(True)
+pylab.legend()
+
+pylab.show()