Ybusn(linedata)=
Columns 1 through 5
14.7752 - 6.4985i 0.0000 + 0.0000i 0.0000 + 0.0000i -14.7752 + 6.4985i 0.0000 + 0.0000i
0.0000 + 0.0000i 14.7752 - 6.4985i 0.0000 + 0.0000i 0.0000 + 0.0000i -14.7752 + 6.4985i
0.0000 + 0.0000i 0.0000 + 0.0000i 14.7752 - 6.4985i 0.0000 + 0.0000i 0.0000 + 0.0000i
-14.7752 + 6.4985i 0.0000 + 0.0000i 0.0000 + 0.0000i 26.1902 - 9.6810i -11.4150 + 3.1825i
0.0000 + 0.0000i -14.7752 + 6.4985i 0.0000 + 0.0000i -11.4150 + 3.1825i 37.6052 -12.8635i
0.0000 + 0.0000i 0.0000 + 0.0000i -14.7752 + 6.4985i 0.0000 + 0.0000i -11.4150 + 3.1825i
Column 6
0.0000 + 0.0000i
0.0000 + 0.0000i
-14.7752 + 6.4985i
0.0000 + 0.0000i
-11.4150 + 3.1825i
26.1902 - 9.6810i
phi =
0.9840 - 0.0134i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.9808 - 0.0125i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i 0.9795 - 0.0122i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.0000 - 0.0000i
C =
1.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 1.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 + 0.0000i
0.0000 + 0.0000i 0.0000 + 0.0000i 1.0000 + 0.0000i 0.0000 + 0.0000i
-0.4669 + 0.0010i -0.4669 + 0.0010i -0.4669 + 0.0010i -0.4669 + 0.0010i
-0.2139 - 0.0103i -0.2139 - 0.0103i -0.2139 - 0.0103i -0.2139 - 0.0103i
-0.3193 + 0.0093i -0.3193 + 0.0093i -0.3193 + 0.0093i -0.3193 + 0.0093i
Zbus=1/Ybus;
PG1=0.0923;
PG2=0.1368; %sau nay chinh lai de chon nut dieu chinh cong suat phat
PG3=0.0792;
Pgg=[PG1,PG2,PG3,1];
%tinh dong dien nhanh
e=ybusn(linedata);
linebranch=zeros(nbr,3);
Ig=phi*Pgg';
Ibus=C*Ig;
V=Zbus*Ibus;
for k=1:nbr
if nl(k)>0 && nr(k)>0
Ibranch(k)=abs(-(V(nl(k))-V(nr(k)))*e(nl(k),nr(k)));
end
end
Ibranch;
linebranch(:,1)=linedata(:,1);
linebranch(:,2)=linedata(:,2);
linebranch(:,3)=Ibranch';
disp([ ' nl nr |I|' ]);
disp([linebranch]);
%Kiem tra dong nhanh
nbr=length(linedata(:,1));
Imax=linedata(:,7);
flag=0;
niter=0;
n=0
while (flag==0&&niter<90)
for n=1:nbr
if linebranch(n)>Imax(n)
niter=niter+1;
PG2=PG2-0.001;
Pgg=[PG1,PG2,PG3,1];
Ig=phi*Pgg';
Ibus=C*Ig;
V=Zbus*Ibus;
for k=1:nbr
if nl(k)>0 && nr(k)>0
Ibranch(k)=abs(-(V(nl(k))-V(nr(k)))*e(nl(k),nr(k)));
end
end
else
flag=1;
end
end
end
Ibranch
I changed my new code. It work ok but the loop is not stop when Ibracnh<Imax.Please post your answer in a new answer let me know you online and answer you soon, don't post in comment.

4 件のコメント

Walter Roberson
Walter Roberson 2016 年 4 月 2 日
And without the code for "caculate again the Ibranch in branch"
Star Strider
Star Strider 2016 年 4 月 2 日
Please define these:
xfirst;
pop0;
popp=pop;
x0n;
Plossn; %buoc nay thuc hien de tinh duoc ma tran B
%nhap cong suat phat tung nut
Pgg=[0.0923,0.1368,0.0792,1];
%tinh dong dien nhanh
e=ybusn(linedata);
linebranch=zeros(nbr,3);
Ig=phi*Pgg';
Ibus=C*Ig;
V=Zbus*Ibus;
Please also define any other constants necessary to run your code.
Quynh tran
Quynh tran 2016 年 4 月 2 日
I got it
Rena Berman
Rena Berman 2017 年 1 月 20 日
(Answers Dev) Restored Question.

サインインしてコメントする。

 採用された回答

Kuifeng
Kuifeng 2016 年 4 月 2 日
編集済み: Walter Roberson 2016 年 4 月 2 日

0 投票

i think maybe your loop never finishes.... endlesss loop in the 'Ibranch'
k = 1;
while k<=nbr % k run in the number of branch
while Ibranch(k)>Imax(k) %to check Ibranh in each of branch
PG2=PG2-0.001;
Pgg=[0.0923,PG2,0.0792,1];
V=Zbus*(C*(phi*Pgg'));
k=k+1;
% caculate again the Ibranch in branch;
end
end

1 件のコメント

Quynh tran
Quynh tran 2016 年 4 月 2 日
Many thanks for your answer. I tried as you talk, with your code, it even not work and freezing the program.

サインインしてコメントする。

その他の回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 4 月 2 日

0 投票

Your code has
while Ibranch(k)>Imax(k) %to check Ibranh in each of branch
but inside the "while" you do not appear to change Ibranch or Imax or k. If the condition becomes true once, then it appears that you are going to get an infinite loop.
However, you do have the line of code
caculate again the Ibranch in branch;
which, due to MATLAB's command / function equivalence, would be the same as calling
calculate('again', 'the', 'Ibranch', 'in', 'branch')
and we have no information about any function named "calculate" or how that function is going to modify Ibranch or Imax . It could happen. It just looks unlikely.

5 件のコメント

Quynh tran
Quynh tran 2016 年 4 月 2 日
thanks for your contribution. I changed my code to make it more clear.
Walter Roberson
Walter Roberson 2016 年 4 月 2 日
while k=1:nbr is not valid code.
Be careful: you appear to have an outer loop in "k" and also an inner loop in "k".
Quynh tran
Quynh tran 2016 年 4 月 2 日
I up my new code, with this code, I can run it very ok. But it only one times change the value of PG2 and Ibranch>Imax. I still don't know the way to change it.
Walter Roberson
Walter Roberson 2016 年 4 月 2 日
Your current posted code has an outer loop of "for k=1:nbr " and also has that as an inner loop. If you need an inner loop then you must use a different variable name for the index.
Quynh tran
Quynh tran 2016 年 4 月 2 日
as you talk, I change my variable name. But have a new problem, that is the loop is not stop, it run enough niterloop even when the the Ibranch<Imax

サインインしてコメントする。

Quynh tran
Quynh tran 2016 年 4 月 3 日

0 投票

do you have any correct?

カテゴリ

ヘルプ センター および File ExchangeStartup and Shutdown についてさらに検索

タグ

タグが未入力です。

質問済み:

2016 年 4 月 2 日

コメント済み:

2017 年 1 月 20 日

Community Treasure Hunt

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

Start Hunting!

Translated by