IEEE13节点用高斯赛德尔法求解潮流matlab代码
时间: 2023-12-22 12:04:36 浏览: 95
以下是一个使用高斯赛德尔法求解IEEE 13节点潮流的Matlab代码示例:
```
% 定义节点和支路参数
Z = [0.2084+0.4385i,-0.0765-0.1531i,0.0,0.0,0.0,0.0,0.0,0.0,0.0;
-0.0765-0.1531i,0.3163+0.6645i,-0.0719-0.1441i,0.0,0.0,0.0,0.0,0.0,0.0;
0.0,-0.0719-0.1441i,0.1741+0.3685i,-0.0378-0.0757i,0.0,0.0,0.0,0.0,0.0;
0.0,0.0,-0.0378-0.0757i,0.1228+0.2584i,-0.045+0.045i,0.0,0.0,0.0,0.0;
0.0,0.0,0.0,-0.045+0.045i,0.045+0.145i,0.0,0.0,0.0,0.0;
0.0,0.0,0.0,0.0,0.0,0.1-0.1i,0.0,0.0,0.0;
0.0,0.0,0.0,0.0,0.0,0.0,0.0625+0.1321i,-0.0438-0.0893i,0.0;
0.0,0.0,0.0,0.0,0.0,0.0,-0.0438-0.0893i,0.1373+0.2891i,-0.0485-0.0984i;
0.0,0.0,0.0,0.0,0.0,0.0,0.0,-0.0485-0.0984i,0.0485+0.1485i];
Y = inv(Z);
B = imag(Y);
G = real(Y);
% 定义节点数据
% 节点编号 电压幅值(kV) 相角(度) 有功功率(MW) 无功功率(MVAR)
% 1 1.06 0.0 0.0 0.0
% 2 1.0 0.0 0.0 0.0
% 3 1.0 0.0 0.0 0.0
% 4 1.0 0.0 0.0 0.0
% 5 1.0 0.0 0.0 0.0
% 6 1.0 0.0 0.0 0.0
% 7 1.0 0.0 0.0 0.0
% 8 1.0 0.0 0.0 0.0
% 9 1.0 0.0 0.0 0.0
V = [1.06;1.0;1.0;1.0;1.0;1.0;1.0;1.0;1.0];
del = [0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0];
P = [0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0];
Q = [0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0;0.0];
% 迭代计算
for n = 1:10
for i = 1:9
% 计算节点i的功率不平衡
P_unbalance = P(i) - V(i)^2 * G(i,i);
Q_unbalance = Q(i) - V(i)^2 * B(i,i);
% 更新节点i的电压幅值和相角
V(i) = sqrt((P(i)^2 + Q(i)^2)/(P(i)^2 + Q(i)^2 + (V(i)^2 * B(i,i))^2));
del(i) = atan(-Q(i)/P(i)) - atan(V(i)*B(i,i));
% 更新节点i的有功和无功功率
P(i) = P(i) + V(i)^2 * (G(i,:)*V - G(i,i)*V(i) - B(i,:)*del);
Q(i) = Q(i) + V(i)^2 * (B(i,:)*V - B(i,i)*V(i) + G(i,:)*del);
end
end
% 输出结果
disp('节点电压幅值:');
disp(V);
disp('节点相角:');
disp(del);
disp('节点有功功率:');
disp(P);
disp('节点无功功率:');
disp(Q);
```
请注意,这只是一个简单的示例代码,实际应用中可能需要更多的参数和更复杂的计算。此外,高斯赛德尔法也可能会遇到收敛问题,需要进行特殊处理。
阅读全文