필터 지우기
필터 지우기

while executing a m-file it shows busy?

조회 수: 1 (최근 30일)
AKSHIT SAMADHIYA
AKSHIT SAMADHIYA 2016년 11월 3일
답변: Emircan Han 2017년 6월 30일
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
Adam
Adam 2016년 11월 3일
What is your question? Matlab always shows busy when it is busy. It's a feature.

댓글을 달려면 로그인하십시오.

채택된 답변

Anna Trofimova
Anna Trofimova 2016년 11월 3일
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
AKSHIT SAMADHIYA
AKSHIT SAMADHIYA 2016년 11월 3일
maam if u could suggest any solution. i have tried a lot
Steven Lord
Steven Lord 2016년 11월 3일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Emircan Han
Emircan Han 2017년 6월 30일
How did you solve this problem, i couldn't get it?

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by