number of element are not equal
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi all; I am trying to predict the output of solar module by using the code below:
% Va = module operating voltage (V)
% Ia = module operating current (A)
%-----MANUFACTURER'S DATA-----
VOC=21; %open circuit voltage (V)
ISC=7.7; %short circuit current (A)
VM1=16.9; %reference voltage for maximum power
IM1=7.1; %reference current for maximum power
T1=298; %reference temperature (K)
G1=1000; %reference irradiance (W/m^2)
NS=36; %number of cells per module
AM0=0.974; %area of one module (m^2)
mi=0.0025; %temperature coefficient for short circuit current (A/K)
%-----CELL PARAMETERS-----
EG=1.124; %energy gap (eV)
A=1.3; %ideality factor
k=1.38*10^-23; %Boltzmann's constant (J/K)
q=1.6*10^-19; %charge of electron (C)
n=1.2; % diode quality factor
h=VOC/1000; %setting increment
Va=0:h:VOC; %range of I with increment h
%-----------input variable-----------
TaC=input('Temprature (C): '); % ambiant temperature (c)
G=input('Irradiance (W/m2): '); % solar irradiance (W/m2)
TaK=273+TaC; % ambiant temperature Kelvin
IL_T1 = ISC * (G/G1); % Ecuacion (3)
IL = IL_T1 + mi*(TaK - T1); % Ecuacion (2)
I0_T1=ISC/(exp(q*VOC/(n*k*T1))-1); % reference saturation current
I0= I0_T1*(TaK/T1).^(3/n).*exp(-q*EG/(n*k).*((1./TaK)-(1/T1))); % saturation current
Xv = I0_T1*q/(n*k*T1) * exp(q*VOC/(n*k*T1)); % Ecuacion (8)
dVdI_Voc = - 1.15/NS / 2; % dV / dI at Voc
Rs = - dVdI_Voc - 1/Xv; % Ecuacion (7)
VT = A * k * TaK / q; % Thermal voltage (V)
Vc = Va/NS; % Cell voltage [Va is the output voltage]
N=length(Va); %number of data points
Ia(N)=0; %setting final value of V
for i=1:(N-1)
Ia(i) = Ia - (IL - Ia - I0.*( exp((Vc(i)+Ia.*Rs)./VT) -1))/(-1 - (I0.*( exp((Vc(i)+Ia.*Rs)./VT) -1)).*Rs./VT);
end
figure (1)
plot (Va,Ia), xlabel('Voltage (V)'), ylabel('Current (A)');
but I get this error:
??? In an assignment A(I) = B, the number of elements in B and I must be the same.
how to overcome this error ??? please advice.. thanks
1 commentaire
Walter Roberson
le 15 Oct 2012
Please read the guide to tags and add tags that have more useful meanings; see http://www.mathworks.co.uk/matlabcentral/answers/43073-a-guide-to-tags
Réponse acceptée
Azzi Abdelmalek
le 15 Oct 2012
Modifié(e) : Azzi Abdelmalek
le 15 Oct 2012
use * instead of .* , the problem is in your last for loop
for i=1:(N-1)
Ia(i) = Ia - (IL - Ia - I0.*( exp((Vc(i)+Ia.*Rs)./VT) -1))/(-1 - (I0.*( exp((Vc(i)+Ia.*Rs)./VT) -1)).*Rs./VT);
end
also you set Ia(N), i=N-1:-1:1 was expected
corrected code
Ia(N)=0;
for i=N-1:-1:1
Ia(i) = Ia(i+1) - (IL - Ia(i+1) - I0*( exp((Vc(i)+Ia(i+1)*Rs)/VT) -1))/(-1 - (I0*( exp((Vc(i)+Ia(i+1)*Rs)/VT) -1))*Rs/VT);
end
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Sources dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!