电力系统分析实验--短路计算

2019-04-14 12:29发布

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)%高斯消去法 %时间复杂度(n-1)*(n-2)*(n-2) nbus = length(Y(1,:)); nr = length(retain); nlist = 1:nbus;%nlist保存该消去而尚未消去的节点 qlist = nlist;%qlist为除保留节点外的所有节点集合 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) = [];%把消去的节点从nlist中删去 Yt = Yn; for p = nlist for q = nlist %P70 (4-14)公式 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); %save yd yd 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)%判断节点n、m是否有支路直接连接 Y(n,m) = Y(n,m)-yd(h,3); Y(m,n) = Y(n,m); end end %计算节点导纳矩阵的对角元素 h = find(yd(:,1:2)==n);%找出与节点n有支路直接连接的所有支路的导纳 [h1,~] = ind2sub([size(yd(:,1)),2],h); Y(n,n) = sum(yd(h1,3)); end end