while executing a m-file it shows busy?
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
AKSHIT SAMADHIYA
am 3 Nov. 2016
Beantwortet: Emircan Han
am 30 Jun. 2017
I am working on PV Cell modelling. I came across a matlab code and while running the m file it shows busy.
clc;
clear all;
T=25+273;
Tn=25+273;
dT=T-Tn;
G=800;
Gn=1000;
Imp=7.61;
Vmp=26.3;
Iscn=8.21;
Vocn=32.9;
Pmaxe=Vmp*Imp;
Kv=-0.1230;
Ki=0.0032;
Ns=54;
k=1.38065e-23;
q=1.602e-19;
a=1.3;
Vtn=k*Tn/q;
Vt=k*T/q;
Rpmin=(Vmp/(Iscn-Imp))-((Vocn-Vmp)/Imp);
Rp=Rpmin;
Rs=0;
Io=(Iscn+(Ki*dT))/((exp((Vocn+(Kv*dT))/a*Vt))-1);
P=(0);
err=inf;
tol=0.01;
while(err>tol)
Ipvn=(((Rs+Rp)/Rp))*Iscn;
Ipv=(Ipvn+(Ki*dT))*(G/Gn);
Isc=(Iscn+(Ki*dT))*(G/Gn);
Rs=Rs+0.01;
b=exp(((Vmp+(Imp*Rs))*q)/(Ns*a*k*T));
Rp=(Vmp+(Imp*Rs))/((Vmp*Ipv)-(Vmp*Io*b)+(Vmp*Io)-Pmaxe);
clear V
clear I
V=0:0.1:50;
I=zeros(1,size(V,2));
g=zeros(1,size(V,2));
glin=zeros(1,size(V,2));
I_=zeros(1,size(V,2));
for j=1:size(V,2)
g(j)=Ipv-(Io*exp(V(j)+(Rs*I(j)))/(Vt*a*Ns))+Io-((V(j)+(Rs*I(j)))/Rp)-I(j);
while(abs(g(j))>0.001)
g(j)=Ipv-(Io*exp(V(j)+(Rs*I(j)))/(Vt*a*Ns))+Io-((V(j)+(Rs*I(j)))/Rp)-I(j);
glin(j)=-(Io*exp((V(j)+(Rs*I(j)))/(Vt*a*Ns))*Rs/(Vt*a*Ns))-(Rs/Rp)-1;
I_(j)=I(j)-(g(j)/glin(j));
I(j)=I_(j);
end
end
P=(Ipv-(Io*exp((V+(I.*Rs))/(Vt*a*Ns)))+Io-((V+(I.*Rs))/Rp)).*V;
Pmax=max(P);
err=(Pmax-Pmaxe);
end
fprintf('Model info:-\n');
fprintf('Rp=%f',Rp);
fprintf('Rs=%f',Rs);
fprintf('Pmax=%f',Pmax);
1 Kommentar
Adam
am 3 Nov. 2016
What is your question? Matlab always shows busy when it is busy. It's a feature.
Akzeptierte Antwort
Anna Trofimova
am 3 Nov. 2016
It is getting in stuck while performing while loop inside for loop ( while(abs(g(j))>0.001)). Check your code for mistakes, because there are situations when (abs(g(j))>0.001) cannot be false.
2 Kommentare
Steven Lord
am 3 Nov. 2016
Add a counter that you increment each time through your while loop. Include in your while condition both a check on the value of g(j) and a check that the counter is not too large. After the while loop, if the counter is too large you didn't converse and you can handle that case appropriately.
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!