-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathphotovoltaic_SD_sse_.mbx
43 lines (32 loc) · 1.38 KB
/
photovoltaic_SD_sse_.mbx
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
constants
N = 26; // number of measures
// Data for output voltage in V
Vl[N] = (-0.2057; -0.1291; -0.0588; 0.0057; 0.0646; 0.1185; 0.1678; 0.2132; 0.2545; 0.2924; 0.3269; 0.3585; 0.3873; 0.4137; 0.4373; 0.459; 0.4784; 0.496; 0.5119; 0.5265; 0.5398; 0.5521; 0.5633; 0.5736; 0.5833; 0.59);
// Data for output current in A
I[N] = (0.764; 0.762; 0.7605; 0.7605; 0.76; 0.759; 0.757; 0.757; 0.7555; 0.754; 0.7505; 0.7465; 0.7385; 0.728; 0.7065; 0.6755; 0.632; 0.573; 0.499; 0.413; 0.3165; 0.212; 0.1035; -0.01; -0.123; -0.21);
k = 1.3806503*1e-23; // Boltzmann constant in J/K
T = 33+273; // Cell temperature in K
q = 1.60217646*1e-19; // Magnitude of charge on an electron in C
variables
Iph in [0,1]; // Photo-generated current in A
Isd in [0,1]; // Reverse saturation current in uA
Rs in [0,0.5]; // Series resistance in ohm
Rsh in [0,1]; // Shunt resistance in ohm
n in [1,2]; // Diode ideality factor
//Id_ in [-1e12,1e12];
//Ish_ in [-1e12,1e12];
function Id(VL,IL,Isd,Rs,n)
return Isd*1e-6*(exp(q*(VL+Rs*IL)/(n*k*T))-1)
end
function Ish(VL,IL,Rs,Rsh)
return (VL+Rs*IL)/(1e2*Rsh)
end
function fIL(VL,IL,n,Iph,Isd,Rs,Rsh)
return Iph - Id(VL,IL,Isd,Rs,n)-Ish(VL,IL,Rs,Rsh)
end
//function fIL(VL,IL,n,Iph,Isd,Rs,Rsh)
// return Iph - Isd*1e-6*(exp(q*(VL+Rs*IL)/(n*k*T))-1)-(VL+Rs*IL)/(1e2*Rsh)
//end
minimize sum(i=0:N-1,
(I[i] - fIL(Vl[i],I[i],n,Iph,Isd,Rs,Rsh))^2
);