class="markdown_views prism-atom-one-light">
程序要求根据已知的电力网的数学模型(节点导纳矩阵)及故障点位置,完成该电力系统的对称短路计算,要求计算出短路电流、短路功率等参数。
function Yshortcircuit(Y)
if nargin<1
xd = [
0 1 0.15j;
0 2 0.08j;
4 0 0.175j;
1 3 0.12j;
2 4 0.08j;
3 4 0.07259j];
Y = Xd2Ybus(xd);
end
slbus = input('请输入短路节点(默认为3):');
if isempty(slbus)
slbus = 3;
end
Sb = input('请输入基准功率(默认为60)MV·A:');
if isempty(Sb)
Sb = 60;
end
Uav = input('请输入节点%d的平均额定电压(默认为115)kV:');
if isempty(Uav)
Uav = 115;
end
nbus = length(Y(:,1));
Is = zeros(nbus,1);
Yn = gauss(Y,slbus);
Yij = Yn(slbus,slbus);
Is = -1*Yij;
fprintf('短路节点%d起始次暂态电流标幺值:',slbus);
disp(abs(Is));
fprintf('短路节点%d起始次暂态电流有名值(kA):',slbus);
disp(abs(Is*Sb/3^0.5/Uav));
fprintf('节点%d短路时的短路功率为(MV·A):',slbus);
disp(abs(Is*Sb));
end
function Yn = gauss(Y,retain)%高斯消去法
nbus = length(Y(1,:));
nr = length(retain);
nlist = 1:nbus;
qlist = nlist;
for n = 1:nr
temp = find(qlist == retain(n));
qlist(temp) = [];
end
Yn = Y;
for n = 1:length(qlist)
qb = qlist(n);
temp = find(nlist==qb);
nlist(temp) = [];
Yt = Yn;
for p = nlist
for q = nlist
Yt(p,q) = Yn(p,q)-Yn(p,qb)*Yn(qb,q)/Yn(qb,qb);
end
end
Yt(qb,:) = zeros(1,nbus);
Yt(:,qb) = zeros(nbus,1);
Yn = Yt;
end
end
function Y = Xd2Ybus(xd)
yd = xd;
yd(:,3) = 1./xd(:,3);
nbus = max(max(yd(:,1:2)));
Y = zeros(nbus);
for n = 1:nbus
for m = 1:n-1
h1 = find(yd(:,1)==m);
h2 = find(yd(:,2)==n);
h = intersect(h1,h2);
if ~isempty(h)
Y(n,m) = Y(n,m)-yd(h,3);
Y(m,n) = Y(n,m);
end
end
h = find(yd(:,1:2)==n);
[h1,~] = ind2sub([size(yd(:,1)),2],h);
Y(n,n) = sum(yd(h1,3));
end
end