GAMS程序 输电网34节点最优潮流模型
时间: 2023-12-12 12:04:37 浏览: 150
以下是一个简单的 GAMS 程序,用于建立34节点输电网的最优潮流模型:
```
* 定义变量
Variables
P(i) 发电机功率
theta(i) 节点相角
Pij(i,j) 线路有功功率
Qij(i,j) 线路无功功率
Pf(i,j) 线路潮流
* 定义参数
Parameters
Pg(i) 发电机最大功率
Pl(i) 负荷功率
B(i,j) 节点导纳
G(i,j) 节点导纳实部
Bc(i,j) 节点导纳虚部
Vmin(i) 节点电压下限
Vmax(i) 节点电压上限
* 定义约束
Equations
PowerBalance(i) 发电机和负荷功率平衡
LineFlow(i,j) 线路容量限制
VoltageAngle(i) 节点电压相角限制
VoltageLimit(i) 节点电压限制
* 定义目标函数
Positive Variables Pij, Qij, Pf;
Minimize ObjectiveFunction:
sum(i, Pg(i) - P(i));
* 约束条件
PowerBalance(i).. P(i) - Pl(i) =e= sum(j, Pij(i,j));
LineFlow(i,j).. Pf(i,j) =e= G(i,j)*(theta(i) - theta(j)) + Bc(i,j)*(theta(i) - theta(j));
VoltageAngle(i).. theta(i) =l= 90;
VoltageLimit(i).. Vmin(i)*Vmin(i) =l= sum(j, G(i,j)*Pf(i,j) - Bc(i,j)*Qij(i,j)) =e= Vmax(i)*Vmax(i);
* 定义数据
Pg(1) = 0;
Pg(2) = 163;
Pg(3) = 85;
Pg(4) = 0;
Pg(5) = 0;
Pg(6) = 0;
Pg(7) = 0;
Pg(8) = 0;
Pg(9) = 0;
Pg(10) = 0;
Pg(11) = 0;
Pg(12) = 0;
Pg(13) = 0;
Pg(14) = 0;
Pg(15) = 0;
Pg(16) = 0;
Pg(17) = 0;
Pg(18) = 0;
Pg(19) = 0;
Pg(20) = 0;
Pg(21) = 0;
Pg(22) = 0;
Pg(23) = 0;
Pg(24) = 0;
Pg(25) = 0;
Pg(26) = 0;
Pg(27) = 0;
Pg(28) = 0;
Pg(29) = 0;
Pg(30) = 0;
Pg(31) = 0;
Pg(32) = 0;
Pg(33) = 0;
Pg(34) = 0;
Pl(1) = 55;
Pl(2) = 20;
Pl(3) = 37;
Pl(4) = 37;
Pl(5) = 0;
Pl(6) = 0;
Pl(7) = 0;
Pl(8) = 0;
Pl(9) = 0;
Pl(10) = 0;
Pl(11) = 0;
Pl(12) = 0;
Pl(13) = 0;
Pl(14) = 0;
Pl(15) = 0;
Pl(16) = 0;
Pl(17) = 0;
Pl(18) = 0;
Pl(19) = 0;
Pl(20) = 0;
Pl(21) = 0;
Pl(22) = 0;
Pl(23) = 0;
Pl(24) = 0;
Pl(25) = 0;
Pl(26) = 0;
Pl(27) = 0;
Pl(28) = 0;
Pl(29) = 0;
Pl(30) = 0;
Pl(31) = 0;
Pl(32) = 0;
Pl(33) = 0;
Pl(34) = 0;
B(1,2) = 0.01938;
B(1,5) = 0.05403;
B(2,3) = 0.04699;
B(2,4) = 0.05811;
B(2,5) = 0.05695;
B(3,4) = 0.06701;
B(4,5) = 0.01335;
B(4,7) = 0.07866;
B(5,6) = 0.09498;
B(6,11) = 0.052;
B(6,12) = 0.025;
B(7,8) = 0.012;
B(8,9) = 0.0636;
B(9,10) = 0.0586;
B(9,14) = 0.0498;
B(10,11) = 0.0496;
B(11,12) = 0.025;
B(11,13) = 0.0224;
B(12,13) = 0.021;
B(13,14) = 0.0749;
B(13,15) = 0.0164;
B(14,15) = 0.0693;
B(15,16) = 0.0168;
B(16,17) = 0.0598;
B(16,18) = 0.0441;
B(17,18) = 0.04699;
G(i,j) = B(i,j)*cos(arctan(Bc(i,j)/G(i,j)));
Bc(i,j) = B(i,j)*sin(arctan(Bc(i,j)/G(i,j)));
Vmin(1) = 0.95;
Vmax(1) = 1.05;
Vmin(2) = 0.95;
Vmax(2) = 1.05;
Vmin(3) = 0.95;
Vmax(3) = 1.05;
Vmin(4) = 0.95;
Vmax(4) = 1.05;
Vmin(5) = 0.95;
Vmax(5) = 1.05;
Vmin(6) = 0.95;
Vmax(6) = 1.05;
Vmin(7) = 0.95;
Vmax(7) = 1.05;
Vmin(8) = 0.95;
Vmax(8) = 1.05;
Vmin(9) = 0.95;
Vmax(9) = 1.05;
Vmin(10) = 0.95;
Vmax(10) = 1.05;
Vmin(11) = 0.95;
Vmax(11) = 1.05;
Vmin(12) = 0.95;
Vmax(12) = 1.05;
Vmin(13) = 0.95;
Vmax(13) = 1.05;
Vmin(14) = 0.95;
Vmax(14) = 1.05;
Vmin(15) = 0.95;
Vmax(15) = 1.05;
Vmin(16) = 0.95;
Vmax(16) = 1.05;
Vmin(17) = 0.95;
Vmax(17) = 1.05;
Vmin(18) = 0.95;
Vmax(18) = 1.05;
Vmin(19) = 0.95;
Vmax(19) = 1.05;
Vmin(20) = 0.95;
Vmax(20) = 1.05;
Vmin(21) = 0.95;
Vmax(21) = 1.05;
Vmin(22) = 0.95;
Vmax(22) = 1.05;
Vmin(23) = 0.95;
Vmax(23) = 1.05;
Vmin(24) = 0.95;
Vmax(24) = 1.05;
Vmin(25) = 0.95;
Vmax(25) = 1.05;
Vmin(26) = 0.95;
Vmax(26) = 1.05;
Vmin(27) =
阅读全文