% Example of use of "solar" % May 2011, tested on MATLAB R2010A % Translated and improved by Thibaut Leroy (thibaut.leroy@gmail.com), % French solar car team Hlios (http://www.helioscar.com) % HEI (Hautes Etudes d'Ingnieur) engineering school Lille, France % Sunpower datasheets are property of Sunpower Corporation (http://us.sunpowercorp.com/) % Based on published code by Francisco M. Gonzlez-Longatt, % "Model of Photovoltaic Module in MatlabTM", % 2DO CONGRESO IBEROAMERICANO DE ESTUDIANTES DE INGENIERA ELCTRICA, ELECTRNICA Y COMPUTACIN (II CIBELEC 2005) function SimpleSolarCellAndPanelModel %Define Voltage Va = 0:0.01:1.665; figure('Color', 'w') subplot(2,1,1); %title('Suncase MX 60 240 cell current/voltage') hold on plot(Va, solar(Va,1,25), 'b-', 'LineWidth', 1) plot(Va, solar(Va,1,40), 'b--', 'LineWidth', 1) plot(Va, solar(Va,1,55), 'b-.', 'LineWidth', 1) plot(Va, solar(Va,1,70), 'b:', 'LineWidth', 1) ylim([0,Inf]); xlabel('Voltage [V]'); ylabel('Current [A]'); legend({'Model @ 1000W/m^2 / 25C', ... 'Model @ 1000W/m^2 / 40C', ... 'Model @ 1000W/m^2 / 55C', ... 'Model @ 1000W/m^2 / 70C'}, ... 'Location', 'SouthWest'); grid on subplot(2,1,2); title('Suncase MX 60 240 cell power/voltage') hold on plot(Va, Va.*solar(Va,1,25), 'b-', 'LineWidth', 1) plot(Va, Va.*solar(Va,0.75,40), 'b--', 'LineWidth', 1) plot(Va, Va.*solar(Va,0.5,55), 'b-.', 'LineWidth', 1) plot(Va, Va.*solar(Va,0.25,70), 'b:', 'LineWidth', 1) ylim([0,Inf]); xlabel('Voltage [V]'); ylabel('Power [W]'); legend({'Model @ 1000W/m^2 / 25C', ... 'Model @ 750W/m^2 / 40C', ... 'Model @ 500W/m^2 / 55C', ... 'Model @ 250W/m^2 / 70C'}, ... 'Location', 'NorthWest'); grid on % Panel computations Ns =60 ; % Number of cells serially connected in a panel []. See SunpowerA300PanelDatasheet.pdf Va0 = 0:0.01:0.68; % Voltage vector of one cell [V] Ia1 = solar(Va0,1,25); % Compute current from voltage vector [A] %Compute the new voltage (reverse X and Y cell's graph) for Ns cells %Do "interp1" to have a constant spaced vector %Do "coerce" to limit extrap values to positive values Va1 = max(Ns*interp1(Ia1, Va0, 0:0.001:ceil(max(Ia1)*100)/100, 'linear', 'extrap'), 0); Ia2 = solar(Va0,0.8,25); Va2 = max(Ns*interp1(Ia2, Va0, 0:0.001:ceil(max(Ia2)*100)/100, 'linear', 'extrap'), 0); Ia3 = solar(Va0,0.5,25); Va3 = max(Ns*interp1(Ia3, Va0, 0:0.001:ceil(max(Ia3)*100)/100, 'linear', 'extrap'), 0); Ia4 = solar(Va0,0.2,25); Va4 = max(Ns*interp1(Ia4, Va0, 0:0.001:ceil(max(Ia4)*100)/100, 'linear', 'extrap'), 0); figure('Color', 'w') subplot(2,1,1); %title('Suncase MX 60 240 panel current/voltage') hold on plot(Va1,0:0.001:ceil(max(Ia1)*100)/100, 'k') plot(Va2,0:0.001:ceil(max(Ia2)*100)/100, 'c') plot(Va3,0:0.001:ceil(max(Ia3)*100)/100, 'r') plot(Va4,0:0.001:ceil(max(Ia4)*100)/100, 'g') xlabel('Voltage [V]'); ylabel('Current [A]'); legend({'Model @ 1000W/m^2 / 25C' ... 'Model @ 800W/m^2 / 25C', ... 'Model @ 500W/m^2 / 25C', ... 'Model @ 200W/m^2 / 25C'}, ... 'Location', 'NorthWest'); grid on subplot(2,1,2); %title('Suncase MX 60 240 cell power/voltage') hold on plot(Ns*Va0,Ns*Va0.*Ia1, 'k') plot(Ns*Va0,Ns*Va0.*Ia2, 'c') plot(Ns*Va0,Ns*Va0.*Ia3, 'r') plot(Ns*Va0,Ns*Va0.*Ia4, 'g') ylim([0,Inf]); xlabel('Voltage [V]'); ylabel('Power [W]'); legend({'Model @ 1000W/m^2 / 25C' ... 'Model @ 800W/m^2 / 25C', ... 'Model @ 500W/m^2 / 25C', ... 'Model @ 200W/m^2 / 25C'}, ... 'Location', 'NorthWest'); grid on Ia5 = solar(Va0,1,0); Va5 = max(Ns*interp1(Ia5, Va0, 0:0.001:ceil(max(Ia5)*100)/100, 'linear', 'extrap'), 0); Ia6 = solar(Va0,1,10); Va6 = max(Ns*interp1(Ia6, Va0, 0:0.001:ceil(max(Ia6)*100)/100, 'linear', 'extrap'), 0); Ia7 = solar(Va0,1,20); Va7 = max(Ns*interp1(Ia7, Va0, 0:0.001:ceil(max(Ia7)*100)/100, 'linear', 'extrap'), 0); Ia8 = solar(Va0,1,30); Va8 = max(Ns*interp1(Ia8, Va0, 0:0.001:ceil(max(Ia8)*100)/100, 'linear', 'extrap'), 0); Ia9 = solar(Va0,1,40); Va9 = max(Ns*interp1(Ia9, Va0, 0:0.001:ceil(max(Ia9)*100)/100, 'linear', 'extrap'), 0); figure('Color', 'w') subplot(2,1,1); title('Suncase MX 60 240 panel current/voltage') hold on plot(Va5,0:0.001:ceil(max(Ia5)*100)/100, 'k') plot(Va6,0:0.001:ceil(max(Ia6)*100)/100, 'c') plot(Va7,0:0.001:ceil(max(Ia7)*100)/100, 'r') plot(Va8,0:0.001:ceil(max(Ia8)*100)/100, 'g') plot(Va9,0:0.001:ceil(max(Ia9)*100)/100, 'b') xlabel('Voltage [V]'); ylabel('Current [A]'); legend({'Model @ 1000W/m^2 / 0C' ... 'Model @ 1000W/m^2 / 10C', ... 'Model @ 1000W/m^2 / 20C', ... 'Model @ 1000W/m^2 / 30C', ... 'Model @ 1000W/m^2 / 40C'}, ... 'Location', 'NorthWest'); grid on subplot(2,1,2); title('Suncase MX 60 240 cell power/voltage') hold on plot(Ns*Va0,Ns*Va0.*Ia5, 'k') plot(Ns*Va0,Ns*Va0.*Ia6, 'c') plot(Ns*Va0,Ns*Va0.*Ia7, 'r') plot(Ns*Va0,Ns*Va0.*Ia8, 'g') plot(Ns*Va0,Ns*Va0.*Ia9, 'b') ylim([0,Inf]); xlabel('Voltage [V]'); ylabel('Power [W]'); legend({'Model @ 1000W/m^2 / 0C' ... 'Model @ 1000W/m^2 / 10C', ... 'Model @ 1000W/m^2 / 20C', ... 'Model @ 1000W/m^2 / 30C', ... 'Model @ 1000W/m^2 / 40C'}, ... 'Location', 'NorthWest'); grid on end