find optimal value of LOADDATA(:,3) finding variable x at any row so as to miminize TPL.500<x<3000 For example x is shown in 2nd row of LOADDATA matrix comment.Note that x can be at any row modifying LOADDATA(:,3).Can i use optimization tool box.How?

1 view (last 30 days)
clear all
clc
tic
format short
bmva=100;
bkv=12.66;
LOADDATA=[...
%Node PL(kW) QL(kVAR)
1 0 0
2 100 60 %60-x
3 90 40
4 120 80
5 60 30
6 60 20
7 200 100
8 200 100
9 60 20
10 60 20
11 45 30
12 60 35
13 60 35
14 120 80
15 60 10
16 60 20
17 60 20
18 90 40
19 90 40
20 90 40
21 90 40
22 90 40
23 90 50
24 420 200
25 420 200
26 60 25
27 60 25
28 60 20
29 120 70
30 200 600
31 150 70
32 210 100
33 60 40];
LINEDATA=[...
%ln SN RN R X
1 1 2 0.0922 0.0470
2 2 3 0.4930 0.2511
3 3 4 0.3660 0.1864
4 4 5 0.3811 0.1941
5 5 6 0.8190 0.7070
6 6 7 0.1872 0.6188
7 7 8 1.7114 1.2351
8 8 9 1.0300 0.7400
9 9 10 1.0440 0.7400
10 10 11 0.1966 0.0650
11 11 12 0.3744 0.1238
12 12 13 1.4680 1.1550
13 13 14 0.5416 0.7129
14 14 15 0.5910 0.5260
15 15 16 0.7463 0.5450
16 16 17 1.2890 1.7210
17 17 18 0.7320 0.5740
18 2 19 0.1640 0.1565
19 19 20 1.5042 1.3554
20 20 21 0.4095 0.4784
21 21 22 0.7089 0.9373
22 3 23 0.4512 0.3083
23 23 24 0.8980 0.7091
24 24 25 0.8960 0.7011
25 6 26 0.2030 0.1034
26 26 27 0.2842 0.1447
27 27 28 1.0590 0.933
28 28 29 0.8042 0.7006
29 29 30 0.5075 0.2585
30 30 31 0.9744 0.9630
31 31 32 0.3105 0.3619
32 32 33 0.3410 0.5302];
R=LINEDATA(:,4);
X=LINEDATA(:,5);
Rpu=(R.*bmva)/((bkv)^2); %changing to pu values
Xpu=(X.*bmva)/((bkv)^2);
Zpu=Rpu+sqrt(-1)*Xpu;
PL=(LOADDATA(:,2))/(bmva*1000);
QL=(LOADDATA(:,3))/(bmva*1000);
SL=PL+sqrt(-1)*QL;
ln=max(LINEDATA(:,1));
tn=ln+1;
sn=LINEDATA(:,2);
rn=LINEDATA(:,3);
%%% Forming BIBC Matrix %%%
BIBC=zeros(ln,ln);
for j=1:ln
BIBC(:,rn(j))=BIBC(:,sn(j));
BIBC(j,rn(j))=1;
%BIBC(j,j)=1;
end
BIBC(:,1)=[];
BIBC;
BCBV=zeros(ln,ln);
for h=1:ln
BCBV(rn(h),:)=BCBV(sn(h),:);
BCBV(rn(h),h)=Zpu(h,1);
end
BCBV(1,:)=[];
BCBV;
DLF=BCBV*BIBC;
iter=0;
V=ones(tn,1);
Vnew=ones(tn,1);
DV=ones(tn,1);
IL=zeros(tn,1);
while max(DV)>=0.0001 && iter<1000
for j=1:tn
IL(j)=conj(SL(j)/V(j)); %current at each node i.e from 1
end
IL(1,:)=[]; %deleting 1st row
dv=DLF*IL;
for k=1:ln
V(rn(k))=V(1)-dv(k);
end
DV=abs(Vnew-V);
Vnew=V;
iter=iter+1;
end
V;
vol=abs(V);
IL;
IBR=BIBC*IL;
for k=1:tn-1
LP(k)=((abs(IBR(k)))^2)*Rpu(k); %losses in branch
LQ(k)=((abs(IBR(k)))^2)*Xpu(k);
end
LP1=LP';
TPL=sum(LP)*(bmva*1000)
% total P loss base mva=100
TQL=sum(LQ)*(bmva*1000); % total Q loss
%end
%end
toc;
iter

Answers (0)

Community Treasure Hunt

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

Start Hunting!