summaryrefslogtreecommitdiff
path: root/tools/solarmeter/solarcells_p_r_graph.py
blob: aab38fad5d108b07118894f1a666e5b4af256b2f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#!/usr/bin/python2 -00
# -*- coding: utf-8 -*-

import numpy as np
import pylab

measurements={}

def addm(subject, r, u, i):
  """ Add Measurments to dict
    @param subject name of solarcell panel. each panel has 6 cells. each 3 are in series. "1b" means panel 1 and second series of three cells
    @param r load resistor
    @param u measured voltage in volts
    @param i remasured current in ampere
    """
  global measurements
  if not subject in measurements:
    measurements[subject]={}
  measurements[subject][r] = (u,i)

def getm_ui(subject):
  global measurements
  return zip(* map( lambda (r, ui): ui, sorted(measurements[subject].items()) ))

def getm_rp(subject):
  """ 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(* map( lambda (r, (u,i)): (u/i, u*i), sorted(measurements[subject].items()) ))

def getm_parallelAB_ui(panelnum):
  global measurements
  (uA, iA) = getm_ui(str(panelnum)+'a')
  (uB, iB) = getm_ui(str(panelnum)+'b')
  u_par = map(lambda us: sum(us)/2, zip(uA,uB))
  i_par = map(lambda (i1,i2): i1+i2, zip(iA,iB))
  return (u_par, i_par)

def getm_parallelAB_rp(panelnum):
  """ get measurements load over power with simulated parallel connection between xA and xB
      @panelnum number of panel
      @returns tuple of lists: (list(r values), list(p values))
    """
  (u_s, i_s) = getm_parallelAB_ui(panelnum)
  return zip(* map(lambda (u,i): (u/i, u*i), zip(u_s, i_s)))

subjects = [str(i)+c for i in range(1,7) for c in "ab"]

#### Measurements with 250W Baustellenstrahler ####
addm("2a", 120, 0.88, 7.4e-3)
addm("2b",120, 0.8, 6.6e-3)
addm("3a",120, 0.7, 5.8e-3)
addm("3b",120, 0.65, 5.4e-3)
addm("4a",120, 0.66, 5.5e-3)
addm("4b",120, 0.78, 6.6e-3)
addm("5a",120, 0.77, 6.5e-3)
addm("5b",120, 0.9, 7.8e-3)
addm("6a",120, 0.72, 6.0e-3)
addm("6b",120, 0.93, 7.8e-3)
addm("1a",120, 0.84, 7.1e-3)
addm("1a", 330, 2, 6.2e-3)
addm("1a", 1000, 4.58, 4.5e-3)
addm("1a", 4700, 6, 1.2e-3)
addm("1b",120, 0.74 , 6.2e-3)
addm("1b", 330, 1.8, 5.7e-3)
addm("1b", 1000, 4, 4e-3)
addm("1b", 4700, 4.3, 0.9e-3)
addm("2a", 330, 2.25, 6.9e-3)
addm("2a", 1000, 4.74, 4.7e-3)
addm("2a", 4700, 5.8, 1.2e-3)
addm("2b", 330, 2.17, 6.7e-3)
addm("2b", 1000, 3.95, 3.9e-3)
addm("2b", 4700, 4.6, 1.0e-3)
addm("3a", 330,  1.86, 5.7e-3)
addm("3a", 1000,4.75, 4.7e-3)
addm("3a", 4700, 5.8, 1.2e-3)
addm("3b", 330, 1.74, 5.3e-3)
addm("3b", 1000, 4.52, 4.6e-3)
addm("3b", 4700, 5.8, 1.2e-3)
addm("4a", 330, 1.81, 5.5e-3)
addm("4a", 1000, 4.98, 4.9e-3)
addm("4a", 4700, 5.8, 1.2e-3)
addm("4b", 330, 2.21, 6.5e-3)
addm("4b", 1000, 4.29, 4.2e-3)
addm("4b", 4700, 5.5, 1.2e-3)
addm("5a", 330, 2.1, 6.4e-3)
addm("5a", 1000, 4.0, 4.0e-3)
addm("5a", 4700, 4.7, 1e-3)
addm("5b", 330, 2.27, 7e-3)
addm("5b", 1000, 4.29, 4.3e-3)
addm("5b", 4700, 5.5, 1.2e-3)
addm("6a", 330, 1.69, 5.2e-3)
addm("6a", 1000, 3.61, 3.6e-3)
addm("6a", 4700, 3.9, 0.8e-3)
addm("6b", 330, 2, 6.2e-3)
addm("6b", 1000, 3.54, 3.5e-3)
addm("6b", 4700,4.2, 0.9e-3)
addm ('1a', 3300, 6.71, 2.0e-3)
addm ('1b', 3300, 4.8, 1.4e-3)
addm ('2a', 3300, 6.6, 1.9e-3)
addm ('2b', 3300, 5.1, 1.5e-3)
addm ('3a', 3300, 6.47, 1.9e-3)
addm ('3b', 3300, 6.45, 1.9e-3)
addm ('4a', 3300, 6.5, 1.9e-3)
addm ('4b', 3300, 6.02, 1.8e-3)
addm ('5a', 3300, 5.25, 1.5e-3)
addm ('5b', 3300, 6.05, 1.8e-3)
addm ('6a', 3300, 4.27, 1.2e-3)
addm ('6b', 3300, 4.62, 1.4e-3)
addm ('1a', 1500, 6.25, 4.1e-3)
addm ('1b', 1500, 4.72, 3.1e-3)
addm ('2a', 1500, 6.20, 4.1e-3)
addm ('2b', 1500, 4.80, 3.2e-3)
addm ('3a', 1500, 6.25, 4.1e-3)
addm ('3b', 1500, 6.28, 4.2e-3)
addm ('4a', 1500, 6.32, 4.2e-3)
addm ('4b', 1500, 5.68, 3.8e-3)
addm ('5a', 1500, 5.00, 3.3e-3)
addm ('5b', 1500, 5.67, 3.8e-3)
addm ('6a', 1500, 4.19, 2.8e-3)
addm ('6b', 1500, 4.36, 2.9e-3)
si = iter(subjects)
addm(si.next(), 2200, 6.60, 3e-3)
addm(si.next(), 2200, 4.57, 2.1e-3)
addm(si.next(), 2200, 6.17,2.8e-3)
addm(si.next(), 2200, 4.96, 2.2e-3)
addm(si.next(), 2200, 6.1, 2.8e-3)
addm(si.next(), 2200, 6.08, 2.75e-3)
addm(si.next(), 2200, 6.16, 2.8e-3)
addm(si.next(), 2200,5.77, 2.6e-3)
addm(si.next(), 2200, 5.0, 2.25e-3)
addm(si.next(), 2200, 5.75, 2.6e-3)
addm(si.next(), 2200, 4.05, 1.8e-3)
addm(si.next(), 2200, 4.34, 1.98e-3)
si = iter(subjects)
addm(si.next(), 1200, 5.6, 4.8e-3)
addm(si.next(), 1200, 4.2, 3.6e-3)
addm(si.next(), 1200, 5.5, 4.7e-3)
addm(si.next(), 1200, 4.4, 3.7e-3)
addm(si.next(), 1200, 5.8,5e-3)
addm(si.next(), 1200, 5.4, 4.6e-3)
addm(si.next(), 1200, 6.0, 5.1e-3)
addm(si.next(), 1200, 5.35, 4.5e-3)
addm(si.next(), 1200, 4.6, 3.9e-3)
addm(si.next(), 1200, 5.1, 4.3e-3)
addm(si.next(), 1200, 3.9, 3.3e-3)
addm(si.next(), 1200, 4, 3.4e-3)
addm("3a", 1800, 6.2, 3.4e-3)
addm("3b", 1800, 6, 3.3e-3)
addm("4a", 1800, 6.25, 3.5e-3)
addm("4b", 1800, 5.7, 3.2e-3)

#### Measurements with 1200W Halogen Scheinwerfer ####
addm("es3a", 1200, 6.7, 5.7e-3)
subjects_es = ["es"+str(i)+c for i in range(1,7) for c in "ab"]
esi = iter(subjects_es)
addm(esi.next(), 220, 3.8, 17.9e-3)
addm(esi.next(), 220, 3.2, 14.2e-3)
addm(esi.next(), 220, 3.7, 17.6e-3)
addm(esi.next(), 220, 3.6, 17.2e-3)
addm(esi.next(), 220, 3, 14.2e-3)
addm(esi.next(), 220, 3.2, 15.2e-3)
addm(esi.next(), 220, 3, 14e-3) #4a
addm(esi.next(), 220, 3.2, 15.2e-3) #4b
addm(esi.next(), 220, 3.8, 18e-3)
addm(esi.next(), 220, 3.5, 16.5e-3)
addm(esi.next(), 220, 2.7, 12.7e-3)
addm(esi.next(), 220, 3.4, 16.3e-3)

#~ esi = iter(subjects_es)
#~ addm(esi.next(), 220, 
#~ addm(esi.next(), 220,
#~ addm(esi.next(), 220,
#~ addm(esi.next(), 220,
#~ addm(esi.next(), 220,
#~ addm(esi.next(), 220,
#~ addm(esi.next(), 220,
#~ addm(esi.next(), 220,
#~ addm(esi.next(), 220,
#~ addm(esi.next(), 220,
#~ addm(esi.next(), 220,
#~ addm(esi.next(), 220,


#subjects = ["1a", "1b"]
#subjects.remove("1b")

pylab.figure(1)
pylab.xlabel('Spannung [U]')
pylab.ylabel('Strom [I]')
pylab.grid(True)
for subject in subjects:
  (u, i) = getm_ui(subject)
  pylab.plot(u,i, label=subject)
  pylab.hold(True)
pylab.legend()

pylab.figure(2)
pylab.xlabel('Widerstand [Ohm]')
pylab.ylabel('Leistung [W]')
pylab.xscale('log', basex=10)
pylab.yscale('log', basey=10)
pylab.grid(True)
for subject in subjects:
  (r, p) = getm_rp(subject)
  pylab.plot(r,p, label=subject)
  pylab.hold(True)
pylab.legend()

pylab.figure(3)
pylab.xlabel('Spannung [U]')
pylab.ylabel('Strom [I]')
pylab.grid(True)
for panelid in range(1,7):
  (u, i) = getm_parallelAB_ui(panelid)
  pylab.plot(u,i, label=str(panelid))
  pylab.hold(True)
pylab.legend()

pylab.figure(4)
pylab.xlabel('Widerstand [Ohm]')
pylab.ylabel('Leistung [W]')
pylab.xscale('log', basex=10)
pylab.yscale('log', basey=10)
pylab.grid(True)
for panelid in range(1,7):
  (r, p) = getm_parallelAB_rp(panelid)
  pylab.plot(r,p, label=str(panelid))
  pylab.hold(True)
pylab.legend()

pylab.show()