Sei sulla pagina 1di 8

The SAS System

The OPTMODEL Procedure


Solution Summary
Solver NLP
Algorithm Interior Point
Objective Function Total_Cost
Solution Status Iteration Limit Reached
Objective Value 1139.298652
Iterations 5000

Optimality Error 1196.4705563


Infeasibility 0.0038929698

[1] PG.SOL QG.SOL V.SOL Th.SOL


1 1.59904 -0.039774 1.05379 0.00000
2 0.80128 0.867922 1.04524 -0.05801
3 0.97087 -0.18265
4 0.99472 -0.13752
5 1.00706 -0.11413
6 0.28909 0.301555 1.00736 -0.17735
7 0.96908 -0.18470
8 0.96907 -0.18464
9 0.95651 -0.21055
10 0.95709 -0.21013
11 0.97770 -0.19594
12 0.98913 -0.19603
13 0.98092 -0.19840
14 0.94780 -0.22580

[1] [2] P.SOL Q.SOL LSL.BODY LSL.UB LSL.DUAL


1 2 1.02903466 -0.21216455 1.05067889 1.05 -476986238
[1] [2] P.SOL Q.SOL LSL.BODY LSL.UB LSL.DUAL
1 5 0.56970249 0.05885504 0.57273453 0.60 -123.160
2 3 0.70075148 0.21765244 0.73377464 0.80 -51.159
2 4 0.51669565 0.11020353 0.52831734 0.60 -47.076
2 5 0.37702694 0.07726150 0.38486186 0.40 -213.571
3 4 -0.26504636 -0.03821197 0.26778672 0.30 -105.103
4 5 -0.58785506 -0.09894525 0.59612393 0.60 -710.103
4 7 0.21709862 0.12737521 0.25170669 0.25 -2087.088
4 9 0.12472198 0.07277039 0.14439911 0.15 -520.138
5 6 0.25408574 0.00654848 0.25417011 0.30 -71.117
6 11 0.13345946 0.08748886 0.15957985 0.20 -82.888
6 12 0.08804071 0.03067826 0.09323262 0.10 -497.602
6 13 0.21057333 0.09907462 0.23271636 0.25 -192.951
7 8 -0.00065932 0.00038547 0.00076373 0.10 -33.955
7 9 0.21802778 0.11347981 0.24579215 0.25 -553.038
9 10 -0.00681380 -0.00440997 0.00811638 0.10 -36.614
9 14 0.05407320 0.00606021 0.05441173 0.10 -73.850
10 11 -0.09563555 -0.06171282 0.11381841 0.15 -92.100
12 13 0.02558193 0.01273547 0.02857669 0.10 -47.475
13 14 0.09262377 0.04705940 0.10389297 0.10 -3.73756E9

p_loss q_loss
9.9413 39.47
proc optmodel;

/* Parameters */

/* Buses: ********************************************************/
number sb = 100; /* Base power in MVAr */
number nB = 14; /* Number of buses */
set <number> GBUS = {1,2,6} ;
/* Set of buses with generation */
/* Load buses: */
number pl{ 1..nB} = [0 21.7 94.2 47.8 7.6 11.2 0 0 29.5 9 3.5 6.1 13.5 14.9];
/* Active load [MW]*/
number ql{ 1..nB} = [0 12.7 19 -3.9 1.6 7.5 0 0 16.6 5.8 1.8 1.6 5.8 5];
/* Reactive load [MVAr] */
/* Generation buses : */
number cq{ GBUS } = [ 0.005 0.005 0.005]; /* Quadratic cost coeficients
[BTu/hMW2] */
number cl{ GBUS } = [ 2.450 3.510 3.890]; /* Linear cost
coeficients [BTu/MWh] */
number cb{ GBUS } = [ 105 44.1 40.6]; /* Constant cost
coeficients [BTu/h] */
number pg_min{ GBUS} = [10 20 20]; /* Max. active power generation [MW]*/
number pg_max{ GBUS} = [160 80 50]; /* Min. active power generation [MW]*/
*/number qg_max{ GBUS} = [ 200 1000 1000]; /* Max. reactive power generation
[MVAr]*/
*/number qg_min{ GBUS} = [ 0 -1000 -1000]; /* Min. reactive power generation
[MVAr]*/
number v_min = 0.95; /* minimum voltage magnitude [pu]*/
number v_max = 1.05; /* maximum voltage magnitude [pu]*/
number refB = 1; /* reference bus */

*/Substituim;
number qg_max{GBUS} = [ 1e6 1e6 1e6]; /* Max. reactive power generation
[MVAr]*/
number qg_min{GBUS} = [ -1e6 -1e6 -1e6]; /* Min. reactive power generation
[MVAr]*/

/* Lines: ********************************************************/
set <number, number> LINES = {<1,2>, <1,5>, <2,3>,<2,4>,<2,5>,
<3,4>,<4,5>,<4,7>,<4,9>,<5,6>,<6,11>,<6,12>,<6,13>,<7,8>,
<7,9>,<9,10>,<9,14>,<10,11>,<12,13>,<13,14>}; /* Set of lines == 20 */

/* Conductance and susceptance matrices, off-diagonal [pu] */


number g { <i,j> in LINES } = [-4.999132 -1.025897 -1.135019 -1.686033
-1.701140 -1.985976 -6.840981 0 0 0 -1.955029 -1.525967 -3.098927 0 0
-3.902050 -1.424005 -1.880885 -2.489025 -1.136994];
number b { <i,j> in LINES } = [15.263087 4.234984 4.781863 5.115838
5.193927 5.068817 21.578554 4.781943 1.797979 3.967939 4.094074 3.175964
6.102755 5.676980 9.090083 10.365394 3.029050 4.402944 2.251975
2.314963];
/* Conductance and susceptance matrices, diagonal [pu] */
number gi { 1..nB } = [6.025029 9.521324 3.120995 10.512990 9.568018
6.579923 0 0 5.326055 5.782934 3.835913 4.014992 6.724946 2.561000];
number bi { 1..nB } = [-19.498070 -30.354715 -9.850680 -38.343132 -34.975404
-17.340733 -19.549006 -5.676980 -24.282506 -14.768338 -8.497018 -5.427939
-10.669694 -5.344014];

/* Conductance and susceptance matrices, diagonal [pu] */


/*number gi { 1..nB } = [6.0250 9.5213 3.1210 10.5130 9.5680 6.5799 0 0
5.3261 5.7829 3.8359 4.0150 6.7249 2.5610];
number bi { 1..nB } = [-19.4471 -30.2721 -9.8224 -38.6542 -35.5336 -17.3407
-19.5490 -5.677 -24.2825 -14.7683 -8.4970 -5.4279 -10.6697 -5.3440];
/* Conductance and susceptance matrices, off-diagonal [pu] */
/*number g { LINES } = [-4.991 -1.0259 -1.1350 -1.6860 -1.7011 -1.9860 -6.841
0 0 0 -1.955 -3.0989 0 0
-3.9020 -1.4240 -1.8809 -2.4890 -1.1370];
number b { LINES } = [15.2631 4.2350 4.7819 5.1158 5.1939 5.0688 21.5786
4.8895 1.8555 4.2574 4.0941 6.1028 5.6770 9.0901 10.3654 3.0291 4.4029
2.2520 2.3150
];

/* Shunt susceptance [pu] */


number bs{ LINES } = [0.0528 0.0492 0.0438 0.034 0.0346 0.0128 0 0 0 0 0 0 0 0
0 0 0 0 0 0 ];
/* Line capacity, apparent power [MVA] */
number s_max{ LINES } = [ 105 60 80 60 40 30 60 25 15 30 20 10
25 10 25 10 10 15 10 10];

/* Decision variables */
var PG { i in GBUS } >= pg_min[i]/sb <= pg_max[i]/sb; /* Active power
generation at bus "i" (MW) */
var QG { i in GBUS } >= qg_min[i]/sb <= qg_max[i]/sb;
*/var QG { i in GBUS } ;
*/var QG { i in GBUS }; /* Reactive power generation at bus "i" (MVAr) */
var V { i in 1..nB } >= v_min <= v_max; /* Voltage magnitude at
bus "i" (p.u.) */
var Th { i in 1..nB } >=-2*constant('PI') <=2*constant('PI'); /* Voltage phase
at bus "i" (p.u.) */
fix Th[refB]=0; /* Reference bus */
var P { <i,j> in LINES} init 1; /* Line active power
flow (MW) */
var Q { <i,j> in LINES} init 1; /* Line reactive power
flow (MVAr) */

/* Objective function */
min Total_Cost = sum{ i in GBUS } ( cq[i]*(sb*PG[i])^2+cl[i]*sb*PG[i]+cb[i] );

/* Nodal Power Flow Equations ****************************************/


con NPFE_P {i in {1..nB}}:
if i in GBUS then PG[i] - pl[i]/sb else -pl[i]/sb /* Net active power
injection at bus "i" */
= V[i]^2*gi[i] +
V[i]*sum{<k,l> in LINES : k=i or l=i}
if k=i then
V[l]*(g[k,l]*cos(Th[k]-Th[l]) + b[k,l]*sin(Th[k]-Th[l]))
/* Active power leaving bus "i" through line <i,k> */
else
V[k]*(g[k,l]*cos(Th[l]-Th[k]) + b[k,l]*sin(Th[l]-Th[k]));
/* Active power leaving bus "i" through line <i,l> */
con NPFE_Q {i in {1..nB}}:
if i in GBUS then QG[i] - ql[i]/sb else -ql[i]/sb /* Net reactive
power injection at bus "i" */
= -V[i]^2*bi[i]+
V[i]*sum{<k,l> in LINES : k=i or l=i}
if k=i then
V[l]*(g[k,l]*sin(Th[k]-Th[l]) - b[k,l]*cos(Th[k]-Th[l]))
/* Reactive power leaving bus "i" through line <i,k> */
else
V[k]*(g[k,l]*sin(Th[l]-Th[k]) - b[k,l]*cos(Th[l]-Th[k]));
/* Reactive power leaving bus "i" through line <i,l> */

/* Line Power Flow Equations ****************************************/


con LPFE_P {<i,j> in LINES}:
P[i,j] = V[i]*V[j]*(g[i,j]*cos(Th[i]-Th[j]) + b[i,j]*sin(Th[i]-Th[j])) -
g[i,j]*V[i]^2; /* Active power through <i,j> */
con LPFE_Q {<i,j> in LINES}:
Q[i,j] = V[i]*V[j]*(g[i,j]*sin(Th[i]-Th[j]) - b[i,j]*cos(Th[i]-Th[j])) +
V[i]^2*(b[i,j]-bs[i,j]); /* Reactive power through <i,j> */

/* Line security ****************************************/


con LSL {<i,j> in LINES}:
sqrt( P[i,j]^2+Q[i,j]^2) <= s_max[i,j]/sb;
expand;
solve with nlp / MAXITER=50000;

print PG.sol QG.sol V.sol Th.sol;


print P.sol Q.sol LSL.body LSL.ub LSL.dual;

number p_loss = sb*sum{i in GBUS} PG[i].sol - sum{i in 1..nB} pl[i];


number q_loss = sb*sum{i in GBUS} QG[i].sol - sum{i in 1..nB} ql[i];
print p_loss q_loss;

Potrebbero piacerti anche