-
Notifications
You must be signed in to change notification settings - Fork 3
/
Photowatt-DDM.txt
77 lines (74 loc) · 1.96 KB
/
Photowatt-DDM.txt
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
Constants
N = 25;// number of measures
// Data for output voltage in V
VD[N] = (0.1248;
1.8093;
3.3511;
4.7622;
6.0538;
7.2364;
8.3189;
9.3097;
10.2163;
11.0449;
11.8018;
12.4929;
13.1231;
13.6983;
14.2221;
14.6995;
15.1346;
15.5311;
15.8929;
16.2229;
16.5241;
16.7987;
17.0499;
17.2793;
17.4885);
// Data for output current in A
ID[N] = (1.0315;
1.03;
1.026;
1.022;
1.018;
1.0155;
1.014;
1.01;
1.0035;
0.988;
0.963;
0.9255;
0.8725;
0.8075;
0.7265;
0.6345;
0.5345;
0.4275;
0.3185;
0.2085;
0.101;
-0.008;
-0.111;
-0.209;
-0.303);
k = 1.3806503e-23;// Boltzmann constant in J/K
T = 45 + 273.15;// Cell temperature in K
q = 1.60217646e-19;// Magnitude of charge on an electron in C
Variables
Iph in [0,2]; // Photo-generated current in A
I01 in [0,50]; // Reverse saturation current in uA
I02 in [0,50]; // Reverse saturation current in uA
n1 in [1,50]; // Diode ideality factor
n2 in [1,50]; // Diode ideality factor
Rs in [0,2]; // Series resistance in ohm
Rp in [0,20]; // Shunt resistance in hundred-ohm
// single diode model (SDM)
function model_ddm(V, I, Iph, I01, I02, n1, n2, Rs, Rp)
tmp = V+ I*Rs;
c = k*T/q;
return Iph - I01*1e-6*(exp(tmp/(n1*c)) - 1) - I02*1e-6*(exp(tmp/(n2*c)) - 1) - tmp/(100*Rp);
end
// minimize the SSE
Minimize
sum(i = 1:N, (ID(i) - model_ddm(VD(i),ID(i), Iph, I01, I02, n1, n2, Rs, Rp))^2);