フィルターのクリア

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 Center および File ExchangeApp Building についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by