From e4243718126891cd607dabf7405c0e987b4670d8 Mon Sep 17 00:00:00 2001 From: Bernhard Tittelbach Date: Sat, 10 Dec 2011 18:42:59 +0000 Subject: solarmeter poti sweep git-svn-id: https://svn.spreadspace.org/mur.sat@217 7de4ea59-55d0-425e-a1af-a3118ea81d4c --- tools/solarmeter/solarmeter_plot.py | 59 +++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100755 tools/solarmeter/solarmeter_plot.py (limited to 'tools/solarmeter/solarmeter_plot.py') 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() -- cgit v1.2.3