前推回代潮流计算程序
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
function Flow1(Z,S,Sb,Vb)
% Z 各支路阻抗
% S 各节点运算负荷
% Sb 基准功率
% Zb 基准阻抗
% Flow(Z,S,Sb,Vb) 计算网络功率及电压分布
% 输出收敛迭代次数及功率分布和电压分布
% 数据初始化
Z(:,1)=Z(:,1)+1;
Z1=[1,0,1,0];
Z=[Z1;Z];%使得支路编号与支路末点编号一致
[m,n]=size(Z);
Zb=(Vb^2)/Sb*1000;
Z(:,4)=Z(:,4)/Zb;
S(:,2)=S(:,2)/Sb;
k=1;
V=ones(m,1);
dU=ones(m,1);
%前推回代
n=0;
while max(abs(dU))>10^-4
Sr=S(:,2);
V1=V;
for i=m:-1:1 %前推功率
A=(find(Z(:,2)==i));%求以i节点为始点的各支路
[b,c]=size(A);
if b~=0
for j=1:1:b %求以当前节点为始点的各支路功率总和
N=A(j,1);
if N~=6
dSr=((abs(Sr(N,1))/V(N,1))^2)*Z(N,4); %各支路功率损耗else
dSr=0;
end
Sr(N,2)=Sr(N,1)+dSr; %N支路功率
Sr(i,1)=Sr(i,1)+Sr(N,2);
end
else
Sr(i,2)=Sr(i,1);
end
end
V(1,1)=1;
for t=2:m %回代电压
if t~=6
a=Z(t,2); %由于是辐射型网络,只有一个始点
dV1=(real(Sr(t,2))*real(Z(t,4))+imag(Sr(t,2))*imag(Z(t,4)))/V(a,1);
dV2=(real(Sr(t,2))*imag(Z(t,4))-imag(Sr(t,2))*real(Z(t,4)))/V(a,1);
V(t,1)=((V(a,1)-dV1)^2+dV2^2)^0.5 ;
else
dk=k*(V(5,1)/V1(5,1)-1)
k=k-dk
if k>=1.1
k=1.1;
elseif k<=0.9
k=0.9;
else
%k=vpa(k,3);
k=round(k*100)/100
end
k
V(6,1)=k*V(5,1);
end
end
dU=V-V1;
n=n+1;
if n>15
fprintf('迭代15次不收!\n');
break;
end
end
%输出
a=1:1:m;%编号
fprintf('迭代收敛次数为:\n');
n
fprintf('网络功率分布为:\n');
Sr(:,2)=Sr(:,2)*Sb;
Sr=[a',Sr]
fprintf('网络电压分布为:\n');
%V=V*Vb;
V=[a',V]
clc
clear all;
Z2=[
1, 1, 2, 1.197+j*0.82 ;
2, 2, 3, 1.796+j*1.231;
3, 3, 4, 1.306+j*0.895;
4, 4, 5, 1.851+j*1.268;
5, 5, 6, 1.524+j*1.044;
6, 6, 7, 1.905+j*1.305;
7, 7, 8, 1.197+j*0.82 ;
8, 8, 9, 0.653+j*0.447;
9, 9, 10, 1.143+j*0.783;
10, 4, 11, 2.823+j*1.172;
11, 11, 12, 1.184+j*0.491;
12, 12, 13, 1.002+j*0.416;
13, 13, 14, 0.455+j*0.189;
14, 14, 15, 0.546+j*0.227;
15, 5, 16, 2.55+j*1.058;
16, 6, 17, 1.366+j*0.567;
17, 17, 18, 0.819+j*0.34 ;
18, 18, 19, 1.548+j*0.642;
19, 19, 20, 1.368+j*0.567;
20, 20, 21, 3.552+j*1.474;
21, 7, 22, 1.548+j*0.642;
22, 22, 23, 1.092+j*0.453;
23, 23, 24, 0.91+j*0.378;
24, 24, 25, 0.455+j*0.189;
25, 25, 26, 0.364+j*0.151;
26, 8, 27, 1.002+j*0.417;
27, 27, 28, 4.403+j*1.215; ];
S2=[
1, 0;
2, 35.28;
3, 14;
4, 35.28;
5, 14;
6, 35.28;
7, 35.28;
8, 35.28;
9, 14;
10, 14;
11, 56;
12, 35.28;
13, 35.28;
14, 14;
15, 35.28;
16, 35.28;
17, 8.96;
18, 8.96;
19, 35.28;
20, 35.28;
21, 14;
22, 35.28;
23, 8.96;