Azzera filtri
Azzera filtri

number of element are not equal

1 visualizzazione (ultimi 30 giorni)
Samer Husam
Samer Husam il 15 Ott 2012
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

Risposta accettata

Azzi Abdelmalek
Azzi Abdelmalek il 15 Ott 2012
Modificato: Azzi Abdelmalek il 15 Ott 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
  2 Commenti
Samer Husam
Samer Husam il 15 Ott 2012
so do suggested to set : i = 1:N ?
Samer Husam
Samer Husam il 15 Ott 2012
its really works... thanks

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by