clc
clear
format short
BranchData = [
1 2 0.0922 0.0470;
2 3 0.4930 0.2511;
3 4 0.3660 0.1864;
4 5 0.3811 0.1941;
5 6 0.8190 0.7070;
6 7 0.1872 0.6188;
7 8 0.7114 0.2351;
8 9 1.0300 0.7400;
9 10 1.0440 0.7400;
10 11 0.1966 0.0650;
11 12 0.3744 0.1238;
12 13 1.4680 1.1550;
13 14 0.5416 0.7129;
14 15 0.5910 0.5260;
15 16 0.7463 0.5450;
16 17 1.2890 1.7210;
17 18 0.7320 0.5740;
2 19 0.1640 0.1565;
19 20 1.5042 1.3554;
20 21 0.4095 0.4784;
21 22 0.7089 0.9373;
3 23 0.4512 0.3083;
23 24 0.8980 0.7091;
24 25 0.8960 0.7011;
6 26 0.2030 0.1034;
26 27 0.2842 0.1447;
27 28 1.0590 0.9337;
28 29 0.8042 0.7006;
29 30 0.5075 0.2585;
30 31 0.9744 0.9630;
31 32 0.3105 0.3619;
32 33 0.3410 0.5302;
]; % 支路,阻抗
NodeData = [
NodeData1,NodeData2,NodeData3,NodeData4,NodeData5,NodeData6,...
NodeData7,NodeData8,NodeData9,NodeData10,NodeData11,NodeData12,...
NodeData13,NodeData14,NodeData15,NodeData16,NodeData17,NodeData18,...
NodeData19,NodeData20,NodeData21,NodeData22,NodeData23,NodeData24
]; % 节点,负荷
ESSrange = [ %本程序以储能充电作为正方向
1 17 200 80
2 33 200 80
3 30 150 50
4 14 150 50
]; %储能位置与充放电有功无功边界
UB = 12.66; % 电压基准 kV
SB = 10; % 功率基准 MVA
ZB = UB^2/SB; % 阻抗基准 ohm
BranchData(:,[3,4]) = BranchData(:,[3,4]) / ZB; % 阻抗标幺化
NodeData(:,[2,3]) = NodeData(:,[2,3]) / SB / 1000;% 功率标幺化
ESSrange(:,[3,4]) = ESSrange(:,[3,4]) / SB / 1000;% 储能功率标幺化
NodeData=NodeData(1,n);
NN=33;%节点数
Nzhilu=NN-1;%支路数
Ness=length(ESSrange(:,1));%储能数量
Pij=sdpvar(1,Nzhilu);
Qij=sdpvar(1,Nzhilu);
I2ij=sdpvar(1,Nzhilu);
V2ij=sdpvar(1,Nzhilu);
Pess=sdpvar(1,Ness);
Qess=sdpvar(1,Ness);
% l=sdpvar(1,1);
%目标函数
Objective=0;
for k=1:Nzhilu
Objective=Objective+I2ij(k)*BranchData(k,3);
end
%约束条件
Constraints=[];
%功率平衡约束
%分支节点编号2、3、6
%末端节点编号18、22、25、33
%有功约束
k=1;
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+Pij(18)+NodeData(k,2)];
k=2;
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+Pij(22)+NodeData(k,2)];
for k=3:4
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+NodeData(k,2)];
end
k=5;
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+Pij(25)+NodeData(k,2)];
for k=6:12
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+NodeData(k,2)];
end
k=13;
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+Pess(4)+NodeData(k,2)];
for k=14:15
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+NodeData(k,2)];
end
k=16;
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+Pess(1)+NodeData(k,2)];
% for k=6:16
% Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+NodeData(k,2)];
% end
k=17;
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==NodeData(k,2)];
for k=18:20
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+NodeData(k,2)];
end
k=21;
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==NodeData(k,2)];
for k=22:23
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+NodeData(k,2)];
end
k=24;
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==NodeData(k,2)];
for k=25:28
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+NodeData(k,2)];
end
k=29;
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+Pess(3)+NodeData(k,2)];
for k=30:31
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+NodeData(k,2)];
end
% for k=25:31
% Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==Pij(k+1)+NodeData(k,2)];
% end
k=32;
Constraints=[Constraints,Pij(k)-BranchData(k,3)*I2ij(k)==NodeData(k,2)+Pess(2)];
%无功约束
k=1;
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+Qij(18)+NodeData(k,3)];
k=2;
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+Qij(22)+NodeData(k,3)];
for k=3:4
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+NodeData(k,3)];
end
k=5;
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+Qij(25)+NodeData(k,3)];
for k=6:12
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+NodeData(k,3)];
end
k=13;
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+Qess(4)+NodeData(k,3)];
for k=14:15
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+NodeData(k,3)];
end
k=16;
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+Qess(1)+NodeData(k,3)];
% for k=6:16
% Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+NodeData(k,3)];
% end
k=17;
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==NodeData(k,3)];
for k=18:20
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+NodeData(k,3)];
end
k=21;
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==NodeData(k,3)];
for k=22:23
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+NodeData(k,3)];
end
k=24;
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==NodeData(k,3)];
for k=25:28
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+NodeData(k,3)];
end
k=29;
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+Qess(3)+NodeData(k,3)];
for k=30:31
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+NodeData(k,3)];
end
% for k=25:31
% Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==Qij(k+1)+NodeData(k,3)];
% end
k=32;
Constraints=[Constraints,Qij(k)-BranchData(k,4)*I2ij(k)==NodeData(k,3)+Qess(2)];
%二阶锥约束
%不等式约束
for k=1:Nzhilu
Constraints=[Constraints,1.05>=V2ij(k)>=0.95];
end
for k=1:Nzhilu
Constraints=[Constraints,I2ij(k)<=1];
end
for k=1:Ness
Constraints=[Constraints,ESSrange(k,3)>=Pess(k)>=-ESSrange(k,3),ESSrange(k,4)>=Qess(k)>=-ESSrange(k,4)];
end
%等式约束
k=1;
Constraints=[Constraints,V2ij(k)==1-2*(BranchData(k,3)*Pij(k)+BranchData(k,4)*Qij(k))+((BranchData(k,3))^2+(BranchData(k,4))^2)*I2ij(k)];
for k=2:17
Constraints=[Constraints,V2ij(k)==V2ij(k-1)-2*(BranchData(k,3)*Pij(k)+BranchData(k,4)*Qij(k))+((BranchData(k,3))^2+(BranchData(k,4))^2)*I2ij(k)];
end
k=18;
Constraints=[Constraints,V2ij(k)==V2ij(1)-2*(BranchData(k,3)*Pij(k)+BranchData(k,4)*Qij(k))+((BranchData(k,3))^2+(BranchData(k,4))^2)*I2ij(k)];
for k=19:21
Constraints=[Constraints,V2ij(k)==V2ij(k-1)-2*(BranchData(k,3)*Pij(k)+BranchData(k,4)*Qij(k))+((BranchData(k,3))^2+(BranchData(k,4))^2)*I2ij(k)];
end
k=22;
Constraints=[Constraints,V2ij(k)==V2ij(2)-2*(BranchData(k,3)*Pij(k)+BranchData(k,4)*Qij(k))+((BranchData(k,3))^2+(BranchData(k,4))^2)*I2ij(k)];
for k=23:24
Constraints=[Constraints,V2ij(k)==V2ij(k-1)-2*(BranchData(k,3)*Pij(k)+BranchData(k,4)*Qij(k))+((BranchData(k,3))^2+(BranchData(k,4))^2)*I2ij(k)];
end
k=25;
Constraints=[Constraints,V2ij(k)==V2
评论5