资源简介
电力系统使用图论方法进行潮流追踪的MATLAB程序
代码片段和文件信息
function GraphTheory(APGPn_branchn_genn_busFee)
%% 生成节点 进出节点集
for i = 1:n_branch
if AP(i3)<0
a = AP(i3);
AP(i3) = AP(i4);
AP(i4)= a;
b = AP(i1);
AP(i1) = AP(i2);
AP(i2)= b;
end
end
AP = abs(AP);
for i = 1:n_branch
AP(i 4) = abs(AP(i 4));
end
for i = 1:n_bus
Node(i).inNodeSET = [];
Node(i).outNodeSET = [];
end
for i = 1:n_branch
for j = 1:n_branch
if AP(j2) == i
Node(i).inNodeSET = [ Node(i).inNodeSET AP(j1)];
end
end
end
for i = 1:n_branch
for j = 1:n_branch
if AP(j1) == i
Node(i).outNodeSET = [ Node(i).outNodeSET AP(j2)];
end
end
end
%% 屏显节点的进出节点集
for i = 1:n_bus
fprintf(‘%d‘i);
fprintf(‘号节点的进出节点集为:\n‘);
disp(Node(i));
end
%% main 循环
result = zeros(n_genn_branch);
Result = zeros(n_genn_branch);
for j = 1 : n_bus-1
% 找出0进线节点
for i = 1 : n_bus
if( isempty(Node(i).inNodeSET))
nowNode = i;
break
end
end
temp = sum (GP(:nowNode));
temp_result = GP(:nowNode)/sum (GP(:nowNode));
temp1 = Node(nowNode).outNodeSET;
for ii = 1: length(temp1)
for ii1 = 1:n_branch
if AP(ii11)== nowNode && AP(ii12) == temp1(ii)
result(:ii1) = temp_result;
end
end
end
% temp1(ii) 为 nowNode的出节点
for ii = 1: length(temp1)
for ii1 = 1:n_branch
if AP(ii11)== nowNode && AP(ii1 2) == temp1(ii)
GP(:temp1(ii)) = GP(:temp1(ii)) + GP(:nowNode)*(AP(ii14)/temp);
end
end
% 从 nowNode的出节点的进线集中删除当前节点
if length(Node(temp1(ii)).inNodeSET) == 1
Node(temp1(ii)).inNodeSET = [];
else
for ii2 = 1: length(Node(temp1(ii)).inNodeSET)
if Node(temp1(ii)).inNodeSET(ii2) == nowNode
Node(temp1(ii)).inNodeSET(ii2)= [];
break
end
end
end
end
% 将当前节点 排除
Node(nowNode).inNodeSET = [-1];
end
for i=1:n_branch
Result(:i)=result(:i)*Fee(1i);
end
disp(‘使用图论方法求得的利用份额结果为:‘);
disp(result);
disp(‘使用图论方法求得的输电费用分摊结果为:‘)
disp(Result);
end
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2486 2015-02-13 17:42 PowerTrace\GraphTheory.m
文件 98 2015-02-13 17:42 PowerTrace\mainPT.m
文件 391 2015-02-13 17:41 PowerTrace\Pbus5.m
文件 55644 2015-02-13 18:10 PowerTrace\潮流追踪结果.png
目录 0 2015-03-10 20:21 PowerTrace
----------- --------- ---------- ----- ----
58619 5
评论
共有 条评论