Abstract
This chapter provides a solution for optimal power flow OPF problem in GAMS. Different OPF models are investigated, such as single and multi-period DC-AC optimal power flow.
Access provided by CONRICYT-eBooks. Download chapter PDF
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
This chapter provides a solution for optimal power flow OPF problem in GAMS. Different OPF models are investigated, such as single and multi-period DC-AC optimal power flow.
6.1 Single Period Optimal DC Power Flow
There are some necessary conditions that make the DC power flow acceptable as an approximate solution for AC power flow such as:
-
The ratio of \(\frac{x_{ij}} {r_{ij}}\) should be large enough that r ij can be neglected.
-
The voltage magnitudes are approximately 1 pu.
The DC power flow concept for a two-bus network is shown in Fig. 6.1. The basic variables in DC power flow are voltage angles δ i . The angle of the slack bus is assumed to be zero as the reference for the rest of network.
The technical and economic characteristics of generating units shown in Table 6.1 are given as follows:
The demand at bus 2 is L 2 = 400 MW, line reactance is X 12 = 0. 2 pu, and line flow limit is P 12 max = 1. 50 pu (per unit on 100 MVA base). The optimization problem which should be solved is formulated in (6.1).
The GAMS code for solving the (6.1) is provided in GCode 6.1.
GCode 6.1 The OPF GAMS code for two-bus network, Example (6.1)
Sets Gen /g1 * g2/ bus / 1 * 2 /; Scalars L2 /400/ X12 /0.2/ Sbase /100/ P12_max /1.5/ ; Table data (Gen, * ) a b c Pmin Pmax G1 3 20 100 28 206 G2 4.05 18.07 98.87 90 284; Variables P( gen ),OF, delta ( bus ),P12; Equations eq1, eq2, eq3, eq4; eq1 .. OF = e = sum(gen, data (gen, ’a ’ ) * P( gen ) * P( gen )+data (gen, ’b ’ ) * P( gen )+data (gen, ’ c ’ ) ); eq2 .. P( ’G1 ’ )= e = P12; eq3 .. P( ’G2 ’ )+ P12 = e = L2/Sbase; eq4 .. P12 = e=(delta ( ’1 ’ ) −delta ( ’2 ’ ) )/X12; P. lo ( gen )=data (gen, ’Pmin ’ )/Sbase; P. up( gen )=data (gen, ’Pmax ’ )/Sbase; P12. lo=− P12_max; P12. up =+ P12_max; delta. fx ( ’1 ’ ) =0; Model OPF /all/; Solve OPF us qcp min of;
The operating costs would be $306.108, P 12 = 150 MW and δ 2 = −0. 3 (rad).
The general power flow concept is shown in Fig. 6.2. As it can be seen in Fig. 6.2, every bus might host some generation and demand. Each bus might be connected to other network buses by multiple branches (with different characteristics). The power balance between generation, demand and power transfers should be satisfied at every bus of the network under study.
The general mathematical formulation of OPF is described in (6.2). It should be noted that the technical terms of (6.2) are all linear. The only nonlinear part is the cost function. This makes the DC-OPF a strong tool for power system studies at the transmission level. This means that if the cost term can be expressed in linear form then the DC-OPF would become a linear programming problem and can be solved using linear solvers in GAMS such as CPLEX [1].
6.1.1 Three-Bus Network DC-OPF
The three-bus network data is shown in Fig. 6.3. This example is taken from [2] (Example 4B, p. 110).
The GAMS code for solving this problem is given as GCode 6.2: The developed code for solving the OPF problem in three-bus network (Fig. 6.3) is explained here. It is general and can be used for any network with any size.
-
Three sets are defined: bus (all network buses), slack(bus) which shows slack buses with reference angle values, Gen (set of generating units)
-
A scalar value named Sbase is defined for per unit calculations
-
The set node is defined as the similar set to set bus
-
The table GenData defines the technical and economic characteristics of generating units
-
The set GBconect defines the connection point of each generating unit
-
The table BusData specifies the demand values in each bus
-
The set conex specifies how each bus is connected to the other network buses
-
The table branch defines the branch characteristics
-
Four variables are used for this formulation namely: OF (objective function), Pij (active power flow between bus and node), Pg(generating schedule of each generating unit), and delta (voltage angle at each bus)
-
Three equations are defined: const1 (active flow calculation between each pair of connected buses), const2 (nodal active power balance in each bus), and const3 (objective function calculation)
-
The definition of the model loadflow (specifies for GAMS that which constraints should be taken into account)
-
Variables’ limits specification
-
Solve statement
-
Generating report from the solved model
-
The marginal value of const2.m provides the LMP at each bus. This is used for congestion cost calculation.
GCode 6.2 The DC-OPF GAMS code for three-bus network, Example (Sect. 6.1.1)
Sets bus / 1 * 3 / slack ( bus ) /3/ Gen /g1 * g3 /; scalars Sbase /100/; a l i a s (bus, node ); Table GenData(Gen, * ) Generating units c h a r a c t e r i s t i c s b pmin pmax g1 10 0 65 g2 11 0 100; * −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−− set GBconect(bus,Gen) connectivity index of each generating unit to each bus /1 . g1 3 . g2 / ; Table BusData(bus, * ) Demands of each bus in MW Pd 2 100; set conex Bus connectivity matrix / 1 . 2 2 . 3 1 . 3/; conex (bus, node )$( conex (node, bus ) ) =1; Table branch (bus, node, * ) Network technical c h a r a c t e r i s t i c s x Limit 1 . 2 0.2 100 2 . 3 0.25 100 1 . 3 0.4 100 ; branch (bus, node, ’x ’ )$( branch (bus, node, ’x ’ )=0) = branch (node, bus, ’x ’ ); branch (bus, node, ’ Limit ’ )$( branch (bus, node, ’ Limit ’ )=0) = branch (node, bus, ’ Limit ’ ); branch (bus, node, ’ bij ’ ) $conex (bus, node ) =1/branch (bus, node, ’x ’ ); Variables OF Pij (bus, node ) Pg(Gen) delta ( bus ); Equations const1, const2, const3; const1 (bus, node ) $conex (bus, node ).. Pij (bus, node )= e = branch (bus, node, ’ bij ’ ) * ( delta ( bus ) −delta ( node ) ); const2 ( bus ) .. + sum(Gen$GBconect(bus,Gen),Pg(Gen) ) − BusData(bus, ’pd ’ )/Sbase= e = + sum( node$conex (node, bus ), Pij (bus, node ) ); const3 .. OF = g = sum(Gen, Pg(Gen) * GenData(Gen, ’b ’ ) * Sbase ); Model loadflow /const1, const2, const3 /; Pg. lo (Gen)= GenData(Gen, ’Pmin ’ )/Sbase; Pg. up(Gen)= GenData(Gen, ’Pmax ’ )/Sbase; delta. up( bus )= pi; delta. lo ( bus )=− pi; delta. fx ( slack ) =0; Pij. up(bus, node )$ (( conex (bus, node ) ) ) =1* branch (bus, node, ’ Limit ’ )/Sbase; Pij. lo (bus, node )$ (( conex (bus, node ) ) )=−1*branch (bus, node, ’ Limit ’ )/Sbase; Solve loadflow minimizing OF using lp; parameter report (bus, * ), Congestioncost; report (bus, ’Gen( MW ) ’ )= sum(Gen$GBconect(bus,Gen),Pg. l (Gen) ) * sbase; report (bus, ’ Angle ’ )=delta. l ( bus ); report (bus, ’ load ( MW ) ’ )= BusData(bus, ’pd ’ ); report (bus, ’LMP($/ MWh ) ’ )=const2.m ( bus )/ sbase ; Congestioncost= sum(( bus, node ), Pij. l (bus, node ) *( − const2.m ( bus )+const2.m ( node ) ) ) /2 ; display report, Pij. l, Congestioncost;
The total operating costs will be 1035 $/h and the LMP for all buses are equal to 11 $/h. This means that if the demand value at any bus increases for 1 MW then the operating cost will increase by 11 $/h. Since the generating unit 1 is generating power at its maximum limit (because it is cheaper) the additional demand should be supplied by generating unit 2 with operating cost equal to 11 $/MW h. The detailed three-bus optimal power flow solution with (P ij max = 100 MW) is given in Table 6.2.
Question: What would happen if the flow limit of the branch connecting bus 1 to bus 2 is reduced to 50 MW.
Answer: The answer is straightforward. The operating cost might increase but how much? We can easily decrease the flow limit in the GCode 6.2 (table Branch). The new operating cost would be 1056.250 $/h. The LMP values are different for each bus in this case. The LMP values are λ 1 = 10 $/MW h, λ 2 = 11. 625 $/MW h, λ 3 = 11 $/MW h. The power flow solution is shown in Fig. 6.4. The LMP value in bus 1 is λ 1 = 10 $/MW h because if the load increases in this node it will be supplied by generator 1 (which the operating costs are 10 $/MW h). The LMP value in bus 3 is λ 3 = 11 $/MW h because any increase in load in this node should be supplied by generator 2 (which the operating costs are 11 $/MW h). Generator 1 cannot send more power by line 1 − 2 since it is congested and the direction of the power flow in branch 3 − 1 is from bus 3 to bus 1. Finally, The LMP value in bus 2 is λ 3 = 11. 625 $/MW h because some of this demand will be supplied by generating unit 1 and some part will be supplied by unit 2. If the demand should pay the LMP value for every MW h then the total payment by the demand would be 100 MW × 11. 625 $/MW h = 1162.5 $/h. On the other hand, the generating units are also paid based on the LMP value of the connection point. The total payments to the generating units would be 43. 75 × 10 + 56. 25 × 11 = 1056. 25 $/h. As it can be seen, there is a difference between what demand pays and what generating units receive. This surplus money is equal to 1162. 5 − 1056. 25 = 106. 25 $/h. This is also called the congestion cost. Another technique for calculating the congestion costs (C cg ) is using the following formula [3]:
The power flow solution of three-bus network with P 12 max = 50 MW is shown in Fig. 6.4.
The detailed three-bus optimal power flow solution with (P 12 max = 50 MW) is given in Table 6.3.
6.1.2 Five-Bus Network DC-OPF
The five-bus network data is shown in Fig. 6.5. This example is taken from [4].
The GAMS code developed for solving OPF in five-bus network is provided in GCode 6.3.
GCode 6.3 The OPF GAMS code for five-bus network, Example (Sect. 6.1.2)
Sets bus /1*5/, slack ( bus ) /1/ , Gen /g1 * g5 /; Scalars Sbase /100/ ; a l i a s (bus, node ); Table GenData(Gen, * ) b pmin pmax g1 14 0 40 g2 15 0 170 g3 30 0 520 g4 40 0 200 g5 20 0 600 ; set GBconect(bus,Gen) connectivity index of generating unit /1 . g1 1 . g2 3 . g3 4 . g4 5 . g5 / ; Table BusData(bus, * ) Demands of each bus in MW Pd 2 300 3 300 4 400; set conex Bus connectivity matrix /1 . 2 2 . 3 3 . 4 4 . 1 4 . 5 5 . 1/; conex (bus, node ) $conex (node, bus ) =1; Table branch (bus, node, * ) x Limit 1 . 2 0.0281 400 1 . 4 0.0304 400 1 . 5 0.0064 400 2 . 3 0.0108 400 3 . 4 0.0297 400 4 . 5 0.0297 240 ; branch (bus, node, ’x ’ )$( branch (bus, node, ’x ’ )=0) = branch (node, bus, ’x ’ ); branch (bus, node, ’ Limit ’ )$( branch (bus, node, ’ Limit ’ )=0) = branch (node, bus, ’ Limit ’ ); branch (bus, node, ’ bij ’ ) $conex (bus, node ) =1/branch (bus, node, ’x ’ ); Variables OF, Pij (bus, node ),Pg(Gen), delta ( bus ); Equations const1, const2, const3; const1 (bus, node ) $conex (bus, node ).. Pij (bus, node )= e = branch (bus, node, ’ bij ’ ) * ( delta ( bus ) −delta ( node ) ); const2 ( bus ) .. + sum(Gen$GBconect(bus,Gen),Pg(Gen) ) − BusData(bus, ’pd ’ )/Sbase= e = + sum( node$conex (node, bus ), Pij (bus, node ) ); const3 .. OF = g = sum(Gen, Pg(Gen) * GenData(Gen, ’b ’ ) * Sbase ); Model loadflow /const1, const2, const3 /; Pg. lo (Gen)= GenData(Gen, ’Pmin ’ )/Sbase; Pg. up(Gen)= GenData(Gen, ’Pmax ’ )/Sbase; delta. up( bus )= pi; delta. lo ( bus )=− pi; delta. fx ( slack ) =0; Pij. up(bus, node )$ (( conex (bus, node ) ) )= branch (bus, node, ’ Limit ’ )/Sbase; Pij. lo (bus, node )$ (( conex (bus, node ) ) )= −branch (bus, node, ’ Limit ’ )/Sbase; solve loadflow minimizing OF using lp; parameter report (bus, * ), Congestioncost; report (bus, ’Gen( MW ) ’ )= sum(Gen$GBconect(bus,Gen),Pg. l (Gen) ) * sbase; report (bus, ’ Angle ’ )=delta. l ( bus ); report (bus, ’ load ( MW ) ’ )= BusData(bus, ’pd ’ ); report (bus, ’LMP($/ MWh ) ’ )=const2.m ( bus )/ sbase ; Congestioncost= sum(( bus, node ), Pij. l (bus, node ) *( − const2.m ( bus )+const2.m ( node ) ) ) /2; Display report, Pij. l, Congestioncost;
The minimum operating cost is 17,479.897 $/h. The network is highly congested, and the LMP values are different in various buses. The five-bus network flows and directions are depicted in Fig. 6.6. The detailed five-bus optimal power flow solution is given in Table 6.4.
6.1.3 IEEE Reliability Test System 24 Bus
The IEEE RTS 24-bus network is shown in Fig. 6.7. It is a transmission network with the voltage levels of 138 kV, 230 kV, and Sbase = 100 MVA. The branch data for IEEE RTS 24-bus network is given in Table 6.5 [5]. The from bus, to bus, reactance (X), resistance (r), total line charging susceptance (b), and MVA rating (MVA) are specified in this table. The parallel lines in MATPOWER are merged, and the resultants are given in Table 6.5. The generation data for IEEE RTS 24-bus network is given in Table 6.6. The data of generating units in this network is inspired by Conejo et al. [6] and Bouffard et al. [7] with some modifications. The slack bus is bus 13 in this network.
6.1.3.1 IEEE-RTS: Base Case
In this case, it is assumed that the network is intact and all branches and generating units are working in normal condition. The minimum operating cost is $29,574.275 obtained by using the GCode 6.4.
GCode 6.4 The OPF GAMS code for IEEE Reliability test 24-bus network, Example (Sect. 6.1.3)
sets bus /1*24/, slack ( bus ) /13/,Gen /g1 * g12 /; scalar Sbase /100/; a l i a s (bus, node ); Table GenData(Gen, * ) Generating units c h a r a c t e r i s t i c s Pmax Pmin b CostsD costst RU RD SU SD UT DT uini U0 So g1 400 100 5.47 0 0 47 47 105 108 1 1 1 5 0 ; set GBconect(bus,Gen) connectivity index of each generating unit to each bus /18 . g1 / ; Table BusData(bus, * ) Demands of each bus in MW /MVar Pd Qd 1 108 22; Table branch (bus, node, * ) Network technical c h a r a c t e r i s t i c s r x b limit 1 . 2 0.0026 0.0139 0.4611 175; parameter conex (bus, node ); conex (bus, node ) $branch (bus, node, ’ limit ’ ) =1; conex (bus, node )$( conex (node, bus ) ) =1; branch (bus, node, ’x ’ )$( branch (bus, node, ’x ’ )=0) = branch (node, bus, ’x ’ ); branch (bus, node, ’ Limit ’ )$( branch (bus, node, ’ Limit ’ )=0) = branch (node, bus, ’ Limit ’ ); branch (bus, node, ’ bij ’ ) $conex (bus, node ) =1/branch (bus, node, ’x ’ ); Variables OF, Pij (bus, node ),Pg(Gen), delta ( bus ); Equations const1, const2, const3; const1 (bus, node )$( conex (bus, node ) ) .. Pij (bus, node )= e = branch (bus, node, ’ bij ’ ) * ( delta ( bus ) −delta ( node ) ); const2 ( bus ) .. + sum(Gen$GBconect(bus,Gen),Pg(Gen) ) − BusData(bus, ’pd ’ )/Sbase= e = + sum( node$conex (node, bus ), Pij (bus, node ) ); const3 .. OF = g = sum(Gen, Pg(Gen) * GenData(Gen, ’b ’ ) * Sbase ); Model loadflow /const1, const2, const3 /; Pg. lo (Gen)= GenData(Gen, ’Pmin ’ )/Sbase; Pg. up(Gen)= GenData(Gen, ’Pmax ’ )/Sbase; delta. up( bus )= pi/2; delta. lo ( bus )=− pi/2; delta. fx ( slack ) =0; Pij. up(bus, node )$ (( conex (bus, node ) ) ) =1* branch (bus, node, ’ Limit ’ )/Sbase; Pij. lo (bus, node )$ (( conex (bus, node ) ) )=−1*branch (bus, node, ’ Limit ’ )/Sbase; Solve loadflow minimizing OF using lp;
The base case solution of IEEE RTS 24-bus network without changing the branch flow limits is described in Table 6.7. As it can be observed in Table 6.7, the LMP values are all the same and equal to 20.7 $/MW h. This is because there is no congestion in this network for the given loading values. The congestion cost would be zero in this case.
6.1.3.2 IEEE-RTS: Branch Flow Limit Reduction
Now the branch flow limits are reduced by 30%. The problem is solved again, and the angle values are found as given in Table 6.8. The minimum operating cost is $29,747.745 obtained by using the GCode 6.4. The congestion cost is $4597.217 in this case. The solution of IEEE RTS 24-bus network (branch flow limits are reduced by 30%) is given in Table 6.8. Reducing the branch flow limit will not only increase the operating cost but also makes the LMP values different across the network.
6.1.3.3 IEEE-RTS: Branch Outage
In this case, some branch contingencies are examined. In order to simulate the branch outage, the following equation should be satisfied.
where ξ ij is a binary parameter which shows the status of the branch connecting bus i to bus j. In the developed GAMS code, if the branch limit is set to 0 it is considered as an outaged branch. This is because const1 which models the flow calculation in line ij is calculated for every branch which has conex(bus, node) > 0. Now some different contingencies are evaluated as follows:
-
Contingency 1: branch ℓ 20−19, ℓ 12−23 are out. Congestion costs are $4905.000 and OF = $29,888.196. The congested lines are ℓ 13−23. The LMP values are not the same in different buses.
-
Contingency 2: branch ℓ 14−16, ℓ 16−19 are out. Congestion costs are $6224.250 and OF = $32,199.855. The congested lines are ℓ 24−3, ℓ 8−7. The LMP values are not the same in different buses.
-
Contingency 3: branch ℓ 1−5, ℓ 4−2 are out. Congestion costs are $0 and OF = $29,574.275. No line would be congested and therefore the LMP values are the same in all buses.
The OPF solutions for these three contingency cases are provided in Table 6.9.
6.1.3.4 IEEE-RTS: Generator Outage
In this case, some generating units are out of service. This can be because of unplanned outage or maintenance purpose. Now some different contingencies are evaluated as follows:
-
Contingency 1: The generating unit g 9 (connected to bus 7) is out. Solving the problem shows that no line is congested but removing the g 9 will cause an increase in total operating costs which becomes OF = $29,633.420.
-
Contingency 2: The generating unit g 5 (connected to bus 15) is out. Solving the problem shows that line ℓ 8−7 is congested but removing the g 5 will cause an increase in total operating costs which becomes OF = $30,328.570. The LMP values are different on different buses, and the congestion costs are $40.250.
-
Contingency 3: The generating unit g 8 (connected to bus 23) is out. Solving the problem shows that line ℓ 8−7 is congested but removing the g 8 will cause an increase in total operating costs which becomes OF = $33,078.420. The LMP values are different on different buses, and the congestion costs are $40.250.
-
Contingency 4: The generating unit g 10 (connected to bus 13) is out. The problem becomes infeasible, and GAMS cannot find any solution for it. This is because no solution is found which satisfies the technical constraints. Some load shedding action should take place.
The OPF solutions for first three contingency cases are given in Table 6.10. In order to analyze the contingency case 4, the load shedding is modeled using a virtual generating unit connected to bus i as shown in Fig. 6.8. The production cost of this specific unit is set to a high value. It is usually called the value of the loss of load. The production level of this generating unit is equal to the load shedding that should happen in bus i. The maximum power of this unit is equal to the load connected to the bus i (0 ≤ LS i ≤ L i ). The DC-OPF problem considering the load shedding concept is formulated in (6.6).
The GAMS code for modeling and calculating the load shedding values is given in GCode 6.5:
GCode 6.5 The OPF GAMS code for IEEE Reliability test 24-bus network with load shedding modeling
Sets bus /1*24/ slack ( bus ) /13/ Gen /g1 * g12/ scalars Sbase /100/ VOLL /10000/; a l i a s (bus, node ); table GenData(Gen, * ) Generating units c h a r a c t e r i s t i c s Pmax Pmin b * * * * * * * * REMOVED FOR SAVING SPACE * * * * * * ; set GBconect(bus,Gen) connectivity index of each generating unit to each bus / * * REMOVED FOR SAVING SPACE * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / ; Table BusData(bus, * ) Demands of each bus in MW Pd Qd * * * * * * * * REMOVED FOR SAVING SPACE * * * * * * ; table branch (bus, node, * ) Network technical c h a r a c t e r i s t i c s r x b limit * * * * * * * * REMOVED FOR SAVING SPACE * * * * * * ; branch (bus, node, ’x ’ )$( branch (bus, node, ’x ’ )=0) = branch (node, bus, ’x ’ ); branch (bus, node, ’ Limit ’ )$( branch (bus, node, ’ Limit ’ )=0) = branch (node, bus, ’ Limit ’ ); branch (bus, node, ’ bij ’ ) $branch (bus, node, ’ Limit ’ ) =1/branch (bus, node, ’x ’ ); parameter conex (bus, node ); conex (bus, node )$( branch (bus, node, ’ limit ’ )and branch (node, bus, ’ limit ’ ) ) =1; conex (bus, node )$( conex (node, bus ) ) =1; Variables OF, Pij (bus, node ),Pg(Gen), delta ( bus ), lsh ( bus ); Equations const1, const2, const3; const1 (bus, node )$( conex (bus, node ) ) .. Pij (bus, node )= e = branch (bus, node, ’ bij ’ ) * ( delta ( bus ) −delta ( node ) ); const2 ( bus ) .. lsh ( bus ) + sum(Gen$GBconect(bus,Gen),Pg(Gen) ) − BusData(bus, ’pd ’ )/Sbase = e =+ sum( node$conex (node, bus ), Pij (bus, node ) ); const3 .. OF = g = sum(( bus,Gen) $GBconect (bus,Gen),Pg(Gen) * GenData(Gen, ’b ’ ) * Sbase )+ sum(bus,VOLL * lsh ( bus ) * Sbase ); model loadflow /const1, const2, const3 /; Pg. lo (Gen)= GenData(Gen, ’Pmin ’ )/Sbase; Pg. up(Gen)= GenData(Gen, ’Pmax ’ )/Sbase; delta. up( bus )= pi/2; delta. lo ( bus )=− pi/2; delta. fx ( slack ) =0; Pij. up(bus, node )$ (( conex (bus, node ) ) ) =1* branch (bus, node, ’ Limit ’ )/Sbase; Pij. lo (bus, node )$ (( conex (bus, node ) ) )=−1*branch (bus, node, ’ Limit ’ )/Sbase; lsh. up( bus )= BusData(bus, ’pd ’ )/Sbase; lsh. lo ( bus )= 0; solve loadflow minimizing OF using lp; parameter report (bus, * ), Congestioncost; report (bus, ’Gen( MW ) ’ )= 1 * sum(Gen$GBconect(bus,Gen),Pg. l (Gen) ) * sbase; report (bus, ’ Angle ’ )=delta. l ( bus ); report (bus, ’ load ( MW ) ’ )= BusData(bus, ’pd ’ ); report (bus, ’LSH ’ )=lsh. l ( bus ) * sbase ; report (bus, ’LMP($/ MWh ) ’ )=const2.m ( bus )/ sbase ; Congestioncost= sum(( bus, node ), Pij. l (bus, node ) *( − const2.m ( bus )+const2.m ( node ) ) ) /2 ; display report, Pij. l, Congestioncost; execute_unload ”opf. gdx” report execute ’gdxxrw. exe OPF. gdx o = OPF. xls par =report rng =report !A1 ’ display GBconect;
The OPF solution for contingency case 4 is given in Table 6.11. The simulation results show that the demand in bus 18 should be reduced by 116 MW as given in Table 6.11. It should be noted that the LMP values are not meaningful in this case. The LMP values are calculated and shown in Table 6.12.
In order to calculate the LMP in a network with load shedding, the calculated amount of load shedding should be curtailed from the demand in the specific bus (here bus 18) and the problem should be resolved.
Nomenclature
Indices and Sets
- g :
-
Index of thermal generating units.
- i, j :
-
Index of network buses.
- Ω G :
-
Set of all thermal generating units.
- Ω G i :
-
Set of all thermal generating units connected to bus i.
- Ω ℓ i :
-
Set of all buses connected to bus i.
- Ω B :
-
Set of network buses.
- Ω ℓ :
-
Set of network branches.
Parameters
- L i :
-
Electric power demand in bus i
- a g , b g , c g :
-
Fuel cost coefficients of thermal unit g.
- P g max∕min :
-
Maximum/minimum limits of power generation of thermal unit g.
- P ij max :
-
Maximum power flow limits of branch connecting bus i to j.
- x ij :
-
Reactance of branch connecting bus i to j.
- r ij :
-
Resistance of branch connecting bus i to j.
Variables
- P ij :
-
Active power flow of branch connecting bus i to j.
- P g :
-
Active power generated by thermal unit g(MW).
- λ i :
-
Locational marginal price in bus i ($/MW h).
- LS i :
-
Load shedding in bus i (MW).
- OF:
-
Total operating costs ($/h).
- δ i :
-
Voltage angle in bus i (rad).
6.2 Multi-Period Optimal Wind-DC OPF
The load flow model considering wind power and load shedding is shown in Fig. 6.9. The multi-period wind DC-OPF is formulated as follows:
The objective function in (6.7a) consists of operating costs of thermal units, load shedding costs, and wind curtailment costs. The nodal power balance is formulated in (6.7b). This equation is also providing the LMP value in bus i at time t (λ i, t ). The active flow in branch connecting bus i to bus j is calculated in (6.7c). The branch flow limits of every branch is formulated in (6.7d). The operating limits of the thermal generating unit are modeled in (6.7e). The ramp rates of thermal units are described in (6.7f) and (6.7g). The load shedding of bus i is limited to the existing demand at time t as stated in (6.7h). The wind power curtailment is formulated in (6.7i). At any bus i hosting wind turbine, the amount of wind power generation depends on wind power availability and wind power capacity as described in (6.7j). It should bear in mind that the demand and wind power availability change vs time. These variations are reflected in L i, t and w t , respectively. The wind power connection points to the network are indicated in Fig. 6.10.
The wind-demand variation pattern vs time is shown in Fig. 6.11. The optimal thermal unit power generation schedules of multi-period wind DC-OPF is given in Table 6.13.
GCode 6.6 Multi-period DC-OPF for modified IEEE RTS 24-bus system
Sets bus /1*24/ , slack ( bus ) /13/,Gen /g1 * g12 /, t /t1 * t24 /; Scalars Sbase /100/ ,VOLL /10000/,VWC /50/; a l i a s (bus, node ); table GD(Gen, * ) Generating units c h a r a c t e r i s t i c s Pmax Pmin b CostsD costst RU RD SU SD UT DT uini U0 So * Removed for saving space Set GB(bus,Gen) connectivity index of each generating unit to each bus / * Removed for saving space / ; Table BusData(bus, * ) Demands of each bus in MW * * * * * * * * * * Omitted for saving space ; table branch (bus, node, * ) Network technical c h a r a c t e r i s t i c s * * * * * * * * * * Omitted for saving space ; Table WD ( t, * ) w d t1 0.0786666666666667 0.684511335492475 t2 0.0866666666666667 0.644122690036197 t3 0.117333333333333 0.61306915602972 t4 0.258666666666667 0.599733282530006 t5 0.361333333333333 0.588874071251667 t10 0.548 0.787007048961707 t20 0.561333333333333 0.936368832158506 t21 0.565333333333333 0.887597637645266 t22 0.556 0.809297008954087 t23 0.724 0.74585635359116 t24 0.84 0.733473042484283; Parameter Wcap( bus ) /8 200 19 150 21 100/; branch (bus, node, ’x ’ )$( branch (bus, node, ’x ’ )=0) = branch (node, bus, ’x ’ ); branch (bus, node, ’ Limit ’ )$( branch (bus, node, ’ Limit ’ )=0) = branch (node, bus, ’ Limit ’ ); branch (bus, node, ’ bij ’ ) $branch (bus, node, ’ Limit ’ ) =1/branch (bus, node, ’x ’ ); branch (bus, node, ’ z ’ ) $branch (bus, node, ’ Limit ’ )= sqrt( power ( branch (bus, node, ’x ’ ),2)+ power ( branch (bus, node, ’ r ’ ),2) ); branch (node, bus, ’ z ’ )= branch (bus, node, ’ z ’ ); parameter conex (bus, node ); conex (bus, node )$( branch (bus, node, ’ limit ’ )and branch (node, bus, ’ limit ’ ) ) =1; conex (bus, node )$( conex (node, bus ) ) =1; Variables OF, Pij (bus, node, t ),Pg(Gen, t ), delta (bus, t ), lsh (bus, t ),Pw(bus, t ), pc (bus, t ); Equations const1, const2, const3, const4, const5, const6; const1 (bus, node, t )$( conex (bus, node ) ) .. Pij (bus, node, t )= e = branch (bus, node, ’ bij ’ ) * ( delta (bus, t ) −delta (node, t ) ); const2 (bus, t ) .. lsh (bus, t )$BusData(bus, ’pd ’ ) + Pw(bus, t )$Wcap( bus )+ sum(Gen$GB(bus,Gen),Pg(Gen, t ) ) − WD ( t, ’d ’ ) * BusData(bus, ’pd ’ )/Sbase= e =+ sum( node$conex (node, bus ), Pij (bus, node, t ) ); const3 .. OF = g = sum(( bus,Gen, t )$GB(bus,Gen),Pg(Gen, t ) * GD (Gen, ’b ’ ) * Sbase ) + sum(( bus, t ),VOLL * lsh (bus, t ) * Sbase$BusData + VWC* Pc(bus, t ) * sbase$Wcap ( bus ) ); const4 (gen, t ) .. pg(gen, t+1) − pg(gen, t )=l= GD (gen, ’RU’ )/Sbase; const5 (gen, t ) .. pg(gen, t −1) − pg(gen, t )=l= GD (gen, ’RD’ )/Sbase; const6 (bus, t )$Wcap( bus ) .. pc (bus, t )= e = WD ( t, ’w’ ) * Wcap( bus )/Sbase− pw(bus, t ); model loadflow /const1, const2, const3, const4, const5, const6 /; Pg. lo (Gen, t )= GD (Gen, ’Pmin ’ )/Sbase; Pg. up(Gen, t )= GD (Gen, ’Pmax ’ )/Sbase; delta. up(bus, t )= pi/2; delta. lo (bus, t )=− pi/2; delta. fx ( slack, t ) =0; Pij. up(bus, node, t )$ (( conex (bus, node ) ) ) =1* branch (bus, node, ’ Limit ’ )/Sbase; Pij. lo (bus, node, t )$ (( conex (bus, node ) ) )=−1*branch (bus, node, ’ Limit ’ )/Sbase; lsh. up(bus, t )= WD ( t, ’d ’ ) * BusData(bus, ’pd ’ )/Sbase; lsh. lo (bus, t )= 0; Pw. up(bus, t )= WD ( t, ’w’ ) * Wcap( bus )/Sbase; Pw. lo (bus, t ) =0; Pc. up(bus, t )= WD ( t, ’w’ ) * Wcap( bus )/Sbase; Pc. lo (bus, t ) =0; Solve loadflow minimizing OF using lp;
The wind power generations at efferent buses vs time are shown in Fig. 6.12.
The wind power curtailment is occurring in bus 19 at time t 17 equal to 38.76 and also in bus 21 at time t 16 equal to 15.32 MW and also at time t 17 equal to 86.93 MW. The total operating cost (including the wind curtailment cost) would be $4. 3229 × 105.
Nomenclature
Indices and Sets
- g :
-
Index of thermal generating units.
- w :
-
Index of wind turbine units.
- i, j :
-
Index of network buses.
- Ω G :
-
Set of all thermal generating units.
- Ω G i :
-
Set of all thermal generating units connected to bus i.
- Ω ℓ i :
-
Set of all buses connected to bus i.
- Ω B :
-
Set of network buses.
- Ω ℓ :
-
Set of network branches.
Parameters
- w i, t :
-
Availability of wind turbine connected to bus i at time t
- Λ i w :
-
Capacity of wind turbine connected to bus i
- L i, t :
-
Electric power demand in bus i at time t
- a g , b g , c g :
-
Fuel cost coefficients of thermal unit g.
- P g max∕min :
-
Maximum/minimum limits of power generation of thermal unit g.
- P ij max :
-
Maximum power flow limits of branch connecting bus i to j.
- x ij :
-
Reactance of branch connecting bus i to j.
- r ij :
-
Resistance of branch connecting bus i to j.
- VOLL:
-
Value of loss of load ($/MW h)
- VWC:
-
Value of loss of wind ($/MW h)
Variables
- P ij, t :
-
Active power flow of branch connecting bus i to j at time t (MW).
- P g, t :
-
Active power generated by thermal unit g at time t (MW).
- P i, t w :
-
Active power generated by wind turbine connected to bus i at time t (MW).
- P i, t wc :
-
Curtailed power of wind turbine connected to bus i at time t (MW).
- λ i, t :
-
Locational marginal price in bus i at time t ($/MW h).
- LS i, t :
-
Load shedding in bus i at time t (MW).
- OF:
-
Total operating costs ($).
- δ i, t :
-
Voltage angle of bus i at time t (rad).
6.3 Multi-Period Optimal AC Power Flow
The AC power flow considering wind generation and load shedding is shown in Fig. 6.13.
The optimal power flow equations are described in (6.8) as follows:
The GAMS code developed for solving the minimum cost OPF is given in GCode 6.7. The optimal active/reactive power generation of thermal units in MP-AC OPF are given in Figs. 6.14 and 6.15, respectively.
GCode 6.7 Multi-period AC OPF for modified IEEE RTS 24 bus system
Sets i network buses /1*24/ , slack ( i ) /13/, t /t1 * t24/ GB( i ) generating buses /1,2,7,15*16,18,21*23/; scalars Sbase /100/ ,VOLL /10000/,VWC /50/; a l i a s ( i, j ); Table GenD( i, * ) Generating units c h a r a c t e r i s t i c s pmax pmin b Qmax Qmin Vg RU RD 1 152 30.4 13.32 192 −50 1.035 21 21 2 152 30.4 13.32 192 −50 1.035 21 21 7 350 75 20.7 300 0 1.025 43 43 13 591 206.85 20.93 591 0 1.02 31 31 15 215 66.25 21 215 −100 1.014 31 31 16 155 54.25 10.52 155 −50 1.017 31 31 18 400 100 5.47 400 −50 1.05 70 70 21 400 100 5.47 400 −50 1.05 70 70 22 300 0 0 300 −60 1.05 53 53 23 360 248.5 10.52 310 −125 1.05 31 31 ; Table BD( i, * ) Demands of each bus in MW Pd Qd * removed for saving space; table LN( i, j, * ) Network technical c h a r a c t e r i s t i c s r x b limit * removed for saving space; Table WD ( t, * ) w d * removed for saving space ; parameter Wcap( i ) /8 200 19 150 21 100/; LN( i, j, ’x ’ )$(LN( i, j, ’x ’ )=0) = LN( j, i, ’x ’ );LN( i, j, ’ r ’ )$(LN( i, j, ’ r ’ )=0) = LN( j, i, ’ r ’ ); LN( i, j, ’b ’ )$(LN( i, j, ’b ’ )=0) = LN( j, i, ’b ’ );LN( i, j, ’ bij ’ )$LN( i, j, ’ Limit ’ )=1/ LN( i, j, ’x ’ ); LN( i, j, ’ Limit ’ )$(LN( i, j, ’ Limit ’ )=0) = LN( j, i, ’ Limit ’ ); LN( i, j, ’ z ’ )$LN( i, j, ’ Limit ’ )= sqrt( power (LN( i, j, ’x ’ ),2)+ power (LN( i, j, ’ r ’ ),2) ); LN( j, i, ’ z ’ )$(LN( i, j, ’ z ’ )=0) = LN( i, j, ’ z ’ ); LN( i, j, ’ th ’ )$(LN( i, j, ’ Limit ’ ) and LN( i, j, ’x ’ ) and LN( i, j, ’ r ’ ) ) =arctan (LN( i, j, ’x ’ ) /(LN( i, j, ’ r ’ ) ) ); LN( i, j, ’ th ’ )$(LN( i, j, ’ Limit ’ ) and LN( i, j, ’x ’ ) and LN( i, j, ’ r ’ )=0) = pi/2; LN( i, j, ’ th ’ )$(LN( i, j, ’ Limit ’ ) and LN( i, j, ’ r ’ ) and LN( i, j, ’x ’ )=0) =0; LN( j, i, ’ th ’ )$LN( i, j, ’ Limit ’ )= LN( i, j, ’ th ’ ); Parameter cx ( i, j ); cx ( i, j )$(LN( i, j, ’ limit ’ )and LN( j, i, ’ limit ’ ) ) =1; cx ( i, j )$( cx ( j, i ) ) =1; Variables OF, Pij ( i, j, t ), Qij ( i, j, t ),Pg( i, t ),Qg( i, t ),Va( i, t ),V( i, t ),Pw( i, t ); Equations eq1, eq2, eq3, eq4, eq5, eq6, eq7; eq1 ( i, j, t ) $cx ( i, j ).. Pij ( i, j, t )= e=( V( i, t ) * V( i, t ) * cos(LN( j, i, ’ th ’ ) ) − V( i, t ) * V( j, t ) * cos(Va( i, t ) − Va( j, t )+ LN( j, i, ’ th ’ ) ) )/ LN( j, i, ’ z ’ ); eq2 ( i, j, t ) $cx ( i, j ).. Qij ( i, j, t )= e=( V( i, t ) * V( i, t ) * sin(LN( j, i, ’ th ’ ) ) − V( i, t ) * V( j, t ) * sin(Va( i, t ) − Va( j, t )+ LN( j, i, ’ th ’ ) ) )/ LN( j, i, ’ z ’ ) − LN( j, i, ’b ’ ) * V( i, t ) * V( i, t ) /2; eq3 ( i, t ) .. Pw( i, t )$Wcap( i )+ Pg( i, t )$GenD( i, ’Pmax ’ ) − WD ( t, ’d ’ ) * BD( i, ’pd ’ )/Sbase= e = + sum( j$cx ( j, i ), Pij ( i, j, t ) ); eq4 ( i, t ) .. Qg( i, t )$GenD( i, ’Qmax ’ ) − WD ( t, ’d ’ ) * BD( i, ’qd ’ )/Sbase= e = + sum( j$cx ( j, i ), Qij ( i, j, t ) ); eq5 .. OF = g = sum(( i, t ),Pg( i, t ) * GenD( i, ’b ’ ) * Sbase$GenD( i, ’Pmax ’ ) ); eq6 ( i, t )$(GenD( i, ’Pmax ’ ) and ord ( t )>1) .. Pg( i, t ) − Pg( i, t −1) =l= GenD( i, ’RU’ )/Sbase; eq7 ( i, t )$(GenD( i, ’Pmax ’ ) and ord ( t ) <card ( t ) ) .. Pg( i, t ) − Pg( i, t+1) =l= GenD( i, ’RD’ )/Sbase; Model loadflow /eq1, eq2, eq3, eq4, eq5, eq6, eq7 /; Pg. lo ( i, t )= GenD( i, ’Pmin ’ )/Sbase; Pg. up( i, t )= GenD( i, ’Pmax ’ )/Sbase; Qg. lo ( i, t )= GenD( i, ’Qmin ’ )/Sbase; Qg. up( i, t )= GenD( i, ’Qmax ’ )/Sbase; Va. up( i, t )= pi/2; Va. lo ( i, t )=− pi/2; Va. l ( i, t ) =0; Va. fx ( slack, t ) =0; Pij. up( i, j, t )$ (( cx ( i, j ) ) ) =+1*LN( i, j, ’ Limit ’ )/Sbase; Pij. lo ( i, j, t )$ (( cx ( i, j ) ) )=−1* LN( i, j, ’ Limit ’ )/Sbase; Qij. up( i, j, t )$ (( cx ( i, j ) ) ) =+1*LN( i, j, ’ Limit ’ )/Sbase; Qij. lo ( i, j, t )$ (( cx ( i, j ) ) )=−1* LN( i, j, ’ Limit ’ )/Sbase; V. lo ( i, t ) =0.9; V. up( i, t ) =1.1; Pw. up( i, t )= WD ( t, ’d ’ ) * Wcap( i )/ sbase; Pw. lo ( i, t ) =0; Solve loadflow minimizing OF using nlp;
Nomenclature
Parameters
- w i, t :
-
Availability of wind turbine connected to bus i at time t
- Λ i w :
-
Capacity of wind turbine connected to bus i
- P i, t L :
-
Active power component of demand in bus i at time t
- P i, t w :
-
Active power generation by wind turbine connected to bus i at time t
- Q i, t w :
-
Reactive power generation by wind turbine connected to bus i at time t
- a g , b g , c g :
-
Fuel cost coefficients of thermal unit g.
- P i g, max∕min :
-
Maximum/minimum limits of power generation of thermal unit g connected to bus i.
- P ij max :
-
Maximum power flow limits of branch connecting bus i to j.
- x ij :
-
Reactance of branch connecting bus i to j.
- r ij :
-
Resistance of branch connecting bus i to j.
- VOLL:
-
Value of loss of load ($/MW h)
- VWC:
-
Value of loss of wind ($/MW h)
- b :
-
Total line charging susceptance of branch connecting bus i to j (pu).
Variables
- S ij, t :
-
Apparent power flow of branch connecting bus i to j at time t.
- P i, t g :
-
Active power generated by thermal unit g connected to bus i at time t (MW).
- P i, t w :
-
Active power generated by wind turbine connected to bus i at time t (MW).
- λ i, t p :
-
Active locational marginal price (LMP) in bus i at time t ($/MW h).
- P i, t LS :
-
Active Load shedding in bus i at time t (MW).
- P i, t wc :
-
Curtailed power of wind turbine connected to bus i at time t (MW).
- I ij, t :
-
Current flow of branch connecting bus i to j at time t.
- Q i, t LS :
-
Reactive Load shedding in bus i at time t (MVAr).
- Q i, t g :
-
Reactive power generated by thermal unit g connected to bus i at time t (MW).
- λ i, t q :
-
Reactive locational marginal price (LMP) in bus i at time t ($/MVArh).
- OF:
-
Total operating costs ($).
- δ i, t :
-
Voltage angle in bus i at time t (rad).
- V i, t :
-
Voltage magnitude in bus i at time t (pu).
References
A. Meeraus A. Brooke, D. Kendrick, R. Raman, GAMS/Cplex 7.0 User Notes. GAMS Development Corp. (2000)
A.J. Wood, B.F. Wollenberg, Power Generation, Operation, and Control (Wiley, Hoboken, 2012)
P. Maghouli, A. Soroudi, A. Keane, Robust computational framework for mid-term techno-economical assessment of energy storage. IET Gener. Transm. Distrib. 10(3), 822–831 (2016)
F. Li, R. Bo Small test systems for power system economic studies, in: IEEE PES General Meeting (2010), pp. 1–4
R.D. Zimmerman, C.E. Murillo-Sanchez, R.J. Thomas, Matpower: steady-state operations, planning, and analysis tools for power systems research and education. IEEE Trans. Power Syst. 26(1), 12–19 (2011)
A.J. Conejo, M. Carrión, J.M. Morales, Decision Making Under Uncertainty in Electricity Markets, vol. 1 (Springer, New York, 2010)
F. Bouffard, F.D. Galiana, A.J. Conejo, Market-clearing with stochastic security-part II: case studies. IEEE Trans. Power Syst. 20(4), 1827–1835 (2005)
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2017 Springer International Publishing AG
About this chapter
Cite this chapter
Soroudi, A. (2017). Multi-Period Optimal Power Flow. In: Power System Optimization Modeling in GAMS. Springer, Cham. https://doi.org/10.1007/978-3-319-62350-4_6
Download citation
DOI: https://doi.org/10.1007/978-3-319-62350-4_6
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-62349-8
Online ISBN: 978-3-319-62350-4
eBook Packages: EnergyEnergy (R0)