Iteration step △x can be found only when the gain matrix is nonsingu- ...... ABC. △. EN. ABC. Y. 675. ABC. Y. Table 4.1.: Connection type and phases with load ...
INTERNATIONAL UNIVERSITY OF SARAJEVO FACULTY OF ENGINEERNG AND NATURAL SCIENCES
Distribution System State Estimation with examples in MATLAB, AMPL and C++
I. Džafić, M. Hodžić, I. Huseinagić
Contents 1. Introduction 1.1. Distribution System State Estimation (DSSE) . . . . . . 1.2. Mathematical formulation . . . . . . . . . . . . . . . . . 2. Distribution Power Flow 2.1. Modeling of System Components . . . . 2.1.1. Single phase branch π equivalent 2.1.2. Generator Modeling . . . . . . . 2.1.3. Load Modeling . . . . . . . . . . 2.2. Active and Reactive Power Flows . . . . 2.3. Basic Power Flow Problem . . . . . . . 2.3.1. Equality constraints . . . . . . . 2.3.2. Inequality constraints . . . . . . 2.4. Solution of the Power Flow Problem . . 2.4.1. Gauss-Seidel (G-S) Method . . . 2.4.2. Newton-Raphson (N-R) Method
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . . .
5 5 8 13 14 14 16 17 18 19 21 21 21 22 23
3. Optimization for Power Systems 29 3.1. Notation and terminology . . . . . . . . . . . . . . . . . 29 3.1.1. Feasibility and optimality . . . . . . . . . . . . . 30 3.1.2. Convexity . . . . . . . . . . . . . . . . . . . . . . 31 3.1.3. Duality . . . . . . . . . . . . . . . . . . . . . . . 33 3.1.4. Method of Penalty Functions . . . . . . . . . . . 34 3.1.5. Lagrange function, multipliers and optimality conditions . . . . . . . . . . . . . . . . . . . . . . . . 34 3.2. Unconstrained and constrained optimization . . . . . . . 36 3.2.1. Single-variable unconstrained optimization . . . . 36 3.2.2. Multi-variable unconstrained optimization . . . . 37 3.2.3. Multi-variable optimization with equality constraints 37 3.2.4. Multi-variable optimization with inequality constraints . . . . . . . . . . . . . . . . . . . . . . . 39 3.3. Classical Optimization Techniques . . . . . . . . . . . . 41 3.3.1. Unconstrained Optimization Approaches . . . . . 41
i
Contents
Contents
3.3.2. 3.3.3. 3.3.4. 3.3.5. 3.3.6. 3.3.7. 3.3.8. 3.4. Mixed 3.4.1. 3.4.2. 3.4.3. 3.4.4.
Linear Programming . . . . . . . . . . . . . . . . Nonlinear Programming . . . . . . . . . . . . . . Quadratic Programming . . . . . . . . . . . . . . Newton’s Method . . . . . . . . . . . . . . . . . . Interior Point Methods . . . . . . . . . . . . . . . Mixed-Integer Programming . . . . . . . . . . . . Network Flow Programming . . . . . . . . . . . . Integer Nonlinear Programming . . . . . . . . . . Mixed Integer Linear Programming . . . . . . . . Non-Linear Programming . . . . . . . . . . . . . Convex Mixed Integer Non-Linear Programming Non-convex Mixed Integer Non-Linear Programming . . . . . . . . . . . . . . . . . . . . . . . . . 3.5. MINLP Methods . . . . . . . . . . . . . . . . . . . . . . 3.5.1. Branch and Bound (B&B) . . . . . . . . . . . . . 3.5.2. Outer Approximation (OA) . . . . . . . . . . . . 3.5.3. Generalized Benders Decomposition (GBD) . . . 3.5.4. Extended Cutting Plane (ECP) . . . . . . . . . . 3.5.5. LP/NLP based Branch and Bound . . . . . . . . 3.6. Sequential Quadratic Programming . . . . . . . . . . . . 3.7. SQP Methods . . . . . . . . . . . . . . . . . . . . . . . . 3.7.1. Line search method . . . . . . . . . . . . . . . . 3.7.2. Trust region method . . . . . . . . . . . . . . . . 3.7.3. Han-Powell method . . . . . . . . . . . . . . . . 3.7.4. Sequential unconstrained methods . . . . . . . . 3.7.5. Filter methods . . . . . . . . . . . . . . . . . . . 3.7.6. Merit function . . . . . . . . . . . . . . . . . . . 3.7.7. Sequential programming algorithm and basic principle . . . . . . . . . . . . . . . . . . . . . . . . . 3.7.8. Lagrange Newton Iteration with SQP approach . 3.8. Example 3.1 . . . . . . . . . . . . . . . . . . . . . . . . . 3.9. Example 3.2 . . . . . . . . . . . . . . . . . . . . . . . . . 3.10. Example 3.3 . . . . . . . . . . . . . . . . . . . . . . . . . 4. Single-phase modeling 4.1. Problem Description and Basic Principles . . . . 4.2. Load Estimation with 4-connections . . . . . . . 4.2.1. WLS Estimation with Y -connected loads 4.2.2. Consideration of 4-connected loads . . .
ii
. . . .
. . . .
. . . .
. . . .
41 42 42 43 43 43 44 44 45 46 46 47 48 48 50 52 54 54 56 56 57 57 58 59 59 60 60 63 65 69 72 77 79 82 83 85
Contents 4.2.3. Consideration of Measurement Area Losses as Variables . . . . . . . . . . . . . . . . . . . . . . . . 4.2.4. Handling of Bad Data . . . . . . . . . . . . . . . 4.2.5. Summary of the Load Estimation Algorithm . . 4.3. Numerical Results . . . . . . . . . . . . . . . . . . . . . 4.3.1. Load Estimation Accuracy Test . . . . . . . . . . 4.3.2. Bad Data Identification . . . . . . . . . . . . . . 4.3.3. Load Estimation Performance Test . . . . . . . . 4.4. Numerical Sensitivity Factors . . . . . . . . . . . . . . . 5. Multiphase modeling 5.1. Multiphase branch π equivalent . . . . . . . . . . . . . . 5.1.1. Active and reactive power in multiphase branch element . . . . . . . . . . . . . . . . . . . . . . . 5.1.2. Active and reactive branch power sensitivity . . . 5.1.3. Shunt equivalent . . . . . . . . . . . . . . . . . . 5.1.4. Three phase transformers with OLTC . . . . . . 5.1.5. Branch Measurements . . . . . . . . . . . . . . . 5.1.6. Node Measurements . . . . . . . . . . . . . . . . 5.1.7. Injection Measurements . . . . . . . . . . . . . . 5.1.8. PV Nodes . . . . . . . . . . . . . . . . . . . . . . 5.1.9. LVC with OLTC . . . . . . . . . . . . . . . . . . 5.2. Three-Phase State Estimation Method . . . . . . . . . . 5.2.1. Formulation . . . . . . . . . . . . . . . . . . . . . 5.2.2. Solution . . . . . . . . . . . . . . . . . . . . . . .
89 90 91 92 92 95 96 99 101 101 103 105 109 109 112 117 119 123 124 125 125 126
6. Three Phase DSSE IEEE Tests 139 6.1. IEEE 4 bus network case . . . . . . . . . . . . . . . . . 139 6.2. IEEE 13 bus network case . . . . . . . . . . . . . . . . . 149 A. Appendix A.1. MATLAB Programming . . . . . . . . . . . . . . . . . A.1.1. Import Files to M-file . . . . . . . . . . . . . . A.1.2. Introduction of Symbolic Variables . . . . . . . A.1.3. Define Measurements and Parameters . . . . . A.1.4. Calculate Constraints . . . . . . . . . . . . . . A.1.5. Matrix Calculation . . . . . . . . . . . . . . . . A.1.6. Assign Initial Values . . . . . . . . . . . . . . . A.1.7. Solve Gauss-Newton Method and show Results A.2. MATLAB code . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . .
157 157 157 158 160 161 162 163 164 166
iii
Contents
Contents
B. Appendix B.1. AMPL Programming . . . . . . . . . . . . . . . B.1.1. AMPL Model File . . . . . . . . . . . . B.1.2. Declaration of Variables and Parameters B.1.3. Objective function and constraints . . . B.1.4. Solve problem and Display Results . . . B.2. AMPL Code . . . . . . . . . . . . . . . . . . . C. Appendix C.1. C++ Programming . . . . . . . . . . . . . . C.1.1. Assign Initial Values . . . . . . . . . C.1.2. Jacobian Matrix and right hand side C.1.3. Solve problem and Display Results . C.1.4. C++ Code for Example 3.1 . . . . C.1.5. C++ Code for Example 3.2 . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
177 177 177 178 179 180 181
. . . . . . . . (RHS) . . . . . . . . . . . .
. . . . . .
. . . . . .
. . . . . .
189 189 189 189 190 191 192
. . . . . .
Bibliography
197
Index
201
Nomenclature
205
iv
List of Figures 1.1. State Estimation block diagram . . . . . . . . . . . . . . 1.2. Weighted Least Square Algorithm . . . . . . . . . . . . 2.1. 2.2. 2.3. 2.4. 2.5. 2.6.
Equivalent circuit of a line element of length dx π-equivalent of single-phase element . . . . . . Model of a generator connected to bus p . . . . Model of a load connected to bus i . . . . . . . Bus connected to a subset of n buses . . . . . . Different types of buses . . . . . . . . . . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
7 11
. . . . . .
15 16 17 18 18 20
Convex Function . . . . . . . . . . . . . . . . . . . . . . . Convexity of differentiable function on (a,b) . . . . . . . . . Penalty functions . . . . . . . . . . . . . . . . . . . . . . . Pruning rules . . . . . . . . . . . . . . . . . . . . . . . . . Outer Approximation . . . . . . . . . . . . . . . . . . . . (a) Extended Cutting Plane, (b) LP/NLP Based Branch and Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.7. Three bus network with linear compensation of reactive power 3.8. System with capacitor for reactive power compensation . . .
32 33 35 49 52
3.1. 3.2. 3.3. 3.4. 3.5. 3.6.
3.9. Six node network . . . . . . . . . . . . . . . . . . . . . .
55 66 70 73
4.1. Two distribution feeders with a tree-like topology and an open ring . . . . . . . . . . . . . . . . . . . . . . . . . . 80 4.2. Equivalent injections at the boundaries between different measurement areas . . . . . . . . . . . . . . . . . . . . . 81 4.3. 4-connected load fed by an open-Y /open-4 transformer 86 4.4. IEEE 13-node test feeder with 7 MAs . . . . . . . . . . 93 4.5. IEEE 13-node test feeder with 3 MAs . . . . . . . . . . 96 4.6. IEEE 13-node test feeder with 1 MA . . . . . . . . . . . 97 4.7. SLF problem for a 4-connected load fed by an openY /open-4 transformer . . . . . . . . . . . . . . . . . . . 100 4.8. Consideration of the Thévenin equivalent in the SLF problem . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
1
List of Figures
List of Figures
5.1. Three phase equivalent of power system branch . . . . . 101 5.2. Cross-node cross-phase admittances . . . . . . . . . . . 102 5.3. π equivalent of an n × n multiphase element . . . . . . . 102 5.4. Open-Wye Open-Delta transformer . . . . . . . . . . . . 103 5.5. Three phase shunt . . . . . . . . . . . . . . . . . . . . . 109 5.6. π equivalent of a three phase transformer with OLTC on Y-side . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 5.7. π equivalent of a three phase transformer with OLTC on Delta-side . . . . . . . . . . . . . . . . . . . . . . . . . . 111 5.8. Watt meter connection on a phase using current and potential transformers . . . . . . . . . . . . . . . . . . . . . 113 5.9. Measuring total active power entering terminal p using two watt-meters . . . . . . . . . . . . . . . . . . . . . . 113 5.10. Single-phase multi-branch power measurement . . . . . 114 5.11. Cumulative multi-branch power measurement . . . . . . 115 5.12. Current magnitude measurement . . . . . . . . . . . . . 116 5.13. Multi-branch current magnitude measurement . . . . . . 116 5.14. Phase-to-ground voltage magnitude measurement . . . . 117 5.15. Phase-to-phase voltage magnitude measurement . . . . . 118 5.16. Two-phase delta injection . . . . . . . . . . . . . . . . . 119 5.17. Three-phase delta injection . . . . . . . . . . . . . . . . 122 5.18. Simplified schematic of generator voltage regulation . . 124 6.1. IEEE 4 Node Test Feeder . . . . . . . . . . . . . . . . . 140 6.2. Objective function . . . . . . . . . . . . . . . . . . . . . 148 6.3. Modified IEEE 13 Node Test Feeder . . . . . . . . . . . 149
2
List of Tables 3.1. Linear Compensation . . . . . . . . . . . . . . . . . . . . . 3.2. System with Capacitor . . . . . . . . . . . . . . . . . . . . 4.1. Connection type and phases with load in the IEEE-13 test feeder . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2. SCADA measurements, estimated values, and error deviation using current balancing [4] and DSSE (13-node test feeder) . . . . . . . . . . . . . . . . . . . . . . . . . 4.3. Active and Reactive power load scaling factors using DSSE (13-node test feeder) . . . . . . . . . . . . . . . . . . . . 4.4. Average and maximum values of the error deviations in % using current balancing [4] and DSSE (13-node test feeder) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.5. Estimated load error versus the number of MAs (13-node test feeder) . . . . . . . . . . . . . . . . . . . . . . . . . 4.6. Bad data identification in the 13-node test system with 3 MAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.7. Computing time of DSSE for a 642-node distribution network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.8. Performance network key numbers . . . . . . . . . . . . 6.1. Measurement set for IEEE 4-bus network . . . . . . . . 6.2. Bus Voltages . . . . . . . . . . . . . . . . . . . . . . . . 6.3. Estimated voltages, current, load and power flow for 4 bus system . . . . . . . . . . . . . . . . . . . . . . . . . 6.4. Convergence summary . . . . . . . . . . . . . . . . . . . 6.5. Measurement set for IEEE 13-bus network . . . . . . . . 6.6. Bus Voltages . . . . . . . . . . . . . . . . . . . . . . . . 6.7. Line Segment Data . . . . . . . . . . . . . . . . . . . . . 6.8. Estimated voltages for 13 bus system . . . . . . . . . . . 6.9. Convergence Summary . . . . . . . . . . . . . . . . . . .
69 72
93
94 95
95 96 97 98 98 141 141 148 148 150 151 152 154 155
3
1. Introduction 1.1. Distribution System State Estimation (DSSE) With the development of information and communication technologies (ICT), relatively powerful and inexpensive computers are available. Modern telecommunication systems are reliable, have high bandwidth and their price is constantly decreasing. Therefore, intelligent and communicating devices could be used in distribution systems to help the utilities to keep or improve the reliability and the quality of the power supply. State estimation is essential to provide a good evaluation of network state but also to detect bad input data or detect topology errors for example. Moreover, because most of the measurement devices will be accurately synchronized, there will be a revolution in the network monitoring approach as synchronized measurements provide a direct state measurement instead of providing a means to estimate it. Secondly, another possible evolution is to expect that the future protection systems will be more based on communications. Protection is traditionally based on local measurements only. But the introduction of distributed generation and reduced fault current level create a need for communicating protection systems. This evolution is also possible with the experience gained with line differential protection over the last two decades. Very selective and sensitive protection is indeed possible with communications but the security and dependability of the protection system has to be analyzed. A key challenge is to have a real-time model so that power network computations are performed on a model that resembles the current situation. When we say a real-time model we mean a “snapshot” of the system that contains redundant measurements of quantities of interest, the correct topology from which measurements are derived and accurate parameters of the elements in the model. An Distribution Management System (DMS) provides a variety of measured data and computer applications for monitoring and control of the power network. Started
5
Chapter 1
Introduction
as engineering tool, the power system state estimator became the key data processing tool in modern EMS systems, and evolved in today’s industry as a very important application. The block diagram showing the components of a modern state estimator is shown on Fig. 1.1. Monitoring and control of power system assets is conducted through the supervisory control and data acquisition (SCADA) system. In the early days, it was believed that the real-time database provided by SCADA could provide an operator with an accurate system view. Very soon, the deficiencies of SCADA were realized. To mention a few: hard to assure availability of all measurements at all times, measurements prone to errors, etc. A more powerful tool was needed to process collected measurements and to filter bad ones. A central master station, located at the control center, gathers information through the SCADA system. The SCADA system collects measurement data in real time from remote terminal units (RTUs) installed in substations across the power system. Typical RTU measurements include power flows (both active and reactive), power injections, voltage magnitude, phase angles and current magnitude. While there is not much to be said that is not already known about active and reactive power and voltage magnitude measurements, voltage angle measurements are relatively new in practice. Direct measurement of voltage phase angle was impossible for a long time. In order to be valid, those measurements should be synchronized, i.e. a time reference should be provided. The global positioning system (GPS) signal made synchronization possible with accuracy better than 1 µs. A phasor measurement unit (PMU) equipped with a GPS receiver allows for synchronization of measurements, yielding accurately measured and time-stamped voltage phase angles. The overall state estimation process consists of the following steps: • Network topology processing: topology processor gathers status data about the circuit breakers and switches, and configures the one-line diagram of the system. • Observability analysis: Observability analysis determines if a state estimation solution for the entire system can be obtained using the available set of measurements, identifies the unobservable branches, and the observable islands in the system if any exist. • Estimation of the state vector: State estimation determines the optimal estimate for the system state, which is composed of complex bus voltages in the entire power system, based on the
6
1.1 Distribution System State Estimation (DSSE)
V x= δ
Figure 1.1.: State Estimation block diagram network model and the gathered measurements from the system. Also provides the best estimates for all the line flows, loads, transformer taps, and generator outputs. • Detection/identification of bad data: Bad data processing detects the existence of gross errors in the measurement set, identifies and eliminates bad measurements provided that there is enough redundancy in the measurement configuration, parameter and structural error processing, estimates various network parameters, such as transmission line model parameters, tap changing transformer parameters, shunt capacitor or reactor parameters, detects structural errors in the network configuration and identifies the erroneous breaker status provided that there is enough measurement redundancy [1]. Distribution system state estimation (DSSE) may be very different from transmission system state estimation. Compared to transmission networks, distribution networks differ in the following characteristics: • Their topology is radial or weakly meshed. • The load is unbalanced. Therefore, single phase equivalents do not contain enough details and three-phase estimators are needed.
7
Chapter 1
Introduction
• The lines have high r/x ratios, making a decoupling of the active and reactive sub-problems not possible. For example, the ratio may be more or less equal to one for medium voltage overhead lines and will be generally greater than one for underground cables. Some lines segments may be very short (lower than hundreds of meters in an urban environment). • Because of the lower number of customers, these networks have very limited measurement sets compared to transmission systems. Because the number of real-time measurements is too low, load forecasts (also called pseudo-measurements) are generally needed to make the system observable. • The loads are more difficult to forecast than in transmission networks, because the number of customers per transformer is smaller, resulting in greater randomness. Further, with the introduction of electric vehicles or demand response, the load randomness could become even higher. State estimation is becoming necessary in distribution to manage unpredictable loads and generation. Distribution state estimation (DSSE) provides a very useful role in providing network operators with improved, consistent and complete information about the present operating state of their network, as well as ability to drive additional network automation functions. Network automation functions include: network restoration(post-fault), real-time system monitoring, energy loss minimization, outage management via ‘what-if’ network analysis, security assessment, voltage/reactive power optimization, generator control and intelligent load management.
1.2. Mathematical formulation The state of the system can be estimated from a set of redundant measurements taken on the network, e.g. voltage or current flow measurements. The classical approach of state estimation in power systems consists of the application of the Weighted Least Square (WLS) methodology, in which a set of measurements z can be represented as [1]: z = h(x) + e
(1.1)
where z is the (m×1) measurement vector; x is the an (n×1) state vector to be estimated; h is a vector of nonlinear functions that relate the states
8
1.2 Mathematical formulation to the measurements; and e is an (m×1) measurement error vector. It is necessary that m ≥ n and the Jacobian matrix of h(x) has rank n. The state is estimated such that it fits best to the redundant measurements available. The weighted least squares estimator minimizes the weighted sum of squared residuals: minimize J(x) =
1 2
[z − h(x)]T W [z − h(x)]
(1.2)
where W = R−1 = diag(σi2 ) is the weighting matrix, and R is a diagonal matrix whose elements are the variances of the measurement error and σi2 is the variance for the i − th measurement. The first order necessary conditions for a minimum are that ∂J(x) = H T W [z − h(x)] = 0 ∂x
(1.3)
where H(x) is the measurement Jacobian matrix H(x) =
∂h(x) ∂x
(1.4)
Once the nonlinear measurement function h(x) is linearized h(x + 4x) ≈ h(x) + H(x)4x
(1.5)
the following iterative process is obtained (H T W H)4x = H T W [z − h(x)]
(1.6)
xk+1 = xk + 4xk
(1.7)
The symmetric matrix H T W H is called the gain or information matrix. Equations 1.5 are the so-called normal equations of the least-squares method and the iteration step 4x can be found only when the gain matrix is nonsingular. So far state the estimation problem was formulated as an unconstrained minimization problem. However, there are buses in the network that have neither load nor generation, and they are called zero injection power buses. Measurements conducted on these buses are so-called virtual measurements, and they impose additional constraints to the
9
Chapter 1
Introduction
WLS problem. Thus, the WLS estimator minimizes the weighted sum of the squares of the residuals with respect to these constraints: minimize J(x) = subject to
1 2
[z − h(x)]T W [z − h(x)] c(x) = 0
(1.8)
where c(x) = 0 represents the accurate virtual measurements such as zero-injections, which are now excluded from h(x). The constrained minimization problem are solved using the method of Lagrange multipliers as follows: L =J(x) − λT c(x)
(1.9)
where λ is the vector of Lagrange multipliers. Thus, partial derivatives of L with respect to x and λ are obtained to minimize this function and the first-order optimality conditions are derived: ∂L(x)/∂x = 0 ⇒ H T W [z − h(x)] + C T λ = 0 ∂L(x)/∂λ = 0 ⇒ c(x) = 0
(1.10)
where the matrix C = ∂c(x)/∂x is the Jacobian of c(x). Applying the Gauss-Newton method, the nonlinear set of Equations 1.10 is solved iteratively to find the vector x ˆ that minimizes L(x): "
HT W H CT C 0
#"
4x −λ
#
"
=
H T W 4z k −c(xk )
#
(1.11)
where: 4z k = z − h(xk )
(1.12)
Iteration step 4x can be found only when the gain matrix is nonsingular. The iterative approach is applied to obtain the state update until the absolute value of the difference of the states between successive iterations is less than the some tolerance value ε. 4xk+1 = xk+1 − xk < ε
(1.13)
Block diagram of Weighted Least Square algorithm is given in Fig. 1.2.
10
1.2 Mathematical formulation
z
x = x0
(z − h(x )) k
H
[ H T WH ]
[
]
−1
[
]
∆x = H TWH H TW z − h(x k )
x = x + ∆x
Max ( ∆x ) < ε
Figure 1.2.: Weighted Least Square Algorithm Besides the WLS algorithm, other state estimation methods such as decoupled WLS and Least Absolute Value (LAV) estimation were developed, but WLS is dominant in practical implementations.
11
2. Distribution Power Flow One of the most fundamental calculations related to any system is the determination of the steady state behavior. It is of utmost importance to be able to calculate the voltages and currents that different parts of the power system are exposed to. This is essential not only in order to design the different power system components such as generators, lines, transformers, shunt elements, etc. so that these can withstand the stresses they are exposed to during steady state operation without any risk of damages. Furthermore, for an economical operation of the system the losses should be kept at a low value taking various constraints into account, and the risk that the system enters into unstable modes of operation must be supervised. In order to do this in a satisfactory way the state of the system, i.e. all (complex) voltages of all nodes in the system, must be known. With these known, all currents, and hence all active and reactive power flows can be calculated, and other relevant quantities can be calculated in the system. In power systems, this calculation is the steady state power flow problem, also called load flow. It essentially involves finding the steady state voltages at each node, given a certain set of generation and loading conditions. The optimal power flow (OPF) problem seeks to control the generation/consumption of generators/loads to optimize certain objectives such as to minimize the generation cost or power loss in the network. Since power flow is such a fundamental calculation for a power system, it is used in many applications in planning and operation. Some of the optimization problems related to distribution automation, such as network reconfiguration, service restoration, and capacitor placement, require the solution of hundreds or even thousands of power flow problems. These applications place two primary requirements on a distribution power flow program. First, the modeling must reflect the actual behavior of the system components. Second, the solution algorithm must be robust and efficient. There are two popular numerical methods for solving the power-flow equations. These are the Gauss-Seidel (G-S) and the Newton-Raphson (N-R) methods. The N-R method is
13
Chapter 2
Distribution Power Flow
superior to the G-S method because it exhibits a faster convergence characteristic. However, the N-R method suffers from the disadvantage that a “flat start” is not always possible since the solution at the beginning can oscillate without converging toward the solution. In order to avoid this problem, the load-flow solution is often started with a GaussSeidel algorithm followed by the Newton-Raphson algorithm after a few iterations. There is also an approximate but faster method for the loadflow solution. It is a variation of the Newton-Raphson method, called the fast-decoupled method, which was introduced by Stott and Alsac (1974). We will not be covering this method in this book.
2.1. Modeling of System Components Modeling power system components means developing a mathematical model as a set of equations or relations, which appropriately describes the interactions between different quantities in the time frame studied and with the desired accuracy of a physical or engineered component or system. All analysis starts with appropriate formulation of models. This section is focused on modeling of components of power system such as branches, generators, loads, etc.
2.1.1. Single phase branch π equivalent The general model of a transmission line was given by the telegraph equation, which is a partial differential equation, and by assuming stationary sinusoidal conditions the long line equations, ordinary differential equations, were obtained. By solving these equations and restricting the interest to the conditions at the ends of the lines, the lumped-circuit line models (π-models) were obtained, which is an algebraic model. Equivalent circuit of a line element of length dx is shown in Fig. 2.1. Due to the effects of magnetic and electric field created by currents flowing through lines, all lines in power system exhibit the properties of inductance and capacitance. Line resistance is a consequence of conductor material opposition to the passage of current flow, while shunt shunt conductance of the line occurs as a result of leakage currents in insulators and ionized air. Thus, the model is characterized by the series parameters
14
2.1 Modeling of System Components
Figure 2.1.: Equivalent circuit of a line element of length dx R0 = series resistance/km per phase (Ω/km) X 0 = series reactance/km per phase (Ω/km)) and the shunt parameters B 0 = shunt susceptance/km per phase (siemens/km) G0 = shunt conductance/km per phase (siemens/km) The parameters above are specific for the line or cable configuration and are dependent on conductors and geometrical arrangements. From the circuit in Fig. 2.1 the telegraph equation is derived, and from this the lumped-circuit line model for symmetrical steady state conditions, Fig. 2.2. This model is frequently referred to as the π-model, and it is characterized by series impedance (Ω) and shunt admittance (S) between nodes p and q: zpq = rpq + jxpq
(2.1)
sh sh ypq = gpq + jbsh pq
(2.2)
When formulating the network equations the node admittance matrix will be used and the series admittance of the line model is needed: −1 ypq = zpq = gpq + jbpq
(2.3)
where rpq 2 +x2 rpq pq xpq − r2 +x 2 pq pq
gpq = bpq =
(2.4)
15
Chapter 2
Distribution Power Flow
y pq
sh
y pq
sh
Figure 2.2.: π-equivalent of single-phase element For actual transmission lines the series reactance and the series resistance are both positive, and consequently gpq is positive and bpq is negative. The shunt susceptance and the shunt conductance are both sh is so small positive for real line sections. In many cases the value of gpq that it could be neglected. The complex currents ip and iq in Fig. 2.2 can be expressed as functions of the complex voltages at the branch terminal nodes p and q: v ip = y pq (v p − v q ) + y sh pq p sh iq = y pq (v q − v p ) + y pq v q
(2.5)
The corresponding Kirchoff’s equations are y + y sh −y pq ip pq = pq iq −y pq y pq + y sh pq
" #
"
#"
vp vq
#
(2.6)
As seen the matrix on the right hand side of Equation 2.6 is symmetric and the diagonal elements are equal.
2.1.2. Generator Modeling In power flow analysis generators are modeled as current injections, see Fig. 2.3. In steady state a generator is commonly controlled so that the active power injected into the bus and the voltage at the generator terminals are kept constant. Active power from the generator is determined by the turbine control and must of course be within the capability of the turbine-generator system. Voltage is primarily determined by the reactive power injection into the node, and since the generator must operate within its reactive capability curve it is not possible to control the
16
2.1 Modeling of System Components
gen p
Figure 2.3.: Model of a generator connected to bus p voltage outside certain limits. The reactive capability of a generator depends on a number of quantities, such as active power, bus voltage and other operating conditions. The shape of the generator capability curve is specific for each generator and depends on design characteristics, type of generator, hydro or steam turbine, stability constraints, etc.
2.1.3. Load Modeling When formulating the load flow equations for power systems, a load is most often the infeed of power to a network at a lower voltage level, e.g. a distribution network. Often the voltage in the distribution systems is kept constant by controlling the tap-positions of the distribution transformers which means that power, active and reactive, in most cases can be regarded as independent of the voltage on the high voltage side. This ∗ means that the complex power v p (iload p ) is constant, i.e. independent of the voltage magnitude Vi . Also in this case the current is defined as positive when injected into the bus, see Fig. 2.4. In the general case the complex load current can be written as iload = iload p p (vp )
(2.7)
where the function Iiload () describes the load characteristics. More often the load characteristics are given for the active and reactive powers Ppload = Ppload (vp ) Qload = Qload p p (vp ).
(2.8)
17
Chapter 2
Distribution Power Flow load p
Figure 2.4.: Model of a load connected to bus i
2.2. Active and Reactive Power Flows The net complex current injection at a network bus, see Fig. 2.5, is related to the current flows in the branches connected to the bus. Ap-
ip
y p0
Figure 2.5.: Bus connected to a subset of n buses plying Kirchhoff’s Current Law (KCL) yields: ip = y p0 v p + y p1 (v p − v 1 ) + ... + +y pN (v p − v N )
(2.9)
Equation 2.9 can be rewritten as: ip =
N X q=1
18
y pq v q
(2.10)
2.3 Basic Power Flow Problem The complex power at bus p can be expressed as: S p = Pp + jQp = v p i∗p
(2.11)
Expressing Equation 2.10 in polar form and substituting ii from Equation 2.11 results in a set of nonlinear algebraic equations in terms of voltage magnitude in per unit, and angle in radians: Pp + jQp = vp ∠ − δp
n X
ypq vq ∠(θpq + δq )
(2.12)
q=1
where v p = vp ∠δp , v q = vq ∠δq and y pq = ypq ∠θpq . The expressions for active and reactive power injections are obtained by identifying the real and imaginary parts of Equation 2.12, yielding
Pp =
n X
vp vq ypq cos(θpq − δp + δq )
(2.13)
q=1
Qp = −
n X
vp vq ypq sin(θpq − δp + δq )
(2.14)
q=1
2.3. Basic Power Flow Problem In a power distribution system, active and reactive power flows from the generating station to the load through different networks buses and branches. The flow of active and reactive power is called power flow or load flow. The power flow problem models the nonlinear relationships among bus power injections, power demands, and bus voltages and angles, with the network constants providing the circuit parameters. Optimal power flow has an aim to find “optimal” control parameter settings to minimize a desired objective function, subject to certain system constraints. In the basic formulation of the power flow problem, four variables are associated to each bus (network node) p: voltage magnitude (Vp ) ,voltage angle (δp ), net active power (Pp ) and net reactive power (Qp ). Depending on which of the above four variables are known (given) and
19
Chapter 2
Distribution Power Flow
which ones are unknown (to be calculated), three types of buses can be defined: Load bus (PQ): No generator is connected to the bus. At this bus the real and reactive power are specified, and it is desired to find out the voltage magnitude and phase angle through load flow solutions. Generator bus or voltage controlled bus (PV): Here the voltage magnitude corresponding to the generator voltage and real power corresponds to its rating are specified. It is required to find out the reactive power generation and phase angle of the bus voltage. Slack (swing) bus: For the slack bus, it is assumed that the voltage magnitude and voltage phase are known, whereas real and reactive powers are obtained through the load flow solution. Simple network as shown in Fig. 2.6 consists of different types of buses: slack bus, generator bus and load bus.
Figure 2.6.: Different types of buses
The slack, also called reference bus, has double functions in the basic formulation of the power flow problem: 1. It serves as the voltage angle reference 2. Since the active power losses are unknown in advance, the active power generation of the slack bus is used to balance generation, load, and losses.
20
2.4 Solution of the Power Flow Problem
2.3.1. Equality constraints Equality constraints can be written in the following manner: Ppgen
−
Ppload
= Pp =
n X
vp vq ypq cos(θpq − δp + δq )
(2.15)
q=1
Qgen − Qload = Qp = − p p
n X
vp vq ypq sin(θpq − δp + δq )
(2.16)
q=1
are active and reactive power generation at bus where Ppgen and Qgen p load load p, and Pp and Qp are active and reactive load power at bus p.
2.3.2. Inequality constraints Various types of limits are also considered in practical implementations, including voltage magnitudes at PQ buses, branch current flows, branch power flows, active and reactive power generation levels, transformer taps, phase shifter angles, etc. A set of inequality constraints imposes operating limits on variables such as limits on generator real and reactive power injections max min ≤ P Pgen gen ≤ Pgen max Qmin gen ≤ Qgen ≤ Qgen
(2.17)
Another example are real and reactive components of the complex load power that are given within the boundaries min ≤ P max Pload load ≤ Pload min Qload ≤ Qload ≤ Qmax load
(2.18)
2.4. Solution of the Power Flow Problem In all realistic cases the power flow problem cannot be solved analytically, and hence iterative solutions implemented in computers must be used. In this chapter we will review two solutions methods, Gauss iteration with a variant called Gauss-Seidel iterative method, and the Newton- Raphson method.
21
Chapter 2
Distribution Power Flow
2.4.1. Gauss-Seidel (G-S) Method Gauss-Seidel method for solution of system of non-linear equations is very similar to Jacobi method. The convergence of this method is guaranteed in case that the system matrix is diagonally dominant, or symmetric and positive definite. Gauss-Seidel method will be explained on the general example of system of N equations [2]: f1 (x1 , x2 , ..., xN ) = c1 f2 (x1 , x2 , ..., xN ) = c2 .. .
(2.19)
fN (x1 , x2 , ..., xN ) = cN One variable is expressed in each equation, which results in following expressions: x1 = c1 + g1 (x1 , x2 , ..., xN ) x2 = c2 + g2 (x1 , x2 , ..., xN ) .. .
(2.20)
xN = cN + gN (x1 , x2 , ..., xN ) Initial estimate x01 , x02, ..., x0N is chosen and the first iteration yields approximate solution x11 , x12 , ..., x1N . In each iteration, values of the variables calculated in the preceding equations are used in the solution of the subsequent equations:
= c1 + g1 (xn1 , xn2 , ..., xnN ) xn+1 1 n+1 x2 = c2 + g2 (xn1 , xn2 , ..., xnN ) .. .
(2.21)
xn+1 = cN + gN (xn1 , xn2 , ..., xnN ) N Iteration process ends when the change in all variables in two iterations is less than specified accuracy. Power flow solution using Gauss-Seidel method starts with system node voltage equation [3]:
Y 11 Y 21 . . .
Y 12 Y 22 .. .
··· ··· .. .
Y N1 Y N2 · · · Y NN
22
Y 1N V1 I1 Y 2N V 2 I2 .. . = . . .. .. VN
IN
(2.22)
2.4 Solution of the Power Flow Problem All the quantities are expresses in per unit. In most cases, instead of complex current, complex powers are known. In those cases, GaussSeidel method can be used for calculating unknown voltages. Power can be expressed as: S p = V p I ∗p
(2.23)
Pp − jQp = V ∗p I p = V ∗p Ypq V q P = V ∗p Ypp V p + V ∗p Ypq V q P
⇒ V ∗p Ypp V p = (Pp − jQp ) −
⇒ Ypp V p =
⇒Vp =
X
V ∗p Ypq V q
(Pp − jQp ) X − Ypq V q V ∗p
(Pp −jQp ) V ∗p
−
P
Ypq V q
(2.24)
(2.25)
(2.26)
(2.27)
Ypq
Solution can be obtained using iterative method: = V (k+1) p
(Pp −jQp ) V ∗p (k)
−
P
(k)
Ypq V q
Ypq
(2.28)
2.4.2. Newton-Raphson (N-R) Method The second major power flow solution method is the Newton-Raphson algorithm. Key idea behind Newton-Raphson is to use sequential linearization. A nonlinear equation with single variable can be expressed as [2]: f (x) = 0
(2.29)
For solving this equation, select an initial value x0 . The difference between the initial value and the final solution will be 4x0 . Then x = x0 + 4x0 is the solution of nonlinear equation. f (x) = 0 becomes f (x0 + 4x0 ) = 0
(2.30)
23
Chapter 2
Distribution Power Flow
Algorithm 2.1 Gauss-Seidel Method Formulate Ybus in per unit Assign initial estimate for all bus voltages to 1 + j0 For load buses find V p from equation (Pp −jQp ) − (k) V∗ p
P
(k+1) p
(k)
Ypq V q
= V Ypq For voltage-controlled buses, first find reactive power and then corresponding voltage n o P (k+1) (k) (k) ∗ (k) = −Im V p Qp V p Ypp + Ypq V q Check convergence (is the absolute value of the difference of the real (imaginary) part of the voltage between successive iterations less value). Iterate until n o than na tolerance o (k+1) (k) − Re V p ≤ ε Re V p n o n o (k+1) (k) − Im V p ≤ ε Im V p
Expanding the above equation with the Taylor series, results in: f (x0 + 4x0 ) = f (x0 ) + f 0 (x0 )4x0 + f 00 (x0 )
(4x0 )2 (4x0 )n + ... + f (n) (x0 ) + ... = 0 2! n!
(2.31)
If the difference 4x0 is very small, the terms of the second and higher derivatives can be neglected. Thus, previous equation becomes f (x0 + 4x0 ) = f (x0 ) + f 0 (x0 )4x0 = 0
(2.32)
or 4x0 = −
f (x0 ) f 0 (x0 )
(2.33)
The new solution will be x1 = x0 + 4x0 = x0 −
f (x0 ) f 0 (x0 )
(2.34)
The iteration equation is xk+1 = xk + 4xk = xk −
24
f (xk ) f 0 (xk )
(2.35)
2.4 Solution of the Power Flow Problem The Newton method can also be applied to a nonlinear equation with n variables. f1 (x1 , x2 , ..., xN ) = 0 f2 (x1 , x2 , ..., xN ) = 0 .. .
(2.36)
fN (x1 , x2 , ..., xN ) = 0 Similarly, expanding equation and neglecting the terms of second and higher derivatives, equations are f1 + f2 +
∂f1 ∂x1 4x1 ∂f2 ∂x1 4x1
∂f1 ∂x2 4x2 ∂f2 ∂x2 4x2
+ +
+ ... + + ... +
.. . ∂fN ∂fN fN + ∂x1 4x1 + ∂x2 4x2 + ... +
∂f1 ∂xn 4xN ∂f2 ∂xn 4xN
=0 =0
∂fN ∂xn 4xN
(2.37)
=0
Last equation can also be written in matrix form ∂f1 (n) ∂x 1 (n) ∂f
2 ∂x1 .. . (n) ∂fN ∂x1
∂f1 (n) ∂x 2 (n) ∂f
2
∂x2
.. .
∂fN ∂x2
(n)
... ··· .. . ...
∂f1 (n) ∂x n (n) ∂f
(n) 4x1 2 4x(n) 2 ∂xn .. .. . . (n) (n) 4x ∂f N
= −
N
∂xn
(n)
(n)
f1 (n) f2 .. . fN
(2.38) Newton-Raphson algorithm for the n-dimensional case h
−f (n) = J (n) 4X (n) ⇒ 4X (n) = − J (n)
h
i−1
⇒ X (n+1) = X (n) + 4X (n) = X (n) − J (n)
f (n)
i−1
f (n)
(2.39)
(2.40)
Newton-Raphson iteration method can be applied for power flow equations. Firstly, the state vector of unknown voltage angles and magnitudes is ordered such that: "
x=
δ V
#
(2.41)
25
Chapter 2
Distribution Power Flow
and the nonlinear function f is ordered so that the first components correspond to active power and the last ones to reactive power: "
4P (x) 4Q(x)
f (x) =
#
(2.42)
The Jacobian matrix J can be written as
∂P2 ∂δ2
n
··· .. .
∂P2 ∂δn
n
∂PN n ∂PN n · · · ∂δ2 ∂δn ∂Q n ∂Q2 n 2 · · · ∂δ2 ∂δn .. . n n ∂QN ∂δ2
···
∂QN ∂δn
∂P2 ∂v2
n
··· .. .
∂P2 ∂vn
n
n n ∂PN ∂PN · · · ∂Vn ∂v2 ∂Q2 n ∂Q2 n · · · ∂vn ∂v2 .. . n n ∂QN ∂v2
···
∂QN ∂vn
4δ2n .. .
4P2n .. .
n 4δN −− 4v2n .. .
4P n N = −− 4Qn 2 .. .
n 4vN
4QnN
(2.43)
"
4P n 4Qn
#
"
=
J1n J2n J3n J4n
#"
4δ n 4v n
#
(2.44)
Bus 1 is assumed to be slack bus and is not included in calculations. Elements of the Jacobian matrix are partial derivatives of Equation 2.13 and Equation 2.14 evaluated at 4δi and 4Vi . The diagonal and off-diagonal elements of J1 are [3]: X ∂Pp = vp vq ypq sin(θpq − δp + δq ) ∂δp q6=p
(2.45)
∂Pp = −vp vq ypq sin(θpq − δp + δq ), q 6= p ∂δq
(2.46)
The diagonal and off-diagonal elements of J2 are:
26
X ∂Pp = 2vp ypp cos(θpp ) + vq ypq cos(θpq − δp + δq ) ∂vp q6=p
(2.47)
∂Pp = vp ypq cos(θpq − δp + δq ), q 6= p ∂vq
(2.48)
2.4 Solution of the Power Flow Problem The diagonal and off-diagonal elements of J3 are: X ∂Qp = vp vq ypq cos(θpq − δp + δq ) ∂δp q6=p
(2.49)
∂Qp = −vp vq ypq cos(θpq − δp + δq ), q 6= p ∂δq
(2.50)
The diagonal and off-diagonal elements of J4 are: X ∂Qp = −2vp ypp sin(θpp ) − vq ypq sin(θpq − δp + δq ) ∂vp q6=p
(2.51)
∂Qp = −vp ypq sin(θpq − δp + δq ), q 6= p ∂vq
(2.52)
New estimates for voltage magnitudes and phase angles are computed from: δin+1 = δin + 4δin vin+1 = vin + 4vin
(2.53)
Procedure for Newton -Raphson method is described by Algorithm 2.2 Algorithm 2.2 Newton-Raphson Method Formulate Ybus in per unit Assign initial estimate for all x1 , x2 , ..., xN Determine the Jacobian Matrix J for iteration n Determine error vector 4X (n) using h
i−1
f (n) 4X (n) = − J (n) (n) + 4X (n) Set X at iteration (n + 1) as X (n+1) =X Check tolerance. Iterate until f (n) < ε
27
3. Optimization for Power Systems Optimization is mathematical discipline which deals with the finding minimum or maximum of a given problem. It can be applied to several disciplines, such as economics, industry, physics, etc. For achieving better performance in these areas, there is an ever growing demand for solving optimization problems. Due to the requirement of governments, politicians, large industries and investors, field of power system optimization has always been subject of considerable changes and new challenges. From the optimization point of view, various techniques including traditional and modern optimization methods, have been developed to solve these power system operation problems. They can be classified as conventional optimization methods (unconstrained optimization approaches, nonlinear programming, linear programming, quadratic programming, generalized reduced gradient method, Newton method, network-flow programming, mixed-integer programming, interior point methods), intelligence search methods (neural networks, evolutionary algorithms, tabu search, particle swarm optimizations), and nonquantity approaches to address uncertainties in objective and constraints (probability optimization, fuzzy set application, analytic hierarchical process). In this chapter, the main concepts for optimizations are discussed such as feasibility and optimality, convexity, duality, penalty functions, Lagrange function, multipliers and optimality conditions. Further more, this chapter contains description of unconstrained and constrained optimization. The most popular Mixed Integer Nonliner Programming (MINLP) and Sequantial Quadratic Programming (SQP) algorithms are also explained.
3.1. Notation and terminology Optimization is a mathematical discipline which aims at solving given problem, formulated as minimization or maximization problem, which
29
Chapter 3
Optimization for Power Systems
implies looking for the value known as the optimum value, which corresponds to the minimum or maximum of the problem. An optimization problem depends on different components: objective function, variables and also, constraints. The objective function, denoted f , corresponds to the function to minimize or to maximize. It generally gives a single number which measures the quality of a solution of the problem. The variables, denoted x, are the unknowns of the problem to which the best values must be given in order to optimize the value of the objective function. The constraints, denoted g, are functions establishing some relations that the variables must fulfill. They usually are of two types: inequality or equality constraints. Taking into account the above, problem that is considered here can be described as: min f (x) subject to gi (x) = 0, i ∈ E
(3.1)
gi (x) ≥ 0, i ∈ I where f , the objective function, and g, the constraint functions, are continuously differentiable. Finite sets E and I describe the equality and inequality constraints respectively. Either of the two sets E and I may be empty and if so, we have an unconstrained optimization problem. For instance, the set can contain the possible discrete restrictions on the variables which require that the concerned variables take only some particular values, like integer values. The variables which are subject to such restrictions are known as the discrete variables. A problem which has no discrete restriction is said to be continuous, otherwise it is referred to as discrete. If the problem comprises continuous and discrete variables, the problem is also known as a mixed integer problem.
3.1.1. Feasibility and optimality A point x which satisfies all constraints is said to be feasible. The set of all feasible points is denoted by: X = {x|gi (x) = 0, i ∈ E, and gi (x) ≥ 0, i ∈ I}
(3.2)
and is called the feasible region. When, for a given problem, the feasible set X is empty, the problem has no solution and is said to be infeasible. A point ˚ x which minimizes the objective function is known as an optimum solution and the value of f at this point is the optimum value.
30
3.1 Notation and terminology A global minimum ˚ x is a point of the feasible set which produces the minimum value for the objective function over X. Mathematically: A point ˚ x ∈ X is called global minimum of problem if f (˚ x) ≤ f (x) for every x ∈ X. A point ˚ x ∈ X is strict global minimum of problem if f (˚ x) < f (x) for everyx ∈ X, x 6= ˚ x. However, for a general problem, it is expensive to obtain the global minimum and to guarantee that a point is really the global minimum since this implies to explore the whole feasible space. Therefore, another type of minimum, called local minimum is considered. A point ˚ x ∈ X is called local minimum of problem if it is the best in its neighborhood region, i.e. there exists δ > 0 such that f (˚ x) ≤ f (x) for every x ∈ X, such that ||x − ˚ x|| < δ. A point ˚ x ∈ X is strict local minimum of NLP problem if exists δ > 0 such that f (˚ x) < f (x) for every x ∈ X, such that ||x − ˚ x|| < δ and x 6= ˚ x.
3.1.2. Convexity A convex programming problem is a problem with a convex objective function and a convex feasible region. Convex programming problems possess an important feature that any local minimum is also global minimum at the same time. Kuhn-Tucker theorem gives necessary conditions for local minimum of nonlinear problem. In the case of convex programming these conditions are also sufficient. Kuhn-Tucker theorem is valid for certain regularity conditions. Before defining theorem, it is important to introduce some key terms connected to convexity: Convex set: A set C is called convex , if and only if for any two points in C, the line connecting these two points also lies in C, that is if and only if λx1 + (1 − λ)x2 ∈ C, ∀x1 , x2 ∈ C and ∀λ ∈ [0, 1]
(3.3)
Convex function: A function f is called convex if and only if its epigraph is a convex set, that is if and only if f (λx1 +(1−λ)x2 ) ≤ λf (x1 )+(1−λ)f (x2 ), ∀x1 , x2 ∈ C and ∀λ ∈ [0, 1]
31
Chapter 3
Optimization for Power Systems
Figure 3.1.: Convex Function (3.4) Strictly convex function: A function f is called strictly convex if and only if f (λx1 +(1−λ)x2 ) < λf (x1 )+(1−λ)f (x2 ), ∀x1 , x2 ∈ C and ∀λ ∈ [0, 1] (3.5) Concave function: function g is called concave if the function −g is convex function. If the function f is differentiable function “graph is below secant” or “graph is above tangent”. This illustrate next theorem: Theorem 3.1. If the function f is convex, then ∇f (x1 )T (x2 − x1 ) ≤ f (x2 ) − f (x1 ), ∀x1 , x2 ∈ C
(3.6)
The concept of convexity ensures that the Kuhn–Tucker conditions become necessary and sufficient conditions for a global minimum. KuhnTucker (KT) theorem is generalization of Lagrange multipliers methods, which gives opportunities for solving problems with constraints with inequality. It is given with: Theorem 3.2. (Karush -Kuhn-Tucker Theorem). Let ˚ x denote m ˚ local minimum of nonlinear problem. There exists λ ∈ R such that: (i) ∇f (˚ x) +
X
˚ λi ∇gi (˚ x) = 0
(ii) ˚ λi ∇gi (˚ x) = 0, i = 1, ..., m ˚ (iii) λ ≥ 0 (iv) gi (˚ x) ≤ 0, i = 1, ..., m
32
(3.7)
3.1 Notation and terminology
Figure 3.2.: Convexity of differentiable function on (a,b) where ˚ λ is the vector of Lagrange multipliers. Condition (i) is often referred to as first order condition, (ii) is referred to as the complementarity condition (iii) is dual feasibility and (iv) is primal feasibility. Convex problems also possess a related problem called the dual whose solution is under certain conditions equivalent to the solution of nonlinear problem.
3.1.3. Duality Suppose we have problem of linear programming P (primal) and its dual (D): (P )
(D) T
min c x
max bT y
Ax ≥ b
AT y ≤ c
x≥0
(3.8)
y≥0
where X and Y are feasible sets of problems (P ) and (D). The following theorem is easily established and gives us an important relation between the two problems. Theorem 3.3 (Weak Duality). If x0 is feasible for the primal, and y0 is feasible for dual, then cT x0 ≥ bT y0
(3.9)
This theorem shows that a feasible vector to either problem yields a bound on the value of the other problem. The values associated with
33
Chapter 3
Optimization for Power Systems
the primal are all larger than the values associated with the dual. Since the primal seeks a minimum and the dual seeks a maximum, each seeks to reach the other. From this follows an important corollary. Theorem 3.4 (Strong Duality). If primal P has optimal solution ˚ x ˚ and dual D has optimal solution λ, it can be written x = bT ˚ y cT ˚
(3.10)
The above corollary shows that if either of the problems (P ) or (D) has a finite optimal solution, so does the other, and the corresponding values of the objective functions are equal. If either problem has an unbounded objective, the other problem has no feasible solution.
3.1.4. Method of Penalty Functions Methods of penalty are procedures for approximating constrained optimization problems by unconstrained problems. Consider the problem min f (x) gi (x) ≤ 0, i = 1, ..., m
(3.11)
If infinity penalty for leaving feasible set X is introduced (
q(x) =
0, +∞,
x∈X x∈ /X
(3.12)
Problem from Equation 3.11 can be changed to the problem of unconstrained optimization min F (x) = f (x) + q(x), x ∈ Rn
(3.13)
where q(x) is approximated with the set of penalty functions. There are two types of penalty functions: exterior penalty functions, approximation from outside, and interior penalty functions, approximation from inside, as shown in Fig. 3.3.
3.1.5. Lagrange function, multipliers and optimality conditions Lagrange function is defined as: L(x, λ) = f (x) +
34
X
λi gi (x)
(3.14)
3.1 Notation and terminology
Figure 3.3.: Penalty functions where λ is the vector of Lagrange multipliers. It is necessary to find solution of the system: ∂L ∂L ∂L ∂L = 0, ..., = 0, = 0, ..., =0 ∂x1 ∂xn ∂λ1 ∂λm
(3.15)
These solutions are stationary points of Lagrange function, which are the candidates for extremes. Matrix H(x, λ) is defined as:
0 . . .
0 ∂g1 ∂x1 . ..
∂g1 ∂xn
... .. . ··· ··· .. . ···
0 .. .
∂g1 ∂x1
0
∂gm ∂x1 ∂2L ∂x12
∂gm ∂x1
.. . ∂hgm ∂xn
.. .
.. .
∂2L ∂xn ∂x1
··· .. . ··· ··· .. . ···
∂g1 ∂xn
.. .
∂gm ∂xn ∂2L ∂x1 ∂xn
.. . ∂2L ∂xn2
" 0 = JT
J ∇2xx L
#
(3.16)
if (˚ x, ˚ λ) is the solution of start equations and D1 , ..., Dm+n are main minors of matrix H(˚ x, ˚ λ), then • (−1)m D2m+1 > 0, ..., (−1)m Dm+n > 0 implies that ˚ x is strict local minimum • (−1)m+1 D2m+1 > 0, ..., (−1)n Dm+n > 0 implies that ˚ x is strict local maximum Theorem 3.5 (Necessary conditions for local minimum). If ˚ x is local minimum of Lagrange function L, then for ∃˚ λ = (˚ λ1 , ..., ˚ λm ) is satisfied. Theorem 3.6 (Sufficient conditions for local minimum). If (˚ x, ˚ λ) 2 ˚ is stationary point of Lagrange function L, and if matrix ∇xx L(˚ x, λ) is
35
Chapter 3
Optimization for Power Systems
positive definite on tangent area (y T ∇2xx L(˚ x, ˚ λ) > 0, y 6= 0 such that T y ∇gi (˚ x) = 0, i = 1, ..., m) then ˚ x is strict local minimum. Theorem 3.7 (Sufficient conditions for positive definiteness on tangent area). If (−1)m D2m+1 > 0, ..., (−1)m Dm+n > 0 then ∇2xx L(˚ x, ˚ λ) is positive definite matrix on tangent area.
3.2. Unconstrained and constrained optimization The classical methods of optimization are useful in finding the optimum solution of continuous and differentiable functions. These methods are analytical and make use of the techniques of differential calculus in locating the optimum points. In this section we present the necessary and sufficient conditions in locating the optimum solution of a singlevariable function, a multi-variable function with no constraints, and a multi-variable function with equality and inequality constraints.
3.2.1. Single-variable unconstrained optimization A single-variable optimization problem is one in which the value of x = ˚ x is to be found in the interval [a, b] such that ˚ x minimizes f (x). The following two theorems provide the necessary and sufficient conditions for the relative minimum of a function of a single variable. Theorem 3.8 (Necessary Condition). If a function f (x) is defined in the interval a ≤ x ≤ b and has a local minimum at x = ˚ x, where a ≤ 0 ˚ x ≤ b , and if the derivative df (x)/dx = f (x) exists as a finite number at x = ˚ x, then f 0 (˚ x) = 0. If the function f (x) possesses continuous derivatives of every order that come in question, in the neighborhood of x = ˚ x, the following theorem provides the sufficient condition for the minimum or maximum value of the function. Theorem 3.9 (Sufficient Condition) Let f 0 (˚ x) = f 00 (˚ x) = ... = (n−1) (n) f (˚ x) = 0, but f (˚ x) 6= 0. Then f (˚ x) is (i) a minimum value of f (x) if f (n) (˚ x) > 0 and n is even; (ii) a maximum value of f (x) if f (n) (˚ x) < 0 and n is even; (iii) neither a maximum nor a minimum if n is odd. Method of single-variable unconstrained optimization can be described with the following steps:
36
3.2 Unconstrained and constrained optimization 1. Solve f 0 (x) to get a candidate ˚ x. 2. If f 00 (˚ x) > 0 then ˚ x is a local minimum. If f 00 (˚ x) < 0 then ˚ x is a local maximum. 3. If f (x) is convex then a local minimum is a global minimum. If f (x) is concave then a local maximum is a global maximum.
3.2.2. Multi-variable unconstrained optimization In this section the necessary and sufficient conditions for the minimum or maximum of an unconstrained function of several variables are considered. Theorem 3.10 (Necessary Condition). If f (X) has an extreme ˚ and if the first partial derivapoint (maximum or minimum) at X = X ˚ tives of f (X) exist at X, then ∂f ˚ ∂f ˚ ∂f ˚ (X) = (X) = ... = (X) = 0 ∂x1 ∂x2 ∂xn
(3.17)
Theorem 3.11 (Sufficient Condition). A sufficient condition for a stationary point ˚ X to be an extreme point is that the matrix of second partial derivatives (Hessian matrix) of f (X) evaluated at ˚ X is (i) positive definite when ˚ X is a local minimum point, and (ii) negative definite when ˚ X is a local maximum point. Method of multi-variable unconstrained optimization can be described with the following steps: 1. Solve ∇f 0 (X) to get a candidate ˚ X. 2. If H(˚ X) is positive definite then ˚ X is a local minimum. If H(˚ X) ˚ is negative definite then X is a local maximum. 3. If f (X) is convex then a local minimum is a global minimum. If f (X) is concave then a local maximum is a global maximum.
3.2.3. Multi-variable optimization with equality constraints This section describes the optimization of continuous functions subjected to equality constraints: minimize f = f (X) subject to
(3.18)
gj (X) = 0, j = 1, 2, ..., m
37
Chapter 3
Optimization for Power Systems
where X=
x1 x2 .. . xn
.
3.2.3.1. Solution by the Method of Lagrange Multipliers Theorem 3.12 (Necessary Condition). To solve problem with n variables and m equality constraints given with Equation 3.18 Lagrange function L is introduced which uses one Lagrange multiplier λj for each constraint gj (X): L(x1 , x2 , ..., xn , λ1 , λ2 , ..., λm ) = f (X) + λ1 g1 (X) + λ2 g2 (X) + ... + +λm gm (X)
(3.19)
By treating L as a function of the n+m unknowns,x1 , x2 , ..., xn , λ1 , λ2 , ..., λm , the necessary conditions for the extremum of L, which also correspond to the solution of the original problem stated in Equation 3.18, are given by m X ∂L ∂gj ∂f λj = + = 0, i = 1, 2, ..., n ∂xi ∂xi j=1 ∂xi
(3.20)
∂L = gj (X) = 0, j = 1, 2, ..., m ∂λj
(3.21)
Equations 3.20 and 3.21 represent n+m equations in terms of the n+m unknowns, xi and λj . The solution of Equations 3.20 and 3.21 gives
˚ X=
˚ x1 ˚ x2 .. . ˚ xn
and ˚ λ=
˚ λ1 ˚ λ2 .. . ˚ λm
˚ corresponds to the local constrained minimum of f (X) The vector X (sufficient conditions are to be verified) while the vector ˚ λ provides
38
3.2 Unconstrained and constrained optimization the sensitivity information which indicates how tightly the constraint is binding at the optimum point. Theorem 3.13 (Sufficient Condition). A sufficient condition for f (X) to have a local minimum at ˚ X is that the quadratic, Q, defined by Q=
n X m X
∂2L dxi dxj ∂xi ∂xj i=1 j=1
(3.22)
˚ must be positive definite for all values of dX for evaluated at X = X which the constraints are satisfied. Method of multi-variable optimization with equality constraints can be described with the following steps: 1. Form Lagrangian L(x1 , x2 , ..., xn , λ1 , λ2 , ..., λm ) = f (X) + λ1 g1 (X) + λ2 g2 (X) + ... + λm gm (X) 2. Solve ∇L = 0 to get a candidate ˚ X (and ˚ λ). ˚ is optimum if optimum exists. 3. Best X
3.2.4. Multi-variable optimization with inequality constraints Multi-variable optimization with inequality constraints is the solution of the following problem: minimize f = f (X) subject to
(3.23)
gj (X) ≤ 0, j = 1, 2, ..., m The inequality constraints in Equation 3.23 can be transformed to equality constraints by adding non-negative slack variables, yj2 , as gj (X) + yj2 = 0, j = 1, 2, ..., m
(3.24)
where the values of the slack variables are yet unknown. The problem now becomes minimize f = f (X) subject to
(3.25)
Gj (X, Y) = gj (X) + yj2 = 0 j = 1, 2, ..., m where Y = [y1 , y2 , .., ym ]T is the vector of slack variables.
39
Chapter 3
Optimization for Power Systems
3.2.4.1. Solution by the Method of Lagrange Multipliers Theorem 3.14 (Necessary Condition). Problem of multi-variable optimization with inequality constraints can be solved conveniently by the method of Lagrange multipliers. For this, Lagrange function L is introduced as: L(X, Y, λ) = f (X) +
m X
λj Gj (X, Y)
(3.26)
j=1
where λ = [λ1 , λ2 , .., λm ]T is the vector of Lagrange multipliers. The stationary points of the Lagrange function can be found by solving the following equations (necessary conditions): m X ∂L ∂f ∂gj (X, Y, λ) = (X) + λj (X) = 0, i = 1, 2, ..., n (3.27) ∂xi ∂xi ∂xi j=1
∂L (X, Y, λ) = Gj (X, Y) = gj (X)+yj2 = 0, j = 1, 2, ..., m (3.28) ∂λj ∂L (X, Y, λ) = 2λj yj = 0, j = 1, 2, ..., m ∂yi
(3.29)
It can be seen that Equations 3.27-3.29 represent n + 2m equations in the n + 2m unknowns, X, λ, and Y . The solution of Equations 3.273.29 thus gives the optimum solution vector, ˚ X; the Lagrange multiplier ˚ vector,˚ λ; and the slack variable vector, Y. Kuhn–Tucker Conditions If the set of active constraints is not known, the Kuhn–Tucker conditions can be stated as follows:
(i) ∇f (˚ x) +
X
˚ λi ∇gi (˚ x) = 0
(ii) ˚ λi ∇gi (˚ x) = 0, i = 1, ..., m ˚ (iii) λ ≥ 0
(3.30)
(iv) gi (˚ x) ≤ 0, i = 1, ..., m For a class of convex programming problems, Kuhn–Tucker conditions are necessary and sufficient for a global minimum.
40
3.3 Classical Optimization Techniques
3.3. Classical Optimization Techniques From the view of optimization, the various techniques including traditional and modern optimization methods, which have been developed to solve power system operation problems, are classified into three groups [2]: 1. Conventional optimization methods including: Unconstrained optimization approaches, Nonlinear programming (NLP), Linear programming (LP), Quadratic programming (QP), Generalized reduced gradient method, Newton method, Network flow programming (NFP), Mixed - integer programming (MIP), Interior point (IP) methods 2. Intelligence search methods such as: Neural network (NN), Evolutionary algorithms (EAs), Tabu search (TS), Particle swarm optimization (PSO) 3. Nonquantity approaches to address uncertainties in objectives and constraints: Probabilistic optimization, Fuzzy set applications, Analytic hierarchical process (AHP) This book is mainly focused on conventional optimization methods, with the special attention given to Mixed Integer Nonlinear (MINLP) and Sequential quadratic programming (SQP) methods.
3.3.1. Unconstrained Optimization Approaches Unconstrained optimization approaches are the basis of the constrained optimization algorithms. In particular, most of the constrained optimization problems in power system operation can be converted into unconstrained optimization problems. The major unconstrained optimization approaches that are used in power system operation are gradient method, line search, Lagrange multiplier method, Newton-Raphson optimization, trust-region optimization, quasi-Newton method, double dogleg optimization, and conjugate gradient optimization, etc. [2].
3.3.2. Linear Programming The linear programming (LP)-based technique is used to linearize the nonlinear power system optimization problem, so that objective function and constraints of power system optimization have linear forms.
41
Chapter 3
Optimization for Power Systems
The simplex method is known to be quite effective for solving LP problems. The LP approach has several advantages. First, it is reliable, especially regarding convergence properties. Second, it can quickly identify infeasibility. Third, it accommodates a large variety of power system operating limits, including the very important contingency constraints. The disadvantages of LP-based techniques are inaccurate evaluation of system losses and insufficient ability to find an exact solution compared with an accurate nonlinear power system model. However, a great deal of practical applications show that LP-based solutions generally meet the requirements of engineering precision. Thus LP is widely used to solve power system operation problems such as securityconstrained economic dispatch, optimal power flow, steady-state security regions, reactive power optimization, etc.[2].
3.3.3. Nonlinear Programming Power system operation problems are nonlinear. Thus nonlinear programming (NLP) based techniques can easily handle power system operation problems such as the OPF problems with nonlinear objective and constraint functions. To solve a nonlinear programming problem, the first step in this method is to choose a search direction in the iterative procedure, which is determined by the first partial derivatives of the equations (the reduced gradient). Therefore, these methods are referred to as first-order methods, such as the generalized reduced gradient (GRG) method. NLP-based methods have higher accuracy than LP-based approaches, and also have global convergence, which means that the convergence can be guaranteed independent of the starting point, but a slow convergent rate may occur because of zigzagging in the search direction [2].
3.3.4. Quadratic Programming Quadratic programming (QP) is a special form of nonlinear programming. The objective function of QP optimization model is quadratic, and the constraints are in linear form. Quadratic programming has higher accuracy than LP-based approaches. Especially, the most oftenused objective function in power system optimization is the generator cost function, which generally is a quadratic. Thus there is no sim-
42
3.3 Classical Optimization Techniques plification for such objective function for a power system optimization problem solved by QP [2].
3.3.5. Newton’s Method Newton’s method requires the computation of the second-order partial derivatives of the power flow equations and other constraints (the Hessian) and is therefore called a second-order method. The necessary conditions of optimality commonly are the Kuhn-Tucker conditions. Newton’s method is favored for its quadratic convergence properties [2].
3.3.6. Interior Point Methods The interior point (IP) method is originally used to solve linear programming. It is faster and perhaps better than the conventional simplex algorithm in linear programming. IP methods were first applied to solve OPF problems in the 1990s, and recently, the IP method has been extended and improved to solve OPF with QP and NLP forms [2].
3.3.7. Mixed-Integer Programming The power system problem can also be formulated as a mixed-integer programming (MIP) optimization problem with integer variables such as transformer tap ratio, phase shifter angle, and unit on or off status. MIP is extremely demanding of computer resources, and the number of discrete variables is an important indicator of how difficult an MIP will be to solve. MIP methods that are used to solve OPF problems are the recursive mixed-integer programming technique using an approximation method and the branch and bound (B&B) method, which is a typical method for integer programming. A decomposition technique is generally adopted to decompose the MIP problem into a continuous problem and an integer problem. Decomposition methods such as Benders’ decomposition method (BDM) can greatly improve efficiency in solving a large-scale network by reducing the dimensions of the individual sub-problems. The results show a significant reduction of the number of iterations, required computation time, and memory space. Also, decomposition allows the application of a separate method for the
43
Chapter 3
Optimization for Power Systems
solution of each sub-problem, which makes the approach very attractive. Mixed-integer programming can be used to solve the unit commitment, OPF, as well as the optimal reconfiguration of electric distribution network [2].
3.3.8. Network Flow Programming Network flow programming (NFP) is special linear programming. NFP was first applied to solve optimization problems in power systems in 1980s. The early applications of NFP were mainly on a linear model. Recently, nonlinear convex network flow programming has been used in power systems’ optimization problems. NFP-based algorithms have the features of fast speed and simple calculation. These methods are efficient for solving simplified OPF problems such as security-constrained economic dispatch, multi-area systems economic dispatch, and optimal reconfiguration of an electric distribution network [2].
3.4. Mixed Integer Nonlinear Programming Mixed integer nonlinear programs (MINLP) are one of the most general types of finite-dimensional, single-objective mathematical programs. Containing both, continuous and integer decision variables, and without any limitation to the complexity of either the objective function or the constraints, these problems are classified as NP-hard. Mixed-integer optimization represents a powerful framework for mathematically modeling many optimization problems. Over the last five years there has been a significant increase in the development of these models in process systems engineering. In the most recent years, considerable number of researchers including chemical engineers, operations researchers, industrial engineers, mechanical engineers, economists, statisticians, computer scientists, operations managers, and mathematical programmers are interested in solving large-scale Mixed Integer Nonlinear Programming (MINLP) problems. This great interest is a result of the fact that most of the applications from the real-world can be modeled as MINLP problems. Additionally, the performance of solvers handling nonlinear constraints was largely improved, making this class of problems even more challenging. It is possible to restrict MINLP model
44
3.4 Mixed Integer Nonlinear Programming to contain only linear functions, and then MINLP reduces to a MixedInteger Linear Program (MILP), which is an NP-Hard problem. On the other hand, if we restrict model to have no integer variable but allow for general nonlinear functions in the objective or the constraints, then MINLP reduces to a Nonlinear Program (NLP) which is also known to be NP-Hard. Problem NLP includes a number of important subclasses of problems. If both objective and constraints are linear functions, then NLP is a Linear Programming (LP) problem. If objective is a quadratic function and constraints are linear, then NLP is referred to as a Quadratic Programming (QP) problem. Many optimization problems involve discrete and continuous variables that can be modeled as mixed integer nonlinear programming (MINLP) problems. For instance, integer variables can represent the number of workers needed to perform a certain task whereas continuous variables can denote physical values, such as pressure or temperature. This has led to a wide range of applications in the field of process systems engineering. In particular, one may find applications which include gas network problems, nuclear core reloaded problems, cyclic scheduling trim-loss optimization in the paper industry, synthesis problems, layout problems. Other examples are efficient management of electricity transmission, contingency analysis and blackout prevention of electric power systems. A mixed integer nonlinear program formulation can be represented as: minimize f (x, y) subject to gj (x, y), j ∈ J x∈X
(3.31)
y ∈ Y, integer The function f (x, y) is a nonlinear objective function and g(x, y) a nonlinear constraint function. The variables x, y are the decision variables, where y is required to be integer valued, and J is the index set of inequalities. We note that we do not generally assume smoothness of f or convexity of the functions involved [4, 5]. Different realizations of the objective function and the feasible set give rise to key classes of MINLPs addressed in the following sections.
3.4.1. Mixed Integer Linear Programming A Mixed Integer Linear Programming problem is the special case of the MINLP problem in which functions f and g assume a linear form.
45
Chapter 3
Optimization for Power Systems
This is approach where nonlinear functions are approximated by using piecewise-linear functions. This approach requires the addition of binary variables that model the piecewise approximation. The advantage of such an approach is that advanced MILP techniques can be applied. The disadvantage of the approach is that the approximations are not totally exact. It is usually written in the form: min cT x + dT y Ax + By ≤ b x∈X
(3.32)
y∈Y where A and B are, matrices of coefficients, b is vector, called righthand side, c and d are, vectors of costs. Even if these problems are a special and, in general, easier case with respect to MINLPs, they are NP-hard.
3.4.2. Non-Linear Programming Another special case of MINLP problems is Non-Linear Programming where the functions f and g are non-linear but no variable is required to be integer. The classical NLP problem can be written in the following form: min f (y) g(y) ≤ 0 y∈Y
(3.33)
Different issues arise when one tries to solve this kind of problems. Some heuristic and exact methods are tailored for a widely studied subclass of these problems: convex NLPs. In this case, the additional assumption is that f and g are convex functions. Some of these methods can be used for more general non-convex NLPs, but no guarantee on the global optimality of the solution is given. In particular, when no assumption on convexity is done, the problem usually has local optimal solutions.
3.4.3. Convex Mixed Integer Non-Linear Programming The third interesting subclass of general MINLP is the convex MINLP. Even though mixed-integer optimization problems are nonconvex as a
46
3.4 Mixed Integer Nonlinear Programming result of the presence of discrete variables, the term convex MINLP is commonly used to refer to a class of MINLPs for which a convex program results when any explicit restrictions of discreteness on variables are relaxed (i.e., removed). In its simplest definition, for a convex MINLP, it is assumed that the objective function is a convex function and that the feasible set is described by a set of convex nonlinear function. The immediate and most important consideration derived by this assumption is that each local minimum of the problem is guaranteed to be also a global minimum.
3.4.4. Non-convex Mixed Integer Non-Linear Programming The most complex case we can face to is non-convex Mixed Integer Nonlinear Programming. In this case, solutions which are optimal within a restricted part of the feasible region (neighborhood), are not optimal and not considering entire feasible region. This issue implies, for example, that, if sub-problems are solved, there is no guarantee that the solution provided is a global optimum. It means that the linearization cuts might cut off not only infeasible points, but also parts of the feasible region. For this reason, when non-convex constraints are involved, one has to carefully use linearization cuts. The relaxation of the original problem, obtained using convex envelopes or under-estimators of the non-convex functions, MINLP has the form: min z f (x, y) ≤ z g(x, y) ≤ 0 x∈X y∈Y
(3.34)
where z is an auxiliary variable added in order to have a linear objective function, f and g are convex (in some cases, linear) functions. The use of under-estimators makes the feasible region larger; if the optimal solution is feasible for the non-convex MINLP, then it is also its global optimum. Otherwise, i.e. if the solution is infeasible for MINLP, a refining on the underestimation of the non-convex functions is needed. This is done by branching, not restricted to integer variables but also on continuous ones.
47
Chapter 3
Optimization for Power Systems
3.5. MINLP Methods This section gives an overview on algorithmic approaches available for MINLP. Even if many approaches are historically grown and well established for MINLP, the field of these algorithms is still young and developing. The most common approaches for MINLP to find in the literature are Branch and Bound, Outer Approximation and Generalized Benders Decomposition. Here the background and fundamental concepts of those three approaches will be illustrated. Further available algorithms for MINLP, which are less prominent, are also briefly discussed.
3.5.1. Branch and Bound (B&B) One of the most successful methods for solving MINLP problems is branch and bound. The branch and bound (B&B) method was introduced in 1960 by Land and Doig for combinatorial optimization problems. In this method the search process is organized structurally in the form of a search tree. The B&B method starts by solving first the continuous NLP relaxation. If all discrete variables take integer values the search is stopped. Otherwise, a tree search is performed in the space of the integer variables. These are successively fixed at the corresponding nodes of the tree, giving rise to relaxed NLP sub-problems of the form (NLP1) which yield lower bounds for the sub-problems in the descendant nodes. Fathoming of nodes occurs when the lower bound exceeds the current upper bound, when the sub-problem is infeasible or when all integer variables take on discrete values. The latter yields an upper bound to the original problem. A node in the branch-and-bound tree is uniquely defined by a set of bounds, (l, u), on the integer variables and corresponds to the NLP [6, 7]: minimize f (x), subject to c(x) ≤ 0, x∈X
(3.35)
li ≤ xi ≤ ui, ∀i ∈ I The branch–and–bound algorithm starts by solving above problem, giving ˚ x as its solution. Next, the branching and pruning rules are applied for every node.
48
3.5 MINLP Methods Pruning rules Let U be an upper bound on the optimal value of problem (initialized as U = inf ). Nodes are pruned in the following three cases: Infeasible nodes: If any node is infeasible, then any node in its sub-tree is also infeasible and the node can be assumed to be fathomed (pruned). Integer feasible nodes: If a node produces an integer feasible solution then this solution is optimal in the whole sub-tree starting at this node. And this node can therefore be assumed to be fathomed. The optimal value of this node provides an upper bound (new incumbent solution) on the solution of problem, which can be used to fathom nodes. Upper bounds on NLP nodes: If the optimal value of a node or its lower bound is greater than or equal to the current upper-bound then this node is fathomed since no improved solution can be found in its sub-tree. Finally, if none of the above conditions are satisfied, one of the variables is fractional and two new sub-problems can be created, with the variable alternately relaxed. This is called branching.
yi = 1 yi = 0
Figure 3.4.: Pruning rules Branching If the solution ˚ x is feasible but not integral, then we any non-integral variable is branched. Branching introduces two new NLP nodes, also referred to as child nodes. In particular, it is necessary to initialize bounds for two new problems as (l−, u−) = (l, u) and (l+, u+) = (l, u)
49
Chapter 3
Optimization for Power Systems
and then modify the bound corresponding to the branching variable The two new NLP problems are then defined as N LP (l−, u−) and N LP (l+, u+). In practice, the new problems are stored on a heap H, which is updated with these two new problems. Description of branch and bound algorithm is explained in Algorithm 3.1. Algorithm 3.1 Branch and Bound Choose a tolerance ε > 0, set U = 0, and initialize the heap of open problems H = 0. Add (N LP (−∞, ∞)) to the heap: H = H ∪ {N LP (−∞, ∞)} . while (H 6= 0) do Remove a problem N LP (l, u) from the heap H = H − {N LP (l, u)} Solve N LP (l, u) and let its solution be x(l,u) if (N LP (l, u) is infeasible) then Node can be pruned because it is infeasible. else if (f (x(l,u) ) > 0) then Node can be pruned, because it is dominated by upper bound. else if (x(l,u) integral) then Update incumbent solution U = f (x(l,u) ), ˚ x = x(l,u) . else BranchOnVariablej (x(l,u) k , l, u, H) (l,u) − Set ui = xi , l− = l and j
(l,u)
li+ = xi
k
, u+ = u Add N LP (l− , u− ) and N LP (l+ , u+ ) to the − − + + heap H = H ∪ N LP (l , u ), N LP (l , u ) .
3.5.2. Outer Approximation (OA) First thing necessary to define is NLP sub-problem obtained by fixing (j) the integer variables to xI minimize f (x) subject to c(x) ≤ 0 (j)
x ∈ X and xI = xI
50
(j)
(N LP (xI ))
(3.36)
3.5 MINLP Methods Next, consider the problem minimize η subject to f (x) ≤ η c(x) ≤ 0
(3.37)
x∈X xi ∈ Z, ∀i ∈ I and observe that the convexity of f and c implies that the linearization (j) about the solution x(j) of (N LP (xI )) given by η ≥ f (j) + ∇f (j)T (x − x(j) ) and 0 ≥ c(j) + ∇c(j)T (x − x(j) ) (3.38) is an outer approximation of the feasible set of Equation 3.37. Next, define an index set of all possible feasible integer assignments: n
(j)
o
χ = x(j) ∈ X : x(j) solves N LP (xI )
(3.39)
Because χ is bounded, there exists only a finite number of different (j) integer points xI , and hence χ is a finite set. Now, one can construct an MILP that is equivalent to Equation 3.37: minimize η subject to η ≥ f (j) + ∇f (j)T (x − x(j) ), ∀x(j) ∈ χ 0 ≥ c(j) + ∇c(j)T (x − x(j) ), ∀x(j) ∈ χ
(3.40)
x∈X xi ∈ Z, ∀i ∈ I It is possible to show that Equations 3.37 and 3.40 have the same optimal value and that any solution of Equation 3.37 is an optimal solution of Equation 3.40. However, the converse is not true. Duran and Grossmann (1986) propose a relaxation algorithm that solves an alternating sequence of MILP problems and NLP sub-problems. Also, it is possible to add an upper bound on η corresponding to the best solution found so far: n
η < U k = min f (j) |N LP (x(j) ) is f easible
o
(3.41)
However, this latter constraint is not enforceable in practice, and is typically replaced by η ≤ U k − ε, where ε > 0 is a small tolerance.
51
Chapter 3
Optimization for Power Systems
Figure 3.5.: Outer Approximation Thus, the MILP master problem solved at iteration k is given by minimize η subject to η ≤ U k − ε η ≥ f (j) + ∇f (j)T (x − x(j) ), ∀x(j) ∈ χ
(3.42)
0 ≥ c(j) + ∇c(j)T (x − x(j) ), ∀x(j) ∈ χ x∈X xi ∈ Z, ∀i ∈ I
A description of the outer approximation algorithm is given by Algorithm 3.2.
3.5.3. Generalized Benders Decomposition (GBD) Consider the outer approximations and assume that the constraints χ are inactive. Summing up the outer approximations from Equation 3.38 weighted with (1, λ(j) ), where λ(j) ≥ 0 are the multipliers (j) of (N LP (xI )), the following valid inequality can be obtained:
η ≥ (f (j) + λ(j)T c(j) ) + ∇f (j) +
52
X (j)
(j) T
λi ∇ci
(x − x(j) ) (3.43)
3.5 MINLP Methods Algorithm 3.2 Outer Approximation Given x(0) , choose a tolerance ε > 0, set U −1 = ∞, set k = 0, and initialize χ−1 = 0 repeat (j) Solve N LP (xI ) and let the solution be x(j) (j) if N LP (xI ) is feasible and f (j) < U k−1 then Update current best point ˚ x = x(j) and U k = f (j) else Set U k = U k−1 Linearize objective and constraint f and c about x(j) and set χk = χk−1 ∪ {j} Solve M (χk ), let the solution be x(k+1) and set k = k + 1. until M ILP (M (χk )) is infeasible Observe that λ(j)T c(j) = 0 as a result of complementary slackness and that the continuous variable component of the gradient ∇C f (j) +
X (j)
(j)
λi ∇C ci
=0
(3.44)
as a result of the optimality of x(j) . Thus, it is possible to rewrite the cut from Equation 3.43 in the integer variables only as
η ≥ f (j) + ∇I f (j) +
X (j)
(j) T
λi ∇I ci
(j)
(xI − xI )
(3.45)
which is the Benders cut for feasible sub-problems. Also, note that the (j) optimality of (N LP (xI )) implies the existence of multipliers of the bounds and that their value is equal to the gradient in the Benders cut. Thus, we the Benders cut can be written compactly as
(j) T
η ≥ f (j) + µi
(j)
(xI − xI )
(3.46)
The advantage of the Benders cuts is that they involve only the integer variables and one objective variable. A disadvantage is that the Benders cuts are almost always dense. Moreover, the Benders cuts are weaker than the outer approximation cuts from which they are derived.
53
Chapter 3
Optimization for Power Systems
3.5.4. Extended Cutting Plane (ECP) In contrast to the BB, OA and GBD method, extended cutting plane method does not consider NLP sub-problems but only MILP sub-problems. It relies only on the iterative solution of a reduced master problem by successively adding a linearization of the most violated constraint at the predicted point. The ECP method successively adds linearizations by evaluating gradients instead of solving NLP sub-problems. The MILP reduced master problem (RM-ECP(K)) is defined as: z(k) = min η s.t. η ≥ f (˚ x) + ∇f (˚ x)T (x − ˚ x), ˚ x∈K gj (˚ x) + ∇gj (˚ x)T (x − ˚ x) ≤ 0, j ∈ J, ˚ x∈K
(3.47)
x ∈ X, XI ∈ Z I where J(K) = {j ∈ argmaxj∈J gj (˚ x)} is the index set of most violated constraints for each solution ˚ x ∈ K. It is also possible to add linearizations of all violated constraints to problem. In that case, J(K) = {j|gj (˚ x) > 0}. The optimal values z(k) of problem generate a nondecreasing sequence of lower bounds. Convergence of the algorithm is achieved when the maximum constraint violation is smaller than a specified tolerance. The ECP method may require a large number of iterations since the linearizations are not coming from solutions to NLP sub-problems. Convergence can often be accelerated by solving NLP sub-problems (N LP (xI )) and adding the corresponding linearizations, as in the OA method. Algorithm 3.3 gives the pseudo-code for the ECP algorithm.
3.5.5. LP/NLP based Branch and Bound The LP/NLP-Based Branch and Bound algorithm (LP/NLP-BB) was first proposed by Quesada and Grossmann (1992). The method is an extension of the OA method, which improves outer approximation by avoiding the solution of multiple MILP master problems, which take an increasing amount of computing time. The method starts by solving an initial NLP sub-problem which is linearized. The basic idea consists then of performing an LP-based branch and bound method for MILP master problem in which NLP sub-problems (NLP2) are solved at those
54
3.5 MINLP Methods Algorithm 3.3 Extended Cutting Plane Initialize choose convergence tolerance ε. K ← 0 Lower Bound Let (˚ ηi, ˚ xi ) be optimal solution to (RM-ECP(K)). Terminate? is gj (˚ xi ) < ε, ∀j ∈ J and f (˚ xi ) − ˚ η i < ε? If so, ˚ xi is optimal with ε feasibility. Refine K←K∪ ˚ xi , t ∈ argmaxi gj (˚ xi ) and J(K) ← J(K) ∪ {t} i ← i + 1. Go to 1. nodes in which feasible integer solutions are found. Whenever an integer solution is found at a node, the standard branch-and-bound is interrupted and N LP (xI ) is solved by fixing integer variables to solution values at that node. The linearizations from the solution of N LP (xI ) are then used to update the reduced master problem (MP(K)). The branch-and-bound tree is then continued with the updated reduced master problem. The main advantage of LP/NLP-BB over OA is that the need of restarting the tree search is avoided and only a single tree is required. LP/NLP-based branch-and-bound algorithm can be viewed
Figure 3.6.: (a) Extended Cutting Plane, (b) LP/NLP Based Branch and Bound
as a hybrid algorithm between nonlinear branch-and-bound and outer approximation. The LP/NLP method commonly reduces quite significantly the number of nodes to be enumerated. The trade-off, however, is that the number of NLP sub-problems may increase.
55
Chapter 3
Optimization for Power Systems
3.6. Sequential Quadratic Programming The first work in SQP field can be found in Wilson’s doctoral dissertation, where his algorithm represents special case of convex problems solving an inequality constrained quadratic sub-problem in each iteration. Sequential quadratic programming has become popular with the work of Big and Han. Bigg proposed algorithm where quadratic subproblem had only equality constraints. The modern era of SQP methods can be traced to the publication of the Han-Powell method in 1976. Han solved inequality constrained problem with Hessian and quasi-Newton approximation to the Hessian of the Lagrangian function. Powel proposed a method similar to Han’s method but where algorithm converged superlinearly even if Hessian and Lagrangian function was indefinite. Current implementations of SQP methods for large-scale optimization have solved problems with as many as 40,000 variables and inequality constraints. SQP represents a conceptual method from which specific algorithms have evolved.
3.7. SQP Methods SQP methods are a class of optimization methods that solve a quadratic programming sub-problem at each iteration. Each QP sub-problem minimizes a quadratic model of a certain modified Lagrangian function subject to linearized constraints. A merit function is reduced along each search direction to ensure convergence from any starting point. The basic structure of an SQP method involves major and minor iterations. The major iterations generate a sequence of iterates (xk , k) that converge to ˚ x,˚ π . At each iterate a QP sub-problem is used to generate a search direction towards the next iterate (xk+1 , k + 1). Solving such a sub-problem is itself an iterative procedure, with the minor iterations of an SQP method being the iterations of the QP method. Constrained minimizer ˚ x is written as linear combination of constraint gradients. This combination of gradients is known as Lagrange multipliers. Vector of Lagrange multipliers associated with nonlinear constraints is ˚ π. In order to well define SQP method definition of the QP Hessian plays an important role. Quadratic programming solver need to solve linear systems formed from quadratic programming constrained matrices. Local solution can be characterized in a terms of Karush-Kuhn-Tucker
56
3.7 SQP Methods KKT conditions given as a first and second derivatives of Lagrangian function [8].
3.7.1. Line search method Line search method represent modification of Newton’s method applied to the first-order optimality conditions. Associated with the k−th iteration of a conventional line-search method for unconstrained optimization is a scalar-valued function mk (x) that represents a local line-search model of f . The next iterate is then xk+1 =xk + dk , where dk is chosen so that the improvement in f is at least as good as a fixed fraction of the improvement in the local model, i.e., dk must satisfy following: f (xk ) − f (xk + dk ) ≥ η(mk (xx ) − mk (xk + dk ))
(3.48)
where η is a fixed parameter such that 0 < η < 21 . Line-search models are quadratic functions based on a first or second order of Taylor-series. Main feature of line-search method is that dk (α) is defined in terms of convex sub-problem and definition of this variable may warrant the use of a nonmonotone line search where f can increase during the iterations. In a case where there are no constraints, line search and trust region methods have many properties in common. Only difference is that a line-search method involves the solution of a bounded convex sub-problem [9, 10].
3.7.2. Trust region method Alternative use of line search methods using merit function to ensure global convergence is the trust-region approach. Here size of the step is limited by imposing a constraint of the norm of the solution of quadratic programming problem. Algorithm proposed by Fletcher [11] solved quadratic sub-problem by minimization of Lagrangian function for the QP sub-problem. In [12] algorithm present is for when one equality constraint is present. This algorithm is related to the conventional trustregion approach in unconstrained optimization. Trust region method solves sub-problem as is stated 1 mindRn gkT d + dT Hk d 2
subject to kdk ≤ δk ,
57
Chapter 3
Optimization for Power Systems
Value δk , is used for defining an initial estimate of δk+1 with a possibility to increase. If radius of this region is reduced over sequence consecutive iterations, step δk , will reduce to zero. It is possible to define trustregion methods which do not enforce a reduction in f at every step. Trust-region problem need to be solved more than once before satisfaction of condition, unlike modern optimization methods which need only approximate solution of the condition mentioned above. Complexity of constrained minimization is higher than in a case of unconstrained minimization. Modern trust-region methods require only an approximate solution of given problem [13].
3.7.3. Han-Powell method Han and Powell made significant improvements of the Wilson’s work. They introduced definition of QP sub-problem in terms of positivedefinite quasi-Newton approximation. Second is the use of line-search merit function for obtaining sequence for improving estimation value in solution. Merit function can bee defined as a scalar function whose value provides a measure of the quality of a given point as an estimate of a solution of the constrained problem. Merit function is used with line-search model for definition of decrease at the k th iteration. In constrained case dk is used to satisfy M (xk )−M (xk +dk ) ≥ η(mk (xk )−mk (xk +dk )), xk +dk ≥ 0 (3.49) l1 is proposed as a merit function which will be explained later. It is proposed calculation of dk as: dk (α) = αpk = α(xk − x ˆk )
(3.50)
where x˚k is the solution of the problem where is needed minimization, stated as follows: 1 minimizexRn fk + gkT (x − xk ) + (x − xk )T Bk (x − xk ) 2 subject to ck + Jk (x − xk = 0,
58
x ≥ 0, )
(3.51)
3.7 SQP Methods
3.7.4. Sequential unconstrained methods Fletcher in his work suggested that penalty function l1 can be minimized subject to bounds by solving a sequence of non-differentiable unconstrained sub-problems of the form minimizexRn fˆk (x) + ρ kˆ ck (x)k1 + ρ k[x]k1
(3.52)
where cˆk (x) is a linearized constraint function. Fletcher proposed minimizing of this function using a trust-region method, rather than linesearch method. Using trust region method form is now changed to sub-problem form of minimizexRn fˆk (xk + d) + ρ kˆ ck (xk + d)k1 + ρ k[xk + d]k1 (3.53) subject to kdk ≤ δk . Each sub-problem has a quadratic objective function. This approach forms the basis of Fletcher’s “Sl1-QP method”. The “Sl1-QP method” can be used with unconstrained merit functions. Extension of this problem is defined as “Sl∞ − QP “ method, which uses trust-region sub-problem minimizexRn fˆk (xk + d) + ρ kˆ ck (xk + d)k∞ + ρ k[xk + d]k∞ (3.54) subject to kdk∞ ≤ δk , which can be defined as quadratic problem in following manner [11]: minimizedRn ;θ,σ fˆk (xk + d) + ρθ + ρσ subject to − θe ≤ cˆk (xk + d) ≤ θe θ ≥ 0 − δk e ≤ d ≤ δk e,
xk + d + σe ≥ 0,
(3.55)
σ≥0
3.7.5. Filter methods Filters can be used to force convergence. Filters represent two dimensional measure of quality based on f (x) and kc(x)k. Filter method requires progress taking into account two dimensional function made of (kc(x)k, f (x)). This function provides point x ¯ as a better than point ˚ x. This two points, the pair (h(¯ x), f (¯ x)) is said to dominate the pair
59
Chapter 3
Optimization for Power Systems
(h(˚ x), f (˚ x)) if h(¯ x) ≤ βh(˚ x) and f (¯ x) ≤ f (˚ x) − γh(˚ x), whereβ, γ(0, 1) are constraints. The filter is called “slooping filter” when filter consists of a list of entries (hj , fj ). The original filter proposed by Fletcher and Leyffer uses γ = 0, β = 1. A pair of (h(˚ x), f (˚ x)) is said to be “acceptable to the filter” F if it is not dominated by another filter which represents h(xk ) ≤ βhj .Sometimes this points are added to filter and then entries that are dominated by the new pair are removed. Important property of the filter is that if there are an infinite sequence of iteration in which (h(xk ), f (xk )) is entered into the filter {f (xk )}is bounded below than h(xk ) → 0.
3.7.6. Merit function To establish global convergence for constrained optimization algorithms a way of measuring progress towards a solution is needed. For SQP this is done by constructing a merit function a reduction in which implies that an acceptable step has been taken. In a nonlinearly constrained optimization algorithms choice of merit function represents significant importance. From merit function can be evaluated performance of the algorithm as well as enforce of global convergence. Penalty merit function for enough values of the penalty parameter minimizers for the NLP problem are unconstrained minimizers for the exact penalty function. Also Lagrangian function can be used as merit function, but this function includes Lagrange multipliers. For calculating variables x it is necessary to obtain correct value for the multiplier estimate and when the optimal multiplier vector is used there is a finite value of the solution of the problem which is unconstrained minimize of the merit function.
3.7.7. Sequential programming algorithm and basic principle It is not known how to compute a solution of nonlinear program in a finite number of iterations, except linear and quadratic programming. So in order to solve this problem developed algorithms are sequential in its nature so that infinite sequence of generated point such that the limit points of convergent sub-sequences are solutions of the problem.
60
3.7 SQP Methods The number of iterations required to solve the QP sub-problem increase or decrease with the problem. This increase in Quadratic programming iterations raises two issues: overall efficiency and the effort required to compute a minimizer for the quadratic programming sub-problem. In this sense, a "satisfactory" criterion will be one that is efficient in the sense that the number of nonlinear iterations is not adversely affected. The problem here can be that if QP algorithm is terminated prior to obtaining a solution it can affect solution of the SQP algorithm in a number of critical ways. This can lead to low quality of search direction. The idea of sequential quadratic programming (SQP) methods is to solve the nonlinearly constrained problem using a sequence of quadratic programming (QP) sub-problems. The constraints of each QP subproblem are linearizations of the constraints in the original problem, and the objective function of the sub-problem is a Quadratic approximation to the Lagrangian function. Nonlinear programming problems can be formulated as: minimize f (x) subject to h(x) = 0
(3.56)
g(x) ≤ 0 This problems can be found in many applications like science, engineering, industry etc. When problem is formulated in NLP it is general model depending which type of objective function is included if the function f is linear or quadratic. SQP is powerful tool where this method it is possible to solve problems with nonlinear constraints. Basic idea here is to model nonlinear programming at approximate solution by a quadratic programming sub-problem and use solution of this problem to construct better solution for step xk+1 . This process happens in loop until solution converge to ˚ x. SQP also can be considered as an extension of Newton methods and quasi-Newton methods depending of the appropriate choice of quadratic sub-problem. SQP is generally very successful method with two important properties. First property is that SQP is not a feasible-point method. Feasible here includes that feasible point satisfies all of the constraints of NLP. SQP methods can be easily modified so that linear constraints including simple bounds are always satisfied. Second important property is existance of rapid and accurate algorithms for solving quadratic programs. This solution can be quite easy since for example if there are only one equality constraints the solution of the quadratic program is treated as solution of a set of system
61
Chapter 3
Optimization for Power Systems
of linear equations. In order to explain basic idea of SQP algorithm some assumptions need to be made. For vector-valued functions ∇r is used for notation of Jacobian of the function like ∇h(x) = (∇h1 (x), ∇h2 (x), ..., ∇hm (x))
(3.57)
Hessian is defined to be symmetric matrix where (i, j)th component is Hf (x)i,j =
δ 2 f (x) δxi , δxj
(3.58)
Lagrangian function is defined as L(x, u, v) = f (x) + ut h(x) + v t h(x)
(3.59)
where u and v are multiplier vectors. The major reason for using a quadratic sub-problem is a problem with a quadratic objective function and linear constraints is that such problems are relatively easy to solve and yet in their objective function can reflect the nonlinearities of the original problem. The main problem of SQP is proper choose of quadratic sub-problems. One form of the quadratic sub-problem can be: 1 minimizedk (rk )dx + dtx Bk dk 2 subject to ∇h(xk )t dx + h(xk ) = 0
(3.60)
∇g(xk )t dx + g(xk ) ≤ 0 where dx = x−xk , and rk and Bk need to be chosen. Objective function here is local quadratic approximation to f at xk . This solution works when constraints are linear, but presence of nonlinear constraints makes this choice fail. To take nonlinearity constraints into account SQP uses quadratic mode of Lagrangian function as the objective function. Now problem can be defined as: minimize L(x, ˚ u,˚ v) subject to h(x) = 0
(3.61)
g(x) ≤ 0 Taylor series approximation in x for the Lagrangian is 1 L(xk , uk , v k ) + ∇L(xk , uk , v k )t dx + dx HL(xk , uk , v k )dx 2
62
(3.62)
3.7 SQP Methods Using this function as objective function leads to generation of iteration same as one generated by Newton’s method for the system composed of the first order necessary condition and the constraint equations. This brings algorithm with good local convergence properties. The problem also can be defined as previous just in this step ∇L(xk , uk , v k )t is replaced with ∇f (xk )t . Solution of the quadratic problem dx is used to generate new iteration step xk+1 . Here are needed new estimates for the multipliers . They can be chosen to be optima multipliers of the quadratic sub-problem. Al updates can be defined as: xk+1 = xk + αdx uk+1 = uk + αdu v k+1 = v k + αdv where parameter α is called steplength parameter. Effectiveness of the algorithm is determined by the proper choice of the parameters for new iteration. Algorithm 3.4 Basic Algorithm Given approximations (x0 , u0 , v 0 ), B0 and a merit function φ, set k = 0. 1.Form and solve quadratic programming to obtain (dx , du , dv ). 2. Choose steplength αso that φ(xk + αdx ) 3. Set xk+1 = xk + αdx , uk+1 = uk + αdu , v k+1 = v k + αdv 4. Stop if converged. 5. Compute Bk+1 . 6. Set k = k + 1; go to 1. [11]
3.7.8. Lagrange Newton Iteration with SQP approach General constrained optimization problem can be formulated as follows: minimize f (x),
xRn
hj (x) = 0, jE = {1, 2, ..., p}
(3.63)
With this method is represented solution of Karush-Kuhn-Tucker (KKT) conditions of the problem formulated below. Lagrangian function can
63
Chapter 3
Optimization for Power Systems
be defined L(x, λ) = f (x) +
X
λj hj (x) = f (x) + λT h(x)
(3.64)
jE
with defined KKT conditions: "
∇L(x, λ) =
∇f (x) +
λj ∇hj (x) h(x) P
j
#
" #
=
0 0
(3.65)
Hessian matrix has the following structure: "
Q BT ∇ L(x, λ) = B 0
#
2
Q = ∇2 f (x) +
X
(3.66)
λj ∇2 hj (x) = ∇2xx L(x, λ),
(3.67)
j
∇h1 (x)T .. B = h0 (x) = . T ∇hp (x)
(3.68)
Here Newton equation can be further transformed to: "
Q BT B 0
#"
#
"
∇f (x) 4x =− + h(x) λ
#
(3.69)
where λ+ = λ + 4λ and ∇f (x) = ∇f (x) + B T λ. If matrix B has full rank and it is positive defined matrix Q, the linear system of the equations mentioned above is uniquely solved and also represents unique solution of the quadratic sub-problem [14].
Sequential Quadratic Programming Algorithm If for the next set of problem, matrix B has full rank and it is positive defined matrix Q, the linear system of the equations mentioned above is uniquely solved "
64
Q BT B 0
#"
#
"
4x ∇f (x) =− λ+ h(x)
#
3.8 Example 3.1 Algorithm 3.5 Lagrange Newton Initialize choose (x0 , λ0 )T R(n+p) Calculate " # ∇f (xk ) + B T λk k 0 k k ∇f (x ), B = h (x ), F = h(xk ) Solve the equations # # of linear " " # "system ∇f (x) Q B T 4x =− h(x) B 0 λ+ Use xk+1 = xk + 4x go to step Calculate.
and also represents unique solution of the quadratic sub-problem. 1 minimize q(4x) = 4xT Q4x + ∇f (x)T 4x + f (x) 2 subject to ∇gi (x)T 4x + gi (x) ≤ 0, iI
(3.70)
∇hj (x)T 4x + hj(x) ≤ 0, jE where Q = Q(x, λ, µ) = ∇2 f (x) +
X iI
λi ∇2 gi (x) +
X
µj ∇2 hj (x) (3.71)
jE
Now, SQP algorithm can be solved with Algorithm 3.6.
3.8. Example 3.1 Consider the three-bus system shown in Fig. 3.7. Known quantities are also shown in figure (in p.u.). Given: V 1 = 1 + j0, I 2 = 0.2 + j0.3t, I 3 = 1 + j5, Z = 0.1 + j0.3.
65
Chapter 3
Optimization for Power Systems
Algorithm 3.6 Sequential Quadratic Programming Initialize choose (x0 , λ0 , µ0 )T R(n+m+p) Calculate ∇f (xk ), A = g 0 (xk ), B = #h0 (xk ), F k = " ∇f (xk ) + AT λk + B T µk , h(x) if
the
following conditions are fulfilled
k
F < T OL, λk ≥ 0, g(xk ) ≤ 0 and | (λk )T g(xk ) |≤ T OL then terminate the calculation and calculate P P Q = ∇2 f (xk ) + iI λki ∇2 gi (xk ) + jE µj ∇2 hj (xk ) Determine the value of Lagrange multiplicators λlin and µlin Choose xk+1 = xk + 4x, λk+1 = λi,lin in a case where i iIlin (4x), and otherwise set = 0, µk+1 = µlin , k = k + 1 go to step Calculate. λk+1 i
Figure 3.7.: Three bus network with linear compensation of reactive power
Initial estimates of unknown variables are: λ1 = 1, λ2 = 1, λ3 = 1, λ4 = 1, t = 1. First, initial values of variables can be found using Node Voltage method
E1 1 0 0 V1 I2 = −Y12 Y12 + Y23 −Y23 V2 I3 0 −Y23 Y23 V3
66
(3.72)
3.8 Example 3.1
V1 1 0 0 E1 0.2 + j0.3 = −1 + j3 2 − j6 −1 + j3 V2 V3 0 −1 + j3 1 − j3 −1 − j5 (3.73) where Y = 1/Z. Then bus voltages becomes
[V ] = [Y ]−1 [I]
(3.74)
when the bus voltages are determined, it is easy to calculate branch currents as: I12 = (V1 − V2 )Y12
(3.75)
I23 = (V2 − V3 )Y23
(3.76)
The goal is to minimize power loses subject to several constraints. Problem can be formulated as follows:
M in
X
Ploss = M in |I12 |2 R + |I23 |2 R =
M in
(I12r )2 + (I12im )2 R + (I23r )2 + (I23im )2 R
(3.77)
subject to c1 : I12r + I2r − I23r = 0 c2 : I23r − I3r = 0 c3 : I12im + I2im t − I23im = 0
(3.78)
c4 : I23im − I3im = 0 Now, we can form function i 1 h (I12r )2 + (I12im )2 R + (I23r )2 + (I23im )2 R 2 + λ1 (I12r + I2r − I23r ) + λ2 (I23r − I3r )
f=
(3.79)
+ λ3 (I12im + I2im t − I23im ) + λ4 (I23im − I3im )
67
Chapter 3
Optimization for Power Systems
where ∂f ∂I12r ∂f ∂I12im ∂f ∂I23r ∂f ∂I23im ∂f ∂t
∂f ∂λ1 ∂f ∂λ2 ∂f ∂λ3 ∂f ∂λ4
= I12r R + λ1 = f1 = I12im R + λ3 = f2 = I23r R − λ1 + λ2 = f3 = I23im R − λ3 + λ4 = f4
= I12r + I2r − I23r = f5 = I23r − I3r = f6 = I12im + I2im t − I23im = f7 = I23im − I3im = f8
= λ3 I2im = f9 (3.80)
Next step is to calculate Jacobian matrix J: ∂f 1 12r ∂I ∂f 2 ∂I12r ∂f3 ∂I12r ∂f4 ∂I12r ∂f5 ∂I12r ∂f 6 ∂I12r ∂f7 ∂I 12r ∂f8 ∂I12r ∂f9 ∂I12r
∂f1 ∂I12im ∂f2 ∂I12im ∂f3 ∂I12im ∂f4 ∂I12im ∂f5 ∂I12im ∂f6 ∂I12im ∂f7 ∂I12im ∂f8 ∂I12im ∂f9 ∂I12im
∂f1 ∂I23r ∂f2 ∂I23r ∂f3 ∂I23r ∂f4 ∂I23r ∂f5 ∂I23r ∂f6 ∂I23r ∂f7 ∂I23r ∂f8 ∂I23r ∂f9 ∂I23r
∂f1 ∂I23im ∂f2 ∂I23im ∂f3 ∂I23im ∂f4 ∂I23im ∂f5 ∂I23im ∂f6 ∂I23im ∂f7 ∂I23im ∂f8 ∂I23im ∂f9 ∂I23im
∂f1 ∂λ1 ∂f2 ∂λ1 ∂f3 ∂λ1 ∂f4 ∂λ1 ∂f5 ∂λ1 ∂f6 ∂λ1 ∂f7 ∂λ1 ∂f8 ∂λ1 ∂f9 ∂λ1
∂f1 ∂λ2 ∂f2 ∂λ2 ∂f3 ∂λ2 ∂f4 ∂λ2 ∂f5 ∂λ2 ∂f6 ∂λ2 ∂f7 ∂λ2 ∂f8 ∂λ2 ∂f9 ∂λ2
∂f1 ∂λ3 ∂f2 ∂λ3 ∂f3 ∂λ3 ∂f4 ∂λ3 ∂f5 ∂λ3 ∂f6 ∂λ3 ∂f7 ∂λ3 ∂f8 ∂λ3 ∂f9 ∂λ3
∂f1 ∂λ4 ∂f2 ∂λ4 ∂f3 ∂λ4 ∂f4 ∂λ4 ∂f5 ∂λ4 ∂f6 ∂λ4 ∂f7 ∂λ4 ∂f8 ∂λ4 ∂f9 ∂λ4
∂f1 ∂t ∂f2 ∂t ∂f3 ∂t ∂f4 ∂t ∂f5 ∂t ∂f6 ∂t ∂f7 ∂t ∂f8 ∂t ∂f9 ∂t
(3.81) In Newton-Raphson method, the vector of system variables is given with h
4X (n) = − J (n)
i−1
f (n)
(3.82)
or, when it is applied to the given model, vector of system variables becomes
68
4I12r 4I12im 4I23r 4I23im 4λ1 4λ2 4λ3 4λ4 4t
(n)
=−
R 0 0 0 1 0 0 0 0
0 R 0 0 0 0 1 0 0
0 0 R 0 −1 1 0 0 0
0 0 0 R 0 0 −1 1 0
1 0 −1 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0
0 1 0 −1 0 0 0 0 I2im
0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 I2im 0 0
−1
f1 f2 f3 f4 f5 f6 f7 f8 f9
(n)
3.9 Example 3.2 (3.83)
Set X at iteration (n + 1) is given as X (n+1) = X (n) + 4X (n)
(3.84)
Results The main goal here was to minimize losses using linear compensation of reactive power. For the linear compensation parameter t is used in reactive component of complex current of generator. To verify effectiveness of the method, 3-bus system is used for test. The simulations were performed using C++ software. The test was carried out by solving the optimal power flow problem of the power loss objective. The obtained results are presented in Tab. 3.1. The results shown here illustrate that Variable Initial value Value obtained by N-R I12r 0.8 0.8 I12im 4.7 0 I23r 1 1 I23im 5 5 t 1 16.6667 loss 4.873 2.664 Table 3.1.: Linear Compensation
this method can be used for managing reactive power to improve performance of power system by increasing flow of active power.
3.9. Example 3.2 Second example uses capacitor for reactive power compensation. Again, the three-bus system is used. Known quantities are shown in Fig. 3.8 (in p.u.). Given: V 1 = 1 + j0, S 2 = 0.2 + j0.3, S 3 = 0.4 + j0.6, Z = 0.01 + j0.03. Initial estimates of unknown variables are: V 2 = 1 + j0, V 3 = 1 + j0, bc = 0.1, λ1 = 1, λ2 = 1, λ3 = 1, λ4 = 1, λ5 = 1, λ6 = 1, λ7 = 1, λ8 = 1, λ9 = 1, λ10 = 1, λ11 = 1, λ12 = 1, λ13 = 1, λ14 = 1. In this case powers are known, as given in the Fig. 3.8. In order to calculate unknown variables these complex powers will be used. Relationship between the real and
69
Chapter 3
Optimization for Power Systems
Figure 3.8.: System with capacitor for reactive power compensation
reactive power, and complex current is determined using fundamental definition of complex power given with: S = P + jQ P + jQ = (Vr + jVim )(Ir + jIim )∗
(3.85)
P + jQ = Vr Ir + Vim Iim + j(−Vr Iim + Vim Ir ) Using this, problem can be formulated as follows:
M in
(I12r )2 + (I12im )2 R + (I23r )2 + (I23im )2 R
(3.86)
subject to
70
c1 : I12r + I2r − I23r − Icr = 0
(3.87)
c2 : I23r − I3r = 0
(3.88)
c3 : I12im + I2im − I23im − Icim = 0
(3.89)
c4 : I23im − I3im = 0
(3.90)
c5 : [(V1r − V2r ) G − (V1im − V2im ) B] − I12r = 0
(3.91)
c6 : [(V1r − V2r ) B + (V1im − V2im ) G] − I12im = 0
(3.92)
c7 : [(V2r − V3r ) G − (V2im − V3im ) B] − I23r = 0
(3.93)
c8 : [(V1r − V2r ) B + (V1im − V2im ) G] − I23im = 0
(3.94)
3.9 Example 3.2 c9 : −bc V2im − Icr = 0
(3.95)
c10 : bc V2r − Icim = 0
(3.96)
c11 : P2 − V2r I2r − V2im I2im = 0
(3.97)
c12 : P3 − V3r I3r − V3im I3im = 0
(3.98)
c13 : Q2 + V2r I2im − V2im I2r = 0
(3.99)
c14 : Q3 + V3r I3im − V3im I3r = 0
(3.100)
Using the Newton-Raphson method, same procedure can be applied as in first example in order to calculate system variables. Vector of system variables is given with 4X (n) =[4I12r 4I12im 4I23r 4I23im 4Icr 4Icim bc V2r V2im V3r V3im I2r I2im I3r I3im λ1 λ2 λ3
(3.101)
(n)
λ4 λ5 λ6 λ7 λ8 λ9 λ10 λ11 λ12 λ13 λ14 ]
Results can be obtained by iterating the set X as given in the formula: X (n+1) = X (n) + 4X (n)
(3.102)
Results Our main goal was to reduce the losses for the network. Because reactive power uses a proportion of the available transmission capacity as well as increases the losses in transmission, we need to compensate this reactive power. The power capacitor has for a long time been the most common device for generating reactive power. A capacitor in principle acts as generator which produces only reactive power. When connected to plant which consumes reactive power, the load on generators, cables and transformers is relieved, thereby increasing the transmission capacity of active power. Ultimately, power losses and voltage drop will be reduced after shunt capacitor is installed. Tab. 3.2 contains the results of such system with reactive compensation. In this example stopping criterion was set to value 10−6 . This convergence has been achieved after two iterations and results are shown in Tab. 3.2. The values of the objective function for each iteration are also shown in Tab. 3.2. The objective function value is around 0.0059 at the point of convergence. It can be concluded that reactive compensation by capacitor can be successfully used for reducing power losses in networks. The method is very simple, fast, and can be extended to any realistically sized system networks.
71
Chapter 3 Variable I12r I12im I23r I23im Icr Icim bc V2r V2im V3r V3im I2r I2im I3r I3im loss
Optimization for Power Systems Initial Value Iteration(1) Iteration(2) 0.2 0.205635 0.205706 -0.2 -0.117572 0.0154148 0.4 0.404755 0.402168 -0.6 -0.621332 -0.619911 0 0.000499334 0.00193964 0.1 0.201086 0.333592 0.1 0.201644 0.334656 1 0.994416 0.998405 0 -0.00499334 -0.00632533 1 0.971729 0.975786 0 -0.0109227 -0.0121913 0.2 0.199619 0.198402 -0.3 -0.302674 -0.301734 0.4 0.404755 0.402168 -0.6 -0.621332 -0.619911 0.006 0.00605989 0.00588581 Table 3.2.: System with Capacitor
3.10. Example 3.3 Using sequential quadratic programming find optimal solution for the generators in the network shown in Fig. 3.9. Network consist of a three generators, where generator G1 is slack generator and is taken as a reference and magnitude and phase are specified as VG1 = 1 + j0. Value of the generators is expressed over their prices. Costs of the generators 2 ,C = 0.15P 2 are: C1 = 0.1PG1 + 0.2PG1 2 G2 + 0.18PG2 , C3 = 0.2PG3 + 2 . On three nodes are connected three consumers with their 0.15PG3 active powers PL1 , PL2 , PL3 . Impedance of the line in the network is the P min ≤ same ZL = 0.01 + j0.05. Aim is to find min 3i=1 Ci , where PGi max . In order to solve this problem power flow analysis and PGi ≤ PGi SQP approach are used. More about power flow analysis can be found in [3]. First step in solving this problem represent forming set of equations for the nodes in the network. Using power flow analysis set of equations
72
3.10 Example 3.3
Figure 3.9.: Six node network can be formed so that power flows from node 1 to the node 6, as follows: n1 : SG1 − S12 = 0
(3.103)
n2 : −S21 − SL1 − S23 − S25 = 0
(3.104)
n3 : SG3 − S32 − S34 = 0
(3.105)
n4 : −S43 − SL3 − S45 = 0
(3.106)
n5 : −S54 − S52 − SL2 − S56 = 0
(3.107)
n6 : SG2 − S65 = 0
(3.108)
Complex power can be expressed as : S = P + jQ where P represents active power which is real part of the complex power and Q is reactive part and represents imaginary part of the equation. If real and imaginary part of the equation write as: Pi =
n X
Vi Vj Yij cos(θij − δi + δj )
j=1
Qi = −
n X
(3.109) Vi Vj Yij sin(θij − δi + δj )
j=1
73
Chapter 3
Optimization for Power Systems
equations for the nodes (1 to 6) can be written in following manner: h1 : −V12 Y11 cosθ11 − V1 V2 Y12 cos(θ12 − δ1 + δ2 ) + PG1 = 0
h2 :
(3.110)
− V2 V1 Y21 cos(θ21 −δ2 +δ1 )−V22 Y22 cosθ22 − V2 V3 Y23 cos(θ23 −δ2 +δ3 )−(V2 V5 Y25 cos(θ25 −δ2 +δ5 ))−PL1 =0 (3.111)
h3 :
h4 :
h5 :
− V3 V2 Y32 cos(θ32 − δ3 + δ2 ) − V32 Y33 cosθ33 − V3 V4 Y34 cos(θ34 − δ3 + δ4 ) + PG3 = 0 − V4 V3 Y43 cos(θ43 − δ4 + δ3 ) − V42 Y44 cosθ44 − V4 V5 Y45 cos(θ45 − δ4 + δ5 ) − PL3 = 0 − V5 V2 Y52 cos(θ52 −δ5 +δ2 ))−V5 V4 Y54 cos(θ54 −δ5 +δ4 )− V52 Y55 cosθ55 )−V5 V6 Y56 cos(θ56 −δ5 +δ6 )−PL2 =0
h6 : −V6 V5 Y65 cos(θ65 − δ6 + δ5 ) − V62 Y66 cosθ66 ) + PG2 = 0
(3.112)
(3.113)
(3.114)
(3.115)
Reactive power equations are formed for all nodes except node 1, since the first generator is referent one and reactive power does not have any influence on the network. h7 :
V2 V1 Y21 sin(θ21 −δ2 +δ1 )+V22 Y22 sinθ22 +V2 V3 Y23 sin(θ23 −δ2 +δ3 )+V2 V5 Y25 sin(θ25 −δ2 +δ5 )−QL1 =0 (3.116)
h8 :
h9 :
74
V3 V2 Y32 sin(θ32 − δ3 + δ2 ) + V32 Y33 sinθ33 V3 V4 Y34 sin(θ34 − δ3 + δ4 ) + QG3 = 0 V4 V3 Y43 sin(θ43 − δ4 + δ3 ) + V42 Y44 sinθ44 V4 V5 Y45 sin(θ45 − δ4 + δ5 ) − QL3 = 0
(3.117)
(3.118)
3.10 Example 3.3
h10 :
V5 V2 Y52 sin(θ52 −δ5 +δ2 )+V5 V4 Y54 sin(θ54 −δ5 +δ4 ) +V52 Y55 sinθ55 +V5 V6 Y56 sin(θ56 −δ5 +δ6 )−QL2 =0
h11 : V6 V5 Y65 sin(θ65 − δ6 + δ5 ) + V62 Y66 sinθ66 + QG2 = 0
(3.119)
(3.120)
Voltages in the initial state have values 1 V. Elements Yxx are elements of admittance matrix. Admittance matrix YL =
1 ZL
=
1 0.01+j0.05
= ... = 19.61∠ − 1.37S.
Y11 Y12 Y Y22 YL = 21 ... ... Yn1 Yn2
... Y1n ... Y2n ... ... ... Ynn
After this step power flow analysis is finished. Next step in solving this problem represents applying a SQP method. This method explained in detail above, and here will be considered just steps needed for calculation. SQP method requires minimization of the objective function f . For this problem it represents minimization of the function 2 2 2 f (x) = 0.1PG1 + 0.2PG1 + 0.15PG2 + 0.18PG2 + 0.2PG3 + 0.15PG3
under the condition B4x + h(x) = 0, which in this specific case represents sum of the power in the nodes. Lagrangian function state as: 2 2 L(x, λ)=0.1PG1 +0.2PG1 +0.15PG2 +0.18PG2 2 +0.2PG3 +0.15PG3 +
11 X
λi hi
i=1
For Hessian matrix it is important to calculate elements of the matrix "
Q BT ∇ L(x, λ) = B 0
#
2
where Q = ∇2 f (x) +
X
λj ∇2 hj (x) = ∇2xx L(x, λ),
j
75
Chapter 3
Optimization for Power Systems
and ∇h1 (x)T .. B = h0 (x) = . T ∇hp (x)
Since derivation is calculated for all variables (PG1 , PG2 , PG3 , QG1 , QG2 , QG3 , V1 , V2 , V3 , V4 , V5 , V6 , δ1 , δ2 , δ3 , δ4, δ5 , δ6 ) Hessian ∇2 L(x, λ) matrix has structure
0.4 0 0 . .. . .. 0
0 0.36 0 .. . .. . 0
0 0 0.30 .. . .. . 0
... ... ... .. . .. . −V6 Y56 cos(θ56 − δ5 + δ6 )
... ... ... .. . .. . 0
0 0 0
0 −V5 V6 Y56 cos(θ56 − δ5 + δ6 ) 0
For given optimization problem it is necessary to find values of parameters for adjusting generators. So, for the formulated problem "
Q BT B 0
#"
#
"
∇f (x) 4x =− h(x) λ+
#
these parameters can be found like: "
#
"
4x ∇f (x) =− + λ h(x)
#"
Q BT B 0
#−1
Finding inverse matrix is possible only if matrix is square. A matrix possessing an inverse is called nonsingular, or invertible. Now applying SQP algorithm values of the parameters can be calculated in the first step. In order to converge solution it is needed to perform algorithm in few steps until solution converge to ε ≤ 10−6 .
76
4. Single-phase modeling Distribution system state estimation aims to compute an accurate estimate of system loads, which are used as inputs to modern distribution system management applications such as optimal volt/VAr control and optimal feeder reconfiguration. Transmission system state estimation is very well established [1] and is widely adopted in transmission system control centers. However, distribution system state estimation faces several challenges which are distinct from those encountered in transmission networks. These challenges include: (i) a limited number of real time measurements many of which are current magnitudes, (ii) an unsymmetrical network design coupled with an unbalanced load operation, (iii) a large resistance to reactance ratio particularly for underground cables, and (iv) the large size of distribution networks. Therefore, the methodologies of transmission system state estimation cannot be straightforwardly applied in distribution networks. In North American distribution networks which are predominantly radial, state estimation is practically equivalent to load estimation [15]. This has motivated approaches which offer a compromise between conventional load allocation and a fully sophisticated AC state estimator [16]. Several practical distribution system state estimators have been built around load flow algorithms. An early approach proposed a load flow calculation that balances remote measurement currents and load currents described by their statistical models [17]. Reference [18] employed a radial load flow to adjust nodal loads; this required treating the available measurements as completely accurate. Another approach [19] adjusted the loads based on a load modeling technique which incorporates the use of customer load profile curves and a radial load flow which uses measurements as solution constraints. Field results from an improved implementation of the algorithm in [19] have been reported in [20]. The importance of load estimation in distribution networks has been emphasized in [21] which proposed a load modeling algorithm that makes use of automated meter reading systems. In contrast to previous approaches, reference [22] proposed decomposing the distribution system state estimation prob-
77
Chapter 4
Single-phase modeling
lem into several weighted least squares (WLS) sub-problems where each corresponds to a single branch state estimation; the sub-problems are coordinated by a forward/backward sweep load flow scheme. A comprehensive implementation based on the algorithm in [22] was also tested in [23]. However, the efficient implementations of branch oriented radial load flow based approaches assume that the load flow direction is predictable; this assumption is becoming invalid with the increased levels of installed distributed generation. Another class of distribution system state estimators is based on the theory of transmission system state estimation, but uses load data as psedo-measurements. References [24] and [25] employed the WLS method and a three-phase model to estimate the state of the network; reference [24] used an approximation of the Jacobian matrix which is held constant over a few iterations, while [25] converted power measurements into current measurements and expressed bus voltages in rectangular form to obtain a constant Jacobian matrix. Recent work [26] also proposed an approximate linear state estimation formulation by making use of rectangular coordinates; this formulation is intended for incorporating synchronized phasor measurements in distribution state estimation. Unlike [24, 25, 26], reference [27] proposed a branch current distribution state estimator which employs branch current phasors as state variables. For systems with Y connected loads, the branch current estimator [27] allows the Jacobian matrix to be decoupled on a per-phase basis, thus improving the efficiency as compared to node voltage based WLS three-phase distribution system estimation. Reference [15] extended the approach in [27] so that data from the advanced metering infrastructure could be used to improve the accuracy of the estimation. Pseudo-measurement modeling has been recently discussed in [28], where the computations were based on an artificial neural network in conjunction with load profiles. The above WLS approaches have been demonstrated on small size networks; it is unlikely that they can satisfy the performance requirements on very large scale distribution networks. This chapter presents a real-time distribution system state estimator (DSSE) that satisfies the performance requirements on practically sized radial distribution network models and can easily handle distributed generation. The proposed approach decomposes the state estimation problem into two sub-problems which are iterated until convergence: (i) The first sub-problem is a WLS estimation problem on a reduced network consisting of measurement areas. Each measurement area (MA) can contain several groups of Y - or 4-
78
4.1 Problem Description and Basic Principles connected loads. The size of this sub-problem is proportional to the number of branch measurements; due to the paucity of measurements, the WLS problem is small and can be solved very efficiently. In addition, the formulation of the first sub-problem does not involve the use of the distribution equipment parameters and its solution is therefore not affected by the resistance to reactance ratio of distribution circuits. (ii) The second sub-problem is a distribution network load flow using the Fortescue transformation [29]. The solution to this sub-problem yields the voltage state-vector for the different phases and the losses per measurement area. Chapter provides a detailed description of the formulation and solution approach, including the explicit treatment of delta connections and the filtering of gross errors. Numerical results include a comparison with conventional load allocation based on current balancing [17]; results are also reported on a practical large-scale distribution network model having about one million nodes.
4.1. Problem Description and Basic Principles Distribution networks are typically operated as radial with current magnitude or real/reactive power flow measurements located at feeder heads. Few other real time measurements are also located at strategic points in the network. The loads are not telemetered in real time; rather their values are defined by making use of load curves and automated meter readings (AMRs). The load curves constitute load values for different seasons, different day types (working day/holiday), and for different hours of the day; they are also differentiated by the load type (residential/industrial/commercial). AMR is a collection of customer load information which is transmitted to the central computing unit at specified times during the day. The bus loads are initially forecasted using the load curves, AMRs, and other relevant meteorological conditions. The real time measurements are employed in the state estimator to improve the estimate of the forecasted load. In fact, the use of forecasts to cope with the lack of observability, pseudo-measurement provision, and enhancement of bad data detection has been the subject of research for transmission system SE [30, 31]. Other methodologies in transmission system SE can be also extended to DSSE, for instance, the use of the estimates to build a historical database which can be used in forecasting-aided DSSE, along the lines of the implementation
79
Chapter 4
Single-phase modeling
described in [31]. Fig. 4.1 shows a part of a distribution network operated with an open loop; it also displays typical locations of real time measurements and loads. Each of the feeders has current magnitude
Figure 4.1.: Two distribution feeders with a tree-like topology and an open ring or branch power flow measurements, some of which are located downstream from the feeder head. Fig. 4.1 also shows eight measurement areas (MAs), denoted by MA1 to MA 8. A measurement area is defined as a connected sub-network which does not include any branch measurements and whose connections to other sub-networks are through branches which have telemetered flow measurements. For instance, MA 3 in Fig. 4.1 is connected to three sub-networks which are defined by MA 2, MA 4, and MA 5, and the connections between the MAs are via telemetered branches. The basic principle of the proposed DSSE is the adjustment of the forecasted load values to conform to the flow measurements at the boundaries of the measurement areas. In particular, a constrained WLS problem is formulated such that (i) the mismatch between the measured and estimated branch current magnitude/power flow quantities is minimized and (ii) the estimated real/reactive power injection into each MA is balanced by the adjusted load values and area power losses. Although the power balance is enforced for each MA on its own, the adjustment of loads in different MAs is coordinated in one WLS problem because the interconnected MAs are interdependent via
80
4.1 Problem Description and Basic Principles their common branch flow measurements. This interdependence, illustrated in Fig. 4.2, requires that the estimated real/reactive load flow leaving one MA is entering into the other. The WLS problem therefore simply makes use of the connectivity graph between the MAs and does not need the topology information or the equipment parameters within the MAs. This makes the WLS phase insensitive to the line parameter values, which is a significant advantage. In practice, current magni-
Figure 4.2.: Equivalent injections at the boundaries between different measurement areas tude measurements are dominant over power flow measurements at the boundaries between MAs; they are effectively handled in the WLS problem by including a branch apparent power constraint that relates the estimated current to the estimated real and reactive power flow. The WLS objective includes different weights to differentiate between the quality of the real time and the pseudo-measurements; real time measurements are assigned a large weight to ensure that they are closely matched, whereas pseudo-measurements corresponding to load forecasts are given a lower weight to allow a larger discrepancy between the estimated and forecasted quantities. The solution to the WLS problem yields the real/reactive load scaling factors, i.e. the ratios of the estimated to the forecasted values of loads. However, the losses estimated by WLS to balance the power in each MA may deviate from the losses computed from an unbalanced load flow with the scaled loads. This calls for a process that iterates between the load flow computation [16] and WLS estimation to achieve convergence. During the iterative pro-
81
Chapter 4
Single-phase modeling
cess, any significant variations in the values of the load scaling factors which are adjacent to a branch measurement are checked for possible gross error in this real time measurement. To reduce the computational effort, the loads within an MA that have the same weights are grouped together into one load group; consequently the loads in the same group will be scaled by the same factor. The size of the WLS problem can be further reduced if the MAs contain only Y -connected equipment because this allows the decoupling of the problem into three sub-problems, one for each phase. The decoupling of the problem was discussed earlier in the context of the branch current estimator [27]. However decoupling will no longer be valid when the delta connections are modeled as this would require the calculation of scaling factors for loads connected between phases. The modeling of unbalanced 4-connected equipment in a load estimator has not been previously discussed in the literature and is a distinctive contribution of this chapter.
4.2. Load Estimation with 4-connections The inputs to the DSSE consist of the network data, load forecasts, loads with known power factor, active and reactive power flow measurements, current magnitude measurements, and voltage measurements. The branch measurements are used to define the MAs with Y -connected loads; 4-connected loads are grouped in separate MAs even if sufficient measurements are not available at the boundaries of these areas. The load forecasts constitute the initial load values that the estimator aims to adjust by making use of the real time measurements. The initial load values together with the branch data are used to run a three-phase load flow and compute the bus voltages and measurement area losses. A WLS problem (sec. 4.2.1) is then solved for all phases at once; this yields the load group scaling factors and which are the ratios of the real and reactive estimated load values to the initially forecasted ones. The load flow results are also employed to compute sensitivities with respect to variations in the load group scaling factors for properly handling 4connected loads (sec. 4.2.2) and area losses (sec. 4.2.3). The estimated scaling factors are checked for possible bad data (sec. 4.2.4); if such data is identified, it is removed from the set of real time measurements and the WLS problem is solved again. The algorithm iterates between the WLS and the load flow solutions until the absolute difference of losses and of voltage deviations from two consecutive load flow iterations is less
82
4.2 Load Estimation with 4-connections than a given threshold. A procedural description of the load estimator is summarized in sec. 4.2.5. In the development below, m denotes the MA number where the first MY areas include only Y -connected loads, and the areas MY + 1, ..., MY + M4 include only 4-connected loads.
4.2.1. WLS Estimation with Y -connected loads
M , QM , I M , V M in a distribuThe real time analog measurements Pφ,n φ,n φ,n φ,n tion network are typically very few and mostly located near the primary transformers and feeder heads, while the rest is sparsely distributed at strategic locations in different parts of the network. Many of these measurements are often current magnitudes, a measurement type known to be the least effective in state estimation [1]. The mathematical formulation described in this section employs the available real time measurements and pseudo-measurements (load forecasts) to estimate the load scaling factors in an MA. While it is possible that the same scaling factor could be applied to all the loads within one MA, typically the load forecasts within an MA are not known within the same accuracy. Therefore, the loads within an MA are grouped based on their forecast accuracy, or equivalently their weighting factor, and a scaling factor is associated with each of these load groups. The WLS problem for a network with MAs having only Y -connected loads is given by minimizing the sum of squared error between the measured and estimated values as given by (4.1) and (4.2) subject to the MA constraints; the first three terms in (4.2) are for the real time measurements, the fourth term is for the pseudo-measurements or forecasted values of load groups, and the fifth term is to restrict power factor deviations of loads having a specified power factor. The MA constraints include the active and reactive area balance constraints in (4.3) and (4.4), the apparent power constraints associated with the current magnitude measurements in (4.5) and (4.6), and the bound limits of the scaling factors in (4.7):
minimize J =
X
Jφ
(4.1)
φ∈P HY
83
Chapter 4
Single-phase modeling
where Jφ is given in (4.2):
(i)
X
Jφ =
(i)
M 2 2 [ωnP M (Pφ,n − Pφ,n ) + ωnQM (Qφ,n − QM φ,n ) ]
n∈P QM
+
(i)
X
M 2 [ωnCM (Iφ,n − Iφ,n ) ]
n∈CM
+
(i)
X
M 2 [ωnV M (Vφ,n − Vφ,n ) ]
n∈V M
+
X
(i)
(i)
LG 2 [ωnP LG (Pφ,n (KPφ,n − 1))2 + ωnQLG (QLG φ,n (KQφ,n − 1)) ]
n∈LG
+
(i)
X
(i)
[ωnP F G (KPφ,n − KQφ,n )2 ]
n∈P F G
(4.2) and subject to (4.3)-(4.6):
X
(i)
(i)
X
Pφ,n =
(i)
LG KPφ,n Pφ,n + P LOSSφ,M A(m) ,
(4.3)
n∈LG(m)
n∈IM (m)
m = 1, . . . , MY , φ ∈ P HY X
(i)
(i)
X
Qφ,n =
(i)
KQφ,n QLG φ,n + QLOSSφ,M A(m) , (4.4)
n∈LG(m)
n∈IM (m)
m = 1, . . . , MY , φ ∈ P HY
(i)
LF (i−1) (i) 2 Iφ,n ) ,
(i)
(Pφ,n )2 + (Qφ,n )2 = (Vφ,n
n ∈ CM \V M, φ ∈ P HY (4.5)
(i)
(i)
(i) (i)
(Pφ,n )2 + (Qφ,n )2 = (Vφ,n Iφ,n )2 n ∈ V M, φ ∈ P HY
(i)
(i)
max min max min ≤ KP KPφ,n φ,n ≤ KPφ,n , KQφ,n ≤ KQφ,n ≤ KQφ,n n ∈ LG(m), m = 1, . . . , MY , φ ∈ P HY
84
(4.6)
(4.7)
4.2 Load Estimation with 4-connections The optimization variables in (4.1)-(4.7) are all quantities which are (i) (i) (i) (i) (i) indexed by the iteration counter: Iφ,n , KPφ,n , KQφ,n , Pφ,n , Qφ,n and (i)
Vφ,n . Note that (4.5) applies to branches which have a current measurement but no voltage measurement associated with them; it therefore employs the voltage magnitude from the previous load flow iteration. Equation 4.6 applies to branches which have both a voltage and current measurement associated with them. The problem given by (4.1)-(4.7) is a WLS problem with equality constraints (4.3)-(4.6) and bound constraints on the load group scaling factors (4.7). A solution can be obtained within a few iterations by solving the optimization problem with equality constraints (4.1)-(4.6) [32] and enforcing the limits on the load group scaling factors (4.7) whenever they get violated. This approach allows rapid detection of obviously bad measurements as explained in sec. 4.2.3 Note that for Y -connected loads the above problem can be decoupled into three sub-problems, one for each phase. Each sub-problem consists of minimizing (4.2) subject to (4.3)-(4.7) where φ is one of the phases (a, b, c) in the Y -connection area. Distributed generation can be easily incorporated in the above formulation either as measured real power with a specified power factor, or as a pseudo-measurement with estimates of both real and reactive power. The above formulation can also account for measurement dependencies by suitable adjustments to the objective function (4.1); details are given in [33, 34, 35].
4.2.2. Consideration of 4-connected loads The presence of 4-connected loads in the network renders the load estimation problem as formulated in (4.1)-(4.7) not separable between the phases, i.e. it will not be possible to write MA equations which are specific to each phase. To simplify the extension of the WLS formulation to systems having both Y - and 4-connected loads, the MAs are further divided to include only one load connection type (Y or 4). Recall that the network is initially partitioned into MAs such that each is a connected sub-network which does not include any branch measurement and whose connection to other MAs is through telemetered branches. The requirement to have only one load connection type in an MA may require further partitioning of an MA into smaller MAs which do not typically have telemetered measurements at their boundaries. Consider for illustration an MA initially having Y -connected loads and one 4connected load which is fed through an open-Y /open-4 transformer. As
85
Chapter 4
Single-phase modeling
depicted in Fig. 4.3, this MA has to be split into Area 1 which includes the Y loads (not shown) and Area 2 which includes the 4 load. The
Figure 4.3.: 4-connected load fed by an open-Y /open-4 transformer estimation problem in this case is extended by four additional variables, representing the estimated real and reactive power flow at the boundary between Area 1 and Area 2. The real and reactive power balance for Area 2 (analogous to equations (4.3) and (4.4)) is therefore given by:
(i)
(i)
(i)
LG LG (i) LG Pa(i) + Pb = KPab Pab + KPbc Pbc + KPca Pca + P LOSS (i)
(4.8)
(i)
(i)
(i)
LG LG (i) LG (i) Q(i) a + Qb = KQab Qab + KQbc Qbc + KQca Qca + QLOSS
(4.9) Equations (4.8) and (4.9) are not sufficient for load estimation because the estimated values of the real/reactive power (on the left hand side
86
4.2 Load Estimation with 4-connections of (4.8) and (4.9)) do not correspond to any real time measurement at the boundary between the areas. These estimated values of power are therefore expressed by a first-order approximation around the load flow value:
Pa(i) = PaLF (i−1) +
∂Pa ∂KPab
(i−1)
(i)
(i−1)
(KPab − KPab
)
∂Pa (i−1) (i) (i−1) + (KPbc − KPbc ) ∂KPbc ∂Pa (i−1) (i) (i−1) (KPca − KPca ) + ∂KPca
(i) Pb
=
LF (i−1) Pb
∂Pb + ∂KPab
(i−1)
(4.10)
(i)
(i−1)
(KPab − KPab
)
∂Pb (i−1) (i) (i−1) + (KPbc − KPbc ) ∂KPbc ∂Pb (i−1) (i) (i−1) + (KPca − KPca ) ∂KPca
LF (i−1) Q(i) + a = Qa
∂Qa ∂KQbc
(i−1)
∂Qa + ∂KQca
(i−1)
+
(i)
(i−1)
(i)
∂Qb + ∂KQca
(i−1)
(i−1)
(KQab − KQab (i−1)
) (4.12)
)
(i−1) (KQ(i) ) ca − KQca
(i−1)
(i)
+
∂Qb ∂KQbc
+
∂Qa ∂KQab
(KQbc − KQbc
LF (i−1)
Qb = Qb
(4.11)
∂Qb ∂KQab (i)
(i−1)
(i)
(i−1)
(KQab − KQab (i−1)
(KQbc − KQbc
)
) (4.13)
(i−1) (KQ(i) ) ca − KQca
87
Chapter 4
Single-phase modeling
The partial derivatives in (4.10)-(4.13), representing the sensitivity of the real and reactive power at the boundary between the areas to the load group scaling factors can be obtained numerically; details are given in the sec. 4.4. The above approach ((4.8)-(4.13)) can be extended to handling any number of 4-connected equipment and load groups. In general, after the MAs are further partitioned based on their connectivity type, the following equations for MAs with 4 connections are included in addition to those for MAs with Y connections ((4.1)-(4.7)):
P
(i)
P
φ∈P HY n∈IM (m)
Pφ,n =
P
(i)
P
ρ∈P H∆ k∈LG(m)
(i)
LG + P LOSS KPρ,k Pρ,k M A(m)
m = MY + 1, . . . , MY + M∆ (4.14)
P
(i)
P
φ∈P HY n∈IM (m)
Qφ,n =
P
(i)
P
ρ∈P H∆ k∈LG(m)
(i)
KQρ,k QLG ρ,k + QLOSSM A(m)
m = MY + 1, . . . , MY + M∆ (4.15)
(i)
LF (i−1)
Pφ,n = Pφ,n
+
P
P
ρ∈P H∆ k∈LG(m)
h
i ∂Pφ,n (i−1) (i) (KPρ,k ∂KPρ,k
(i−1)
− KPρ,k
)
m = MY + 1, . . . , MY + M∆ , n ∈ IM (m), , φ ∈ P HY (4.16)
(i)
LF (i−1)
Qφ,n = Qφ,n
+
P
P
ρ∈P H∆ k∈LG(m)
h
i ∂Qφ,n (i−1) (i) (KQρ,k ∂KQρ,k
(i−1)
− KQρ,k )
m = MY + 1, . . . , MY + M∆ , n ∈ IM (m), , φ ∈ P HY (4.17)
(i)
(i)
min ≤ KP max min max KPρ,k ρ,k ≤ KPρ,k , KQρ,k ≤ KQρ,k ≤ KQρ,k k ∈ LG(m), m = MY + 1, . . . , MY + M∆ , ρ ∈ P H∆
88
(4.18)
4.2 Load Estimation with 4-connections
4.2.3. Consideration of Measurement Area Losses as Variables The power balance equations, given by (4.3) and (4.4) for Y-connection areas and (4.14) and (4.15) for 4-connection areas, include an estimate of the losses per area. Similar to the development of (4.10)-(4.13), this loss estimate can be also expressed as a first-order approximation around the loss value obtained from the load flow. For Y -connection areas the loss estimate is expressed on a per-phase basis as shown in (4.19) and (4.20), whereas for the 4-connection areas it is given by (4.21) and (4.22) for all phases taken together:
LF (i−1)
(i)
P LOSSφ,M A(m) = P LOSSφ,M A(m) "
+
X n∈LG(m)
∂P LOSSφ,M A(m) ∂KPφ,n
#(i−1) (i)
(i−1)
(4.19)
(i)
(i−1)
(4.20)
(KPφ,n − KPφ,n )
m = 1, . . . , MY , φ ∈ P HY
LF (i−1)
(i)
QLOSSφ,M A(m) = QLOSSφ,M A(m) "
+
X n∈LG(m)
∂QLOSSφ,M A(m) ∂KQφ,n
#(i−1)
(KQφ,n − KQφ,n )
m = 1, . . . , MY , φ ∈ P HY
LF (i−1)
(i)
P LOSSM A(m) = P LOSSM A(m) "
+
X
X
ρ∈P H∆ k∈LG(m)
∂P LOSSM A(m) ∂KPρ,k
#(i−1) (i)
(i−1)
(KPρ,k − KPρ,k
)
m = MY + 1, . . . , MY + M∆ (4.21)
89
Chapter 4
Single-phase modeling
LF (i−1)
(i)
QLOSSM A(m) = QLOSSM A(m) "
+
X
X
ρ∈P H∆ k∈LG(m)
∂QLOSSM A(m) ∂KQρ,k
#(i−1) (i)
(i−1)
(KQρ,k − KQρ,k )
m = MY + 1, . . . , MY + M∆ (4.22) The sensitivity factors in (4.19)-(4.22) are also estimated numerically using the load flow. Numerical experience shows that it is sufficient to compute them at the initialization phase and hold them constant throughout the iterations. In practice, holding the sensitivity factors constant results in more iterations, but with reduced computations per iteration. The solutions are virtually identical given that the same mismatch equations are used to check for convergence.
4.2.4. Handling of Bad Data Bad data in WLS-based state estimation algorithms is commonly handled using normalized residuals [1]. Whilst such an approach is applicable in this case, performance requirements for real time computations would be more easily met if the detection of obviously bad measurements [36] is carried out separately. In DSSE, obviously bad measurements are defined as those which result in load group scaling factors that fall outside reasonable limits. The load group scaling factor limits can be derived from the distribution transformer rating; in practice, the scaled load is nonnegative and should not exceed the short-term rating of the transformer. Consider for example the current magnitude measurement on the branch connecting MA 3 to MA 4 in Fig. 4.1; let the area with the lower/higher index be designated as the FROM/TO area. The worst load scaling factors on the two sides of this current measurement are denoted as KF ROM and KT O , where the worst scaling factor in an area corresponds to the load factor that has the largest absolute deviation from 1 and gives maximum difference in the scaling factors between the two adjacent MAs. To facilitate the detection of obviously bad data, the following Bad Data Factor (BDF) is defined: BDF = |KF ROM − KT O |. The normal range of the BDF can be easily computed from the load scaling factor limits; this range, which is
90
4.2 Load Estimation with 4-connections system specific, is tuned as more experience is gained with the use of the DSSE. BDF values which fall outside the normal range are used to flag bad measurements. For illustration, consider two cases in the system of Fig. 4.1. First, if the measured current magnitude on the branch connecting MA 3 to MA 4 is much larger than its true value, then the iterative solution of the WLS estimator with equality constraints will compute a low or possibly negative worst scaling factor for one MA and a large positive worst scaling factor for the other MA. The negative worst scaling factor indicates that the MA is behaving as a source supplying a large amount of power corresponding to the large current magnitude; the solver clamps the negative scaling factors to zero. The large positive worst scaling factor corresponds to the load group adjusting its level to sink the large power directed towards it (matching to the erroneous large current measurement). The BDF would be larger than the maximum value under normal conditions, thus indicating that this current measurement should be automatically discarded. Second, consider a measured current magnitude which is much smaller than its true value. It will also result in a disparity of worst scaling factors and a large value of the BDF; the MA to which the power (due to this current) is directed will have a low worst scaling factor to match the low current value, while the MA from which the power is supplied will have a high worst load scaling factor to reduce the net power export corresponding to this current.
4.2.5. Summary of the Load Estimation Algorithm The DSSE algorithm is summarized in the following steps: -
Step 0 (Initialization, i = 0): Initialize all the active and reactive load group scaling factors to 1 and run the load flow to calculate the active/reactive measurement area power losses and bus voltage magnitudes.
-
Step 1 : Compute the sensitivity of the active/reactive measurement area losses to the active/reactive load group scaling factors, and the sensitivity of the active/reactive power injections at the boundary of 4-connection areas to the active/reactive load group scaling factors (see 4.23-4.26). Increment the iteration counter i by one.
-
Step 2 : Solve the WLS problem given by (4.1)-(4.7) and
91
Chapter 4
Single-phase modeling (4.14)-(4.22) for all phases at once. Check for obviously bad data measurements. If any is identified, disable the corresponding measurement and repeat the WLS solution. This step gives the updated values of the load group scaling factors at the current iteration.
-
Step 3 : Compute the active/reactive measurement area power losses and bus voltage magnitudes using the load flow with the updated values of the load group scaling factors from Step 2.
-
Step 4: Compute the maximum absolute difference between the loss values and between the bus voltage magnitudes as obtained from the current and previous load flow solutions. If both values are less than a pre-specified tolerance, or if the iteration counter exceeded its maximum allowed value, print the solution and stop. Otherwise, go to Step 1.
4.3. Numerical Results The numerical results are reported on three test system models. The first system is the IEEE 13-node test feeder [37] which is used to demonstrate the accuracy of the proposed DSSE and to compare it with an implementation of the current balancing method in [17]. The second and third systems are employed to demonstrate the solution performance; the third system is a large network representing a typical US distribution utility. The DSSE is implemented in C++ and makes extensive use of shared memory. The weights are set to 100 for measurements, 1 for industrial loads whose pattern of behavior can be well predicted, and 0.01 for other loads. The numerical calculations are carried out using the Intel MKL library.
4.3.1. Load Estimation Accuracy Test Fig. 4.4 displays the schematic of the IEEE 13-node test feeder, whose complete data set including the line configuration and unbalanced load data can be obtained from [37]. Tab. 4.1 includes a summary of the load connection types, and the phases which carry load. The measurement set is summarized in the first four columns of Tab. 4.2 which shows
92
4.3 Numerical Results
Figure 4.4.: IEEE 13-node test feeder with 7 MAs the measurement locations, the phases on which the measurements are taken, the type of the measurement (inferred from its unit), and the corresponding SCADA readings. Columns 5 and 6 of this table report the corresponding estimated value (EST) and percentage deviation error (e) when using the current balancing method [17]; columns 7 and 8 show the same values but from the DSSE, whose real and reactive load scaling factors are given in Tab. 4.3. Node Phase Conn. Node Phase Conn. 632 ABC Y 680 ABC Y 634 ABC Y 652 A Y 645 B Y 692 CA 4 646 BC 4 611 C Y 671 ABC 4 EN ABC Y 675 ABC Y Table 4.1.: Connection type and phases with load in the IEEE-13 test feeder
Note that the percentage deviation error (e) denotes the absolute difference between the true and estimated values, normalized by the true value. It is obvious from Tab. 4.2 and Tab. 4.3 that DSSE adjusts the loads using reasonable scaling factors and produces less error deviations in the estimated values of the measurements as compared to current bal-
93
Chapter 4
Single-phase modeling
MEASUREMENTS REF.[4] DSSE Loc. Ph. Unit SCADA EST. e[%] EST. e[%] T R1 ABC MW 3.66 3.65 0.27 3.67 0.27 T R1 ABC MVAr 2.31 2.28 1.30 2.30 0.43 L2 A A 95.67 127.98 33.77 98.23 2.68 L2 B A 66.44 66.10 0.51 67.90 2.20 L2 C A 70.15 70.19 0.06 70.91 1.08 L3 A A 576.37 533.47 7.44 578.94 0.45 L3 B A 265.25 303.90 14.57 263.55 0.64 L3 C A 547.64 552.44 0.88 545.30 0.43 L5 B A 145.54 139.48 4.16 144.09 1.00 L5 C A 58.94 11.35 80.74 57.77 1.99 L5 B kV 4.15 4.10 1.20 4.11 0.96 L5 C kV 4.15 4.08 1.69 4.09 1.45 L8 A A 280.80 275.38 1.93 286.75 2.12 L8 B A 69.73 69.76 0.04 70.10 0.53 L8 C A 194.79 181.37 6.89 189.89 2.52 L10 A A 25.20 25.36 0.63 25.85 2.58 L10 B A 22.50 25.15 11.78 23.56 4.71 L10 C A 24.87 25.66 3.18 24.23 2.57 L11 A A 54.17 54.55 0.70 53.52 1.20 L11 C A 70.99 71.65 0.93 70.95 0.06 Table 4.2.: SCADA measurements, estimated values, and error deviation using current balancing [4] and DSSE (13-node test feeder)
ancing [17]. Tab. 4.4 shows a comparative summary of the average and maximum error deviations at the base load and with 25% and 50% load increase. These results again show that DSSE produces significantly better values for the average and maximum error deviations even at different operating conditions. In fact, Tab. 4.4 shows that the worst case error deviation for DSSE is 4.71%, whereas for current balancing it is 80.74%. The accuracy of the DSSE was also tested with 3 MAs as shown in Fig. 4.5, and one MA as shown in Fig. 4.6. For each of these cases, including the initial case of Fig. 4.4, the sum of the absolute mismatch between the estimated and true load values was computed and displayed in Tab. 4.5. The results show that load estimation improves when more
94
4.3 Numerical Results P-Scaling Q-Scaling A B C A B C 632 1.00 1.00 1.00 1.00 1.00 1.00 634 1.21 1.09 1.02 0.98 0.99 0.99 645 0.99 1.02 646 0.98 0.99 671 1.01 1.01 1.01 0.99 0.99 0.99 675 1.03 1.09 0.97 1.00 1.07 1.02 680 1.09 1.12 0.96 0.97 1.07 1.00 652 1.00 0.96 692 0.99 0.98 611 1.00 1.10 EN 1.11 0.97 1.11 0.97 0.92 1.02 Table 4.3.: Active and Reactive power load scaling factors using DSSE (13-node test feeder) Node
REF.[4] DSSE Avg. Max. Avg. Max. 0 9.1 80.74 1.47 4.71 25 5.52 30.86 1.30 3.85 50 7.77 76.68 1.37 4.04 Table 4.4.: Average and maximum values of the error deviations in % using current balancing [4] and DSSE (13-node test feeder) Load Increase [%]
MAs are employed.
4.3.2. Bad Data Identification The identification of bad data, as described in sec. 4.2.4, is demonstrated in two tests on the IEEE 13-node feeder with three MAs (Fig. 4.5). The normal BDF value in this system is not expected to exceed 2; this corresponds to a minimum load scaling factor of 0 and a maximum of 2. In the first test, the current magnitude measurement in phase-A of line 11 was increased to 300 A; for comparison, the normal value quoted in Tab. 4.2 is 54.17 A. The DSSE results in Tab. 4.6 show that the worst scaling factor in MA 3 (lower left) for phase A is 5.49; in MA 2 (lower right) the worst scaling factor is 0.21 while in all other areas and phases
95
Chapter 4
Single-phase modeling
Number of MAs Error [pu] 7 0.0804 3 0.1958 1 0.4516 Table 4.5.: Estimated load error versus the number of MAs (13-node test feeder)
Figure 4.5.: IEEE 13-node test feeder with 3 MAs the scaling is around 1. The BDF for L11-A is 5.28, which is larger than the maximum normal value, thus signaling that this measurement is bad. In the second test, the measured current magnitude in phase-A of line 11 is now assumed to be 600 A. In this case, the worst scaling factor KF ROM corresponding to L11-A is negative; it is clamped to zero in the DSSE results in Tab. 4.6. The corresponding BDF value of 9.82 is much larger than the maximum normal value, again indicating the existence of bad data.
4.3.3. Load Estimation Performance Test The performance of the DSSE in terms of computing requirements cannot be properly gauged on the 13-node network model due to its small size. The load estimation test was conducted in a full operational system environment which includes operator workstations and one DMS
96
4.3 Numerical Results
Figure 4.6.: IEEE 13-node test feeder with 1 MA Loc.
Ph.
KF ROM KT O BDF KF ROM KT O BDF T R1 A 1.00 0.91 0.09 1.00 0.91 0.09 T R1 B 1.00 0.98 0.02 1.00 0.98 0.02 T R1 C 1.00 0.98 0.02 1.00 0.98 0.02 L3 A 0.91 0.21 0.70 0.91 0.00 0.91 L3 B 0.98 1.02 0.04 0.98 1.02 0.04 L3 C 0.98 1.02 0.04 0.98 1.02 0.04 L11 A 0.21 5.49 5.28 0.00 9.82 9.82 L11 C 0.98 1.06 0.08 0.98 1.06 0.08 Table 4.6.: Bad data identification in the 13-node test system with 3 MAs
server, consisting of two 4-core processors clocking at 3.6 GHz with 16 GB of RAM and using input data from shared memory in 4 parallel processes. Simulated field data is supplied to the DMS for a processing identical to that in real time operation. A 624-node distribution network model was used to measure the effect of the number of MAs on the computing time of DSSE, first without bad data and then with one bad measurement. The results in Tab. 4.7 show that the performance of DSSE scales well with the number of MAs. Although a realistic large network can in practice be divided into smaller networks where each is independently estimated on its own Distribution Management System (DMS) server, clients may require running
97
Chapter 4
Single-phase modeling
Computing Time Without Bad Data [ms] With Bad Data [ms] 2 81.4 94.2 5 84.5 98.7 10 89.9 107.7 20 98.5 119.3 Table 4.7.: Computing time of DSSE for a 642-node distribution network # MA
DSSE for the network as a whole on one server. To show the capacity of the proposed approach in handling such cases, the load estimation performance test was executed on a large distribution network under simulated real time conditions. A representative network portion of a large US distribution utility was replicated 50 times to simulate the real full size of the utility’s network. Tab. 4.8 shows key numbers characterizing the network which has about 1 million nodes and 3500 feeders. The DSSE for the complete network requires between 375 and 536 s corresponding to key event characteristics in the network; these figures are in compliance with standard performance requirements as specified for DMS control centers. With typical bad data identification, the computing time increases by an average of 15-20%. Equipment Type Number Substations 1500 Transformers (w/LTC) 1500 Transformers (w/o LTC) 1000 Substations Capacitors 1500 Feeders 3450 Feeder Capacitors 15000 Line Voltage Regulators 750 Service Transformers 950000 PQ Measurements 5000 Current Measurements 25000 Table 4.8.: Performance network key numbers
This chapter demonstrated a novel approach for load estimation in ra-
98
4.4 Numerical Sensitivity Factors dial and asymmetrical distribution networks; it is based on the implementation of a distribution system state estimator that combines unbalanced three-phase load flow and WLS estimation over measurement areas. The WLS estimation integrates real time measurements (active/reactive power flow and current magnitude) and load pseudomeasurements (from short-term load forecasting) through weighting factors that account for the accuracy of the available information. Numerical results show that the DSSE produces highly accurate results and complies with the real time computational requirements for DMS control centers. Comparisons with a previous approach employing current balancing also show that DSSE is superior and can effectively handle 4-connected equipment.
4.4. Numerical Sensitivity Factors This section describes a numerical approach to estimate the sensitivity factors in Equations 4.10-4.13. Consider Fig. 4.7 where the voltages on the primary side of the transformer are taken from the load flow computation and treated as constant values; the corresponding values of Pa , Pb , Qa and Qb are denoted by LF. In order to obtain all the sensitivity factors, the procedure below is executed six times, each time slightly changing the real or reactive power of the load value (Sab , Sbc , Sca ) connected between two phases. Consider the case in Fig. 4.7 where the active power of Sca is incremented by a small amount; after this increment, a simple load flow (SLF) is used to compute the new values of Pa , Pb , Qa and Qb (denoted by SLF). The SLF problem includes the two-phase slack bus-bar, the transformer, and the 4-connected load. The sensitivity factors representing the partial derivatives of Pa , Pb , Qa and Qb with respect to KPca can be then estimated as follows:
∂Pa PaSLF − PaLF P SLF − PaLF = Lim ≈ a ∂KPca ∆KPca →0 ∆KPca ∆KPca
(4.23)
∂Pb PbSLF − PbLF P SLF − PbLF = Lim ≈ b ∂KPca ∆KPca →0 ∆KPca ∆KPca
(4.24)
99
Chapter 4
Single-phase modeling
QSLF − QLF QSLF − QLF ∂Qa a a a = Lim ≈ a ∂KPca ∆KPca →0 ∆KPca ∆KPca
(4.25)
∂Qb QSLF QSLF − QLF − QLF b b b = Lim ≈ b ∂KPca ∆KPca →0 ∆KPca ∆KPca
(4.26)
The above procedure is repeated for separate incremental changes in KQca , KPab , KQab , KPbc , and KQbc . Slightly more accurate results for the sensitivity factors can be obtained if the Thévenin equivalent (Fig. 4.8) of the network is fully employed in the SLF computations.
Figure 4.7.: SLF problem for a 4-connected load fed by an openY /open-4 transformer
Figure 4.8.: Consideration of the Thévenin equivalent in the SLF problem
100
5. Multiphase modeling 5.1. Multiphase branch π equivalent Modeling of a multiphase branch element is usually done by approximating it by the π equivalent approach. Magnetic and electric field couplings are done given as phase mutual admittances as shown in Fig. 5.1. Phase information is provided using numbers 0, 1, and 2. Fig. 5.1 shows
Figure 5.1.: Three phase equivalent of power system branch that there is admittance connection between any two phases on nodes p and q. In order to simplify the drawing, the cross node phase coupling elements are shown using four-pole presentation. The four-pole presentation of the cross node coupling elements is shown in Fig. 5.2. In order to eliminate complexity of diagrams, all multiphase elements are drawn using single-line diagram. Fig. 5.3 shows the π equivalent of a multiphase network element. If the element is three phase, then all matrices have dimension 3 × 3. In general, for n-phase elements, corresponding matrices have n × n dimension.
101
Chapter 5
Multiphase modeling
Figure 5.2.: Cross-node cross-phase admittances
Figure 5.3.: π equivalent of an n × n multiphase element The corresponding Kirchoff’s equations are "
#
"
Ip Y s + Y gp −Y s = Iq −Y s Y s + Y gq
#"
Vp Vq
#
(5.1)
or "
#
"
Y pp Y pq Ip = Iq Y qp Y qq
#"
Vp Vq
#
(5.2)
In most cases number of phases of node p and node q is equal. However, for some transformer connections (Open Wye-Open Delta, mid tap, etc) number of phases of node p and node q is not equal. Fig. 5.4 shows OYOD transformer where number of phases on p and q nodes are not equal. In general, π equivalent has four sub-matrices with different sizes:
Ip
Y pp
|{z} |{z} nϕp ×1 nϕp ×nϕp I = Y qp q |{z} |{z} nϕq ×1
102
nϕq ×nϕp
Y pq
Vp
|{z} |{z}
nϕp ×nϕq nϕp ×1 V Y qq q |{z} |{z}
nϕq ×nϕq
nϕq ×1
(5.3)
5.1 Multiphase branch π equivalent
Figure 5.4.: Open-Wye Open-Delta transformer
5.1.1. Active and reactive power in multiphase branch element Complex powers on nodes p and q have same directions with their corresponding electrical currents and can be calculated as "
#
∗
diag(V p ) I p S pq ∗ = S qp diag(V q ) I q
(5.4)
Complex power on side p is
S pq = diag(V p ) Y pp V p + Y pq V q
∗
(5.5)
and complex power through phase k is calculated as1
nϕp −1
nϕq −1
X
X
(k) S (k) pq = v p
l=0
v (l) y (k,l) p + pp
∗ ∀k ∈ {0, .., n − 1} v (l) y (k,l) q pq
l=0
(5.6) After applying Euler’s transformations (l)
(l) jδp v (l) p = vp e 1
(5.7)
Number of phases on node p and node q can be different (e.g. open Wye - open Delta transformers).
103
Chapter 5
Multiphase modeling
(k)
(k) jδp v (k) p = vp e
(5.8)
(k)
(k) jδq v (k) q = vq e
(5.9)
(k,l)
(k,l) jθpp = ypp e y (k,l) pp
(5.10)
(k,l)
(k,l) jθpq y (k,l) = ypq e pq
(5.11)
complex power at node p and phase k becomes: nϕp −1
X
S (k) pq =
l=0 nϕq −1
X
(k)
(l)
(k,l)
(k,l) j δp −δp −θpp vp(k) vp(l) ypp e
(k)
(k,l)
(l)
(k,l) j δp −δq −θpq vp(k) vq(l) ypq e
+ (5.12)
l=0
Active and reactive powers entering terminal p of phase k at n-phase element is calculated then as nϕp −1 (k) Ppq =
X
(k,l) (k,l) vp(k) vp(l) ypp cos δp(k) − δp(l) − θpp +
l=0 nϕq −1
X
(5.13) (k,l) vp(k) vq(l) ypq cos
δp(k)
−
δq(l)
−
(k,l) θpq
l=0
nϕp −1
Q(k) pq
=
X
(k,l) (k,l) vp(k) vp(l) ypp sin δp(k) − δp(l) − θpp +
l=0 nϕq −1
X l=0
104
(5.14) (k,l) (k,l) vp(k) vq(l) ypq sin δp(k) − δq(l) − θpq
5.1 Multiphase branch π equivalent
5.1.2. Active and reactive branch power sensitivity 5.1.2.1.
∂Pp ∂vp
∂Pp ∂δp
and
Derivations of active power at node p with respect to phase voltage magnitudes and node p are (k 6= l) (l)
∂Ppq
(k)
∂vp
(l,k) (l,k) |k6=l = vp(l) ypp cos δp(l) − δp(k) − θpp
(5.15)
and for the case when (k = l) nϕp −1
(l)
∂Ppq
(l)
∂vp
X
=
(l,k) (l,k) vp(k) ypp cos δp(l) − δp(k) − θpp +
k=0,k6=l nϕq −1
X
+
(l,k) (l,k) vq(k) ypq cos δp(l) − δq(k) − θpq +
(5.16)
k=0
(l,l) (l,l) + 2vp(l) ypp cos θpp
Equation (5.16) can be rewritten as nϕp −1
(l)
∂Ppq
(l)
=
∂vp
X
(l,k) (l,k) vp(k) ypp cos δp(l) − δp(k) − θpp +
k=0 nϕq −1
X
+
(l,k) (l,k) cos δp(l) − δq(k) − θpq + vq(k) ypq
(5.17)
k=0
(l,l) (l,l) + vp(l) ypp cos θpp
which can be further simplified to (l)
∂Ppq
(l)
∂vp
(l)
=
Ppq
(l)
vp
(l,l) (l,l) + vp(l) ypp cos θpp
(5.18)
Derivations of active power at branch pq entering its terminal at p node side with respect to phase voltage angles and node p are (k 6= il) (l)
∂Ppq
(k)
∂δp
(l,k) (l,k) sin δp(l) − δp(k) − θpp |k6=i = vp(l) vp(k) ypp
(5.19)
105
Chapter 5
Multiphase modeling
and when (k = l)
(l)
(l)
= −
∂Ppq ∂δp
nϕp −1
X
(l,k) (l,k) vp(l) vp(k) ypp sin δp(l) − δp(k) − θpp
k=0,k6=i
nϕq −1
X
+
(l,k) (l,k) vp(l) vq(k) ypq sin δp(l) − δq(k) − θpq
k=0
nϕp −1
X
= −
(l,k) (l,k) vp(l) vp(k) ypp sin δp(l) − δp(k) − θpp
(5.20)
k=0 nϕq −1
X
+
(l,k) (l,k) vp(l) vq(k) ypq sin δp(l) − δq(k) − θpq
k=0
+
vp(l)
2
(l,l) ypp sin
(l,l) θpp
This can be further simplified to (l)
∂Ppq
(l)
∂δp
5.1.2.2.
∂Pp ∂vq
(l) = − Q(l) pq + vp
and
2
(l,l) (l,l) ypp sin θpp
(5.21)
∂Pp ∂δq
Derivations of active power at node p with respect to phase voltage magnitudes and node q are
(l)
∂Ppq
(k)
∂vq
(l,k) (l,k) = vp(l) ypq cos δp(l) − δq(k) − θpq , ∀k
(5.22)
Derivations of active power at node p with respect to phase voltage angles and node q are
(l)
∂Ppq
(k)
∂δq
106
(l,k) (l,k) sin δp(l) − δq(k) − θpq , ∀k = vp(l) vq(k) ypq
(5.23)
5.1 Multiphase branch π equivalent 5.1.2.3.
∂Qp ∂vp
and
∂Qp ∂δp
Derivations of reactive power at node p with respect to phase voltage magnitudes and node p are (k 6= l) (l)
∂Qpq
(k)
∂vp
(l,k) (l,k) |k6=l = vp(l) ypp sin δp(l) − δp(k) − θpp
(5.24)
and for (k = i) nϕp −1
(l)
∂Qpq (l)
∂vp
X
=
(l,k) (l,k) vp(k) ypp sin δp(l) − δp(k) − θpp +
k=0,k6=l nϕq −1
X
+
(l,k) (l,k) vq(k) ypq sin δp(l) − δq(k) − θpq −
(5.25)
k=0
(l,l) (l,l) − 2vp(l) ypp sin θpp
Equation (5.25) can be rewrite as nϕp −1
(l)
∂Qpq (l)
=
∂vp
X
(l,k) (l,k) vp(k) ypp sin δp(l) − δp(k) − θpp +
k=0 nϕq −1
X
+
(l,k) (l,k) vq(k) ypq sin δp(l) − δq(k) − θpq −
(5.26)
k=0
(l,l) (l,l) − vp(l) ypp sin θpp
which can be further simplified to (l)
∂Qpq (l)
∂vp
(l)
=
Qpq (l)
vp
(l,l) (l,l) − vp(l) ypp sin θpp
(5.27)
Derivations of reactive power at node p with respect to phase voltage angles and node p are (k 6= l) (l)
∂Qpq
(k)
∂δp
(l,k) (l,k) cos δp(l) − δp(k) − θpp |k6=l = −vp(l) vp(k) ypp
(5.28)
107
Chapter 5
Multiphase modeling
and for (k = l)
nϕp −1
(l)
∂Qpq (l)
=
∂δp
X
(l,k) (l,k) vp(l) vp(k) ypp cos δp(l) − δp(k) − θpp +
k=0,k6=l nϕq −1
+
=
X
(l,k) (l,k) vp(l) vq(k) ypq cos δp(l) − δq(k) − θpq
k=0 nϕp −1 X (l,k) (l,k) vp(l) vp(k) ypp cos δp(l) − δp(k) − θpp + k=0 nϕq −1 X (l,k) (l,k) + vp(l) vq(k) ypq cos δp(l) − δq(k) − θpq k=0 2 (l,l) (l,l) cos θpp − vp(l) ypp
(5.29)
which can be further simplified to (l)
∂Qpq (l)
∂δp
5.1.2.4.
∂Qp ∂vq
(l) = P (l) pq − vp
and
2
(l,l) (l,l) ypp cos θpp
(5.30)
∂Qp ∂δq
Derivations of reactive power at node p with respect to phase voltage magnitudes and node q are
(l)
∂Qpq
(k)
∂vq
(l,k) (l,k) = vp(l) ypq sin δp(l) − δq(k) − θpq , ∀k
(5.31)
Derivations of reactive power at node p with respect to phase voltage angles and node q are
(l)
∂Qpq
(k)
∂δq
108
(l,k) (l,k) cos δp(l) − δq(k) − θpq , ∀k = −vp(l) vq(k) ypq
(5.32)
5.1 Multiphase branch π equivalent
5.1.3. Shunt equivalent Figure shows three phase shunt connected to node p.
Figure 5.5.: Three phase shunt Active and reactive power entering shunt connected to node p and through phase k is: (k)
nϕ X
(k)
l=1 nϕ X
Pshp = Qshp =
vp(k) vp(l) yshp cos δp(k) − δp(l) − θshp
(k,l)
(k,l)
(5.33)
(k,l)
(k,l)
(5.34)
vp(k) vp(l) yshp sin δp(k) − δp(l) − θshp
l=1
5.1.4. Three phase transformers with OLTC 5.1.4.1. OLTC on Wye side Fig. 5.6 shows PI equivalent of a transformer containing OLTC on its Wye side. Active and reactive powers are not affected by ideal transformers. Assuming that number of phases at p and q side are equal, active power
109
Chapter 5
Multiphase modeling
Figure 5.6.: π equivalent of a three phase transformer with OLTC on Y-side entering node p at phase l is (l) Ppq
=
(l) Pp 0 q
=
nϕp −1 h
X
(l) (k)
(l)
(k)
(l,k) (l,k) vp0 vp0 ypp cos δp0 − δp0 − θpp +
k=0 (l)
(l)
(l)
(l,k) (l,k) +vp0 vq(k) ypq cos δp0 − δq(k) − θpq
Q(l) pq
=
(l) Qp0 q
=
nϕp −1 h
X
(l) (k)
(k)
i
(l,k) (l,k) vp0 vp0 ypp sin δp0 − δp0 − θpp +
k=0 (l)
(l)
(l,k) (l,k) +vp0 vq(k) ypq sin δp0 − δq(k) − θpq
i
(5.35) Voltages at side p and p’ of phase k are defined as (k)
(k) v (k) p = tpq v p0
(5.36) (k)
After splitting real ans imaginary part by using (5.7)-(5.11) and tpq = (k) tpq ej0 , we obtain (k)
vp(k) = t(k) pq vp0
(5.37)
and (k)
δp(k) = δp0
110
(5.38)
5.1 Multiphase branch π equivalent Considering (5.37) and (5.38) then equations (5.35) can be written as
=
(l) Pp 0 q
Q(l) pq =
(l) Qp0 q
(l) Ppq
=
=
nϕp −1 " (k) (l) X vp vp (l) (k) (l,k) (l,k) y cos δ − δ − θ + pp p0 p0 (l) (k) pp tpq tpq k=0 (l) vp0 (k) (l,k) (l) (l,k) + (l) vq ypq cos δp0 − δq(k) − θpq tpq nϕp −1 " (k) (l) X vp vp (l) (k) (l,k) (l,k) y sin δ − δ − θ + 0 0 pp pp p p (l) (k) tpq tpq k=0 (l) vp0 (k) (l,k) (l) (l,k) + (l) vq ypq sin δp0 − δq(k) − θpq tpq
(5.39)
5.1.4.2. OLTC on Delta side Fig. 5.7 shows PI equivalent of a transformer containing OLTC on its Delta winding’s side.
Figure 5.7.: π equivalent of a three phase transformer with OLTC on Delta-side
Active and reactive powers at node p is calculated using (5.35).
111
Chapter 5
Multiphase modeling
Voltage and transformer’s phase relation at node p for any two phase k and l is
(k)
(l)
(l) (k,l) v (k) v p0 − v p0 p − v p = tpq
(5.40) (k)
Similarly, after separating real and imaginary parts, considering δp = (k) δp0 we obtain
h
(k)
(l)
vp(k) cos δp(k) −vp(l) cos δp(l) = t(k,l) vp0 cos δp(k) − vp0 cos δp(l) pq
i
(5.41) and
h
(k)
(l)
vp(k) sin δp(k) −vp(l) sin δp(l) = t(k,l) vp0 sin δp(k) − vp0 sin δp(l) pq
i
(5.42)
5.1.5. Branch Measurements 5.1.5.1. Single-phase P and Q branch measurements Fig. 5.8 shows a typical wiring for watt-meter placement on a high voltage branch on terminal p. If active power entering terminal p of branch (k) pq and its phase k is denoted with Ppq then the corresponding active (k) power measurement value is represented with P˜pq . Three phase state (k) estimation should calculate value of Ppq with minimum deviation to (k) P˜pq . Total number of single phase active power branch measurements is given by NPB value. Similar configuration applies also to reactive power meter. Number of single phase reactive power branch measurements is given by NQB value. 5.1.5.2. Cumulative P and Q branch measurements For a three-phase system, a single-phase watt-meter can be connected in each phase and thus we can measure total or cumulative power through a branch. Using this three watt-meter configuration, the total real power can be obtained by adding the three watt-meter readings BC (0) (1) (2) P˜pq = P˜pq + P˜pq + P˜pq
112
5.1 Multiphase branch π equivalent
Figure 5.8.: Watt meter connection on a phase using current and potential transformers In such configurations, it is possible to search for minimum deviation for all three separate measurements as it is explained in sec. 5.1.5.1. However, it is more effective to use two watt-meters for measuring threephase power. This two watt-meter configuration is shown in Fig. 5.9. .
Figure 5.9.: Measuring total active power entering terminal p using two watt-meters Using configuration as shown in Fig. 5.9 it can be seen that total (cumulative) active power of branch pq entering terminal p is given as BC W1 W2 P˜pq = P˜pq + P˜pq
(5.43)
Having cumulative active power measurement for all three phases, it is not possible to search for minimum deviation per phase. Instead, three BC to phase state estimation needs to search minimum deviation of P˜pq BC (0) (1) (2) Ppq = Ppq + Ppq + Ppq
(5.44)
113
Chapter 5
Multiphase modeling
in general for nϕ-phase branch we can write BC Ppq =
nϕ X
(ϕ) Ppq
(5.45)
ϕ=0
Same approach can be applied to handle cumulative reactive power measurements. 5.1.5.3. Phase multi-branch power measurements Measurements are typically connected on switching equipment of substation. In most cases, a measurement can be mapped to outgoing branch. In distribution networks, however, there are situations when more than one branch is connected to the switching equipment. Fig. 5.10 shows one such a case.
Figure 5.10.: Single-phase multi-branch power measurement Handling of single-phase branch power measurements requires adding additional state variables and equations: (k)
Pmbp =
X
(k)
(5.46)
(k)
(5.47)
Ppj
j∈Ωb (p) (k)
Qmbp =
X
Qpj
j∈Ωb (p) (k)
(k)
Three phase state estimation algorithm has to calculate Pmbp and Qmbp values (k) ˜ (k) values, respectively. with minimum deviation to P˜ and Q mbp
114
mbp
5.1 Multiphase branch π equivalent 5.1.5.4. Cumulative multi-branch power measurements Measurements are typically connected on switching equipment of substation. In most cases, a measurement can be mapped to outgoing branch. In distribution networks, however, there are situations when more than one branch is connected to the switching equipment. Fig. 5.11 shows one such a case.
Figure 5.11.: Cumulative multi-branch power measurement
Handling of cumulative branch power measurements requires adding additional state variables and equations:
Pcmbp =
¯ pj,p)−1 X dim(X j∈Ωb (p)
Qcmbp =
(5.48)
(ϕ)
(5.49)
ϕ=0
¯ pj,p)−1 X dim(X j∈Ωb (p)
(ϕ)
Ppj
Qpj
ϕ=0
Three phase state estimation algorithm has to calculate Pcmbp and ˜ cmb values, reQcmbp values with minimum deviation to P˜cmbp and Q p spectively.
5.1.5.5. Single phase current magnitude measurements Typical branch current magnitude measurement configuration using current transformer is shown in Fig. 5.12.
115
Chapter 5
Multiphase modeling
Figure 5.12.: Current magnitude measurement Current magnitude entering node p through phase k is calculated as (k) Ipq
=
1 (k) vp
r
(k) 2
Ppq
(k) 2
+ Qpq
(5.50) (k)
Three phase state estimation should calculate Ipq using (5.50) with (k) minimum deviation to measured I˜pq . 5.1.5.6. Phase multi-branch current measurements Similar to cumulative branch power measurements, as explained in sec. 5.1.5.4, current magnitude measurements can be placed on a switch connected to several outgoing branches. shows one such situation.
Figure 5.13.: Multi-branch current magnitude measurement Handling of cumulative branch current magnitude measurements re-
116
5.1 Multiphase branch π equivalent quires adding additional state variables and equations: (k) Imbp
=
v 1 u u X
(k)
vp
t
(k) 2
Ppj
(k) 2
+ Qpj
(5.51)
j∈Ωb (p)
Three phase state estimation algorithm has to calculate Imbp value with minimum deviation to I˜mbp .
5.1.6. Node Measurements 5.1.6.1. Phase-to-ground voltage magnitude measurements Fig. 5.14 shows phase-to-ground voltage magnitude measurement on phase (2).
Figure 5.14.: Phase-to-ground voltage magnitude measurement (k)
State variable vp is to be calculated with minimum deviation to phase(k) to-ground voltage magnitude measurement v˜p . 5.1.6.2. Phase-to-phase voltage magnitude measurements Fig. 5.15 shows phase-to-phase voltage magnitude measurement on bus p between phases (1) and (2). Phase-to-phase voltage on bus p between phases (k) and (l) is calculated as (l) v (k,l) = v (k) p p − vp
(5.52)
117
Chapter 5
Multiphase modeling
Figure 5.15.: Phase-to-phase voltage magnitude measurement after separating real and imaginary part
(5.53)
(5.54)
vp(k,l) cos δp(k,l) = vp(k) cos δp(k) − vp(l) cos δp(l) vp(k,l) sin δp(k,l) = vp(k) sin δp(k) − vp(l) sin δp(l) After adding squares of (5.53) and (5.54) vp(k,l)
=
r
(k)
(k)
(l) 2
(l)
(k)
(k)
(l)
(l) 2
+ vp sin δp − vp sin δp
vp cos δp − vp cos δp
(5.55) After squaring and applying cos(x − y) = cos x cos y + sin x sin y
(5.56)
we obtain r
vp(k,l)
=
(k) 2
vp
(l) 2
+ vp
(k) (l)
(k)
(l)
− 2vp vp cos δp − δp
(k,l)
(5.57)
Value vp as given by (5.55) is to be calculated with minimum devia(k,l) tion to phase-to-phase voltage magnitude measurement v˜p .
5.1.6.3. Tap changer measurements Handling of these measurements is explained in sec. 5.1.4.
118
5.1 Multiphase branch π equivalent
5.1.7. Injection Measurements 5.1.7.1. Single phase power injection measurements (Yg) If injections are measured per phase, no additional steps are required since active and reactive powers are treated as state variables. If injected active and reactive power measurement at node i and phase k (k) ˜ (k) then the corresponding state variables P (k) are given by P˜inji and Q inji inji (k) (k) (k) ˜ ˜ and Q are to be calculated with minimum to P and Q . inji
inji
inji
5.1.7.2. Cumulative power injection measurements Handling cumulative injections requires adding additional equations: Pcinjp = Qcinjp =
nϕ X k=1 nϕ X
Pp(k)
(5.58)
Q(k) p
(5.59)
k=1
Values Pcinjp and Qcinjp should be calculated with minimum deviation ˜ cinjp . to the corresponding measurements P˜cinjp and Q 5.1.7.3. Two-phase delta power injection measurements Fig. 5.16 shows phase-to-phase injection measurements on bus p between phases (k) and (l).
Figure 5.16.: Two-phase delta injection
119
Chapter 5
Multiphase modeling
For the circuit shown in Fig. 5.16 we can write (l,k) −I (k,l) injp − I injp = 0
(5.60)
After placing injection powers
I (k,l) = p
(k)
∗
(k)
(l)
∗
S injp vp
and
I (l,k) p
=
S injp (l)
vp
we obtain:
−
(k)
∗
(k)
Pinjp + jQinjp
−
(k)
vp
(l)
(l)
Pinjp + jQinjp (l)
vp
∗ =0
(5.61)
In order to remove denominators we have to multiply equation (5.61) (k) ∗ (l) ∗ with − v p v p . This yields
(k)
(k)
Pinjp − jQinjp
v (l) p
∗
(l)
(l)
+ Pinjp − jQinjp
v (k) p
∗
=0
(5.62)
or after expanding complex voltages:
(k)
(k)
(l)
(l)
Pinjp − jQinjp vp(l) cos δp(l) − j sin δp(l) +
(5.63)
Pinjp − jQinjp vp(k) cos δp(k) − j sin δp(k) = 0
Real part of (5.63) is
(l)
(l)
(k)
(k)
vp(k) Pinjp cos δp(k) −Qinjp sin δp(k) +vp(l) Pinjp cos δp(l) −Qinjp sin δp(l) =0 (5.64) Imaginary part of (5.63) is
(l)
(l)
(k)
(k)
vp(k) Pinjp sin δp(k) +Qinjp cos δp(k) +vp(l) Pinjp sin δp(l) +Qinjp cos δp(l) =0 (5.65)
120
5.1 Multiphase branch π equivalent Additionally we can write (k)
(l)
(k,l)
(5.66)
(l)
(k,l)
(5.67)
Pinjp + Pinjp − P4p = 0 (k)
Qinjp + Qinjp − Q4p = 0 (kl)
(kl)
Three phase state estimation has to calculate P4p and Q4p with mini(kl) ˜ (kl) , respectively. Additionally, equations mum deviation to P˜ and Q 4p
4p
(5.64), (5.65), (5.66), and (5.67) have to be satisfied. Approach described by equations (5.64)-(5.67) introduces four additional unknowns and four equations. An alternative approach, that does not introduce additional unknowns, can be also implemented: P4p + jQ4p
=
(k)
(l)
vp − vp
=
!∗
(k,l)
(k,l)
(l,k) I injp
(k,l)
(k,l)
h
(k)
P4p −jQ4p
vp
(k)
vp
2
(k)
(k)
cos δp +j sin δp
(l)
+ vp
2
(l)
−vp
(k) (l)
(l)
(l)
cos δp +j sin δp (l)
(k)
−2vp vp cos δp −δp
i (5.68)
After multiplying and grouping real and imaginary part (k,l)
(l,k)
I injp =
P4p
(k,l)
+j
P4p
(k)
vp
2
2
(k)
vp
2
(l)
+ vp
(k,l)
+Q4p
(k) (l)
2
(k,l)
−Q4p
(l)
(l)
(k)
(k)
vp sin δp −vp sin δp (k)
(l)
−2vp vp cos δp −δp (l)
(l)
(k)
(k)
(l)
+ vp
vp sin δp −vp sin δp
(l,k)
(l)
(l)
(k)
(k)
vp cos δp −vp cos δp
(l)
(l)
(k)
(k)
vp cos δp −vp cos δp
(k) (l)
(k)
(l)
−2vp vp cos δp −δp
(5.69)
(l,k)
= Iinjrep + jIinjiim
p
Complex injection powers are then calculated as (l,k) ∗
(k)
I injp S injp = − v (k) p (l)
(5.70)
(l,k) ∗
S injp =v (l) I injp p
After applying (5.69) into (5.70)
(k)
S injp = −vp(k) cos δp(k) + j sin δp(k) = −vp(k)
h
(l,k)
(l,k)
(l,k)
Iinjrep cos δp(k) + Iinjimp sin δp(k)
(l,k)
(l,k)
Iinjrep − jIinjimp (l,k)
+j Iinjrep sin δp(k) − Iinjimp cos δp(k)
(5.71) i
121
Chapter 5
Multiphase modeling
and
(l)
S injp = vp(l) cos δp(l) + j sin δp(l) = vp(l)
h
(l,k)
(l,k)
(l,k)
Iinjrep cos δp(l) + Iinjimp sin δp(l)
(l,k)
(l,k)
Iinjrep − jIinjimp (l,k)
+j Iinjrep sin δp(l) − Iinjimp cos δp(l)
(5.72) i
5.1.7.4. Three-phase delta power injection measurements Fig. 5.17 shows three phase Delta injection measurements on bus p.
Figure 5.17.: Three-phase delta injection For the circuit shown in Fig. 5.17 we can write, for each two-phase delta injection, similar equations as those derived in sec. 5.1.7.3. Active and reactive powers through two-phase delta injections are not injection loads.
vp(k) Pp(l,k) cos δp(k) −Q(l,k) sin δp(k) +vp(l) Pp(k,l) cos δp(l) −Q(k,l) sin δp(l) =0 p p (5.73)
vp(k) Pp(l,k) sin δp(k) +Q(l,k) cos δp(k) +vp(l) Pp(k,l) sin δp(l) +Q(k,k) cos δp(l) =0 p p (5.74) Further we can write (k,l)
(5.75)
(k,l)
(5.76)
Pp(k,l) + Pp(l,k) − P4p = 0 Q(k,l) + Q(l,k) − Q4p = 0 p p
122
5.1 Multiphase branch π equivalent and finally (k)
(5.77)
(k)
(5.78)
Pp(k,x) + Pp(k,y) − Pinjp =0 Q(k,x) + Q(k,y) − Qinjp =0 p p where (x, y) = (0, 1, 2) \ (k).
Equations (5.73)-(5.78) have to be satisfied for all possible (k, l) combinations: (k, l) ∈ [(0, 1) , (1, 2) , (2, 0)] (k,l)
(k,l)
Three phase state estimation has to calculate P4p and Q4p with (k,l) ˜ (k,l) , respectively, while satisfying minimum deviation to P˜4p and Q 4p equations(5.73)-(5.78). The approach described by (5.73)-(5.78) introduces 12 additional unknowns and 12 equations. An alternative approach, that does not introduce additional unknowns, can be implemented: 5.1.7.5. Cumulative delta injections Cumulative delta injections are handled on the same way as Wyegrounded injections (see sec. 5.1.7.2).
5.1.8. PV Nodes Fig. 5.18 shows simplified power generator voltage regulation block diagram. The excitation circuit is supplied by DC voltage is vreg = f (vref − vf b ) (0)
= f vref − g
(1)
(2)
vp + vp + vp 3
!!
(5.79)
Since the rectifier circuit is placed in negative feed-back loop, the excitation circuit will, in case of un-symmetry, actually regulate average voltage magnitude on terminals of the generator.Clearly, PV generator cannot regulate separate voltages, but only its average value. (0)
vP Vp =
(1)
(2)
vp + vp + vp 3
(5.80)
123
Chapter 5
Multiphase modeling
Figure 5.18.: Simplified schematic of generator voltage regulation
If generator works in voltage regulation mode then equation (5.80) has to be in the set of equality constraints of three-phase state estimation algorithm. Similarly, the active power set point of PV generator is (0)
PP Vp =
(1)
(2)
Pinjp + P injp + Pinjp 3
(5.81)
If generator works in PV regulation mode and its terminal powers are not measured, then equation (5.81) has to be in set of equality constraints in three-phase state estimation algorithm.
5.1.9. LVC with OLTC OLTC modeling is explained in sec. 5.1.4. In case when all tap changer working synchronously (ganged mode), voltage set point is defined with equiation (5.80). Otherwise, every phase is separately regulated. In any case, after successful solution it is necessary to round calculated tap changer values to the closest possible one, according to the step size.
124
5.2 Three-Phase State Estimation Method
5.2. Three-Phase State Estimation Method 5.2.1. Formulation Three phase state estimation method is defined as an equality constrained non-linear minimization of the goal function J. The system states are estimated from the available measurements. State estimator uses a set of analog measurements such as bus voltage magnitude, real power injections, reactive power injections, active power flow, reactive power flow and line current flows along with the system configuration. The objective is to minimize the sum of the squares of the weighted deviations of the estimated measurements from the actual measurements. These measurements are obtained from SCADA systems through remote terminal unit. The objective function is expressed with the following set of equations:
N QB
PB 2 X 1 NX (k) (k) 2 (k) ˜ (k) J= + wPij Pij − P˜ij wQij Qij − Q ij 2 ij∈Ω ij∈Ω b
+
NX P BC
wpbcij
Pbcij −P˜bcij
2
+
NX QBC
N QI X
(k)
(k)
wP Ii Pinji − P˜inji
2
+
i=1
+
NX P IC
˜ bc wqbcij Qbcij −Q ij
2
(5.83)
ij∈Ωb
ij∈Ωb
+
(5.82)
b
wpici Pcinji −P˜cinji
2
N QI X
(k)
(k)
˜ wQIi Qinji − Q inji
i=1 NX QIC
+
2
(5.84)
˜ cinj wqici Qcinji −Q i
2
i=1
i=1
(5.85) +
N BI X
(k) 2
(k)
wIij Iij − I˜ij
(5.86)
ij∈Ωb
+
NX VG
(k)
wv i v i
(k) 2
− v˜i
+
NX V LL
i=1
+
NX TG ij∈Ωb ,i=1
(k,l)
wvLLi vi
(k,l) 2
− v˜i
(5.87)
i=1
(k)
(k)
wti tij −t˜ij
2
+
NX T LL
(k,l)
(k,l)
wtLLi tij −t˜ij
2
(5.88)
ij∈Ωb ,i=1
125
Chapter 5
Multiphase modeling
such that (k)
(k)
cP B ≡fij (vi , vj , vi0 , vj 0 , δi , δj ) − Pij = 0 ∀ij, k ∈ Ωb
(5.89)
(k) (k) cQB ≡gij (vi , vj , vi0 , vj 0 , δi , δj ) − Qij = 0 X X (k) (k) (k) cP N ≡ Pij − P inji,j + Pshi = j∈Ωinji j∈Ωb (l)
∀ij, k ∈ Ωb
(5.90)
0 ∀i, k ∈ Ωn
(5.91)
X
cQN ≡
(k)
(k) 2
cI ≡ Pij
(k) 2
(k)
=0
+ Qij
(k) (k)
ct ≡tij vi0 − vi (k)
ctrLL ≡vi
Qinji,j + Qshi = 0 ∀i ∈ Ωn
(5.92)
j∈Ωinji
j∈Ωb (l)
(k)
(k)
X
Qij −
(k)
(k) (k) 2
− vi Iij
=0
(5.93) (5.94)
(l)
(l)
(k,l)
(k,l)
cos δi −vi cos δi −tij
(k)
(k)
(l)
(l)
vi0 cos δi −vi0 cos δi
=0 (5.95)
(k)
ctiLL ≡vi
(k)
(l)
(l)
sin δi −vi sin δi −tij
(k)
(k)
(l)
(l)
vi0 sin δi −vi0 sin δi
=0 (5.96)
nϕ X
cPBC ≡PijBC − cQBC ≡QBC ij −
(ϕ)
(5.97)
(ϕ)
(5.98)
Pij = 0
ϕ=0 nϕ X
Qij = 0
ϕ=0
(k) 2
cvLL ≡ vi
(l) 2
+ vi
cPcinj ≡Pcinji − cQcinj ≡Qcinji −
nϕ X ϕ=1 nϕ X
(k,l) 2
− vi
(k) (l)
(k)
(l)
−2vi vi cos δi −δi
=0 (5.99)
(ϕ)
(5.100)
(ϕ)
(5.101)
Pinji = 0 Qinji = 0
ϕ=1
5.2.2. Solution Equations (5.82)-(5.88) form, so called constrained Weighted Least Square State Estimation which can be written in matrix form as minimize
126
J(x) =
1 (x − x ˜)T W (x − x ˜) 2
(5.102)
5.2 Three-Phase State Estimation Method such that c(x) = 0
(5.103)
This problem can be solved by Lagrangian method, where the following Lagrangian is built L(x) = J(x) − λT c(x)
(5.104)
The first order Karush-Kuhn-Tucker optimality conditions are ∂L(x) = 0 =⇒ ∂x ∂L(x) = 0 =⇒ ∂λ where the matrix C =
∂c(x) ∂x
W (x − x ˜) − C T λ = 0
(5.105)
c(x) = 0
(5.106)
is the Jacobian of c(x).
After applying the Newton method, the nonlinear set of equations (5.105)-(5.106) is solved iteratively, where in each iteration the following linearized system is solved: "
W C
CT 0
#(iter) "
4x −λ
#(iter)
"
#(iter−1)
W (x − x ˜) =− c(x)
(5.107)
where iter is iteration number and 4x = x(iter) − x(iter−1) . 5.2.2.1. Vector of unknowns Vector of unknowns x is defined as h
T T x = [vδ]T [P Q]T [P Qinj ]T [P Qcinj ]T I T PBC QTBC vLL v 0T tT tTLL
iT
where • [vδ] is vector of dimension 2(N N 1 + 2 · N N 2 + 3 · N N 3) × 1 and contains phase voltage and angle pairs for every node. Slack node angle is fixed at 0◦ . Phase voltages at PV nodes are also fixed. • [P Q] is vector of dimension 4(N B1 + 2 · N B2 + 3 · N B3) × 1 and contains phase active and reactive power pairs for every both terminals of every branch.
127
Chapter 5
Multiphase modeling
• [P Qinj ] is vector of dimension 2(N IN J1+2·N IN J2+3·N IN J3)× 1 and contains phase active and reactive power pairs for every injection (load or generator). • [P Qcinj ] is vector of dimension 2(N CIN J1 + 2 · N CIN J2 + 3 · N CIN J3) × 1 and contains phase active and reactive power pairs for every cumulative measured injection (load or generator). • [I] is vector of dimension N I × 1 and contains calculated current magnitude for every current magnitude measurement. • [PBC ] is vector of dimension N P BC × 1 and contains calculated cumulative active branch powers. • [QBC ] is vector of dimension N QBC × 1 and contains calculated cumulative reactive branch powers. • [vLL ] is vector of dimension N LL × 1 and contains calculated lineto-line voltage magnitudes at positions where line-to-line voltages are measured. • [v 0 ] is vector of dimension N V 0 ×1 and contains calculated voltage magnitudes at virtual tap changer nodes. • [t] is vector of dimension N T × 1 and contains calculated tap positions for each measured or LVC simulated tap position on star transformer side. • [tLL ] is vector of dimension N T LL × 1 and contains calculated tap positions for each measured or LVC simulated tap position on delta transformer side. 5.2.2.2. Jacobian matrix Jacobian matrix C is very sparse:
C1,1 C 2,1 C3,1 C4,1 C= C 5,1 0 0 C8,1
128
C1,2 C2,2 C3,2 0 0 C6,2 0 0
0 C2,3 0 0 0 0 C7,3 0
0 0 0 0 0 0 C7,4 0
0 0 C3,5 0 0 0 0 0
0 0 0 0 0 C6,6 0 0
0 0 0 0 0 C6,7 0 0
0 0 0 0 0 0 0 C8,8
C1,9 0 0 0 0 0 0 0 0 C4,9 C4,10 0 C5,9 0 C5,11 0 0 0 0 0 0 0 0 0
(5.108)
5.2 Three-Phase State Estimation Method Matrix C1,1 C1,1 is matrix of dimension 2(N N 1 + 2 · N N 2 + 3 · N N 3) × 2(N N 1 + 2 · N N 2 + 3 · N N 3) and contains derivations of equality constraints cP B (5.89) and cQB (5.90) with respect to [vδ] variables: (x)
∂cP B
i
(y)
(x)
=
∂fij (vi , vj , vi0 , vj 0 , δi , δj ) (y)
∂vj
(x)
(x)
∂cP Bi (y)
=
∂fij (vi , vj , vi0 , vj 0 , δi , δj ) (y)
∂δj
(5.110)
∂δj
(x)
∂cQB
(5.109)
∂vi
(x)
i
(y)
=
∂g ij (vi , vj , vi0 , vj 0 , δi , δj ) (y)
∂vj
(x)
∂cQBi (y)
(5.111)
∂vi (x)
=
∂g ij (vi , vj , vi0 , vj 0 , δi , δj ) (y)
∂δj
(5.112)
∂δj
Jacobian terms (5.109)-(5.112) are calculated in sec. 5.1.2 on page 105.
Matrix C1,2 C1,2 is matrix of dimension 2(N N 1 + 2 · N N 2 + 3 · N N 3) × 4(N B1 + 2 · N B2 + 3 · N B3) and contains derivations of equality constraints cP B (5.89) and cQB (5.90) with respect to [P Q] variables:
(x)
∂cP B
i
(y) ∂Ppq (x) ∂cP B i (y) ∂Qpq (x) ∂cQB i (y) ∂Qpq (x) ∂cQB i (y) ∂Qpq
(x)
=
∂Pij
(y) ∂Ppq
(
=
−1 0
∀x, y, ij, pq : x = y ∧ ij = pq ∀x, y, ij, pq : x 6= y ∨ ij 6= pq
(5.113)
=0
(5.114)
=0
(5.115) (x)
=
∂Qij
(y) ∂Qpq
(
=
−1 ∀x, y, ij, pq : x = y ∧ ij = pq 0 ∀x, y, ij, pq : x 6= y ∨ ij 6= pq
(5.116)
129
Chapter 5
Multiphase modeling
Matrix C1,9 C1,9 is matrix of dimension 2(N N 1 + 2 · N N 2 + 3 · N N 3) × N V 0 and contains derivations of equality constraints cP B (5.89) and cQB (5.90) with respect to [v 0 ] variables: (x)
∂cP B
i
(y)
(x)
=−
∂fij (vi , vj , vi0 , vj 0 , δi , δj ) ∂vj 0
(x)
∂cQB
(5.117)
(y)
∂vj 0
(x)
i
(y)
=−
∂g ij (vi , vj , vi0 , vj 0 , δi , δj )
(5.118)
(y)
∂vj 0
∂vj 0
Jacobian terms (5.117)-(5.118) are calculated in sec. 5.1.2 on page 105. Matrix C2,1 C2,1 is matrix of dimension 2(N IN J1 + 2 · N IN J2 + 3 · N IN J3) × 2(N N 1 + 2 · N N 2 + 3 · N N 3) and contains derivations of equality constraints cP N (5.91) and cQN (5.92) with respect to [vδ] variables: (x) Pshi +v (x) cos θ (k,l) (x) (x) i shi,i ∂cP N vi i (x) (x) (y) (x,y) = (y) v cos δ −δ −θ i i i shi,i ∂vj 0 (x) 0
∂cP Ni
(x) (y) = vi vi sin (y) ∂δj
(x) (y) (x,y) δi −δi −θshi,i
∀xy, ij : x=y∧i=j ∀xy, ij : x6=y∧i=j ∀ij : i6=j ∀xy, ij : x=y∧i=j
∀xy, ij : x6=y∧i=j
(x) Qshi −v (x) sin θ (k,l) (x) (x) i shi,i ∂cQN vi i (x) (x) (y) (x,y) = (y) v sin δ −δ −θ i i i shi,i ∂vj 0 (x) 0 (x) (y) = −vi vi cos (y) ∂δj
0
130
(5.120)
∀ij : i6=j
0
∂cQNi
(5.119)
∀xy, ij : x=y∧i=j ∀xy, ij : x6=y∧i=j
(5.121)
∀ij : i6=j
(x) (y) (x,y) δi −δi −θshi,i
∀xy, ij : x=y∧i=j
∀xy, ij : x6=y∧i=j (5.122) ∀ij : i6=j
5.2 Three-Phase State Estimation Method Matrix C2,2 C2,1 is matrix of dimension 2(N IN J1 + 2 · N IN J2 + 3 · N IN J3) × 4(N B1 + 2 · N B2 + 3 · N B3) and contains derivations of equality constraints cP N (5.91) and cQN (5.92) with respect to [P Q] variables: (x)
(x)
∂cP N
i
(y) ∂Ppq (x) ∂cP N i (y) ∂Qpq (x) ∂cQN i (y) ∂Qpq (x) ∂cQN i (y) ∂Qpq
=
∂Pij
(y) ∂Ppq
(
=
1 ∀x, y, ij, pq : x = y ∧ ij = pq 0 ∀x, y, ij, pq : x 6= y ∨ ij 6= pq
(5.123)
=0
(5.124)
=0
(5.125) (x)
=
∂Qij
(y) ∂Qpq
(
=
∀x, y, ij, pq : x = y ∧ ij = pq ∀x, y, ij, pq : x 6= y ∨ ij 6= pq
1 0
(5.126)
Matrix C2,3 C2,3 is matrix of dimension 2(N IN J1 + 2 · N IN J2 + 3 · N IN J3) × 2(N IN J1+2·N IN J2+3·N IN J3) and contains derivations of equality constraints cP N (5.91) and cQN (5.92) with respect to [P Qinj ] variables: (x)
∂cP N
i
(y) ∂Pinjj
(x)
=−
∂Pinji (y) ∂Pinjj
(
=
−1 ∀x, y, i, j : x = y ∧ i = j 0 ∀x, y, i, j : x 6= y ∨ ij 6= pq
(5.127)
(x)
∂cP N
i
(y) ∂Qinjj
=0
(5.128)
=0
(5.129)
(x)
∂cQN
i
(y)
∂P injj (x)
∂cQN
(x)
i
(y) ∂Qinjj
=−
∂Qinji (y) ∂Qinjj
(
=
−1 0
∀x, y, i, j : x = y ∧ ij = pq ∀x, y, i, j : x 6= y ∨ ij 6= pq
(5.130)
131
Chapter 5
Multiphase modeling
Matrix C3,1 C3,1 is matrix of dimension N I × 2(N N 1 + 2 · N N 2 + 3 · N N 3) and contains derivations of equality constraints cI (5.93) with respect to [vδ] variables: (x)
∂cIi,j (y) ∂vp
=
−2v (x) I (x) 2
∀xy, ij, p : x = y ∧ (i = p ∨ j = p)
0
∀ij, p : i 6= p ∧ j 6= p
i
ij
(5.131) (x) ∂cIi,j (y) ∂δp
=0
(5.132)
Matrix C3,2 C3,2 is matrix of dimension N I × 4(N B1 + 2 · N B2 + 3 · N B3) and contains derivations of equality constraints cI (5.93) with respect to [P Q] variables: (x)
∂cIi,j (y) ∂Pp,q
(
=
(x)
∂cIi,j (y) ∂Qp,q
(
=
(x)
2Pi,j 0
(x)
2Qi,j 0
∀xy, ij, pq : x = y ∧ ij = pq ∀ij, pq : ij 6= pq
(5.133)
∀xy, ij, pq : x = y ∧ ij = pq ∀ij, pq : ij 6= pq
(5.134)
Matrix C3,5 C3,5 is matrix of dimension N I ×N I and contains derivations of equality constraints cI (5.93) with respect to [I] variables: (x)
∂cIi,j (y) ∂Ip,q
=
−2 v (x) 2 I (x)
∀xy, ij, pq : x = y ∧ ij = pq
0
∀ij, pq : ij 6= pq
i
i,j
(5.135)
Matrix C4,1 C4,1 is matrix of dimension N T × 2(N N 1 + 2 · N N 2 + 3 · N N 3) and contains derivations of equality constraints cI (5.94) with respect to [vδ]
132
5.2 Three-Phase State Estimation Method variables: (x)
(
∂cti,j
−1 0
=
(y) ∂vp (x) ∂cIi,j (y) ∂δp
∀xy, i, p : x = y ∧ i = p ∀i, p : i 6= p
(5.136)
=0
(5.137)
Matrix C4,9 C4,9 is matrix of dimension N T ×N V 0 and contains derivations of equality constraints cI (5.94) with respect to [v 0 ] variables: (x)
∂cti,j
(y) ∂vp0
( (x)
=
tij 0
∀xy, i, p : x = y ∧ i = p ∀i, p : i 6= p
(5.138)
Matrix C4,10 C4,10 is matrix of dimension N T ×N T and contains derivations of equality constraints cI (5.94) with respect to [t] variables: (x)
∂cti,j
(y) ∂tpq
( (x)
=
vi 0 0
∀xy, ij, pq : x = y ∧ ij = pq ∀ij, pq : ij 6= pq
(5.139)
Matrix C5,1 C5,1 is matrix of dimension 2N T LL × 2(N N 1 + 2 · N N 2 + 3 · N N 3) and contains derivations of equality constraints ctrLL (5.95) and ctiLL (5.96) with respect to [vδ] variables: (x,y) ∂ctrLL ij (k)
=
∂vp
(x,y)
∂ctrLL
ij
(k)
∂δp
=
(x) cos δi
∀xy, k, ij, p : x = k ∧ i = p
(y) − cos δi
∀xy, k, ij, p : y = k ∧ i = p
0 otherwise (x,y) (x) (x) (x) t v − v i sin δi i0 ij (y) vi
0
−
(x,y) (y) tij vi0
(y) sin δi
(5.140)
∀xy, k, ij, p : x=k∧i=p ∀xy, k, ij, p : y=k∧i=p otherwise (5.141)
133
Chapter 5
Multiphase modeling
and
(x,y) ∂ctiLL ij (k)
=
∂vp
(x,y)
∂ctiLL
ij
(k)
=
∂δp
(x) sin δi
(y) − sin δi
∀xy, k, ij, p : x = k ∧ i = p ∀xy, k, ij, p : y = k ∧ i = p
0 otherwise (x) (x,y) (x) (x) v − t v cos δi 0 i ij i
(y) (x,y) vi0 tij
(y) vi
−
(5.142)
∀xy, k, ij, p : x=k∧i=p
(y) cos δi
∀xy, k, ij, p : y=k∧i=p otherwise
0
(5.143) Matrix C5,9 C5,9 is matrix of dimension 2N T LL × N V 0 and contains derivations of equality constraints ctrLL (5.95) and ctiLL (5.96) with respect to [v 0 ] variables: (x,y) ∂ctrLL ij (k)
=
∂vp0
(x,y) (x) −tij cos δi
∀xy, k, ij, p : x = k ∧ i = p
(x,y) (y) t cos δi ij
∀xy, k, ij, p : y = k ∧ i = p otherwise
(x,y) (x) −tij sin δi
∀xy, k, ij, p : x = k ∧ i = p
0
(5.144)
and
(x,y) ∂ctiLL ij (k)
=
∂vp
(x,y) (y) t sin δi ij
0
∀xy, k, ij, p : y = k ∧ i = p otherwise
(5.145)
Matrix C5,11 C5,11 is matrix of dimension 2N T LL × N T LL and contains derivations of equality constraints ctrLL (5.95) and ctiLL (5.96) with respect to [tLL ] variables: (x,y)
∂ctrLL
ij
(k,l)
∂tLLpq
=
(y) − v (x) cos δ (x) − v (y) 0 cos δ
xy = kl ∧ ij = pq
0
otherwise
i
i
i
i
(5.146)
134
5.2 Three-Phase State Estimation Method and
(x,y)
∂ctiLL
ij
(k,l)
∂tLLpq
=
(y) − v (x) sin δ (x) − v (y) 0 sin δ
xy = kl ∧ ij = pq
0
otherwise
i
i
i
i
(5.147)
Matrix C6,2 C6,2 is matrix of dimension (N P BC + N QBC) × 4(N B1 + 2 · N B2 + 3 · N B3) and contains derivations of equality constraints cP BC (5.97) and cQBC (5.98) with respect to [P Q] variables:
∂cP BCij ∂Ppq ∂cP BCij ∂Qpq ∂cQBCij ∂Ppq ∂cQBCij ∂Qpq
(
=
−1 ∀ij, pq : ij = pq ∧ x ∈ Ωb (ij) 0 otherwise
(5.148)
=0
(5.149)
=0
(5.150)
(
=
−1 ∀ij, pq : ij = pq ∧ x ∈ Ωb (ij) 0 otherwise
(5.151)
Matrix C6,6 C6,6 is matrix of dimension (N P BC + N QBC) × N P BC and contains derivations of equality constraints cP BC (5.97) and cQBC (5.98) with respect to [PBC ] variables:
∂cP BCij ∂PBCpq ∂cQBCij ∂P BCpq
(
= =0
1 ∀ij, pq : ij = pq 0 otherwise
(5.152) (5.153)
135
Chapter 5
Multiphase modeling
Matrix C6,7 C6,7 is matrix of dimension (N P BC + N QBC) × N QBC and contains derivations of equality constraints cP BC (5.97) and cQBC (5.98) with respect to [QBC ] variables:
∂cP BCij ∂QBCpq ∂cQBCij ∂QBCpq
=0
(5.154)
(
1 0
=
∀ij, pq : ij = pq otherwise
(5.155)
Matrix C7,2 C7,2 is matrix of dimension 2(N CIN J1 + 2 · N CIN J2 + 3 · N CIN J3) × 2(N IN J1 + 2 · N IN J2 + 3 · N IN J3) and contains derivations of equality constraints cPcinj (5.100) and cQcinj (5.101) with respect to [P Qinj ] variables:
∂cPcinji (x) ∂Pinjp
∂cPcinji (x)
(
=
−1 0
∀i, p : i = p ∧ x ∈ Ωinj (l) otherwise
(5.156)
=0
(5.157)
=0
(5.158)
∂Qinjp ∂cQcinji (x)
∂Pinjp ∂cQcinji (x)
∂Qinjp
(
=
−1 0
∀i, p : i = p ∧ x ∈ Ωinj (l) otherwise
(5.159)
Matrix C7,3 C7,3 is matrix of dimension 2(N CIN J1 + 2 · N CIN J2 + 3 · N CIN J3) × 2(N CIN J1 + 2 · N CIN J2 + 3 · N CIN J3) and contains derivations of equality constraints cPcinj (5.100) and cQcinj (5.101) with respect to [P Qcinj ] variables:
136
5.2 Three-Phase State Estimation Method
(
∂cPcinji ∂Pcinjp ∂cPcinji ∂Qcinjp ∂cQcinji ∂Pcinjp ∂cQcinji ∂Qcinjp
1 0
=
∀i, p : i = p otherwise
(5.160)
=0
(5.161)
=0
(5.162)
(
1 0
=
∀i, p : i = p otherwise
(5.163)
Matrix C8,1 C8,1 is matrix of dimension N V LL × 2(N N 1 + 2 · N N 2 + 3 · N N 3) and contains derivations of equality constraints cVLL (5.99) with respect to [vδ] variables: (x,y) ∂cVLL i (k)
=
∂vp
(x) (y) (x) (y) 2v − 2v cos δ − δ i i i i
∀xy, k, i, p : x=k∧i=p
otherwise
(y) 2v i
−
(x) 2vi cos
0
(x) δi
−
(y) δi
∀xy, k, i, p : y=k∧i=p (5.164)
(x,y)
∂cVLL
i
(k)
=
∂δp
(x) (y) (x) 2vi vi sin δi
(x) (y) (y) −2vi vi sin δi
0
∀xy, k, i, p : x = k ∧ i = p ∀xy, k, i, p : y = k ∧ i = p (5.165) otherwise
Matrix C8,8 C8,8 is matrix of dimension N V LL × N V LL and contains derivations of equality constraints cVLL (5.99) with respect to [vLL ] variables: (x,y)
∂cVLL
i
(k,l) ∂vp
(
=
(x,y)
−2vi 0
∀xy, kl, i, p : xy = kl ∧ i = p otherwise
(5.166)
137
6. Three Phase DSSE IEEE Tests Power System State Estimation (SE) is one of the most important application necessary for efficient Distribution Management System (DMS) applications. Introduction of near to real time state estimation in electricity distribution networks provide network operators with improved, consistent and complete information about the present operating state of their network, providing increased distribution network automation. SE has been traditionally a key function in the transmission systems and the resultant estimates are used for many functions in the operation and planning throughout the entire system, including power flow optimization and bad data analysis. It is a technique used to find unknown values of the state variables based on some imperfect measurements. The state estimator provides estimate of unknown variables such as active and reactive line power flow, active and reactive power bus injection, voltage magnitude and sometimes line current magnitudes. Using PMUs, even angle measurements are available, but these types of measurements were not considered in this study. State estimator uses statistical criteria to estimate the actual value of those unknown variables. One of the most common technique is non-linear Weighted Least Square (LS), used to minimize the sum of the squares of the error based on available set of measurements in the network. If system state can be obtained from the available set of measurements, network is said to be observable. The following sections present an examples of classical power system state estimation analysis using LS formulation and Gauss-Newton method. The algorithms have been tested by means of a standard IEEE 4 and IEEE 13 test systems that can be found in [37].
6.1. IEEE 4 bus network case In this section, state estimation using Weighted Least Square estimator is performed on standard IEEE 4-bus system. State estimation is based
139
Chapter 6
Three Phase DSSE IEEE Tests
on Gauss-Newton algorithm. The one-line diagram of the IEEE 4bus network is illustrated in Fig. 6.1. IEEE 4-bus network presents an example of a small power system which has been used in many examples throughout the research and also in many references cited in this book. The original network and data files can be found in [37]. The 4-bus system has 4 buses, where bus 1 is slack bus, one load at bus 4 which is consuming 1800 kW of power with 0.9 power factor (lagging), and transformer between nodes 1 and 2 with base power Sbase = 6000kV A. High voltage is Vh = 12.47kV and low voltage is Vl = 4.16kV .
Figure 6.1.: IEEE 4 Node Test Feeder In this example, different kind of measurements are employed and considered. Set of measurements across the system are commonly collected and transmitted through a Supervisory Control and Data Acquisition (SCADA) system. This set of measurements is processed to obtain the best estimate of voltages, currents, power injections and power flows of buses and transmission lines. In order to simplify the network analysis, standard IEEE networks usually have this measurement data already defined. For solving the state estimation problem for this test case, LS estimator uses measurements defined from IEEE database. Measurement points considered in this example are given in Tab. 6.1 and include magnitudes of all bus voltages, active and reactive power flow between nodes 3 and 4, active and reactive load flow for node 4, and finally branch current between nodes 1 and 2. According to the Tab. 6.1, the measurement vector z is composed of measurements including voltage magnitude, active power flow, reactive power flow, active load flow, reactive load flow and current. The measurement vector is in the following form: h
(i)
(i)
(i)
(i)
(i)
(i)
(i) (i)
z T = V2 V3 V4 P43 Q43 PL QL I12
i
where i denotes i − th phase for a three-phase network.
140
(6.1)
6.1 IEEE 4 bus network case
Measured Value
Var.
Ph-0
Ph-1
Ph-2
Var.
Ph-0
Ph-1
Ph-2
|V2 | |V3 | |V4 | I12
0.9877 0.9368 0.8061 1.2405
0.9921 0.9451 0.8635 1.1580
0.9895 0.9397 0.8311 1.2030
PL QL P43 Q43
0.9000 0.4359 -0.9000 -0.4359
0.9000 0.4359 -0.9000 -0.4359
0.9000 0.4359 -0.9000 -0.4359
Table 6.1.: Measurement set for IEEE 4-bus network
The bus voltage magnitudes and angles were considered as state variables except at the reference bus (Bus 1) for which the bus angle was assumed to be zero for phase 0, −120◦ for phase 1 and 120◦ for phase 2, and bus magnitude 1(p.u) for all three phases. Other state variables are all active and reactive power flows, active and reactive load flow, and current between nodes 1 and 2. Based on this, it is possible to form state vector, for a three-phase system as follows: (i)
xT =
(i)
(i) (i) (i) (i)
(i)
(i)
(i)
(i)
(i)
[V2 V3 V4 δ2 δ3 δ4 P12 P21 P23 P32 P34 (i) (i) (i) (i) (i) (i) (i) (i) (i) (i) P43 Q12 Q21 Q23 Q32 Q34 Q43 QL PL I12 ]
(6.2)
For a Gauss-Newton algorithm with LS state estimation it is necessary to define initial conditions for state vector from Equation 6.2. Voltage magnitudes and angles are given in Tab. 6.2. Voltages are given in per unit (p.u) and angles are given in radians (rad). Line impedance, Zpq Bus 1 2 3 4
Voltage Mag. |V |(p.u) Phase Angle δ Ph-0 Ph-1 Ph-2 Ph-0 Ph-1 1.000 1.000 1.000 0 -2.0944 1.000 1.000 1.000 0 -2.0944 1.000 1.000 1.000 0 -2.0944 1.000 1.000 1.000 0 -2.0944 Table 6.2.: Bus Voltages
(rad) Ph-2 2.0944 2.0944 2.0944 2.0944
define the impedance of the line from bus p to bus q. For IEEE 4-bus network impedance of line segment between nodes 2 and 3 is given with Z23 = (0.001 + 0.006)(p.u), and impedance between node 1 and 2, and
141
Chapter 6
Three Phase DSSE IEEE Tests
node 3 and 4 are same and given with the following matrix:
Z12/34
0.403 + j1.063 0.128 + j0.486 0.126 + j0.370 = 0.128 + j0.486 0.410 + j1.032 0.130 + j0.408 0.126 + j0.370 0.130 + j0.408 0.406 + j1.050 (6.3)
Impedances Z12 and Z34 are given in ohms per mile. Line segment between nodes 1 and 2 has a length of 2000 feets, and line segment between nodes 3 and 4 has a length of 2500 feets. For simplicity, shunt admittances are not considered here. Base impedances for these line segments are given by: Z12(base) =
Vh2 (12.47kV )2 = Sbase 6000kV A
(6.4)
Z23(base) =
(4.16kV )2 Vl2 = Sbase 6000kV A
(6.5)
where base impedance Z34(base) is the same as base impedance Z12(base) . Impedances in per units are given with Equations 6.6 and 6.7. All per unit measurements are based on 6000kV A base. Z12(p.u) =
Z23(p.u) =
Z12 Z12(base) Z23 Z23(base)
(6.6)
(6.7)
Admittance matrix is calculated simply by inversion of impedance matrix. Expressions and calculated values are defined in the following equations. −1 y12 = Z12 = G + jB −1 y23 = Z23 = G + jB −1 y34 = Z34 = G + jB
y12
142
(6.8)
31.30 − j71.67 −15.47 + j24.75 −5.41 + j15.41 = −15.47 + j24.75 35.16 − j74.69 −9.36 + j19.16 −5.41 + j15.41 −9.36 + j19.16 28.01 − j69.03
6.1 IEEE 4 bus network case (6.9)
y23(p.u)
2.70 − j16.22 0 0 0 2.70 − j16.22 0 = 0 0 2.70 − j16.22 (6.10)
Admittance amplitude and phase are calculated using following formula: √ |Y | = G2 + B2 θ = tan−1 B G
(6.11)
For obtaining the states from the measurements, LS estimator needs to minimize the following objective function:
(i)
(i)
(i) 2
J(x) = wV1 V2 − V2m (i)
+ wP43 P43 −P43m +wQL
(i) QL
−
2
(i) 2 QLm
(i)
(i)
(i) 2
+ wV2 V3 − V3m (i)
+wQ43 Q43 −Q43m + wI
(i) I12
−
2
2 (i) I12m
(i)
(i)
(i) 2
+ wV3 V4 − V4m (i)
+wPL PL −PLm
2
=0 (6.12)
For electric networks the set of measurements are obtained from bus voltages, power flows and injected powers, so the equality constraints can be expressed using the real and reactive power flowing between bus p and bus q. The non-linear equations are: (i)
cP12 ≡ P12 −
n−1 Xh
(i)
(k)
(i,k)
k=0 (i) (i) (k) (i,k) +V1 V2 Y12 cos δ1
cP23 ≡
(i) P23
−
(i)
(k)
(i,k)
V1 V1 Y11 cos δ1 − δ1 − θ11
n−1 Xh
(i)
(k)
−
(i,k)
(k) δ2
−
(i,k) θ12
(i)
i
(k)
−
(k) δ3
−
(i,k) θ23
i
(6.13)
=0
(i,k)
V2 V2 Y22 cos δ2 − δ2 − θ22
k=0 (i) (k) (i,k) (i) +V2 V3 Y23 cos δ2
(6.14)
=0
143
Chapter 6
Three Phase DSSE IEEE Tests
(i)
cP34 ≡ P34 −
n−1 Xh
(i)
(0)
(i,0)
k=0 (i) (k) (i,k) (i) +V3 V4 Y34 cos δ3
(i)
cP21 ≡ P21 −
n−1 Xh
cP32 ≡
−
n−1 Xh
(i)
(k)
(i)
n−1 Xh
cQ12 ≡
−
(i)
(k)
(i)
cQ34 ≡
−
(i)
(0)
(k)
−
(i,k)
(i)
(k) δ1
−
(i,k) θ21
(i)
i
(k)
− δ2 − θ32
i
(k)
(k)
(i,0)
n−1 Xh
(6.15)
=0
(i,k)
(i,k)
(i)
(i)
(k)
−
(i,k)
(k) δ3
−
(i,k) θ43
(i)
i
(k)
(6.16)
=0
(i,k)
(6.17)
=0
(i,k)
(6.18)
=0
(i,k)
V1 V1 Y11 sin δ1 − δ1 − θ11
n−1 Xh
(i)
(k)
−
(i,k)
(k) δ2
−
(i,k) θ12
(i)
i
(k)
n−1 Xh
(i)
(0)
−
(i,0)
(k) δ3
−
(i,k) θ23
(i)
i
(k)
−
−
(i,k) θ34
i
(6.19)
(i,k)
(6.20)
=0
(i,k)
V3 V3 Y33 sin δ3 − δ3 − θ33 (k) δ4
=0
V2 V2 Y22 sin δ2 − δ2 − θ22
k=0 (i) (k) (i,k) (i) +V3 V4 Y34 sin δ3
144
(k)
V4 V4 Y44 cos δ4 − δ4 − θ44
k=0 (i) (k) (i,k) (i) +V2 V3 Y23 sin δ2
(i) Q34
− δ4 − θ34
(i,k)
k=0 (i) (k) (i,k) (i) +V1 V2 Y12 sin δ1
cQ23 ≡ Q23 −
(i,k)
V3 V3 Y33 cos δ3 − δ3 − θ33
k=0 (i) (k) (i,k) (i) +V4 V3 Y43 cos δ4
(i) Q12
(k)
i
(i,k)
k=0 (i) (k) (i,k) (i) +V3 V2 Y32 cos δ3
cP43 ≡ P43 −
(i)
V2 V2 Y22 cos δ2 − δ2 − θ22
k=0 (i) (k) (i,k) (i) +V2 V1 Y21 cos δ2
(i) P32
V3 V3 Y33 cos δ3 − δ3 − θ33
=0
(6.21)
6.1 IEEE 4 bus network case
(i)
cQ21 ≡ Q21 −
n−1 Xh
(i)
(k)
k=0 (i) (k) (i,k) (i) +V2 V1 Y21 sin δ2
(i)
cQ32 ≡ Q32 −
n−1 Xh
(i)
n−1 Xh
(i)
(k)
(i,k)
(i)
(k)
−
(k) δ1
(i,k)
−
(i,k) θ21
(i)
i
(k)
(i)
(0)
−
(k) δ2
(i,0)
−
(i,k) θ32
(i)
i
(k)
(i)
(i)
(i)
(i)
(i)
(i)
(i)
(i)
−
(k) δ3
−
(i,k) θ43
i
(6.22)
(i,k)
(6.23)
=0
(i,k)
V4 V4 Y44 sin δ4 − δ4 − θ44
k=0 (i) (k) (i,k) (i) +V4 V3 Y43 sin δ4
=0
V3 V3 Y33 sin δ3 − δ3 − θ33
k=0 (i) (k) (i,k) (i) +V3 V2 Y32 sin δ3
cQ43 ≡ Q43 −
(i,k)
V2 V2 Y22 sin δ2 − δ2 − θ22
(6.24)
=0
cP N 2 : −P21 − P23 = 0 cQN 2 : −Q21 − Q23 = 0 cP N 3 : −P32 − P34 = 0 cQN 3 : −Q32 − Q34 = 0 (i) (i) cP N 4 : −P43 − PL = 0 (i) (i) cQN 4 : −Q43 − QL = 0 (i) 2 (i) 2 cI12 : P12 + Q12 −
(6.25)
(i) (i) 2
V1 I12
Using above constraints vector of equality constraints c(x) from Equation 1.11 is defined as: c(x) =
cPpq cPqp cQpq cQqp cP Nn cQNn cI
(6.26)
145
Chapter 6
Three Phase DSSE IEEE Tests
where (p, q) = [(1, 2) , (2, 3) , (3, 4)] and n = 2, 3, 4. By definition, matrix C = ∂c(x)/∂x is the Jacobian of matrix of equality constraints c(x). The elements of the Jacobian matrix correspond to the partial derivatives of equality constraints with respect to the state variables x. In this example, matrix C is defined as: ∂cPpq ∂cPpq ∂V ∂δ ∂cPqp ∂cPqp ∂δ ∂V ∂cQpq ∂cQpq ∂V ∂δ ∂cQqp ∂cQqp ∂V ∂δ ∂cP Nn ∂cP Nn ∂V ∂δ
∂cP QNn ∂cQNn ∂V ∂δ
∂cPpq ∂Ppq ∂cPqp ∂Ppq ∂cQpq ∂Ppq ∂cQqp ∂Ppq ∂cP Nn ∂Ppq ∂cQNn ∂Ppq
∂cPpq ∂Pqp ∂cPqp ∂Pqp ∂cPpq ∂Pqp ∂cQqp ∂Pqp ∂cP Nn ∂Pqp ∂cQNn ∂Pqp
∂cPpq ∂cPpq ∂Qpq ∂Qqp ∂cPqp ∂cPqp ∂Qpq ∂Qqp ∂cQpq ∂cP Qpq ∂Qpq ∂Qqp ∂cQqp ∂cQqp ∂Qpq ∂Qqp ∂cP Nn ∂cP Nn ∂Qpq ∂Qqp ∂cQNn ∂cQNn ∂Qpq ∂Qqp
∂cPpq ∂cPpq ∂cPpq ∂PL ∂QL ∂I ∂cPqp ∂cPqp ∂cPqp ∂PL ∂QL ∂I ∂cQpq ∂cQpq ∂cQpq ∂PL ∂QL ∂I ∂cQqp ∂cQqp ∂cP Qqp ∂PL ∂QL ∂I ∂cP Nn ∂cCP Nn ∂cP Nn ∂PL ∂QL ∂I ∂cQNn ∂cQNn ∂cQNn ∂PL ∂QL ∂I
(6.27) Vector 4z for some iteration k is given with:
(i)
(i)
V2 − V2m (i) (i) V3 − V3m (i) (i) V4 − V4m 0 0 0 0 0 0 0 0 4z = (i) P − P (i) 43 43m 0 0 0 0 0 (i) P − P (i) 43 43m (i) P − P (i) Lm L (i) (i) Q − Q L Lm (i) (i) I12 − I12m
146
(6.28)
6.1 IEEE 4 bus network case Each of these measurements is not perfect. There is a constant level of error/noise present in the measurement. Therefore measurement error must be considered. The measurement error variance is assigned to each measurement type to reflect the expected accuracy of the meter used. These values are usually used as weights in the diagonal matrix W. This matrix contains the weighting factors as diagonals elements. Matrix W is given with following diagonal matrix:
W = diag [wV2 wV3 wV4 0 0 0 0 0 0 0 0 wP43 0 0 0 0 0 wQ43 wPL wQL wI] (6.29)
With all matrix defined the application of LS approach for the state estimation of the IEEE 4 bus test case can be applied. Results can be calculated using Equation 6.30:
"
4x − −λ
#
"
=
HT W H CT C 0
#−1 "
H T W 4z k −c(xk )
#
(6.30)
This procedure is repeated the for the rest of the iterations until the difference between xk+1 and xk is within a certain pre-assigned threshold, ε. Gauss-Newton algorithm based on LS state estimation is implemented in two programming languages: MATLAB and AMPL. Optimization solver used in AMPL is KNITRO. The results of applied LS state estimation solved iteratively with Gauss-Newton algorithm are shown in Tab. 6.3. The estimated values for voltage magnitudes, load power, power flow and current magnitude are completely the same when using MATLAB and AMPL. The convergence criteria for this simulation was ε = 10−5 . In both cases results converged with the ε = 5.37 · 10−8 , and results converged with 4 iterations in AMPL and 5 iterations in MATLAB. The convergence summary for the objective function J(xk ) and the ε are given in the below table: A convergence for Gauss-Newton method is plotted as J(x) vs. the number of iterations. Fig. 6.2 illustrate the convergence for the IEEE 4-bus case. It can be seen that the Gauss-Newton method converges very fast for this simple test case.
147
Chapter 6
Three Phase DSSE IEEE Tests
Measured Value LS State Estimation Ph-0 Ph-1 Ph-2 Ph-0 Ph-1 Ph-2 |V2 | 0.9877 0.9921 0.9895 0.9876 0.9921 0.9895 |V3 | 0.9368 0.9451 0.9397 0.9367 0.9451 0.9400 |V4 | 0.8061 0.8635 0.8311 0.8059 0.8637 0.8311 PL 0.9000 0.9000 0.9000 0.9000 0.9000 0.9000 QL 0.4359 0.4359 0.4359 0.4359 0.4359 0.4359 P43 -0.9000 -0.9000 -0.9000 -0.9000 -0.9000 -0.9000 Q43 -0.4359 -0.4359 -0.4359 -0.4359 -0.4359 -0.4359 I12 1.2405 1.1580 1.2030 1.2408 1.1578 1.2032 Table 6.3.: Estimated voltages, current, load and power flow for 4 bus system Var.
Iteration ε J(x) 1 0.9000 0.3776 2 0.1592 0.3244 3 0.0430 0.3231 4 8.3833e-04 0.3231 5 5.3737e-08 0.3231 Table 6.4.: Convergence summary
Convergence of Objective Function 0.38
Objective function J(x)
0.37
0.36
0.35
0.34
0.33
0.32
1
1.5
2
2.5 3 3.5 Number of iterations
4
Figure 6.2.: Objective function
148
4.5
5
6.2 IEEE 13 bus network case
6.2. IEEE 13 bus network case As a second test case IEEE 13 node test feeder was selected to investigate possibilities of LS state estimation. For a small feeder IEEE 13 node provide a good test for the most common features of distribution analysis software. The IEEE 13 Node Test Feeder is one of four standard distribution models developed by the IEEE Power Engineering Society’s Power System Analysis Computing and Economics Committee. This test feeder has several key distribution system components such as overhead and underground lines, spot and distributed loads, capacitors, transformers and voltage regulators. In this section, a modified IEEE 13 bus test case is utilized for case study. Fig. 6.3 gives schematic diagram of a modified IEEE 13 bus system.
Figure 6.3.: Modified IEEE 13 Node Test Feeder For a IEEE 13 node system state vector is composed of voltage magnitudes, voltage angles, active and reactive power flows, and active and reactive load flow. The measurement vector z is composed of active and reactive load flow measurements: (i)
(i)
(i) (i) xT = [Vp(i) δp(i) Ppq Qpq PLp QLp ]; z T =
(i)
(i)
(i)
(i)
(i)
(i)
(i)
(i)
[PL2 PL4 PL5 PL6 PL7 PL8 PL9 PL11 (i) (i) (i) (i) (i) (i) (i) (i) QL2 QL4 QL5 QL6 QL7 QL8 QL9 QL11 ] (6.31)
To estimate the state x, a set of measurements z needs to be collected. In this state estimation, load flow calculation results are utilized as measured data. As shown in the Tab. 6.5, the 13 bus system has eight
149
Chapter 6
Three Phase DSSE IEEE Tests
measured points, bus 2, 4, 5, 6, 7, 8, 9, 11 where loads are placed. Loads are modeled as three-phase or single-phase. Three-phase loads are connected in wye or delta while single-phase loads are connected line-to-ground or line-to-line. Nodes 2, 4, 6, 11, 8 and 9 are connected in wye, where nodes 2, 4, 6 and 8 are modeled as constant kW and kVAr (PQ), 11 as constant impedance and node 9 as constant current. Nodes 5 and 7 and are connected in delta, where 5 is modeled as constant impedance and 7 as constant kW and kVAr. Tab. 6.5 lists measuring set used for this test case. The first bus is used as the reference bus in Measured Value
Var. PL2 PL4 PL5 PL6 PL7 PL8 PL9 PL11
Ph-0 0.0510 0.9600 0 0 2.6142 2.9100 0 0.7680
Ph-1 0.4080 0.3510 0.7200 0.4754 3.3467 1.7400 0 0
Ph-2 0.1140 0.5400 0.0034 0 0.7500 1.5584 0.3600 0
Var. QL2 QL4 QL5 QL6 QL7 QL8 QL9 QL11
Ph-0 0.1980 0.7200 0 0 0.9700 1.0200 0 2.5801
Ph-1 1.0200 0.0300 0.6600 2.0091 1.1400 0.5160 0 0
Ph-2 0.2040 0.5400 0.8260 0 1.6458 1.2720 0.4800 0
Table 6.5.: Measurement set for IEEE 13-bus network
this simulation. The unit for the voltage magnitude is per-unit (p.u.), and the unit for phase angle is degree.Voltage magnitude and angles are given in Tab. 6.6. Following equations show a system with branch impedances expressed in ohms per miles. There are seven different configurations as given by: Z601
Z602
0.347 + j1.018 0.156 + j0.502 0.158 + j0.424 = 0.156 + j0.502 0.338 + j1.048 0.154 + j0.385 (6.32) 0.158 + j0.424 0.154 + j0.385 0.341 + j1.035 0.753 + j1.181 0.158 + j0.424 0.156 + j0.502 = 0.158 + j0.424 0.748 + j1.198 0.154 + j0.385 (6.33) 0.156 + j0.502 0.154 + j0.385 0.744 + j1.211
Z603
150
0 0 0 = 0 1.329 + j1.347 0.207 + j0.459 0 0.207 + j0.459 1.324 + j1.357
(6.34)
6.2 IEEE 13 bus network case
Bus 1 2 3 4 5 6 7 8 9 10 11 12
Voltage Mag. |V |(p.u) Phase Angle δ (rad) Ph-0 Ph-1 Ph-2 Ph-0 Ph-1 Ph-2 1.0689 1.0569 1.0851 0 -2.0944 2.0944 1.0210 1.0420 1.0174 -0.0435 -2.1244 2.0565 1.0180 1.0401 1.0148 -0.0447 -2.1253 2.0563 0.9940 1.0218 0.9960 -0.0564 -2.1331 2.0480 1.0311 1.0134 -2.1290 2.0577 1.0329 1.0155 -2.1276 2.0570 0.9900 1.0529 0.9778 -0.0925 -2.1352 2.0249 0.9835 1.0553 0.9758 -0.0970 -2.1384 2.0251 0.9738 2.0207 0.9881 0.9758 -0.0929 2.0232 0.9825 -0.0916 0.9900 1.0529 0.9778 -0.0925 -2.1352 2.0249 Table 6.6.: Bus Voltages
Z604
1.324 + j1.357 0 0.207 + j0.459 0 0 0 = 0.207 + j0.459 0 1.330 + j1.347
Z605
0 0 0 0 =0 0 0 0 1.329 + j1.348
Z606
(6.36)
0.798 + j0.446 0.319 + j0.033 0.285 − j0.014 = 0.319 + j0.033 0.789 + j0.404 0.319 + j0.033 (6.37) 0.285 − j0.014 0.319 + j0.033 0.798 + j0.446
Z607
(6.35)
1.343 + j0.5124 0 0 0 0 0 = 0 0 0
(6.38)
Each branch between two nodes has defined length of the line segment and type of impedance configuration. These are summarized in Tab. 6.7.
151
Chapter 6
Three Phase DSSE IEEE Tests From To Length(ft.) Configuration 2 6 500 603 2 3 500 602 3 4 0 XFM 6 5 300 603 1 2 2000 601 10 11 800 607 2 7 2000 601 7 10 300 604 7 12 1000 601 10 9 300 605 7 8 500 606 Table 6.7.: Line Segment Data
The IEEE 13 node test feeder contains a transformer between nodes 3 and 4. Impedance of line segment between these two nodes is given with ZXF M = (0.011 + 0.02)(p.u). High voltage is Vh = 4.16kV and low voltage is Vl = 0.48kV . The IEEE 13 node network operates at a nominal voltage of 4.16 kV, and the base power is Sbase = 500kV A. Base impedance and impedance per unit are calculated using equations:
Z(base) =
Vh2 (4.16kV )2 Z = ; Z(p.u) = Sbase 500kV A Z(base)
(6.39)
Admittance matrices are obtained by inversion of the impedance matrices. For given impedance configurations, admittance matrices are calculated for IEEE 13 node network:
y601
39.63 − j114.24 −16.82 + j42.24 −9.21 + j31.57 = −16.82 + j42.24 34.71 − j108.3 −4.37 + j24.11 −9.21 + j31.57 −4.37 + j24.11 30.69 − j102.12 (6.40)
y602
152
192.6 − j246.9 −51.75 + j52.12 −74.05 + j58.50 = −51.75 + j52.1 169.9 − j244.47 −37.66 + j47.85 −74.05 + j58.5 −37.66 + j47.85 179.6 − j245.2
6.2 IEEE 13 bus network case (6.41)
y603
0 0 0 = 0 250.06 − j229.99 −83.33 + j34.59 0 −83.33 + j34.59 248.34 − j231.04
y604
248.34 − j231.04 0 −83.33 + j34.59 0 0 0 = −83.33 + j34.59 0 250.06 − j229.99
y605
(6.43)
0 0 0 0 =0 0 0 0 1226.01 − j229.12
y606
(6.42)
(6.44)
357.14 − j268.9 −83.79 + j103.9 −37.30 + j85.1 396.2 − j280 −83.8 + j103.95 = −83.8 + j104 −37.30 + j85.1 −83.79 + j103.9 357.14 − j269 (6.45)
y607
148.52 − j56.686 0 0 0 0 0 = 0 0 0
(6.46)
and the admittance matrix for line segment between nodes 3 and 4 where transformer is placed:
yXF M
21.11 − j38.388 0 0 0 21.11 − j38.388 0 = 0 0 21.11 − j38.388 (6.47)
Admittance amplitude and phase are calculated on same way as for IEEE 4-node network using Equation 6.11. For obtaining the states
153
Chapter 6
Three Phase DSSE IEEE Tests
from the measurements, LS estimator needs to minimize the following objective function: 2 2 1 (i) (i) (i) (i) J(x) = wPL2 PL2 − PL2m + wPL4 PL4 − PL4m 2
(i)
(i)
2
(i)
(i)
2
(i)
(i)
2
(i) QL2
+ wPL5 PL5 − PL5m + wPL7 PL7 − PL7m + wPL9 PL9 − PL9m + wQL2
−
(i)
(i)
2
(i)
(i)
2
(i)
(i)
2
+ wQL9 QL9 − QL9m
(i)
2
(i)
(i)
2
+ wQL4
2
(i)
(i) QL4
(i)
(i)
2
(i)
(i)
2
(i)
+ wPL11 PL11 − PL11m
+ wQL7 QL7 − QL7m
(i)
+ wPL8 PL8 − PL8m
2 (i) QL2m
+ wQL5 QL5 − QL5m
+ wPL6 PL6 − PL6m
−
+ wQL6 QL6 − QL6m + wQL8 QL8 − QL8m
(i)
(6.48)
2 (i) QL4m
(i)
+ wQL11 QL11 − QL11m
2
Namely, the aim is to minimize the difference between measured and calculated state variables. LS state estimation is applied for the system from the Fig. 6.3 and the state vector is solved iteratively with GaussNewton method. To test the capability of the method in converging to the values near to the measured data, the state estimation algorithm has been coded and compiled in MATLAB. The algorithm converges to the following state estimation solution: Measured Value LS State Estimation Ph-0 Ph-1 Ph-2 Ph-0 Ph-1 Ph-2 |V2 | 1.0210 1.0420 1.0174 1.0209 1.0421 1.0191 |V3 | 1.0180 1.0401 1.0148 1.0209 1.0402 1.0165 |V4 | 0.9940 1.0218 0.9960 0.9939 1.0218 0.9977 |V5 | 1.0311 1.0134 1.0311 1.0150 |V6 | 1.0329 1.0155 1.0329 1.0171 |V7 | 0.9900 1.0529 0.9778 0.9834 1.0460 0.9643 |V8 | 0.9835 1.0553 0.9758 0.9756 1.0471 0.9607 |V9 | 0.9738 0.9574 |V10 | 0.9881 0.9758 0.9814 0.9608 |V11 | 0.9825 0.9756 |V12 | 0.9900 1.0529 0.9778 0.9834 1.0460 0.9643 Table 6.8.: Estimated voltages for 13 bus system
154
6.2 IEEE 13 bus network case Again, convergence criteria is chosen to be 10−5 . Applying the GaussNewton algorithm, the solution is obtained in four iterations. Convergence properties are given in Tab. 6.9. The results of the numerical Iteration ε 1 1.8971 2 0.0246 3 3.2283e-05 4 5.1694e-11 Table 6.9.: Convergence Summary
simulations indicate that given method can accurately estimate the target system conditions.
155
A. Appendix A.1. MATLAB Programming The goal of this section is to introduce the fundamental ideas of programming and solving different networks in MATLAB. The program codes consist of four files. One is the main script and contains code for solving any kind of network provided that information about network are stored in some text files. The other three files are text files where input data are stored. First text file contains information about buses, second information about branches and third file provides information about measurements.
A.1.1. Import Files to M-file MATLAB code which is introduced here is intended to be usable for all types of network configurations. It is a general, insensitive to the network topology, number of nodes, connections between nodes, etc. For reaching this goal, text files are used to provide possibility to enter data for different systems and use same m-file in all different cases. Three different text data files are saved in working directory, “3Pbus.txt”, “3Pbranch.txt”, and “3PbusM”, and are used for any kind of three phase network. Typically these data are available as a plain text files organized into columns. The first file stores bus data such as: bus ID, bus voltage magnitudes, bus voltage angles, injected active and reactive power, and active and reactive load flow for all three phases. The data in second file contains branch information like branch ID, nodes which constitute branch, defined as from and to nodes and branch resistance and reactance. The header data of the third file stores information about measurement for a concrete network. First seven columns of file “3Pbus.txt” for IEEE 13-bus network looks like this: 1 bus V_0 2 1 1.0689
V_1 1.0569
V_2 1.0851
d_0 0
d_1 −120
d_2 120
157
Chapter A 3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12
Appendix
1.0210 1.0180 0.9940 0 0 0.9900 0.9835 0 0.9881 0.9825 0.9900
1.0420 1.0401 1.0218 1.0311 1.0329 1.0529 1.0553 0 0 0 1.0529
1.0174 1.0148 0.9960 1.0134 1.0155 0.9778 0.9758 0.9738 0.9758 0 0.9778
−2.49 −2.56 −3.23 0 0 −5.30 −5.56 0 −5.32 −5.25 −5.30
−121.72 −121.77 −122.22 −121.98 −121.90 −122.34 −122.52 0 0 0 −122.34
117.83 117.82 117.34 117.90 117.86 116.02 116.03 115.78 115.92 0 116.02
Listing A.1: “3Pbus.txt” for IEEE 13-bus network Importing data in MATLAB from an external file is performed using MATLAB built in function importdata. This function is useful because it can interpret files containing text headings or column labels. This is very important because it allows inclusion of documentation inside data file. To import data from text file to MATLAB it is necessary to create a script file and type the code in it: 1 delimiterIn = ’␣ ’ ; headerlinesIn = 1; 2 BUS= i m p o r t d a t a ( ’ 3Pbus . t x t ’ , d e l i m i t e r I n , h e a d e r l i n e s I n ) ; 3 BRANCH=i m p o r t d a t a ( ’ 3 Pbranch . t x t ’ , d e l i m i t e r I n , headerlinesIn ) ; 4 BUSM=i m p o r t d a t a ( ’ 3PbusM . t x t ’ , d e l i m i t e r I n , h e a d e r l i n e s I n ) ;
Listing A.2: Importing data from file The importdata function loads data from ASCII file, filename, or the clipboard, reading numeric data starting from line headerlinesIn+1. In this example, a text file “3Pbus.txt” is imported and specified with Delimiter (space) and Column Header. Listing A.2 describes loading the data from a text file into MATLAB M-file for IEEE 13-bus network, and assigning the values of each column to the defined variable.
A.1.2. Introduction of Symbolic Variables A.1.2.1. Declaration of symbolic variables Symbolic MATLAB Toolbox provides symbolic calculation in MATLAB environment. Doing symbolic calculus is one of the more useful things that MATLAB can perform. Symbolic variables are necessary when the
158
A.1 MATLAB Programming objects to be manipulated are not just numbers but rather expressions involving mathematical variables. Symbolic variables belongs to the class sym (defined by the Symbolic Toolbox). Thus, in order to perform symbolic computations with a certain set of variables, first they need to be declared as a variables from that class. To define variables as symbolic, most easily way is to use sym command. In this example, voltage magnitudes and angles, active and reactive power and load flow are symbolic quantities. Listing A.3 defines symbolic variables: 1 2 3 4 5 6
Ppq_0=sym ( ’ Ppq_0 ’ , [ 1 l e n g t h ( branch ) ] ) ; Ppq_1=sym ( ’ Ppq_1 ’ , [ 1 l e n g t h ( branch ) ] ) ; Ppq_2=sym ( ’ Ppq_2 ’ , [ 1 l e n g t h ( branch ) ] ) ; PL_0=sym ( ’PL_0 ’ , [ 1 l e n g t h ( bus ) ] ) ; PL_1=sym ( ’PL_1 ’ , [ 1 l e n g t h ( bus ) ] ) ; PL_2=sym ( ’PL_2 ’ , [ 1 l e n g t h ( bus ) ] ) ;
Listing A.3: Declaration of symbolic variable Listing A.3 creates different symbolic variables. First three lines create three 1×length(branch) vectors of symbolic variables. First line creates a variable of class sym whose variable name is P pq_0 and elements of first vector have names of the form P pq_0 = [P pq_01 P pq_02 P pq_03 P pq_04]. Same logic applies for all other cases. The argument of sym must be a character-string, i.e. a sequence of symbols. Character strings (more precisely arrays of character strings) form another class called char. In MATLAB strings are marked by apostrophes. When symbolic variable are created, MATLAB will be able to manipulate mathematical expressions that contain variables.
A.1.2.2. Evaluation of Symbolic variables After a different kind of symbolic variable are declared, MATLAB can perform and calculate operations by means of using “formula”, instead of immediately evaluating the answers for each step. This will simplify the complexity of calculation since all calculations are done in general, symbolically, and at the end results are obtained for different numerical values of variables. To replace variable with its actual value, subs function is defined. The keyfunction subs (which stands for
159
Chapter A
Appendix
substitute) is used to replace symbolic variables with either new symbolic variables or with actual values. The syntax for the function is: subs( symbolic_function, list_of_symbols, list_of_values). With this command it is possible to replace variables in an expression by other variables or numbers: 1 AN=s u b s (A, X, Xlambda ( 1 : l e n g t h (X) ) ) ; 2 BN=s u b s (B, X, Xlambda ( 1 : l e n g t h (X) ) ) ;
Listing A.4: Evaluation of symbolic variable Command from Listing A.4 substitute vector of symbolic variables X with vector of their numerical values Xlambda in matrix A (or B). In concrete example, vector X is state vector containing all state variables, and vector Xlambda contains initial values of all state variables, including initial values for Lagrange multipliers λ. Matrix A is first matrix from the left hand side of Equation 1.11, and vector B is right hand side of the same equation.
A.1.3. Define Measurements and Parameters The state estimation algorithm assesses the state of the system at a given moment, using an available set of measurements provided by dedicated metering and communication systems. The classic state estimation algorithms use as measurements branch power flows, bus power injections and bus voltage magnitudes. In this example,measured data are active and reactive load flows and information about measurement is stored in a text file called “3PbusM.txt” , as shown with Listing A.5. 1 2 3 4 5 6
PL_0m=n o n z e r o s ( Pload_0m/ Sbase1P ) ; PL_1m=n o n z e r o s ( Pload_1m/ Sbase1P ) ; PL_2m=n o n z e r o s ( Pload_2m/ Sbase1P ) ; PL_0m=n o n z e r o s ( Qload_0m/ Sbase1P ) ; QL_1m=n o n z e r o s ( Qload_1m/ Sbase1P ) ; QL_2m=n o n z e r o s ( Qload_2m/ Sbase1P ) ;
Listing A.5: Values of measurement set To take into account the fact that loads are not present on each bus, MATLAB built in function nonzeros can be used. This function returns column vector of the nonzero elements. This means that, for example, vector P L_0m will contain active loads just for buses which have defined load in phase zero. Besides the information about measurements,
160
A.1 MATLAB Programming other two text files contain information about some parameters which have constant value. These are given by Listing A.6. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
%f i x i n g v o l t a g e and a n g l e o f s l a c k bus 1 V_01=BUS . data ( 1 , 2 ) ; V_11=BUS . data ( 1 , 3 ) ; V_21=BUS . data ( 1 , 4 ) ; d_01=BUS . data ( 1 , 5 ) ∗ p i / 1 8 0 ; d_11=BUS . data ( 1 , 6 ) ∗ p i / 1 8 0 ; d_21=BUS . data ( 1 , 7 ) ∗ p i / 1 8 0 ; %Y and t h e t a f o r k =1: l e n g t h ( branch ) Zpu1=ybase ∗ f t ( k ) ∗ [ r_00 ( k )+1 i ∗x_00 ( k ) r_01 ( k )+1 i ∗x_01 ( k ) r_02 ( k )+1 i ∗x_02 ( k ) ] ; Zpu2=ybase ∗ f t ( k ) ∗ [ r_10 ( k )+1 i ∗x_10 ( k ) r_11 ( k )+1 i ∗x_11 ( k ) r_12 ( k )+1 i ∗x_12 ( k ) ] ; Zpu3=ybase ∗ f t ( k ) ∗ [ r_20 ( k )+1 i ∗x_20 ( k ) r_21 ( k )+1 i ∗x_21 ( k ) r_22 ( k )+1 i ∗x_22 ( k ) ] ; Zpu=[Zpu1 ( Zpu1~=0) ; Zpu2 ( Zpu2~=0) ; Zpu3 ( Zpu3~=0) ] ; ypu= i n v ( Zpu ) ; Y=abs ( ypu ) ; t h e t a p p=atan2 ( imag ( ypu ) , r e a l ( ypu ) ) ; t h e t a p q=atan2 (−imag ( ypu ) ,− r e a l ( ypu ) ) ;
Listing A.6: Slack bus voltage, admittance matrix Since first bus is reference bus, its voltage magnitude and angle is fixed and assigned value from file “3Pbus.txt”. Also, impedance and admittance matrices can be calculated using data stored in a text file “3Pbranch.txt”. When admittance matrix is defined, magnitude and phase can be simply found using MATLAB functions abs and atan2.
A.1.4. Calculate Constraints MATLAB has ability to make calculations on symbolic expressions, rather than on known number. This is useful when results are not required immediately, so the solutions can be found using variables. This advantage can be used when calculating equality constraints for power system networks. Equality constraints are given as power balance for each node and all three phases. Note that load power is defined just for those nodes where load is placed, and for all other it is set to zero, Listing A.7 defines active power balance for phase zero:
161
Chapter A
1 2 3 4 5 6 7 8 9 10 11
Appendix
f o r n=2:Nn sumP_0=0; f o r k =1: l e n g t h ( branch ) i f ismember ( n , from ( k ) ) & PhaseA ( k ) ~=0 sumP_0=sumP_0+Ppq_0 ( k ) ; e l s e i f ismember ( n , t o ( k ) )& PhaseA ( k ) ~=0 sumP_0=sumP_0+Pqp_0 ( k ) ; end ; end ; sumP_0=Pgen_0 ( n )−Pload_0−sumP_0 ; end
Listing A.7: Power Balance Equality constraints where active and reactive power flows from node p to node q for phase zero is given by Listing A.8: 1 f o r k =1: l e n g t h ( branch ) 2 f o r p=1:Nn 3 f o r q =1:Nn 4 i f ismember ( p , from ( k ) ) & ismember ( q , t o ( k ) ) & PhaseA ( k ) ~=0 5 CPpq_0=Ppq_0 ( k )− 6 (V_0( p ) ∗V_0( p ) ∗Y( 1 , 1 ) ∗ c o s ( d_0 ( p )−d_0 ( p )−t h e t a p p ( 1 , 1 ) )+ 7 V_0( p ) ∗V_0( q ) ∗Y( 1 , 1 ) ∗ c o s ( d_0 ( p )−d_0 ( q )−t h e t a p q ( 1 , 1 ) )+ 8 V_0( p ) ∗V_1( p ) ∗Y( 1 , 2 ) ∗ c o s ( d_0 ( p )−d_1 ( p )−t h e t a p p ( 1 , 2 ) )+ 9 V_0( p ) ∗V_1( q ) ∗Y( 1 , 2 ) ∗ c o s ( d_0 ( p )−d_1 ( q )−t h e t a p q ( 1 , 2 ) )+ 10 V_0( p ) ∗V_2( p ) ∗Y( 1 , 3 ) ∗ c o s ( d_0 ( p )−d_2 ( p )−t h e t a p p ( 1 , 3 ) )+ 11 V_0( p ) ∗V_2( q ) ∗Y( 1 , 3 ) ∗ c o s ( d_0 ( p )−d_2 ( q )−t h e t a p q ( 1 , 3 ) ) ) ; 12 e l s e i f PhaseA ( k )==0 13 CPpq_0 = [ ] ; end ; end ; 14 end 15 end 16 end
Listing A.8: Power Flow Equality constraints
A.1.5. Matrix Calculation With defined objective function and equality constraints it becomes easy to define all vectors and matrices necessary for solving mentioned iterative process. Note that objective function is defined as sum of squares of difference between calculated and measured values. Vectorc(x) is given as a vector of equality constraints for all nodes and all phases. Vector
162
A.1 MATLAB Programming of state variables X include all bus voltages (except reference bus), and all power and load flows. Matrix C is defined using MATLAB function jacobian. It represents partial derivatives of equality constraints with respect to the state variables. Matrix W is a diagonal matrix of weights associated to each measurement. 1 2 3 4 5
%Matrix o f e q u a l i t y c o n s t r a i n t s Con=[Eq1 Eq2 ] ;
%Matrix o f v a r i a b l e s X=[V_0 ( 2 : l e n g t h (V_0) ) V_1 ( 2 : l e n g t h (V_1) ) V_2 ( 2 : l e n g t h ( V_2) ) 6 d_0 ( 2 : l e n g t h ( d_0 ) ) d_1 ( 2 : l e n g t h ( d_1 ) ) d_2 ( 2 : l e n g t h ( d_2 ) ) 7 Ppq Qpq PL_0 PL_1 PL_2 QL_0 QL_1 QL_2 ] ; 8 9 %Matrix C 10 C=j a c o b i a n ( Con ,X) ; 11 12 %Matrix d e l t a Z ( k )−d e r i v a t i v e o f O b j e c t i v e 13 dzk=g r a d i e n t ( Objec , X) ; 14 15 %Matrix ck 16 ck=Con . ’ ; 17 18 %Matrix ␣W 19 W=d i a g (W1) ; 20 21 %Matrix ␣A␣ ( l e f t ␣ s i d e ) ␣AxX=B 22 A=[W␣C ’ ; C z e r o s ( l e n g t h ( Con ) , l e n g t h ( Con ) ) ] ; 23 24 % %Matrix B ( r i g h t s i d e ) AxX=B 25 B=[−W∗ dzk ; −ck ] ;
Listing A.9: Definition of all matrix With all matrices defined Gauss-Newton method can be described as iterative process for solving vector X in the matrix equation A×X = B where matrices A and B are defined in Listing A.9.
A.1.6. Assign Initial Values Originally, vector of state variables X is given with symbolic variables. In order to start first iteration, it is required to determine initial values. These values are taken from text files and assigned to vector Xlambda .
163
Chapter A
Appendix
This vector contains initial values for all variables, plus initial values for Lagrange multiplies. For simplicity, these values are set to 1 and placed in vector L. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
v_0=BUS . data ( : , 2 ) ; v_1=BUS . data ( : , 3 ) ; v_2=BUS . data ( : , 4 ) ; dd_0=BUS . data ( : , 5 ) ∗ p i / 1 8 0 ; dd_1=BUS . data ( : , 6 ) ∗ p i / 1 8 0 ; dd_2=BUS . data ( : , 7 ) ∗ p i / 1 8 0 ; Pload_0m=BUSM. data ( : , 2 ) ; Pload_1m=BUSM. data ( : , 3 ) ; Pload_2m=BUSM. data ( : , 4 ) ; Qload_0m=BUSM. data ( : , 5 ) ; Qload_1m=BUSM. data ( : , 6 ) ; Qload_2m=BUSM. data ( : , 7 ) ; L=o n e s ( 1 , l e n g t h ( Con ) ) ;
%i n i t i a l v a l u e s f o r v a r i a b l e s Xlambda=[V_0 ( 2 : l e n g t h (V_0) ) V_1 ( 2 : l e n g t h (V_1) ) V_2 ( 2 : l e n g t h (V_2) ) 17 d_0 ( 2 : l e n g t h ( d_0 ) ) d_1 ( 2 : l e n g t h ( d_1 ) ) d_2 ( 2 : l e n g t h ( d_2 ) ) 18 Ppq Qpq PL_0 PL_1 PL_2 QL_0 QL_1 QL_2 −L ] ;
Listing A.10: Initial Values from Text file Vector of active and reactive power flows in initial state are calculated on the same way as it was done with symbolic variables, but now instead of symbolic variables initial values are used.
A.1.7. Solve Gauss-Newton Method and show Results With initial values defined, Gauss- Newton algorithm is lunched. Convergence criteria is set to 10−5 . The algorithm is repeated until convergence occurs. MATLAB functions subs and eval are used to replaces all the variables in the symbolic expression with initial values and evaluate the numerical value in the string expression, respectively. 1 2 3 4 5 6 7
164
%t o l e r a n c e ( s t o p p i n g c r i t e r i a ) e p s = 1 e −5; %t o l e r a n c e c a l c u a l t e d i n l o o p epsObtained = 1 ; %number o f i t e r a t i o n
A.1 MATLAB Programming 8 iteration = 0; 9 10 while ( e p s < epsObtained ) 11 12 %i n A and B s u b s t i t u t e v a r i a b l e s i n X with f i r s t l e n g t h ( X) v a l u e s i n Xlambda 13 AN=s u b s (A, X, Xlambda ( 1 : l e n g t h (X) ) ) ; 14 BN=s u b s (B, X, Xlambda ( 1 : l e n g t h (X) ) ) ; 15 16 %c a l c u l a t i o n o f numbers 17 ANE = e v a l (AN) ; 18 BNE = e v a l (BN) ; 19 20 %ch e c k c o n v e r g e n c e f o r c o n s t r a i n t s 21 absB = abs (BNE( l e n g t h (X)+1 : l e n g t h (BNE) ) ) ; 22 epsObtained = max( absB ) ; 23 24 %c a l c u l a t i o n o f dX=i n v (A) ∗B 25 dX=i n v (ANE) ∗BNE; 26 27 %update new v a l u e s X( k+1)=X( k )+dX ( update j u s t v a r i a b l e s , not lambda ) 28 Xlambda=Xlambda ( 1 : l e n g t h (X) ) ’+␣dX ( 1 : l e n g t h (X) ) ; 29 Xlambda=Xlambda ’ ; 30 i t e r a t i o n = i t e r a t i o n + 1 ; 31 end
Listing A.11: Gauss-Newton algorithm
After updated values of state vector approaches to the measured one, and tolerance is satisfied, results can be shown in MATLAB Command Window by simply removing semicolons from the lines in Listing A.12. 1 iteration 2 epsObtained 3 Xlambda ( 1 : l e n g t h (X) ) ’
Listing A.12: Display Results
This will display total number of iterations, achieved tolerance and estimated state vector values. Whole code is given in sec. A.2.
165
Chapter A
Appendix
A.2. MATLAB code
clc clear a l l %∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗IMPORT DATA∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ delimiterIn = ’␣ ’ ; headerlinesIn = 1; BUS = i m p o r t d a t a ( ’ 13 bus . t x t ’ , d e l i m i t e r I n , h e a d e r l i n e s I n ) ; BRANCH = i m p o r t d a t a ( ’ 13 branch . t x t ’ , d e l i m i t e r I n , h e a d e r l i n e s I n ) ; BUSM= i m p o r t d a t a ( ’ 13busM . t x t ’ , d e l i m i t e r I n , h e a d e r l i n e s I n ) ; bus=BUS . data ( : , 1 ) ; v_0=BUS . data ( : , 2 ) ; v_1=BUS . data ( : , 3 ) ; v_2=BUS . data ( : , 4 ) ; dd_0=BUS . data ( : , 5 ) ∗ pi / 1 8 0 ; dd_1=BUS . data ( : , 6 ) ∗ pi / 1 8 0 ; dd_2=BUS . data ( : , 7 ) ∗ pi / 1 8 0 ; Pgen_0=BUS . data ( : , 8 ) ; Pgen_1=BUS . data ( : , 9 ) ; Pgen_2=BUS . data ( : , 1 0 ) ; Qgen_0=BUS . data ( : , 1 1 ) ; Qgen_1=BUS . data ( : , 1 2 ) ; Qgen_2=BUS . data ( : , 1 3 ) ; branch=BRANCH. data ( : , 1 ) ; from=BRANCH. data ( : , 2 ) ; t o=BRANCH. data ( : , 3 ) ; r_00=BRANCH. data ( : , 4 ) ; r_01=BRANCH. data ( : , 5 ) ; r_02=BRANCH. data ( : , 6 ) ; r_10=BRANCH. data ( : , 7 ) ; r_11=BRANCH. data ( : , 8 ) ; r_12=BRANCH. data ( : , 9 ) ; r_20=BRANCH. data ( : , 1 0 ) ; r_21=BRANCH. data ( : , 1 1 ) ; r_22=BRANCH. data ( : , 1 2 ) ; x_00=BRANCH. data ( : , 1 3 ) ; x_01=BRANCH. data ( : , 1 4 ) ; x_02=BRANCH. data ( : , 1 5 ) ; x_10=BRANCH. data ( : , 1 6 ) ; x_11=BRANCH. data ( : , 1 7 ) ; x_12=BRANCH. data ( : , 1 8 ) ; x_20=BRANCH. data ( : , 1 9 ) ; x_21=BRANCH. data ( : , 2 0 ) ; x_22=BRANCH. data ( : , 2 1 ) ; PhaseA=BRANCH. data ( : , 2 2 ) ; PhaseB=BRANCH. data ( : , 2 3 ) ; PhaseC=BRANCH. data ( : , 2 4 ) ; Trans=BRANCH. data ( : , 2 5 ) ; f t=BRANCH. data ( : , 2 6 ) ∗ 0 . 0 0 0 1 8 9 3 9 3 9 3 9 ; busM=BUSM. data ( : , 1 ) ; Pload_0m=BUSM. data ( : , 2 ) ; Pload_1m=BUSM. data ( : , 3 ) ; Pload_2m=BUSM. data ( : , 4 ) ; Qload_0m=BUSM. data ( : , 5 ) ; Qload_1m=BUSM. data ( : , 6 ) ; Qload_2m=BUSM. data ( : , 7 ) ; %∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ENTER DATA∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ Nn=length ( bus ) ; %number o f nodes Nb=length ( branch ) ; %number o f b r a n c h e s Sbase =500 e3 ; %kVA Vh= ( 4 . 1 6 ) ∗ 1 e3 ; Zbase =(Vh^ 2 ) / Sbase ; %Zbase y b a s e =1./ Zbase ; %Ybase Sbase1P =500/3; % %∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗SYMBOLIC VARIABLES∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ Ppq_0=sym ( ’ Ppq_0 ’ , [ 1 length ( branch ) ] ) ; Ppq_1=sym ( ’ Ppq_1 ’ , [ 1 length ( branch ) ] ) ; Ppq_2=sym ( ’ Ppq_2 ’ , [ 1 length ( branch ) ] ) ; Pqp_0=sym ( ’ Pqp_0 ’ , [ 1 length ( branch ) ] ) ; Pqp_1=sym ( ’ Pqp_1 ’ , [ 1 length ( branch ) ] ) ; Pqp_2=sym ( ’ Pqp_2 ’ , [ 1 length ( branch ) ] ) ; Qpq_0=sym ( ’Qpq_0 ’ , [ 1 length ( branch ) ] ) ; Qpq_1=sym ( ’Qpq_1 ’ , [ 1 length ( branch ) ] ) ; Qpq_2=sym ( ’Qpq_2 ’ , [ 1 length ( branch ) ] ) ;
166
A.2 MATLAB code
Qqp_0=sym ( ’Qqp_0 ’ , [ 1 length ( branch ) ] ) ; Qqp_1=sym ( ’Qqp_1 ’ , [ 1 length ( branch ) ] ) ; Qqp_2=sym ( ’Qqp_2 ’ , [ 1 length ( branch ) ] ) ; PL_0=sym ( ’PL_0 ’ , [ 1 Nn ] ) ; PL_1=sym ( ’PL_1 ’ , [ 1 Nn ] ) ; PL_2=sym ( ’PL_2 ’ , [ 1 Nn ] ) ; QL_0=sym ( ’QL_0 ’ , [ 1 Nn ] ) ; QL_1=sym ( ’QL_1 ’ , [ 1 Nn ] ) ; QL_2=sym ( ’QL_2 ’ , [ 1 Nn ] ) ; V_0=sym ( ’V_0 ’ , [ 1 Nn ] ) ; V_1=sym ( ’V_1 ’ , [ 1 Nn ] ) ; V_2=sym ( ’V_2 ’ , [ 1 Nn ] ) ; d_0=sym ( ’ d_0 ’ , [ 1 Nn ] ) ; d_1=sym ( ’ d_1 ’ , [ 1 Nn ] ) ; d_2=sym ( ’ d_2 ’ , [ 1 Nn ] ) ; % %∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ W e i g h t i n g f a c t o r s ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ wPL=100; wQL=100; % %∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗MEASUREMENTS∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ PL_0m=nonzeros ( Pload_0m/ Sbase1P ) ; PL_0m=PL_0m ’ ; PL_1m=nonzeros ( Pload_1m/ Sbase1P ) ; PL_1m=PL_1m ’ ; PL_2m=nonzeros ( Pload_2m/ Sbase1P ) ; PL_2m=PL_2m ’ ; QL_0m=nonzeros ( Qload_0m/ Sbase1P ) ; QL_0m=QL_0m’ ; QL_1m=nonzeros ( Qload_1m/ Sbase1P ) ; QL_1m=QL_1m’ ; QL_2m=nonzeros ( Qload_2m/ Sbase1P ) ; QL_2m=QL_2m’ ; % %∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ PARAMETERS ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ Eq1 = [ ] ; Eq2 = [ ] ; Ppq = [ ] ; Qpq = [ ] ; %f i x i n g v o l t a g e and a n g l e o f s l a c k b u s 1 V_01=BUS . data ( 1 , 2 ) ; V_11=BUS . data ( 1 , 3 ) ; V_21=BUS . data ( 1 , 4 ) ; d_01=BUS . data ( 1 , 5 ) ∗ pi / 1 8 0 ; d_11=BUS . data ( 1 , 6 ) ∗ pi / 1 8 0 ; d_21=BUS . data ( 1 , 7 ) ∗ pi / 1 8 0 ; % %∗∗∗∗ ∗∗∗∗∗∗∗∗ ∗∗∗∗∗∗∗ ∗∗∗∗∗∗∗∗ ∗∗∗∗∗∗∗ ∗∗∗∗∗∗∗∗ ∗∗∗∗∗∗∗ ∗∗∗∗∗∗∗∗ ∗∗∗∗∗ %Y and t h e t a f o r k =1: length ( branch ) Zpu1=y b a s e ∗ f t ( k ) ∗ [ r_00 ( k)+1 i ∗x_00 ( k ) r_01 ( k)+1 i ∗x_01 ( k ) r_02 ( k)+1 i ∗x_02 ( k ) ] ; Zpu2=y b a s e ∗ f t ( k ) ∗ [ r_10 ( k)+1 i ∗x_10 ( k ) r_11 ( k)+1 i ∗x_11 ( k ) r_12 ( k)+1 i ∗x_12 ( k ) ] ; Zpu3=y b a s e ∗ f t ( k ) ∗ [ r_20 ( k)+1 i ∗x_20 ( k ) r_21 ( k)+1 i ∗x_21 ( k ) r_22 ( k)+1 i ∗x_22 ( k ) ] ; Zpu=[Zpu1 ( Zpu1 ~=0); Zpu2 ( Zpu2 ~=0); Zpu3 ( Zpu3 ~ = 0 ) ] ; ypu=inv ( Zpu ) ; Y=abs ( ypu ) ; t h e t a p p=atan2 ( imag ( ypu ) , r e a l ( ypu ) ) ; t h e t a p q=atan2(−imag ( ypu ) , −r e a l ( ypu ) ) ; i f Trans ( k)==1 %Transformer Y=[Y( 1 , 1 ) 0 0 ; 0 Y( 1 , 1 ) 0 ; 0 0 Y ( 1 , 1 ) ] ; t h e t a p p =[ t h e t a p p ( 1 , 1 ) 0 0 ; 0 thetapp ( 1 , 1 ) 0 ; 0 0 thetapp ( 1 , 1 ) ] ; t h e t a p q =[ t h e t a p q ( 1 , 1 ) 0 0 ; 0 thetapq (1 ,1) 0 ; 0 0 thetapq ( 1 , 1 ) ] ; e l s e i f PhaseB ( k)==0 & PhaseC ( k)==0 %Phase A Y=[Y( 1 , 1 ) 0 0 ; 0 0 0 ; 0 0 0 ] ; t h e t a p p =[ t h e t a p p ( 1 , 1 ) 0 0 ; 0 0 0 ; 0 0 0 ] ; t h e t a p q =[ t h e t a p q ( 1 , 1 ) 0 0 ; 0 0 0 ; 0 0 0 ] ; e l s e i f PhaseA ( k)==0 & PhaseC ( k)==0 %Phase B
167
Chapter A
Appendix
Y=[0 0 0 ; 0 Y( 1 , 1 ) 0 ; 0 0 0 ] ; t h e t a p p =[0 0 0 ; 0 t h e t a p p ( 1 , 1 ) 0 ; 0 0 0 ] ; t h e t a p q =[0 0 0 ; 0 t h e t a p q ( 1 , 1 ) 0 ; 0 0 0 ] ; e l s e i f PhaseA ( k)==0 & PhaseB ( k)==0 %Phase C Y=[0 0 0 ; 0 0 0 ; 0 0 Y ( 1 , 1 ) ] ; t h e t a p p =[0 0 0 ; 0 0 0 ; 0 0 t h e t a p p ( 1 , 1 ) ] ; t h e t a p q =[0 0 0 ; 0 0 0 ; 0 0 t h e t a p q ( 1 , 1 ) ] ; e l s e i f PhaseC ( k)==0 %Phase AB Y=[Y( 1 , 1 ) Y( 1 , 2 ) 0 ; Y( 2 , 1 ) Y( 2 , 2 ) 0 ; 0 0 0 ] ; t h e t a p p =[ t h e t a p p ( 1 , 1 ) t h e t a p p ( 1 , 2 ) 0 ; thetapp ( 2 , 1 ) thetapp ( 2 , 2 ) 0 ; 0 0 0 ] ; t h e t a p q =[ t h e t a p q ( 1 , 1 ) t h e t a p q ( 1 , 2 ) 0 ; thetapq (2 ,1) thetapq (2 ,2) 0 ; 0 0 0 ] ; e l s e i f PhaseB ( k)==0 %Phase AC Y=[Y( 1 , 1 ) 0 Y( 1 , 2 ) ; 0 0 0 ; Y( 2 , 1 ) 0 Y ( 2 , 2 ) ] ; t h e t a p p =[ t h e t a p p ( 1 , 1 ) 0 t h e t a p p ( 1 , 2 ) ; 0 0 0 ; thetapp ( 2 , 1 ) 0 thetapp ( 2 , 2 ) ] ; t h e t a p q =[ t h e t a p q ( 1 , 1 ) 0 t h e t a p q ( 1 , 2 ) ; 0 0 0 ; thetapq (2 ,1) 0 thetapq ( 2 , 2 ) ] ; e l s e i f PhaseA ( k)==0 %Phase BC Y=[0 0 0 ; 0 Y( 1 , 1 ) Y( 1 , 2 ) ; 0 Y( 2 , 1 ) Y ( 2 , 2 ) ] ; t h e t a p p =[0 0 0 ; 0 t h e t a p p ( 1 , 1 ) t h e t a p p ( 1 , 2 ) ; 0 thetapp ( 2 , 1 ) thetapp ( 2 , 2 ) ] ; t h e t a p q =[0 0 0 ; 0 t h e t a p q ( 1 , 1 ) t h e t a p q ( 1 , 2 ) ; 0 thetapq (2 ,1) thetapq ( 2 , 2 ) ] ; end ; end ; end ; end ; end ; end ; end ; %∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ CONSTRAINTS ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ f o r p=1:Nn f o r q =1:Nn %∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ %Ppq , Pqp , Qpq , Qqp i f ismember ( p , from ( k ) ) & ismember ( q , t o ( k ) ) & PhaseA ( k)~=0 CPpq_0=Ppq_0 ( k)− (V_0( p ) ∗V_0( p ) ∗Y( 1 , 1 ) ∗ cos ( d_0 ( p ) − d_0 ( p ) − t h e t a p p ( 1 , 1 ) ) + V_0( p ) ∗V_0( q ) ∗Y( 1 , 1 ) ∗ cos ( d_0 ( p ) − d_0 ( q ) − t h e t a p q ( 1 , 1 ) ) + V_0( p ) ∗V_1( p ) ∗Y( 1 , 2 ) ∗ cos ( d_0 ( p ) − d_1 ( p ) − t h e t a p p ( 1 , 2 ) ) + V_0( p ) ∗V_1( q ) ∗Y( 1 , 2 ) ∗ cos ( d_0 ( p ) − d_1 ( q ) − t h e t a p q ( 1 , 2 ) ) + V_0( p ) ∗V_2( p ) ∗Y( 1 , 3 ) ∗ cos ( d_0 ( p ) − d_2 ( p ) − t h e t a p p ( 1 , 3 ) ) + V_0( p ) ∗V_2( q ) ∗Y( 1 , 3 ) ∗ cos ( d_0 ( p ) − d_2 ( q ) − t h e t a p q ( 1 , 3 ) ) ) ; CQpq_0=Qpq_0( k)− (V_0( p ) ∗V_0( p ) ∗Y( 1 , 1 ) ∗ s i n ( d_0 ( p ) − d_0 ( p ) − t h e t a p p ( 1 , 1 ) ) + V_0( p ) ∗V_0( q ) ∗Y( 1 , 1 ) ∗ s i n ( d_0 ( p ) − d_0 ( q ) − t h e t a p q ( 1 , 1 ) ) + V_0( p ) ∗V_1( p ) ∗Y( 1 , 2 ) ∗ s i n ( d_0 ( p ) − d_1 ( p ) − t h e t a p p ( 1 , 2 ) ) + V_0( p ) ∗V_1( q ) ∗Y( 1 , 2 ) ∗ s i n ( d_0 ( p ) − d_1 ( q ) − t h e t a p q ( 1 , 2 ) ) + V_0( p ) ∗V_2( p ) ∗Y( 1 , 3 ) ∗ s i n ( d_0 ( p ) − d_2 ( p ) − t h e t a p p ( 1 , 3 ) ) + V_0( p ) ∗V_2( q ) ∗Y( 1 , 3 ) ∗ s i n ( d_0 ( p ) − d_2 ( q ) − t h e t a p q ( 1 , 3 ) ) ) ; CPqp_0=Pqp_0 ( k)− (V_0( q ) ∗V_0( q ) ∗Y( 1 , 1 ) ∗ cos ( d_0 ( q ) − d_0 ( q ) − t h e t a p p ( 1 , 1 ) ) + V_0( q ) ∗V_0( p ) ∗Y( 1 , 1 ) ∗ cos ( d_0 ( q ) − d_0 ( p ) − t h e t a p q ( 1 , 1 ) ) + V_0( q ) ∗V_1( q ) ∗Y( 1 , 2 ) ∗ cos ( d_0 ( q ) − d_1 ( q ) − t h e t a p p ( 1 , 2 ) ) + V_0( q ) ∗V_1( p ) ∗Y( 1 , 2 ) ∗ cos ( d_0 ( q ) − d_1 ( p ) − t h e t a p q ( 1 , 2 ) ) + V_0( q ) ∗V_2( q ) ∗Y( 1 , 3 ) ∗ cos ( d_0 ( q ) − d_2 ( q ) − t h e t a p p ( 1 , 3 ) ) + V_0( q ) ∗V_2( p ) ∗Y( 1 , 3 ) ∗ cos ( d_0 ( q ) − d_2 ( p ) − t h e t a p q ( 1 , 3 ) ) ) ; CQqp_0=Qqp_0( k)− (V_0( q ) ∗V_0( q ) ∗Y( 1 , 1 ) ∗ s i n ( d_0 ( q ) − d_0 ( q ) − t h e t a p p ( 1 , 1 ) ) + V_0( q ) ∗V_0( p ) ∗Y( 1 , 1 ) ∗ s i n ( d_0 ( q ) − d_0 ( p ) − t h e t a p q ( 1 , 1 ) ) +
168
A.2 MATLAB code V_0( q ) ∗V_1( q ) ∗Y( 1 , 2 ) ∗ s i n ( d_0 ( q ) − d_1 ( q ) − t h e t a p p ( 1 , 2 ) ) + V_0( q ) ∗V_1( p ) ∗Y( 1 , 2 ) ∗ s i n ( d_0 ( q ) − d_1 ( p ) − t h e t a p q ( 1 , 2 ) ) + V_0( q ) ∗V_2( q ) ∗Y( 1 , 3 ) ∗ s i n ( d_0 ( q ) − d_2 ( q ) − t h e t a p p ( 1 , 3 ) ) + V_0( q ) ∗V_2( p ) ∗Y( 1 , 3 ) ∗ s i n ( d_0 ( q ) − d_2 ( p ) − t h e t a p q ( 1 , 3 ) ) ) ; PpqV_0= Ppq_0 ( k ) ; QpqV_0= Qpq_0( k ) ; PqpV_0= Pqp_0 ( k ) ; QqpV_0= Qqp_0( k ) ; else i f PhaseA ( k)==0 CPpq_0 = [ ] ; PpqV_0 = [ ] ; CQpq_0 = [ ] ; QpqV_0 = [ ] ; CPqp_0 = [ ] ; PqpV_0 = [ ] ; CQqp_0 = [ ] ; QqpV_0 = [ ] ; end ; end ; i f ismember ( p , from ( k ) ) & ismember ( q , t o ( k ) ) & PhaseB ( k)~=0 CPpq_1=Ppq_1 ( k)− (V_1( p ) ∗V_0( p ) ∗Y( 2 , 1 ) ∗ cos ( d_1 ( p ) − d_0 ( p ) − t h e t a p p ( 2 , 1 ) ) + V_1( p ) ∗V_0( q ) ∗Y( 2 , 1 ) ∗ cos ( d_1 ( p ) − d_0 ( q ) − t h e t a p q ( 2 , 1 ) ) + V_1( p ) ∗V_1( p ) ∗Y( 2 , 2 ) ∗ cos ( d_1 ( p ) − d_1 ( p ) − t h e t a p p ( 2 , 2 ) ) + V_1( p ) ∗V_1( q ) ∗Y( 2 , 2 ) ∗ cos ( d_1 ( p ) − d_1 ( q ) − t h e t a p q ( 2 , 2 ) ) + V_1( p ) ∗V_2( p ) ∗Y( 2 , 3 ) ∗ cos ( d_1 ( p ) − d_2 ( p ) − t h e t a p p ( 2 , 3 ) ) + V_1( p ) ∗V_2( q ) ∗Y( 2 , 3 ) ∗ cos ( d_1 ( p ) − d_2 ( q ) − t h e t a p q ( 2 , 3 ) ) ) ; CQpq_1=Qpq_1( k)− (V_1( p ) ∗V_0( p ) ∗Y( 2 , 1 ) ∗ s i n ( d_1 ( p ) − d_0 ( p ) − t h e t a p p ( 2 , 1 ) ) + V_1( p ) ∗V_0( q ) ∗Y( 2 , 1 ) ∗ s i n ( d_1 ( p ) − d_0 ( q ) − t h e t a p q ( 2 , 1 ) ) + V_1( p ) ∗V_1( p ) ∗Y( 2 , 2 ) ∗ s i n ( d_1 ( p ) − d_1 ( p ) − t h e t a p p ( 2 , 2 ) ) + V_1( p ) ∗V_1( q ) ∗Y( 2 , 2 ) ∗ s i n ( d_1 ( p ) − d_1 ( q ) − t h e t a p q ( 2 , 2 ) ) + V_1( p ) ∗V_2( p ) ∗Y( 2 , 3 ) ∗ s i n ( d_1 ( p ) − d_2 ( p ) − t h e t a p p ( 2 , 3 ) ) + V_1( p ) ∗V_2( q ) ∗Y( 2 , 3 ) ∗ s i n ( d_1 ( p ) − d_2 ( q ) − t h e t a p q ( 2 , 3 ) ) ) ; CPqp_1=Pqp_1 ( k)− (V_1( q ) ∗V_0( q ) ∗Y( 2 , 1 ) ∗ cos ( d_1 ( q ) − d_0 ( q ) − t h e t a p p ( 2 , 1 ) ) + V_1( q ) ∗V_0( p ) ∗Y( 2 , 1 ) ∗ cos ( d_1 ( q ) − d_0 ( p ) − t h e t a p q ( 2 , 1 ) ) + V_1( q ) ∗V_1( q ) ∗Y( 2 , 2 ) ∗ cos ( d_1 ( q ) − d_1 ( q ) − t h e t a p p ( 2 , 2 ) ) + V_1( q ) ∗V_1( p ) ∗Y( 2 , 2 ) ∗ cos ( d_1 ( q ) − d_1 ( p ) − t h e t a p q ( 2 , 2 ) ) + V_1( q ) ∗V_2( q ) ∗Y( 2 , 3 ) ∗ cos ( d_1 ( q ) − d_2 ( q ) − t h e t a p p ( 2 , 3 ) ) + V_1( q ) ∗V_2( p ) ∗Y( 2 , 3 ) ∗ cos ( d_1 ( q ) − d_2 ( p ) − t h e t a p q ( 2 , 3 ) ) ) ; CQqp_1=Qqp_1( k)− (V_1( q ) ∗V_0( q ) ∗Y( 2 , 1 ) ∗ s i n ( d_1 ( q ) − d_0 ( q ) − t h e t a p p ( 2 , 1 ) ) + V_1( q ) ∗V_0( p ) ∗Y( 2 , 1 ) ∗ s i n ( d_1 ( q ) − d_0 ( p ) − t h e t a p q ( 2 , 1 ) ) + V_1( q ) ∗V_1( q ) ∗Y( 2 , 2 ) ∗ s i n ( d_1 ( q ) − d_1 ( q ) − t h e t a p p ( 2 , 2 ) ) + V_1( q ) ∗V_1( p ) ∗Y( 2 , 2 ) ∗ s i n ( d_1 ( q ) − d_1 ( p ) − t h e t a p q ( 2 , 2 ) ) + V_1( q ) ∗V_2( q ) ∗Y( 2 , 3 ) ∗ s i n ( d_1 ( q ) − d_2 ( q ) − t h e t a p p ( 2 , 3 ) ) + V_1( q ) ∗V_2( p ) ∗Y( 2 , 3 ) ∗ s i n ( d_1 ( q ) − d_2 ( p ) − t h e t a p q ( 2 , 3 ) ) ) ; PpqV_1= Ppq_1 ( k ) ; QpqV_1= Qpq_1( k ) ; PqpV_1= Pqp_1 ( k ) ; QqpV_1= Qqp_1( k ) ; e l s e i f PhaseB ( k)==0 CPpq_1 = [ ] ; PpqV_1 = [ ] ; CQpq_1 = [ ] ; QpqV_1 = [ ] ; CPqp_1 = [ ] ; PqpV_1 = [ ] ; CQqp_1 = [ ] ; QqpV_1 = [ ] ; end ; end ; i f ismember ( p , from ( k ) ) & ismember ( q , t o ( k ) ) & PhaseC ( k)~=0 CPpq_2=Ppq_2 ( k)− (V_2( p ) ∗V_0( p ) ∗Y( 3 , 1 ) ∗ cos ( d_2 ( p ) − d_0 ( p ) − t h e t a p p ( 3 , 1 ) ) + V_2( p ) ∗V_0( q ) ∗Y( 3 , 1 ) ∗ cos ( d_2 ( p ) − d_0 ( q ) − t h e t a p q ( 3 , 1 ) ) + V_2( p ) ∗V_1( p ) ∗Y( 3 , 2 ) ∗ cos ( d_2 ( p ) − d_1 ( p ) − t h e t a p p ( 3 , 2 ) ) + V_2( p ) ∗V_1( q ) ∗Y( 3 , 2 ) ∗ cos ( d_2 ( p ) − d_1 ( q ) − t h e t a p q ( 3 , 2 ) ) + V_2( p ) ∗V_2( p ) ∗Y( 3 , 3 ) ∗ cos ( d_2 ( p ) − d_2 ( p ) − t h e t a p p ( 3 , 3 ) ) + V_2( p ) ∗V_2( q ) ∗Y( 3 , 3 ) ∗ cos ( d_2 ( p ) − d_2 ( q ) − t h e t a p q ( 3 , 3 ) ) ) ; CQpq_2=Qpq_2( k)− (V_2( p ) ∗V_0( p ) ∗Y( 3 , 1 ) ∗ s i n ( d_2 ( p ) − d_0 ( p ) − t h e t a p p ( 3 , 1 ) ) + V_2( p ) ∗V_0( q ) ∗Y( 3 , 1 ) ∗ s i n ( d_2 ( p ) − d_0 ( q ) − t h e t a p q ( 3 , 1 ) ) +
169
Chapter A
Appendix
V_2( p ) ∗V_1( p ) ∗Y( 3 , 2 ) ∗ s i n ( d_2 ( p ) − d_1 ( p ) − t h e t a p p ( 3 , 2 ) ) + V_2( p ) ∗V_1( q ) ∗Y( 3 , 2 ) ∗ s i n ( d_2 ( p ) − d_1 ( q ) − t h e t a p q ( 3 , 2 ) ) + V_2( p ) ∗V_2( p ) ∗Y( 3 , 3 ) ∗ s i n ( d_2 ( p ) − d_2 ( p ) − t h e t a p p ( 3 , 3 ) ) + V_2( p ) ∗V_2( q ) ∗Y( 3 , 3 ) ∗ s i n ( d_2 ( p ) − d_2 ( q ) − t h e t a p q ( 3 , 3 ) ) ) ; CPqp_2=Pqp_2 ( k)− (V_2( q ) ∗V_0( q ) ∗Y( 3 , 1 ) ∗ cos ( d_2 ( q ) − d_0 ( q ) − t h e t a p p ( 3 , 1 ) ) + V_2( q ) ∗V_0( p ) ∗Y( 3 , 1 ) ∗ cos ( d_2 ( q ) − d_0 ( p ) − t h e t a p q ( 3 , 1 ) ) + V_2( q ) ∗V_1( q ) ∗Y( 3 , 2 ) ∗ cos ( d_2 ( q ) − d_1 ( q ) − t h e t a p p ( 3 , 2 ) ) + V_2( q ) ∗V_1( p ) ∗Y( 3 , 2 ) ∗ cos ( d_2 ( q ) − d_1 ( p ) − t h e t a p q ( 3 , 2 ) ) + V_2( q ) ∗V_2( q ) ∗Y( 3 , 3 ) ∗ cos ( d_2 ( q ) − d_2 ( q ) − t h e t a p p ( 3 , 3 ) ) + V_2( q ) ∗V_2( p ) ∗Y( 3 , 3 ) ∗ cos ( d_2 ( q ) − d_2 ( p ) − t h e t a p q ( 3 , 3 ) ) ) ; CQqp_2=Qqp_2( k)− (V_2( q ) ∗V_0( q ) ∗Y( 3 , 1 ) ∗ s i n ( d_2 ( q ) − d_0 ( q ) − t h e t a p p ( 3 , 1 ) ) + V_2( q ) ∗V_0( p ) ∗Y( 3 , 1 ) ∗ s i n ( d_2 ( q ) − d_0 ( p ) − t h e t a p q ( 3 , 1 ) ) + V_2( q ) ∗V_1( q ) ∗Y( 3 , 2 ) ∗ s i n ( d_2 ( q ) − d_1 ( q ) − t h e t a p p ( 3 , 2 ) ) + V_2( q ) ∗V_1( p ) ∗Y( 3 , 2 ) ∗ s i n ( d_2 ( q ) − d_1 ( p ) − t h e t a p q ( 3 , 2 ) ) + V_2( q ) ∗V_2( q ) ∗Y( 3 , 3 ) ∗ s i n ( d_2 ( q ) − d_2 ( q ) − t h e t a p p ( 3 , 3 ) ) + V_2( q ) ∗V_2( p ) ∗Y( 3 , 3 ) ∗ s i n ( d_2 ( q ) − d_2 ( p ) − t h e t a p q ( 3 , 3 ) ) ) ; PpqV_2= Ppq_2 ( k ) ; QpqV_2= Qpq_2( k ) ; PqpV_2= Pqp_2 ( k ) ; QqpV_2= Qqp_2( k ) ; e l s e i f PhaseC ( k)==0 CPpq_2 = [ ] ; PpqV_2 = [ ] ; CQpq_2 = [ ] ; QpqV_2 = [ ] ; CPqp_2 = [ ] ; PqpV_2 = [ ] ; CQqp_2 = [ ] ; QqpV_2 = [ ] ; end ; end ; end end %∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ Ppq= [ Ppq PpqV_0 PpqV_1 PpqV_2 PqpV_0 PqpV_1 PqpV_2 ] ; Qpq= [ Qpq QpqV_0 QpqV_1 QpqV_2 QqpV_0 QqpV_1 QqpV_2 ] ; Eq1=[Eq1 CPpq_0 CPpq_1 CPpq_2 CPqp_0 CPqp_1 CPqp_2 CQpq_0 CQpq_1 CQpq_2 CQqp_0 CQqp_1 CQqp_2 ] ; end %For each node : Pg−PL−sum ( P i j )=0 and Qg−QL−sum ( Q i j )=0 Pl_0 =0; Pl_1 =0; Pl_2 =0; Ql_0=0; Ql_1=0; Ql_2=0; f o r n=2:Nn sumP_0=0; sumP_1=0; sumP_2=0; sumQ_0=0; sumQ_1=0; sumQ_2=0; f o r k =1: length ( branch ) i f ismember ( n , from ( k ) ) & PhaseA ( k)~=0 sumP_0=sumP_0+Ppq_0 ( k ) ; sumQ_0=sumQ_0+Qpq_0( k ) ; e l s e i f ismember ( n , t o ( k ))& PhaseA ( k)~=0 sumP_0=sumP_0+Pqp_0 ( k ) ; sumQ_0=sumQ_0+Qqp_0( k ) ; end ; end ; i f ismember ( n , from ( k ) ) & PhaseB ( k)~=0 sumP_1=sumP_1+Ppq_1 ( k ) ; sumQ_1=sumQ_1+Qpq_1( k ) ; e l s e i f ismember ( n , t o ( k ))& PhaseB ( k)~=0 sumP_1=sumP_1+Pqp_1 ( k ) ; sumQ_1=sumQ_1+Qqp_1( k ) ; end ; end ; i f ismember ( n , from ( k ) ) & PhaseC ( k)~=0 sumP_2=sumP_2+Ppq_2 ( k ) ; sumQ_2=sumQ_2+Qpq_2( k ) ; e l s e i f ismember ( n , t o ( k ))& PhaseC ( k)~=0
170
A.2 MATLAB code
sumP_2=sumP_2+Pqp_2 ( k ) ; sumQ_2=sumQ_2+Qqp_2( k ) ; end ; end ; end %Pload and Qload where we have measurements i f Pload_0m ( n)~=0 Pload_0=PL_0( n ) ; Qload_0=QL_0( n ) ; e l s e i f Pload_0m ( n)==0 Pload_0 =0; Qload_0 =0; end ; end ; i f Pload_1m ( n)~=0 Pload_1=PL_1( n ) ; Qload_1=QL_1( n ) ; e l s e i f Pload_1m ( n)==0 Pload_1 =0; Qload_1 =0; end ; end ; i f Pload_2m ( n)~=0 Pload_2=PL_2( n ) ; Qload_2=QL_2( n ) ; e l s e i f Pload_2m ( n)==0 Pload_2 =0; Qload_2 =0; end ; end ; sumP_0=Pgen_0 ( n)−Pload_0−sumP_0 ; sumP_1=Pgen_1 ( n)−Pload_1−sumP_1 ; sumP_2=Pgen_2 ( n)−Pload_2−sumP_2 ; sumQ_0=Qgen_0 ( n)−Qload_0−sumQ_0 ; sumQ_1=Qgen_1 ( n)−Qload_1−sumQ_1 ; sumQ_2=Qgen_2 ( n)−Qload_2−sumQ_2 ; Pl_0=[Pl_0 Pload_0 ] ; Pl_1=[Pl_1 Pload_1 ] ; Pl_2=[Pl_2 Pload_2 ] ; Ql_0=[Ql_0 Qload_0 ] ; Ql_1=[Ql_1 Qload_1 ] ; Ql_2=[Ql_2 Qload_2 ] ; Eq2= [ Eq2 sumP_0 sumP_1 sumP_2 sumQ_0 sumQ_1 sumQ_2 ] ; end Eq2=Eq2 ( Eq2 ~=0); %∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ %t a k i n g s y m b o l i c v a r i a b l e j u s t where we have v a l u e %f o r PLoad and Qload PL_0=Pl_0 ( Pl_0 ~=0);PL_1=Pl_1 ( Pl_1 ~=0); PL_2=Pl_2 ( Pl_2 ~=0);QL_0=Ql_0 ( Ql_0 ~=0); QL_1=Ql_1 ( Ql_1 ~=0);QL_2=Ql_2 ( Ql_2 ~=0); %f o r V o l t a g e and Angle vv_0 = [ ] ; vv_1 = [ ] ; vv_2 = [ ] ; dv_0 = [ ] ; dv_1 = [ ] ; dv_2 = [ ] ; f o r n=1:Nn i f v_0 ( n)~=0 v o l t a g e _ 0=V_0( n ) ; angle_0=d_0 ( n ) ; e l s e i f v_0 ( n)==0 v o l t a g e _ 0 = [ ] ; angle_0 = [ ] ; end ; end ; i f v_1 ( n)~=0 v o l t a g e _ 1=V_1( n ) ; angle_1=d_1 ( n ) ; e l s e i f v_1 ( n)==0 v o l t a g e _ 1 = [ ] ; angle_1 = [ ] ; end ; end ; i f v_2 ( n)~=0 v o l t a g e _ 2=V_2( n ) ; angle_2=d_2 ( n ) ; e l s e i f v_2 ( n)==0 v o l t a g e _ 2 = [ ] ; angle_2 = [ ] ; end ; end ; vv_0=[vv_0 v o l t a g e _ 0 ] ; vv_1=[vv_1 v o l t a g e _ 1 ] ; vv_2=[vv_2 v o l t a g e _ 2 ] ; dv_0=[dv_0 angle_0 ] ; dv_1=[dv_1 angle_1 ] ; dv_2=[dv_2 angle_2 ] ; end V_0=vv_0 ; V_1=vv_1 ; V_2=vv_2 ; d_0=dv_0 ; d_1=dv_1 ; d_2=dv_2 ;
171
Chapter A
Appendix
%∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗MATRIX∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ %Matrix o f e q u a l i t y c o n s t r a i n t s Con=[Eq1 Eq2 ] ; %Matrix o f v a r i a b l e s X=[V_0 ( 2 : length (V_0) ) V_1 ( 2 : length (V_1) ) V_2 ( 2 : length (V_2) ) d_0 ( 2 : length ( d_0 ) ) d_1 ( 2 : length ( d_1 ) ) d_2 ( 2 : length ( d_2 ) ) Ppq Qpq PL_0 PL_1 PL_2 QL_0 QL_1 QL_2 ] ; %Matrix C C=j a c o b i a n ( Con ,X ) ; %Matrix d e l t a Z ( k)− d e r i v a t i v e o f O b j e c t i v e Objec_0 =0; Objec_1 =0; Objec_2 =0; f o r k =1: length (PL_0) Objec_0=Objec_0 + 0 . 5 ∗ ( (PL_0( k)−PL_0m( k ) ) . ^ 2 +(QL_0( k)−QL_0m( k ) ) . ^ 2 ) ; end ; f o r k =1: length (PL_1) Objec_1=Objec_1 + 0 . 5 ∗ ( (PL_1( k)−PL_1m( k ) ) . ^ 2 +(QL_1( k)−QL_1m( k ) ) . ^ 2 ) ; end ; f o r k =1: length (PL_2) Objec_2=Objec_2 + 0 . 5 ∗ ( (PL_2( k)−PL_2m( k ) ) . ^ 2 +(QL_2( k)−QL_2m( k ) ) . ^ 2 ) ; end ; Objec=Objec_0+Objec_1+Objec_2 ; dzk=gradient ( Objec , X ) ; %Matrix ck ck=Con . ’ ; %Matrix W f o r k =1: length ( dzk ) i f dzk ( k)==0 W1( k )=0; else i f ismember ( k , ( length ( dzk)−1−(length (QL_0) +length (QL_1)+length (QL_2 ) ) : length ( dzk ) ) ) W1( k)=wQL; else W1( k)=wPL ; end ; end ; end W=diag (W1) ; % % Matrix A ( l e f t s i d e ) A=[W C ’ ; C zeros ( length ( Con ) , length ( Con ) ) ] ;
%AxX=B
% %Matrix B ( r i g h t s i d e ) B=[−W∗ dzk ; −ck ] ; %∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗VARIABLES∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ Ppq = [ ] ; Qpq = [ ] ; V_0=v_0 ; V_1=v_1 ; V_2=v_2 ; d_0=dd_0 ; d_1=dd_1 ; d_2=dd_2 ; f o r k =1: length ( branch )
172
A.2 MATLAB code Zpu1=y b a s e ∗ f t ( k ) ∗ [ r_00 ( k)+1 i ∗x_00 ( k ) r_01 ( k)+1 i ∗x_01 ( k ) r_02 ( k)+1 i ∗x_02 ( k ) ] ; Zpu2=y b a s e ∗ f t ( k ) ∗ [ r_10 ( k)+1 i ∗x_10 ( k ) r_11 ( k)+1 i ∗x_11 ( k ) r_12 ( k)+1 i ∗x_12 ( k ) ] ; Zpu3=y b a s e ∗ f t ( k ) ∗ [ r_20 ( k)+1 i ∗x_20 ( k ) r_21 ( k)+1 i ∗x_21 ( k ) r_22 ( k)+1 i ∗x_22 ( k ) ] ; Zpu=[Zpu1 ( Zpu1 ~=0); Zpu2 ( Zpu2 ~=0); Zpu3 ( Zpu3 ~ = 0 ) ] ; ypu=inv ( Zpu ) ; Y=abs ( ypu ) ; t h e t a p p=atan2 ( imag ( ypu ) , r e a l ( ypu ) ) ; t h e t a p q=atan2(−imag ( ypu ) , −r e a l ( ypu ) ) ; i f Trans ( k)==1 %Transformer Y=[Y( 1 , 1 ) 0 0 ; 0 Y( 1 , 1 ) 0 ; 0 0 Y ( 1 , 1 ) ] ; t h e t a p p =[ t h e t a p p ( 1 , 1 ) 0 0 ; 0 thetapp ( 1 , 1 ) 0 ; 0 0 thetapp ( 1 , 1 ) ] ; t h e t a p q =[ t h e t a p q ( 1 , 1 ) 0 0 ; 0 thetapq (1 ,1) 0 ; 0 0 thetapq ( 1 , 1 ) ] ; e l s e i f PhaseB ( k)==0 & PhaseC ( k)==0 %Phase A Y=[Y( 1 , 1 ) 0 0 ; 0 0 0 ; 0 0 0 ] ; t h e t a p p =[ t h e t a p p ( 1 , 1 ) 0 0 ; 0 0 0 ; 0 0 0 ] ; t h e t a p q =[ t h e t a p q ( 1 , 1 ) 0 0 ; 0 0 0 ; 0 0 0 ] ; e l s e i f PhaseA ( k)==0 & PhaseC ( k)==0 %Phase B Y=[0 0 0 ; 0 Y( 1 , 1 ) 0 ; 0 0 0 ] ; t h e t a p p =[0 0 0 ; 0 t h e t a p p ( 1 , 1 ) 0 ; 0 0 0 ] ; t h e t a p q =[0 0 0 ; 0 t h e t a p q ( 1 , 1 ) 0 ; 0 0 0 ] ; e l s e i f PhaseA ( k)==0 & PhaseB ( k)==0 %Phase C Y=[0 0 0 ; 0 0 0 ; 0 0 Y ( 1 , 1 ) ] ; t h e t a p p =[0 0 0 ; 0 0 0 ; 0 0 t h e t a p p ( 1 , 1 ) ] ; t h e t a p q =[0 0 0 ; 0 0 0 ; 0 0 t h e t a p q ( 1 , 1 ) ] ; e l s e i f PhaseC ( k)==0 %Phase AB Y=[Y( 1 , 1 ) Y( 1 , 2 ) 0 ; Y( 2 , 1 ) Y( 2 , 2 ) 0 ; 0 0 0 ] ; t h e t a p p =[ t h e t a p p ( 1 , 1 ) t h e t a p p ( 1 , 2 ) 0 ; thetapp ( 2 , 1 ) thetapp ( 2 , 2 ) 0 ; 0 0 0 ] ; t h e t a p q =[ t h e t a p q ( 1 , 1 ) t h e t a p q ( 1 , 2 ) 0 ; thetapq (2 ,1) thetapq (2 ,2) 0 ; 0 0 0 ] ; e l s e i f PhaseB ( k)==0 %Phase AC Y=[Y( 1 , 1 ) 0 Y( 1 , 2 ) ; 0 0 0 ; Y( 2 , 1 ) 0 Y ( 2 , 2 ) ] ; t h e t a p p =[ t h e t a p p ( 1 , 1 ) 0 t h e t a p p ( 1 , 2 ) ; 0 0 0 ; thetapp ( 2 , 1 ) 0 thetapp ( 2 , 2 ) ] ; t h e t a p q =[ t h e t a p q ( 1 , 1 ) 0 t h e t a p q ( 1 , 2 ) ; 0 0 0 ; thetapq (2 ,1) 0 thetapq ( 2 , 2 ) ] ; e l s e i f PhaseA ( k)==0 %Phase BC Y=[0 0 0 ; 0 Y( 1 , 1 ) Y( 1 , 2 ) ; 0 Y( 2 , 1 ) Y ( 2 , 2 ) ] ; t h e t a p p =[0 0 0 ; 0 t h e t a p p ( 1 , 1 ) t h e t a p p ( 1 , 2 ) ; 0 thetapp ( 2 , 1 ) thetapp ( 2 , 2 ) ] ; t h e t a p q =[0 0 0 ; 0 t h e t a p q ( 1 , 1 ) t h e t a p q ( 1 , 2 ) ; 0 thetapq (2 ,1) thetapq ( 2 , 2 ) ] ; end ; end ; end ; end ; end ; end ; end ; f o r p=1:Nn f o r q =1:Nn i f ismember ( p , from ( k ) ) & ismember ( q , t o ( k ) ) & PhaseA ( k)~=0 Ppq_0=(V_0( p ) ∗V_0( p ) ∗Y( 1 , 1 ) ∗ cos ( d_0 ( p ) − d_0 ( p ) − t h e t a p p ( 1 , 1 ) ) + V_0( p ) ∗V_0( q ) ∗Y( 1 , 1 ) ∗ cos ( d_0 ( p ) − d_0 ( q ) − t h e t a p q ( 1 , 1 ) ) + V_0( p ) ∗V_1( p ) ∗Y( 1 , 2 ) ∗ cos ( d_0 ( p ) − d_1 ( p ) − t h e t a p p ( 1 , 2 ) ) + V_0( p ) ∗V_1( q ) ∗Y( 1 , 2 ) ∗ cos ( d_0 ( p ) − d_1 ( q ) − t h e t a p q ( 1 , 2 ) ) + V_0( p ) ∗V_2( p ) ∗Y( 1 , 3 ) ∗ cos ( d_0 ( p ) − d_2 ( p ) − t h e t a p p ( 1 , 3 ) ) +
173
Chapter A
Appendix
V_0( p ) ∗V_2( q ) ∗Y( 1 , 3 ) ∗ cos ( d_0 ( p ) − d_2 ( q ) − t h e t a p q ( 1 , 3 ) ) ) ; Qpq_0=(V_0( p ) ∗V_0( p ) ∗Y( 1 , 1 ) ∗ s i n ( d_0 ( p ) − d_0 ( p ) − t h e t a p p ( 1 , 1 ) ) + V_0( p ) ∗V_0( q ) ∗Y( 1 , 1 ) ∗ s i n ( d_0 ( p ) − d_0 ( q ) − t h e t a p q ( 1 , 1 ) ) + V_0( p ) ∗V_1( p ) ∗Y( 1 , 2 ) ∗ s i n ( d_0 ( p ) − d_1 ( p ) − t h e t a p p ( 1 , 2 ) ) + V_0( p ) ∗V_1( q ) ∗Y( 1 , 2 ) ∗ s i n ( d_0 ( p ) − d_1 ( q ) − t h e t a p q ( 1 , 2 ) ) + V_0( p ) ∗V_2( p ) ∗Y( 1 , 3 ) ∗ s i n ( d_0 ( p ) − d_2 ( p ) − t h e t a p p ( 1 , 3 ) ) + V_0( p ) ∗V_2( q ) ∗Y( 1 , 3 ) ∗ s i n ( d_0 ( p ) − d_2 ( q ) − t h e t a p q ( 1 , 3 ) ) ) ; Pqp_0=(V_0( q ) ∗V_0( q ) ∗Y( 1 , 1 ) ∗ cos ( d_0 ( q ) − d_0 ( q ) − t h e t a p p ( 1 , 1 ) ) + V_0( q ) ∗V_0( p ) ∗Y( 1 , 1 ) ∗ cos ( d_0 ( q ) − d_0 ( p ) − t h e t a p q ( 1 , 1 ) ) + V_0( q ) ∗V_1( q ) ∗Y( 1 , 2 ) ∗ cos ( d_0 ( q ) − d_1 ( q ) − t h e t a p p ( 1 , 2 ) ) + V_0( q ) ∗V_1( p ) ∗Y( 1 , 2 ) ∗ cos ( d_0 ( q ) − d_1 ( p ) − t h e t a p q ( 1 , 2 ) ) + V_0( q ) ∗V_2( q ) ∗Y( 1 , 3 ) ∗ cos ( d_0 ( q ) − d_2 ( q ) − t h e t a p p ( 1 , 3 ) ) + V_0( q ) ∗V_2( p ) ∗Y( 1 , 3 ) ∗ cos ( d_0 ( q ) − d_2 ( p ) − t h e t a p q ( 1 , 3 ) ) ) ; Qqp_0=(V_0( q ) ∗V_0( q ) ∗Y( 1 , 1 ) ∗ s i n ( d_0 ( q ) − d_0 ( q ) − t h e t a p p ( 1 , 1 ) ) + V_0( q ) ∗V_0( p ) ∗Y( 1 , 1 ) ∗ s i n ( d_0 ( q ) − d_0 ( p ) − t h e t a p q ( 1 , 1 ) ) + V_0( q ) ∗V_1( q ) ∗Y( 1 , 2 ) ∗ s i n ( d_0 ( q ) − d_1 ( q ) − t h e t a p p ( 1 , 2 ) ) + V_0( q ) ∗V_1( p ) ∗Y( 1 , 2 ) ∗ s i n ( d_0 ( q ) − d_1 ( p ) − t h e t a p q ( 1 , 2 ) ) + V_0( q ) ∗V_2( q ) ∗Y( 1 , 3 ) ∗ s i n ( d_0 ( q ) − d_2 ( q ) − t h e t a p p ( 1 , 3 ) ) + V_0( q ) ∗V_2( p ) ∗Y( 1 , 3 ) ∗ s i n ( d_0 ( q ) − d_2 ( p ) − t h e t a p q ( 1 , 3 ) ) ) ; else i f PhaseA ( k)==0 Ppq_0 = [ ] ; Qpq_0 = [ ] ; Pqp_0 = [ ] ; Qqp_0 = [ ] ; end ; end ; i f ismember ( p , from ( k ) ) & ismember ( q , t o ( k ) ) & PhaseB ( k)~=0 Ppq_1=(V_1( p ) ∗V_0( p ) ∗Y( 2 , 1 ) ∗ cos ( d_1 ( p ) − d_0 ( p ) − t h e t a p p ( 2 , 1 ) ) + V_1( p ) ∗V_0( q ) ∗Y( 2 , 1 ) ∗ cos ( d_1 ( p ) − d_0 ( q ) − t h e t a p q ( 2 , 1 ) ) + V_1( p ) ∗V_1( p ) ∗Y( 2 , 2 ) ∗ cos ( d_1 ( p ) − d_1 ( p ) − t h e t a p p ( 2 , 2 ) ) + V_1( p ) ∗V_1( q ) ∗Y( 2 , 2 ) ∗ cos ( d_1 ( p ) − d_1 ( q ) − t h e t a p q ( 2 , 2 ) ) + V_1( p ) ∗V_2( p ) ∗Y( 2 , 3 ) ∗ cos ( d_1 ( p ) − d_2 ( p ) − t h e t a p p ( 2 , 3 ) ) + V_1( p ) ∗V_2( q ) ∗Y( 2 , 3 ) ∗ cos ( d_1 ( p ) − d_2 ( q ) − t h e t a p q ( 2 , 3 ) ) ) ; Qpq_1=(V_1( p ) ∗V_0( p ) ∗Y( 2 , 1 ) ∗ s i n ( d_1 ( p ) − d_0 ( p ) − t h e t a p p ( 2 , 1 ) ) + V_1( p ) ∗V_0( q ) ∗Y( 2 , 1 ) ∗ s i n ( d_1 ( p ) − d_0 ( q ) − t h e t a p q ( 2 , 1 ) ) + V_1( p ) ∗V_1( p ) ∗Y( 2 , 2 ) ∗ s i n ( d_1 ( p ) − d_1 ( p ) − t h e t a p p ( 2 , 2 ) ) + V_1( p ) ∗V_1( q ) ) ∗Y( 2 , 3 ) ∗ s i n ( d_1 ( p ) − d_2 ( p ) − t h e t a p p ( 2 , 3 ) ) + V_1( p ) ∗V_2( q ) ∗Y( 2 , 3 ) ∗ s i n ( d_1 ( p ) − d_2 ( q ) − t h e t a p q ( 2 , 3 ) ) ) ; Pqp_1=(V_1( q ) ∗V_0( q ) ∗Y( 2 , 1 ) ∗ cos ( d_1 ( q ) − d_0 ( q ) − t h e t a p p ( 2 , 1 ) ) + V_1( q ) ∗V_0( p∗Y( 2 , 2 ) ∗ s i n ( d_1 ( p ) − d_1 ( q ) − t h e t a p q ( 2 , 2 ) ) + V_1( p ) ∗V_2( p ) ∗Y( 2 , 1 ) ∗ cos ( d_1 ( q ) − d_0 ( p ) − t h e t a p q ( 2 , 1 ) ) + V_1( q ) ∗V_1( q ) ∗Y( 2 , 2 ) ∗ cos ( d_1 ( q ) − d_1 ( q ) − t h e t a p p ( 2 , 2 ) ) + V_1( q ) ∗V_1( p ) ∗Y( 2 , 2 ) ∗ cos ( d_1 ( q ) − d_1 ( p ) − t h e t a p q ( 2 , 2 ) ) + V_1( q ) ∗V_2( q ) ∗Y( 2 , 3 ) ∗ cos ( d_1 ( q ) − d_2 ( q ) − t h e t a p p ( 2 , 3 ) ) + V_1( q ) ∗V_2( p ) ∗Y( 2 , 3 ) ∗ cos ( d_1 ( q ) − d_2 ( p ) − t h e t a p q ( 2 , 3 ) ) ) ; Qqp_1=(V_1( q ) ∗V_0( q ) ∗Y( 2 , 1 ) ∗ s i n ( d_1 ( q ) − d_0 ( q ) − t h e t a p p ( 2 , 1 ) ) + V_1( q ) ∗V_0( p ) ∗Y( 2 , 1 ) ∗ s i n ( d_1 ( q ) − d_0 ( p ) − t h e t a p q ( 2 , 1 ) ) + V_1( q ) ∗V_1( q ) ∗Y( 2 , 2 ) ∗ s i n ( d_1 ( q ) − d_1 ( q ) − t h e t a p p ( 2 , 2 ) ) + V_1( q ) ∗V_1( p ) ∗Y( 2 , 2 ) ∗ s i n ( d_1 ( q ) − d_1 ( p ) − t h e t a p q ( 2 , 2 ) ) + V_1( q ) ∗V_2( q ) ∗Y( 2 , 3 ) ∗ s i n ( d_1 ( q ) − d_2 ( q ) − t h e t a p p ( 2 , 3 ) ) + V_1( q ) ∗V_2( p ) ∗Y( 2 , 3 ) ∗ s i n ( d_1 ( q ) − d_2 ( p ) − t h e t a p q ( 2 , 3 ) ) ) ; else i f PhaseB ( k)==0 Ppq_1 = [ ] ; Qpq_1 = [ ] ; Pqp_1 = [ ] ; Qqp_1 = [ ] ; end ; end ; i f ismember ( p , from ( k ) ) & ismember ( q , t o ( k ) ) & PhaseC ( k)~=0 Ppq_2=(V_2( p ) ∗V_0( p ) ∗Y( 3 , 1 ) ∗ cos ( d_2 ( p ) − d_0 ( p ) − t h e t a p p ( 3 , 1 ) ) + V_2( p ) ∗V_0( q ) ∗Y( 3 , 1 ) ∗ cos ( d_2 ( p ) − d_0 ( q ) − t h e t a p q ( 3 , 1 ) ) + V_2( p ) ∗V_1( p ) ∗Y( 3 , 2 ) ∗ cos ( d_2 ( p ) − d_1 ( p ) − t h e t a p p ( 3 , 2 ) ) + V_2( p ) ∗V_1( q ) ∗Y( 3 , 2 ) ∗ cos ( d_2 ( p ) − d_1 ( q ) − t h e t a p q ( 3 , 2 ) ) + V_2( p ) ∗V_2( p ) ∗Y( 3 , 3 ) ∗ cos ( d_2 ( p ) − d_2 ( p ) − t h e t a p p ( 3 , 3 ) ) +
174
A.2 MATLAB code V_2( p ) ∗V_2( q ) ∗Y( 3 , 3 ) ∗ cos ( d_2 ( p ) − d_2 ( q ) − t h e t a p q ( 3 , 3 ) ) ) ; Qpq_2=(V_2( p ) ∗V_0( p ) ∗Y( 3 , 1 ) ∗ s i n ( d_2 ( p ) − d_0 ( p ) − t h e t a p p ( 3 , 1 ) ) + V_2( p ) ∗V_0( q ) ∗Y( 3 , 1 ) ∗ s i n ( d_2 ( p ) − d_0 ( q ) − t h e t a p q ( 3 , 1 ) ) + V_2( p ) ∗V_1( p ) ∗Y( 3 , 2 ) ∗ s i n ( d_2 ( p ) − d_1 ( p ) − t h e t a p p ( 3 , 2 ) ) + V_2( p ) ∗V_1( q ) ∗Y( 3 , 2 ) ∗ s i n ( d_2 ( p ) − d_1 ( q ) − t h e t a p q ( 3 , 2 ) ) + V_2( p ) ∗V_2( p ) ∗Y( 3 , 3 ) ∗ s i n ( d_2 ( p ) − d_2 ( p ) − t h e t a p p ( 3 , 3 ) ) + V_2( p ) ∗V_2( q ) ∗Y( 3 , 3 ) ∗ s i n ( d_2 ( p ) − d_2 ( q ) − t h e t a p q ( 3 , 3 ) ) ) ; Pqp_2=(V_2( q ) ∗V_0( q ) ∗Y( 3 , 1 ) ∗ cos ( d_2 ( q ) − d_0 ( q ) − t h e t a p p ( 3 , 1 ) ) + V_2( q ) ∗V_0( p ) ∗Y( 3 , 1 ) ∗ cos ( d_2 ( q ) − d_0 ( p ) − t h e t a p q ( 3 , 1 ) ) + V_2( q ) ∗V_1( q ) ∗Y( 3 , 2 ) ∗ cos ( d_2 ( q ) − d_1 ( q ) − t h e t a p p ( 3 , 2 ) ) + V_2( q ) ∗V_1( p ) ∗Y( 3 , 2 ) ∗ cos ( d_2 ( q ) − d_1 ( p ) − t h e t a p q ( 3 , 2 ) ) + V_2( q ) ∗V_2( q ) ∗Y( 3 , 3 ) ∗ cos ( d_2 ( q ) − d_2 ( q ) − t h e t a p p ( 3 , 3 ) ) + V_2( q ) ∗V_2( p ) ∗Y( 3 , 3 ) ∗ cos ( d_2 ( q ) − d_2 ( p ) − t h e t a p q ( 3 , 3 ) ) ) ; Qqp_2=(V_2( q ) ∗V_0( q ) ∗Y( 3 , 1 ) ∗ s i n ( d_2 ( q ) − d_0 ( q ) − t h e t a p p ( 3 , 1 ) ) + V_2( q ) ∗V_0( p ) ∗Y( 3 , 1 ) ∗ s i n ( d_2 ( q ) − d_0 ( p ) − t h e t a p q ( 3 , 1 ) ) + V_2( q ) ∗V_1( q ) ∗Y( 3 , 2 ) ∗ s i n ( d_2 ( q ) − d_1 ( q ) − t h e t a p p ( 3 , 2 ) ) + V_2( q ) ∗V_1( p ) ∗Y( 3 , 2 ) ∗ s i n ( d_2 ( q ) − d_1 ( p ) − t h e t a p q ( 3 , 2 ) ) + V_2( q ) ∗V_2( q ) ∗Y( 3 , 3 ) ∗ s i n ( d_2 ( q ) − d_2 ( q ) − t h e t a p p ( 3 , 3 ) ) + V_2( q ) ∗V_2( p ) ∗Y( 3 , 3 ) ∗ s i n ( d_2 ( q ) − d_2 ( p ) − t h e t a p q ( 3 , 3 ) ) ) ; else i f PhaseC ( k)==0 Ppq_2 = [ ] ; Qpq_2 = [ ] ; Pqp_2 = [ ] ; Qqp_2 = [ ] ; end ; end ; end end Ppq= [ Ppq Ppq_0 Ppq_1 Ppq_2 Pqp_0 Pqp_1 Pqp_2 ] ; Qpq= [ Qpq Qpq_0 Qpq_1 Qpq_2 Qqp_0 Qqp_1 Qqp_2 ] ; end PL_0=PL_0m ; PL_1=PL_1m ; PL_2=PL_2m ; QL_0=QL_0m; QL_1=QL_1m; QL_2=QL_2m; vv_0 = [ ] ; vv_1 = [ ] ; vv_2 = [ ] ; dv_0 = [ ] ; dv_1 = [ ] ; dv_2 = [ ] ; f o r n=1:Nn i f V_0( n)~=0 v o l t a g e _ 0=V_0( n ) ; angle_0=d_0 ( n ) ; e l s e i f V_0( n)==0 v o l t a g e _ 0 = [ ] ; angle_0 = [ ] ; end ; end ; i f V_1( n)~=0 v o l t a g e _ 1=V_1( n ) ; angle_1=d_1 ( n ) ; e l s e i f V_1( n)==0 v o l t a g e _ 1 = [ ] ; angle_1 = [ ] ; end ; end ; i f V_2( n)~=0 v o l t a g e _ 2=V_2( n ) ; angle_2=d_2 ( n ) ; e l s e i f V_2( n)==0 v o l t a g e _ 2 = [ ] ; angle_2 = [ ] ; end ; end ; vv_0=[vv_0 v o l t a g e _ 0 ] ; vv_1=[vv_1 v o l t a g e _ 1 ] ; vv_2=[vv_2 v o l t a g e _ 2 ] ; dv_0=[dv_0 angle_0 ] ; dv_1=[dv_1 angle_1 ] ; dv_2=[dv_2 angle_2 ] ; end V_0=vv_0 ; V_1=vv_1 ; V_2=vv_2 ; d_0=dv_0 ; d_1=dv_1 ; d_2=dv_2 ; %i n i t i a l v a l u e s f o r v a r i a b l e s L=o n e s ( 1 , length ( Con ) ) ; Xlambda=[V_0 ( 2 : length (V_0) ) V_1 ( 2 : length (V_1) ) V_2 ( 2 : length (V_2) ) d_0 ( 2 : length ( d_0 ) ) d_1 ( 2 : length ( d_1 ) ) d_2 ( 2 : length ( d_2 ) ) Ppq Qpq PL_0 PL_1 PL_2 QL_0 QL_1 QL_2 −L ] ;
175
Chapter A
Appendix
%t o l e r a n c e ( s t o p p i n g c r i t e r i a ) eps = 1 e −5; %t o l e r a n c e c a l c u a l t e d i n l o o p epsObtained = 1 ; %number o f i t e r a t i o n iteration = 0; while ( eps < e p s O b t a i n e d ) %i n A and B s u b s t i t u t e v a r i a b l e s i n X w i t h % f i r s t l e n g t h (X) v a l u e s i n Xlambda AN=s u b s (A, X, Xlambda ( 1 : length (X ) ) ) ; BN=s u b s (B, X, Xlambda ( 1 : length (X ) ) ) ; %c a l c u l a t i o n o f numbers ANE = eval (AN) ; BNE = eval (BN) ; %c h e c k c o n v e r g e n c e f o r c o n s t r a i n t s ( m a t r i x ck i n m a t r i x B) absB = abs (BNE( length (X)+1 : length (BNE ) ) ) ; e p s O b t a i n e d = max( absB ) ; %c a l c u l a t i o n o f dX=i n v (A) ∗B dX=inv (ANE) ∗BNE; %u p d a t e new v a l u e s X( k+1)=X( k)+dX ( u p d a t e j u s t v a r i a b l e s , n o t lambda ) Xlambda=Xlambda ( 1 : length (X) ) ’ + dX ( 1 : length (X ) ) ; Xlambda=Xlambda ’ ; iteration = iteration + 1; end %∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗SHOW RESULTS∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ iteration ; epsObtained ; Xlambda ( 1 : length (X) ) ’ %∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗END∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗
176
B. Appendix B.1. AMPL Programming AMPL is a comprehensive and powerful algebraic modeling language for linear and nonlinear optimization problems, in discrete or continuous variables. Developed at Bell Laboratories, AMPL use common notation and familiar concepts to formulate optimization models and examine solutions, while the computer manages communication with an appropriate solver. AMPL integrates a modeling language for describing optimization data, variables, objectives, and constraints; a command language for browsing models and analyzing results; and a scripting language for gathering and manipulating data and for implementing iterative optimization schemes. Available solvers include the most popular and powerful optimization engines: linear and convex quadratic solvers for both continuous and mixed-integer problems (CPLEX, Gurobi, Xpress) and nonlinear solvers for local solution of continuous problems (CONOPT, Ipopt, KNITRO, MINOS, SNOPT) and mixed-integer problems (Bonmin, Couenne, KNITRO). In this example KNITRO solver is used.
B.1.1. AMPL Model File The natural approach to program in AMPL is entering optimization problem using syntax that is very close to the algebraic expressions of the formulation. To use AMPL, it is necessary to create a text file with the mathematical program code. Any text editor could be used (for example, Notepad) in which the AMPL code can be written. Text file should be saved under the extension .mod. To load a model you should type in AMPL command window: model Name.mod;
177
Chapter B
Appendix
After loading your model, you should choose the type of the solver you want to use to solve your problem. Other option is to immediately write solver type in text file (not in command window) like it is done in Listing B.1. 1 reset ; 2 option s o l v e r knitroampl ;
Listing B.1: Solver Type Since you are interested in loading your model more than once (changing coefficients, after correcting some errors, etc.), you will need to periodically reset AMPL. You cannot load your model with variables, constraints, or objective function using names which already exist – reset allows AMPL to forget all names.
B.1.2. Declaration of Variables and Parameters Variables are the AMPL entities representing the actual variables in our mathematical program. Variables must be declared using the var command. By default the variables are assumed to be real numbers, but if problem requires that a variable or vector of variables is restricted to be integer or binary, command integer or binary in front the declaration of the variable can be used. In our example, variables are actually state vector variable: bus voltage magnitudes, bus voltage angles, active and reactive power flows, active and reactive load and measured branch currents. Example of declaration of bus voltage magnitudes and angles as a variables is given by Listing B.2. 1 2 3 4 5 6
var var var var var var
v2_0 : = 1 ; v2_1 : = 1 ; v2_2 : = 1 ; d2_0 : = 0 ; d2_1 := −2.0943951024; d2_2 : = 2 . 0 9 4 3 9 5 1 0 2 4 ;
Listing B.2: Declaration of Variables The parameter entity is used to hold constant values. In our example, parameters are used for defining magnitudes and angles of admittances, all measured values, weighting factors as well as slack bus values. Listing B.3 shows declarations of admittance magnitudes and angles as
178
B.1 AMPL Programming parameters and the corresponding assignment of values. As it can be seen, a keyword param is used. 1 2 3 4 5 6
param param param param param param
y12_00:= 7 8 . 2 0 8 4 ; y12_01:= 2 9 . 1 8 7 1 ; y12_02:= 1 6 . 3 2 7 0 ; theta12_00 := 1 . 9 8 2 5 ; theta12_01 := −1.0121; theta12_02 := −1.2333;
Listing B.3: Declaration of Parameters
B.1.3. Objective function and constraints The objective function starts with the command maximize or minimize, followed by the name of the objective function (cost, revenue, etc), followed by a colon (:) which is finally followed by the function that should be optimized, terminated by the corresponding semicolon (;). Objective function in Listing B.4 minimizes square error between calculated and measured values. 1 2 3 4 5 6 7 8 9 10 11 12 13 14
minimize S q u a r e E r r o r :
+ + + + + + + + + + +
wP0∗ ( P43_0−P43_0m) ^2+ wP2∗ ( P43_2−P43_2m) ^2+ wQ1∗ ( Q43_1−Q43_1m) ^2+ wV20∗ ( v2_0−v2_0m) ^2 + wV22∗ ( v2_2−v2_2m) ^2 + wV31∗ ( v3_1−v3_1m) ^2 + wV40∗ ( v4_0−v4_0m) ^2 + wV42∗ ( v4_2−v4_2m) ^2 + wPL1∗ (PL_1−PL_1m) ^2 + wQL0∗ (QL_0−QL_0m) ^2 + wQL2∗ (QL_2−QL_2m) ^2 + wI1 ∗ ( I12_1−I12_1m ) ^2+
wP1∗ ( P43_1−P43_1m) ^2 wQ0∗ ( Q43_0−Q43_0m) ^2 wQ2∗ ( Q43_2−Q43_2m) ^2 wV21∗ ( v2_1−v2_1m) ^2 wV30∗ ( v3_0−v3_0m) ^2 wV32∗ ( v3_2−v3_2m) ^2 wV41∗ ( v4_1−v4_1m) ^2 wPL0∗ (PL_0−PL_0m) ^2 wPL2∗ (PL_2−PL_2m) ^2 wQL1∗ (QL_1−QL_1m) ^2 wI0 ∗ ( I12_0−I12_0m ) ^2 wI2 ∗ ( I12_2−I12_2m ) ^ 2 ;
Listing B.4: Objective Function Each constraint or array of constraints (constraints under the same name and different index) starts with the command subject to followed by a name, followed by a colon (:) and finally followed by the corresponding logical constraint. Here we provide examples of how to express active power flow between nodes 1 and 2 for zero phase. All other constraints can be defined on similar manner.
179
Chapter B
Appendix
1 s u b j e c t to 2 3 C1 : P12_0−(v1_0∗v1_0∗y11_00∗ c o s ( d1_0−d1_0−theta11_00 ) 4 +v1_0∗v2_0∗y12_00∗ c o s ( d1_0−d2_0−theta12_00 ) 5 +v1_0∗v1_1∗y11_01∗ c o s ( d1_0−d1_1−theta11_01 ) 6 +v1_0∗v2_1∗y12_01∗ c o s ( d1_0−d2_1−theta12_01 ) 7 +v1_0∗v1_2∗y11_02∗ c o s ( d1_0−d1_2−theta11_02 ) 8 +v1_0∗v2_2∗y12_02∗ c o s ( d1_0−d2_2−theta12_02 ) ) =0;
Listing B.5: Constraints
B.1.4. Solve problem and Display Results After defining model, typing all parameters, variables, objective and constraints, the final step is to solve the model. For this purpose, in command window, following command is used:
solve;
Other option is to include this command directly in .mod file, so loading the file will automatically solve it. Once the problem is solved you can ask for variable values. In general you could use the command display followed by the name of the entity whose value you are interested in: objective function, variables, dual variables etc.You could use the command shown below to display voltage amplitudes on bus 2:
display v2_0, v2_1, v2_2;
Whole code is given in sec. B.2.
180
B.2 AMPL Code
B.2. AMPL Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
reset ; option s o l v e r knitroampl ; # WEIGHTING GROUPS param wVoltage =0; param wP=0; param wQ=0; param wPLoad=100; param wQLoad=100; param wCurrent =0; param wV20:= wVoltage ; param wV21:= wVoltage ; param wV22:= wVoltage ; param wV30:= wVoltage ; param wV31:= wVoltage ; param wV32:= wVoltage ; param wV40:= wVoltage ; param wV41:= wVoltage ; param wV42:= wVoltage ; param wP0:=wP ; param wP1:=wP; param wP2:=wP; param wQ0:=wQ; param wQ1:=wQ; param wQ2:=wQ; param wPL0:=wPLoad ; param wPL1:=wPLoad ; param wPL2:=wPLoad ; param wQL0:=wQLoad ; param wQL1:=wQLoad ; param wQL2:=wQLoad ; param wI0 := wCurrent ; param wI1 := wCurrent ; param wI2 := wCurrent ; # MEASUREMENTS param PL_0m: = 0 . 9 0 0 0 ; param PL_2m: = 0 . 9 0 0 0 ; param QL_1m: = 0 . 4 3 5 9 ; param P43_0m=−PL_0m ; param P43_2m=−PL_2m ; param Q43_1m=−QL_1m; param I12_0m : = 1 . 2 4 0 5 ; param I12_2m : = 1 . 2 0 3 1 ;
param param param param param param param
# PARAMETERS param v2_0m= 0 . 9 8 7 7 ; param v2_2m= 0 . 9 8 9 5 ; param v3_1m= 0 . 9 4 5 1 ; param v4_0m= 0 . 8 0 6 1 ; param v4_2m= 0 . 8 3 1 1 ; param y12_01 := 2 9 . 1 8 7 1 ; param y12_10 := 2 9 . 1 8 7 1 ; param y12_12 := 2 1 . 3 2 2 3 ; param y12_21 := 2 1 . 3 2 2 3 ; param y23_00 := 1 6 . 4 3 9 9 ; param y23_02 := 0 ; param y23_11 := 1 6 . 4 3 9 9 ; param y23_20 := 0 ; param y23_22 := 1 6 . 4 3 9 9 ; param y34_01 := 2 . 5 9 8 6 ; param y34_10 := 2 . 5 9 8 6 ; param y34_12 := 1 . 8 9 8 4 ; param y34_21 := 1 . 8 9 8 4 ; param y11_00 := 7 8 . 2 0 8 4 ; param y11_02 := 1 6 . 3 2 7 0 ; param y11_11 := 8 2 . 5 4 7 4 ;
PL_1m: = 0 . 9 0 0 0 ; QL_0m: = 0 . 4 3 5 9 ; QL_2m: = 0 . 4 3 5 9 ; P43_1m=−PL_1m ; Q43_0m=−QL_0m; Q43_2m=−QL_2m; I12_1m : = 1 . 1 5 8 1 ;
param param param param param param param param param param param param param param param param param param param param param
v2_1m= 0 . 9 9 2 1 ; v3_0m= 0 . 9 3 6 8 ; v3_2m= 0 . 9 3 9 7 ; v4_1m= 0 . 8 6 3 5 ; y12_00 := 7 8 . 2 0 8 4 ; y12_02 := 1 6 . 3 2 7 0 ; y12_11 := 8 2 . 5 4 7 4 ; y12_20 := 1 6 . 3 2 7 0 ; y12_22 := 7 4 . 4 9 7 3 ; y23_01 := 0 ; y23_10 := 0 ; y23_12 := 0 ; y23_21 := 0 ; y34_00 := 6 . 9 6 3 0 ; y34_02 := 1 . 4 5 3 6 ; y34_11 := 7 . 3 4 9 3 ; y34_20 := 1 . 4 5 3 6 ; y34_22 := 6 . 6 3 2 6 ; y11_01 := 2 9 . 1 8 7 1 ; y11_10 := 2 9 . 1 8 7 1 ; y11_12 := 2 1 . 3 2 2 3 ;
181
Chapter B
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param param
182
Appendix
y11_20 := 1 6 . 3 2 7 0 ; param y11_21 := 2 1 . 3 2 2 3 ; y11_22 := 7 4 . 4 9 7 3 ; param y22_00N1:= 7 8 . 2 0 8 4 ; y22_01N1:= 2 9 . 1 8 7 1 ; param y22_02N1:= 1 6 . 3 2 7 0 ; y22_10N1:= 2 9 . 1 8 7 1 ; param y22_11N1:= 8 2 . 5 4 7 4 ; y22_12N1:= 2 1 . 3 2 2 3 ; param y22_20N1:= 1 6 . 3 2 7 0 ; y22_21N1:= 2 1 . 3 2 2 3 ; param y22_22N1:= 7 4 . 4 9 7 3 ; y22_00N3:= 1 6 . 4 3 9 9 ; param y22_01N3:= 0 ; y22_02N3:= 0 ; param y22_10N3:= 0 ; y22_11N3:= 1 6 . 4 3 9 9 ; param y22_12N3:= 0 ; y22_20N3:= 0 ; param y22_21N3:= 0 ; y22_22N3:= 1 6 . 4 3 9 9 ; param y33_00N2:= 1 6 . 4 3 9 9 ; y33_01N2:= 0 ; param y33_02N2:= 0 ; y33_10N2:= 0 ; param y33_11N2:= 1 6 . 4 3 9 9 ; y33_12N2:= 0 ; param y33_20N2:= 0 ; y33_21N2:= 0 ; param y33_22N2:= 1 6 . 4 3 9 9 ; y33_00N4:= 6 . 9 6 3 0 ; param y33_01N4:= 2 . 5 9 8 6 ; y33_02N4:= 1 . 4 5 3 6 ; param y33_10N4:= 2 . 5 9 8 6 ; y33_11N4:= 7 . 3 4 9 3 ; param y33_12N4:= 1 . 8 9 8 4 ; y33_20N4:= 1 . 4 5 3 6 ; param y33_21N4:= 1 . 8 9 8 4 ; y33_22N4:= 6 . 6 3 2 6 ; param y44_00 := 6 . 9 6 3 0 ; y44_01 := 2 . 5 9 8 6 ; param y44_02 := 1 . 4 5 3 6 ; y44_10 := 2 . 5 9 8 6 ; param y44_11 := 7 . 3 4 9 3 ; y44_12 := 1 . 8 9 8 4 ; param y44_20 := 1 . 4 5 3 6 ; y44_21 := 1 . 8 9 8 4 ; param y44_22 := 6 . 6 3 2 6 ; theta12_00 := 1 . 9 8 2 5 ; param theta12_01 := − 1 . 0 1 2 1 ; theta12_02 := − 1 . 2 3 3 3 ; param theta12_10 := − 1 . 0 1 2 1 ; theta12_11 := 2 . 0 1 0 8 ; param theta12_12 := − 1 . 1 1 6 2 ; theta12_20 := − 1 . 2 3 3 3 ; param theta12_21 := − 1 . 1 1 6 2 ; theta12_22 := 1 . 9 5 6 2 ; param theta23_00 := 1 . 7 3 5 9 ; theta23_01 := 0 ; param theta23_02 := 0 ; theta23_10 := 0 ; param theta23_11 := 1 . 7 3 5 9 ; theta23_12 := 0 ; param theta23_20 := 0 ; theta23_21 := 0 ; param theta23_22 := 1 . 7 3 5 9 ; theta34_00 := 1 . 9 8 2 5 ; param theta34_01 := − 1 . 0 1 2 1 ; theta34_02 := − 1 . 2 3 3 3 ; param theta34_10 := − 1 . 0 1 2 1 ; theta34_11 := 2 . 0 1 0 8 ; param theta34_12 := − 1 . 1 1 6 2 ; theta34_20 := − 1 . 2 3 3 3 ; param theta34_21 := − 1 . 1 1 6 2 ; theta34_22 := 1 . 9 5 6 2 ; param theta11_00 := − 1 . 1 5 9 1 ; theta11_01 := 2 . 1 2 9 5 ; param theta11_02 := 1 . 9 0 8 3 ; theta11_10 := 2 . 1 2 9 5 ; param theta11_11 := − 1 . 1 3 0 8 ; theta11_12 := 2 . 0 2 5 4 ; param theta11_20 := 1 . 9 0 8 3 ; theta11_21 := 2 . 0 2 5 4 ; param theta11_22 := −1.1854; theta22_00N1 := − 1 . 1 5 9 1 ; param theta22_01N1 := 2 . 1 2 9 5 ; theta22_02N1 := 1 . 9 0 8 3 ; param theta22_10N1 := 2 . 1 2 9 5 ; theta22_11N1 := − 1 . 1 3 0 8 ; param theta22_12N1 := 2 . 0 2 5 4 ; theta22_20N1 := 1 . 9 0 8 3 ; param theta22_21N1 := 2 . 0 2 5 4 ; theta22_22N1 := − 1 . 1 8 5 4 ; param theta22_00N3 := − 1 . 4 0 5 6 ; theta22_01N3 := 0 ; param theta22_02N3 := 0 ; theta22_10N3 := 0 ; param theta22_11N3:=− 1 . 4 0 5 6 ; theta22_12N3 := 0 ; param theta22_20N3 := 0 ; theta22_21N3 := 0 ; param theta22_22N3 := − 1 . 4 0 5 6 ; theta33_00N2:=− 1 . 4 0 5 6 ; param theta33_01N2 := 0 ; theta33_02N2 := 0 ; param theta33_10N2 := 0 ; theta33_11N2 := − 1 . 4 0 5 6 ; param theta33_12N2 := 0 ; theta33_20N2 := 0 ; param theta33_21N2 := 0 ; theta33_22N2 := − 1 . 4 0 5 6 ; param theta33_00N4 := − 1 . 1 5 9 1 ;
B.2 AMPL Code
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
param param param param param param param param param param param param
theta33_01N4 := 2 . 1 2 9 5 ; param theta33_02N4 := 1 . 9 0 8 3 ; theta33_10N4 := 2 . 1 2 9 5 ; param theta33_11N4 := − 1 . 1 3 0 8 ; theta33_12N4 := 2 . 0 2 5 4 ; param theta33_20N4 := 1 . 9 0 8 3 ; theta33_21N4 := 2 . 0 2 5 4 ; param theta33_22N4 := − 1 . 1 8 5 4 ; theta44_00 := − 1 . 1 5 9 1 ; param theta44_01 := 2 . 1 2 9 5 ; theta44_02 := 1 . 9 0 8 3 ; param theta44_10 := 2 . 1 2 9 5 ; theta44_11 := − 1 . 1 3 0 8 ; param theta44_12 := 2 . 0 2 5 4 ; theta44_20 := 1 . 9 0 8 3 ; param theta44_21 := 2 . 0 2 5 4 ; theta44_22 := − 1 . 1 8 5 4 ; param v1_0 : = 1 ; v1_1 : = 1 ; param v1_2 : = 1 ; d1_0=0; param d1_1= −2.0944; d1_2 = 2 . 0 9 4 4 ;
# VARIABLES v a r P12_0 := PL_0m ; v a r P12_2 := PL_2m ; v a r P23_1 := PL_1m ; v a r P34_0 := PL_0m ; v a r P34_2 := PL_2m ; v a r P21_1 := −PL_1m ; v a r P32_0 := −PL_0m ; v a r P32_2 := −PL_2m ; v a r P43_1 := −PL_1m ; v a r Q12_0 := QL_0m; v a r Q12_2 := QL_2m; v a r Q23_1 := QL_1m; v a r Q34_0 := QL_0m; v a r Q34_2 := QL_2m; v a r Q21_1 := −QL_1m; v a r Q32_0 := −QL_0m; v a r Q32_2 := −QL_2m; v a r Q43_1 := −QL_1m; v a r PL_0 := PL_0m ; v a r PL_2 := PL_2m ; v a r QL_1 := QL_1m; v a r I12_0 : = 1 . 2 4 0 5 ; v a r I12_2 : = 1 . 2 0 3 0 ; v a r v2_1 : = 1 ; v a r v3_0 : = 1 ; v a r v3_2 : = 1 ; v a r v4_1 : = 1 ; v a r d2_0 : = 0 ; v a r d2_2 : = 2 . 0 9 4 4 ; v a r d3_1 := −2.0944; v a r d4_0 : = 0 ; v a r d4_2 : = 2 . 0 9 4 4 ;
var var var var var var var var var var var var var var var var var var var var var var var var var var var var var var var
#OBJECTIVE FUNCTION minimize SquareError : wP0∗ ( P43_0−P43_0m)^2+ + wQ0∗ ( Q43_0−Q43_0m)^2+ + wV20∗ ( v2_0−v2_0m) ^ 2 + + wV30∗ ( v3_0−v3_0m) ^ 2 + + wV40∗ ( v4_0−v4_0m) ^ 2 + + wPL0∗ (PL_0−PL_0m) ^ 2 + + wQL0∗ (QL_0−QL_0m) ^ 2 +
P12_1 := PL_1m ; P23_0 := PL_0m ; P23_2 := PL_2m ; P34_1 := PL_1m ; P21_0 := −PL_0m ; P21_2 := −PL_2m ; P32_1 := −PL_1m ; P43_0 := −PL_0m ; P43_2 := −PL_2m ; Q12_1 := QL_1m; Q23_0 := QL_0m; Q23_2 := QL_2m; Q34_1 := QL_1m; Q21_0 := −QL_0m; Q21_2 := −QL_2m; Q32_1 := −QL_1m; Q43_0 := −QL_0m; Q43_2 := −QL_2m; PL_1 := PL_1m ; QL_0 := QL_0m; QL_2 := QL_2m; I12_1 : = 1 . 1 5 8 0 ; v2_0 : = 1 ; v2_2 : = 1 ; v3_1 : = 1 ; v4_0 : = 1 ; v4_2 : = 1 ; d2_1 := −2.0944; d3_0 : = 0 ; d3_2 : = 2 . 0 9 4 4 ; d4_1 := −2.0944;
wP1∗ ( P43_1−P43_1m)^2+ wQ1∗ ( Q43_1−Q43_1m)^2+ wV21∗ ( v2_1−v2_1m) ^ 2 + wV31∗ ( v3_1−v3_1m) ^ 2 + wV41∗ ( v4_1−v4_1m) ^ 2 + wPL1∗ (PL_1−PL_1m) ^ 2 + wQL1∗ (QL_1−QL_1m) ^ 2 +
wP2∗ ( P43_2−P43_2m) ^ 2 wQ2∗ ( Q43_2−Q43_2m) ^ 2 wV22∗ ( v2_2−v2_2m) ^ 2 wV32∗ ( v3_2−v3_2m) ^ 2 wV42∗ ( v4_2−v4_2m) ^ 2 wPL2∗ (PL_2−PL_2m) ^ 2 wQL2∗ (QL_2−QL_2m) ^ 2
183
Chapter B
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
Appendix
+ wI0 ∗ ( I12_0−I12_0m ) ^ 2 + wI1 ∗ ( I12_1−I12_1m ) ^ 2 + wI2 ∗ ( I12_2−I12_2m ) ^ 2 ; #CONSTRAINTS s u b j e c t to C1 : P12_0−(v1_0∗v1_0∗ y11_00 ∗ c o s ( d1_0−d1_0−theta11_00 ) +v1_0∗v2_0∗ y12_00 ∗ c o s ( d1_0−d2_0−theta12_00 ) +v1_0∗v1_1∗ y11_01 ∗ c o s ( d1_0−d1_1−theta11_01 ) +v1_0∗v2_1∗ y12_01 ∗ c o s ( d1_0−d2_1−theta12_01 ) +v1_0∗v1_2∗ y11_02 ∗ c o s ( d1_0−d1_2−theta11_02 ) +v1_0∗v2_2∗ y12_02 ∗ c o s ( d1_0−d2_2−theta12_02 ) ) = 0 ; C2 : P12_1−(v1_1∗v1_0∗ y11_10 ∗ c o s ( d1_1−d1_0−theta11_10 ) +v1_1∗v2_0∗ y12_10 ∗ c o s ( d1_1−d2_0−theta12_10 ) +v1_1∗v1_1∗ y11_11 ∗ c o s ( d1_1−d1_1−theta11_11 ) +v1_1∗v2_1∗ y12_11 ∗ c o s ( d1_1−d2_1−theta12_11 ) +v1_1∗v1_2∗ y11_12 ∗ c o s ( d1_1−d1_2−theta11_12 ) +v1_1∗v2_2∗ y12_12 ∗ c o s ( d1_1−d2_2−theta12_12 ) ) = 0 ; C3 : P12_2−(v1_2∗v1_0∗ y11_20 ∗ c o s ( d1_2−d1_0−theta11_20 ) +v1_2∗v2_0∗ y12_20 ∗ c o s ( d1_2−d2_0−theta12_20 ) +v1_2∗v1_1∗ y11_21 ∗ c o s ( d1_2−d1_1−theta11_21 ) +v1_2∗v2_1∗ y12_21 ∗ c o s ( d1_2−d2_1−theta12_21 ) +v1_2∗v1_2∗ y11_22 ∗ c o s ( d1_2−d1_2−theta11_22 ) +v1_2∗v2_2∗ y12_22 ∗ c o s ( d1_2−d2_2−theta12_22 ) ) = 0 ; C4 : P21_0−(v2_0∗v2_0∗y22_00N1∗ c o s ( d2_0−d2_0−theta22_00N1 ) +v2_0∗v1_0∗ y12_00 ∗ c o s ( d2_0−d1_0−theta12_00 ) +v2_0∗v2_1∗y22_01N1∗ c o s ( d2_0−d2_1−theta22_01N1 ) +v2_0∗v1_1∗ y12_01 ∗ c o s ( d2_0−d1_1−theta12_01 ) +v2_0∗v2_2∗y22_02N1∗ c o s ( d2_0−d2_2−theta22_02N1 ) +v2_0∗v1_2∗ y12_02 ∗ c o s ( d2_0−d1_2−theta12_02 ) ) = 0 ; C5 : P21_1−(v2_1∗v2_0∗y22_10N1∗ c o s ( d2_1−d2_0−theta22_10N1 ) +v2_1∗v1_0∗ y12_10 ∗ c o s ( d2_1−d1_0−theta12_10 ) +v2_1∗v2_1∗y22_11N1∗ c o s ( d2_1−d2_1−theta22_11N1 ) +v2_1∗v1_1∗ y12_11 ∗ c o s ( d2_1−d1_1−theta12_11 ) +v2_1∗v2_2∗y22_12N1∗ c o s ( d2_1−d2_2−theta22_12N1 ) +v2_1∗v1_2∗ y12_12 ∗ c o s ( d2_1−d1_2−theta12_12 ) ) = 0 ; C6 : P21_2−(v2_2∗v2_0∗y22_20N1∗ c o s ( d2_2−d2_0−theta22_20N1 ) +v2_2∗v1_0∗ y12_20 ∗ c o s ( d2_2−d1_0−theta12_20 ) +v2_2∗v2_1∗y22_21N1∗ c o s ( d2_2−d2_1−theta22_21N1 ) +v2_2∗v1_1∗ y12_21 ∗ c o s ( d2_2−d1_1−theta12_21 ) +v2_2∗v2_2∗y22_22N1∗ c o s ( d2_2−d2_2−theta22_22N1 ) +v2_2∗v1_2∗ y12_22 ∗ c o s ( d2_2−d1_2−theta12_22 ) ) = 0 ; C7 : P23_0−(v2_0∗v2_0∗y22_00N3∗ c o s ( d2_0−d2_0−theta22_00N3 ) +v2_0∗v3_0∗ y23_00 ∗ c o s ( d2_0−d3_0−theta23_00 ) +v2_0∗v2_1∗y22_01N3∗ c o s ( d2_0−d2_1−theta22_01N3 ) +v2_0∗v3_1∗ y23_01 ∗ c o s ( d2_0−d3_1−theta23_01 ) +v2_0∗v2_2∗y22_02N3∗ c o s ( d2_0−d2_2−theta22_02N3 ) +v2_0∗v3_2∗ y23_02 ∗ c o s ( d2_0−d3_2−theta23_02 ) ) = 0 ; C8 : P23_1−(v2_1∗v2_0∗y22_10N3∗ c o s ( d2_1−d2_0−theta22_10N3 ) +v2_1∗v3_0∗ y23_10 ∗ c o s ( d2_1−d3_0−theta23_10 ) +v2_1∗v2_1∗y22_11N3∗ c o s ( d2_1−d2_1−theta22_11N3 ) +v2_1∗v3_1∗ y23_11 ∗ c o s ( d2_1−d3_1−theta23_11 ) +v2_1∗v2_2∗y22_12N3∗ c o s ( d2_1−d2_2−theta22_12N3 ) +v2_1∗v3_2∗ y23_12 ∗ c o s ( d2_1−d3_2−theta23_12 ) ) = 0 ; C9 : P23_2−(v2_2∗v2_0∗y22_20N3∗ c o s ( d2_2−d2_0−theta22_20N3 ) +v2_2∗v3_0∗ y23_20 ∗ c o s ( d2_2−d3_0−theta23_20 ) +v2_2∗v2_1∗y22_21N3∗ c o s ( d2_2−d2_1−theta22_21N3 ) +v2_2∗v3_1∗ y23_21 ∗ c o s ( d2_2−d3_1−theta23_21 )
184
B.2 AMPL Code
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
+v2_2∗v2_2∗y22_22N3∗ c o s ( d2_2−d2_2−theta22_22N3 ) +v2_2∗v3_2∗ y23_22 ∗ c o s ( d2_2−d3_2−theta23_22 ) ) = 0 ; C10 : P32_0−(v3_0∗v3_0∗y33_00N2∗ c o s ( d3_0−d3_0−theta33_00N2 ) +v3_0∗v2_0∗ y23_00 ∗ c o s ( d3_0−d2_0−theta23_00 ) +v3_0∗v3_1∗y33_01N2∗ c o s ( d3_0−d3_1−theta33_01N2 ) +v3_0∗v2_1∗ y23_01 ∗ c o s ( d3_0−d2_1−theta23_01 ) +v3_0∗v3_2∗y33_02N2∗ c o s ( d3_0−d3_2−theta33_02N2 ) +v3_0∗v2_2∗ y23_02 ∗ c o s ( d3_0−d2_2−theta23_02 ) ) = 0 ; C11 : P32_1−(v3_1∗v3_0∗y33_10N2∗ c o s ( d3_1−d3_0−theta33_10N2 ) +v3_1∗v2_0∗ y23_10 ∗ c o s ( d3_1−d2_0−theta23_10 ) +v3_1∗v3_1∗y33_11N2∗ c o s ( d3_1−d3_1−theta33_11N2 ) +v3_1∗v2_1∗ y23_11 ∗ c o s ( d3_1−d2_1−theta23_11 ) +v3_1∗v3_2∗y33_12N2∗ c o s ( d3_1−d3_2−theta33_12N2 ) +v3_1∗v2_2∗ y23_12 ∗ c o s ( d3_1−d2_2−theta23_12 ) ) = 0 ; C12 : P32_2−(v3_2∗v3_0∗y33_20N2∗ c o s ( d3_2−d3_0−theta33_20N2 ) +v3_2∗v2_0∗ y23_20 ∗ c o s ( d3_2−d2_0−theta23_20 ) +v3_2∗v3_1∗y33_21N2∗ c o s ( d3_2−d3_1−theta33_21N2 ) +v3_2∗v2_1∗ y23_21 ∗ c o s ( d3_2−d2_1−theta23_21 ) +v3_2∗v3_2∗y33_22N2∗ c o s ( d3_2−d3_2−theta33_22N2 ) +v3_2∗v2_2∗ y23_22 ∗ c o s ( d3_2−d2_2−theta23_22 ) ) = 0 ; C13 : P34_0−(v3_0∗v3_0∗y33_00N4∗ c o s ( d3_0−d3_0−theta33_00N4 ) +v3_0∗v4_0∗ y34_00 ∗ c o s ( d3_0−d4_0−theta34_00 ) +v3_0∗v3_1∗y33_01N4∗ c o s ( d3_0−d3_1−theta33_01N4 ) +v3_0∗v4_1∗ y34_01 ∗ c o s ( d3_0−d4_1−theta34_01 ) +v3_0∗v3_2∗y33_02N4∗ c o s ( d3_0−d3_2−theta33_02N4 ) +v3_0∗v4_2∗ y34_02 ∗ c o s ( d3_0−d4_2−theta34_02 ) ) = 0 ; C14 : P34_1−(v3_1∗v3_0∗y33_10N4∗ c o s ( d3_1−d3_0−theta33_10N4 ) +v3_1∗v4_0∗ y34_10 ∗ c o s ( d3_1−d4_0−theta34_10 ) +v3_1∗v3_1∗y33_11N4∗ c o s ( d3_1−d3_1−theta33_11N4 ) +v3_1∗v4_1∗ y34_11 ∗ c o s ( d3_1−d4_1−theta34_11 ) +v3_1∗v3_2∗y33_12N4∗ c o s ( d3_1−d3_2−theta33_12N4 ) +v3_1∗v4_2∗ y34_12 ∗ c o s ( d3_1−d4_2−theta34_12 ) ) = 0 ; C15 : P34_2−(v3_2∗v3_0∗y33_20N4∗ c o s ( d3_2−d3_0−theta33_20N4 ) +v3_2∗v4_0∗ y34_20 ∗ c o s ( d3_2−d4_0−theta34_20 ) +v3_2∗v3_1∗y33_21N4∗ c o s ( d3_2−d3_1−theta33_21N4 ) +v3_2∗v4_1∗ y34_21 ∗ c o s ( d3_2−d4_1−theta34_21 ) +v3_2∗v3_2∗y33_22N4∗ c o s ( d3_2−d3_2−theta33_22N4 ) +v3_2∗v4_2∗ y34_22 ∗ c o s ( d3_2−d4_2−theta34_22 ) ) = 0 ; C16 : P43_0−(v4_0∗v4_0∗ y44_00 ∗ c o s ( d4_0−d4_0−theta44_00 ) +v4_0∗v3_0∗ y34_00 ∗ c o s ( d4_0−d3_0−theta34_00 ) +v4_0∗v4_1∗ y44_01 ∗ c o s ( d4_0−d4_1−theta44_01 ) +v4_0∗v3_1∗ y34_01 ∗ c o s ( d4_0−d3_1−theta34_01 ) +v4_0∗v4_2∗ y44_02 ∗ c o s ( d4_0−d4_2−theta44_02 ) +v4_0∗v3_2∗ y34_02 ∗ c o s ( d4_0−d3_2−theta34_02 ) ) = 0 ; C17 : P43_1−(v4_1∗v4_0∗ y44_10 ∗ c o s ( d4_1−d4_0−theta44_10 ) +v4_1∗v3_0∗ y34_10 ∗ c o s ( d4_1−d3_0−theta34_10 ) +v4_1∗v4_1∗ y44_11 ∗ c o s ( d4_1−d4_1−theta44_11 ) +v4_1∗v3_1∗ y34_11 ∗ c o s ( d4_1−d3_1−theta34_11 ) +v4_1∗v4_2∗ y44_12 ∗ c o s ( d4_1−d4_2−theta44_12 ) +v4_1∗v3_2∗ y34_12 ∗ c o s ( d4_1−d3_2−theta34_12 ) ) = 0 ; C18 : P43_2−(v4_2∗v4_0∗ y44_20 ∗ c o s ( d4_2−d4_0−theta44_20 ) +v4_2∗v3_0∗ y34_20 ∗ c o s ( d4_2−d3_0−theta34_20 ) +v4_2∗v4_1∗ y44_21 ∗ c o s ( d4_2−d4_1−theta44_21 ) +v4_2∗v3_1∗ y34_21 ∗ c o s ( d4_2−d3_1−theta34_21 ) +v4_2∗v4_2∗ y44_22 ∗ c o s ( d4_2−d4_2−theta44_22 ) +v4_2∗v3_2∗ y34_22 ∗ c o s ( d4_2−d3_2−theta34_22 ) ) = 0 ;
185
Chapter B
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
C19 : Q12_0−(v1_0∗v1_0∗ y11_00 ∗ s i n ( d1_0−d1_0−theta11_00 ) +v1_0∗v2_0∗ y12_00 ∗ s i n ( d1_0−d2_0−theta12_00 ) +v1_0∗v1_1∗ y11_01 ∗ s i n ( d1_0−d1_1−theta11_01 ) +v1_0∗v2_1∗ y12_01 ∗ s i n ( d1_0−d2_1−theta12_01 ) +v1_0∗v1_2∗ y11_02 ∗ s i n ( d1_0−d1_2−theta11_02 ) +v1_0∗v2_2∗ y12_02 ∗ s i n ( d1_0−d2_2−theta12_02 ) ) = 0 ; C20 : Q12_1−(v1_1∗v1_0∗ y11_10 ∗ s i n ( d1_1−d1_0−theta11_10 ) +v1_1∗v2_0∗ y12_10 ∗ s i n ( d1_1−d2_0−theta12_10 ) +v1_1∗v1_1∗ y11_11 ∗ s i n ( d1_1−d1_1−theta11_11 ) +v1_1∗v2_1∗ y12_11 ∗ s i n ( d1_1−d2_1−theta12_11 ) +v1_1∗v1_2∗ y11_12 ∗ s i n ( d1_1−d1_2−theta11_12 ) +v1_1∗v2_2∗ y12_12 ∗ s i n ( d1_1−d2_2−theta12_12 ) ) = 0 ; C21 : Q12_2−(v1_2∗v1_0∗ y11_20 ∗ s i n ( d1_2−d1_0−theta11_20 ) +v1_2∗v2_0∗ y12_20 ∗ s i n ( d1_2−d2_0−theta12_20 ) +v1_2∗v1_1∗ y11_21 ∗ s i n ( d1_2−d1_1−theta11_21 ) +v1_2∗v2_1∗ y12_21 ∗ s i n ( d1_2−d2_1−theta12_21 ) +v1_2∗v1_2∗ y11_22 ∗ s i n ( d1_2−d1_2−theta11_22 ) +v1_2∗v2_2∗ y12_22 ∗ s i n ( d1_2−d2_2−theta12_22 ) ) = 0 ; C22 : Q21_0−(v2_0∗v2_0∗y22_00N1∗ s i n ( d2_0−d2_0−theta22_00N1 ) +v2_0∗v1_0∗ y12_00 ∗ s i n ( d2_0−d1_0−theta12_00 ) +v2_0∗v2_1∗y22_01N1∗ s i n ( d2_0−d2_1−theta22_01N1 ) +v2_0∗v1_1∗ y12_01 ∗ s i n ( d2_0−d1_1−theta12_01 ) +v2_0∗v2_2∗y22_02N1∗ s i n ( d2_0−d2_2−theta22_02N1 ) +v2_0∗v1_2∗ y12_02 ∗ s i n ( d2_0−d1_2−theta12_02 ) ) = 0 ; C23 : Q21_1−(v2_1∗v2_0∗y22_10N1∗ s i n ( d2_1−d2_0−theta22_10N1 ) +v2_1∗v1_0∗ y12_10 ∗ s i n ( d2_1−d1_0−theta12_10 ) +v2_1∗v2_1∗y22_11N1∗ s i n ( d2_1−d2_1−theta22_11N1 ) +v2_1∗v1_1∗ y12_11 ∗ s i n ( d2_1−d1_1−theta12_11 ) +v2_1∗v2_2∗y22_12N1∗ s i n ( d2_1−d2_2−theta22_12N1 ) +v2_1∗v1_2∗ y12_12 ∗ s i n ( d2_1−d1_2−theta12_12 ) ) = 0 ; C24 : Q21_2−(v2_2∗v2_0∗y22_20N1∗ s i n ( d2_2−d2_0−theta22_20N1 ) +v2_2∗v1_0∗ y12_20 ∗ s i n ( d2_2−d1_0−theta12_20 ) +v2_2∗v2_1∗y22_21N1∗ s i n ( d2_2−d2_1−theta22_21N1 ) +v2_2∗v1_1∗ y12_21 ∗ s i n ( d2_2−d1_1−theta12_21 ) +v2_2∗v2_2∗y22_22N1∗ s i n ( d2_2−d2_2−theta22_22N1 ) +v2_2∗v1_2∗ y12_22 ∗ s i n ( d2_2−d1_2−theta12_22 ) ) = 0 ; C25 : Q23_0−(v2_0∗v2_0∗y22_00N3∗ s i n ( d2_0−d2_0−theta22_00N3 ) +v2_0∗v3_0∗ y23_00 ∗ s i n ( d2_0−d3_0−theta23_00 ) +v2_0∗v2_1∗y22_01N3∗ s i n ( d2_0−d2_1−theta22_01N3 ) +v2_0∗v3_1∗ y23_01 ∗ s i n ( d2_0−d3_1−theta23_01 ) +v2_0∗v2_2∗y22_02N3∗ s i n ( d2_0−d2_2−theta22_02N3 ) +v2_0∗v3_2∗ y23_02 ∗ s i n ( d2_0−d3_2−theta23_02 ) ) = 0 ; C26 : Q23_1−(v2_1∗v2_0∗y22_10N3∗ s i n ( d2_1−d2_0−theta22_10N3 ) +v2_1∗v3_0∗ y23_10 ∗ s i n ( d2_1−d3_0−theta23_10 ) +v2_1∗v2_1∗y22_11N3∗ s i n ( d2_1−d2_1−theta22_11N3 ) +v2_1∗v3_1∗ y23_11 ∗ s i n ( d2_1−d3_1−theta23_11 ) +v2_1∗v2_2∗y22_12N3∗ s i n ( d2_1−d2_2−theta22_12N3 ) +v2_1∗v3_2∗ y23_12 ∗ s i n ( d2_1−d3_2−theta23_12 ) ) = 0 ; C27 : Q23_2−(v2_2∗v2_0∗y22_20N3∗ s i n ( d2_2−d2_0−theta22_20N3 ) +v2_2∗v3_0∗ y23_20 ∗ s i n ( d2_2−d3_0−theta23_20 ) +v2_2∗v2_1∗y22_21N3∗ s i n ( d2_2−d2_1−theta22_21N3 ) +v2_2∗v3_1∗ y23_21 ∗ s i n ( d2_2−d3_1−theta23_21 ) +v2_2∗v2_2∗y22_22N3∗ s i n ( d2_2−d2_2−theta22_22N3 ) +v2_2∗v3_2∗ y23_22 ∗ s i n ( d2_2−d3_2−theta23_22 ) ) = 0 ; C28 : Q32_0−(v3_0∗v3_0∗y33_00N2∗ s i n ( d3_0−d3_0−theta33_00N2 ) +v3_0∗v2_0∗ y23_00 ∗ s i n ( d3_0−d2_0−theta23_00 )
186
Appendix
B.2 AMPL Code
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388
+v3_0∗v3_1∗y33_01N2∗ s i n ( d3_0−d3_1−theta33_01N2 ) +v3_0∗v2_1∗ y23_01 ∗ s i n ( d3_0−d2_1−theta23_01 ) +v3_0∗v3_2∗y33_02N2∗ s i n ( d3_0−d3_2−theta33_02N2 ) +v3_0∗v2_2∗ y23_02 ∗ s i n ( d3_0−d2_2−theta23_02 ) ) = 0 ; C29 : Q32_1−(v3_1∗v3_0∗y33_10N2∗ s i n ( d3_1−d3_0−theta33_10N2 ) +v3_1∗v2_0∗ y23_10 ∗ s i n ( d3_1−d2_0−theta23_10 ) +v3_1∗v3_1∗y33_11N2∗ s i n ( d3_1−d3_1−theta33_11N2 ) +v3_1∗v2_1∗ y23_11 ∗ s i n ( d3_1−d2_1−theta23_11 ) +v3_1∗v3_2∗y33_12N2∗ s i n ( d3_1−d3_2−theta33_12N2 ) +v3_1∗v2_2∗ y23_12 ∗ s i n ( d3_1−d2_2−theta23_12 ) ) = 0 ; C30 : Q32_2−(v3_2∗v3_0∗y33_20N2∗ s i n ( d3_2−d3_0−theta33_20N2 ) +v3_2∗v2_0∗ y23_20 ∗ s i n ( d3_2−d2_0−theta23_20 ) +v3_2∗v3_1∗y33_21N2∗ s i n ( d3_2−d3_1−theta33_21N2 ) +v3_2∗v2_1∗ y23_21 ∗ s i n ( d3_2−d2_1−theta23_21 ) +v3_2∗v3_2∗y33_22N2∗ s i n ( d3_2−d3_2−theta33_22N2 ) +v3_2∗v2_2∗ y23_22 ∗ s i n ( d3_2−d2_2−theta23_22 ) ) = 0 ; C31 : Q34_0−(v3_0∗v3_0∗y33_00N4∗ s i n ( d3_0−d3_0−theta33_00N4 ) +v3_0∗v4_0∗ y34_00 ∗ s i n ( d3_0−d4_0−theta34_00 ) +v3_0∗v3_1∗y33_01N4∗ s i n ( d3_0−d3_1−theta33_01N4 ) +v3_0∗v4_1∗ y34_01 ∗ s i n ( d3_0−d4_1−theta34_01 ) +v3_0∗v3_2∗y33_02N4∗ s i n ( d3_0−d3_2−theta33_02N4 ) +v3_0∗v4_2∗ y34_02 ∗ s i n ( d3_0−d4_2−theta34_02 ) ) = 0 ; C32 : Q34_1−(v3_1∗v3_0∗y33_10N4∗ s i n ( d3_1−d3_0−theta33_10N4 ) +v3_1∗v4_0∗ y34_10 ∗ s i n ( d3_1−d4_0−theta34_10 ) +v3_1∗v3_1∗y33_11N4∗ s i n ( d3_1−d3_1−theta33_11N4 ) +v3_1∗v4_1∗ y34_11 ∗ s i n ( d3_1−d4_1−theta34_11 ) +v3_1∗v3_2∗y33_12N4∗ s i n ( d3_1−d3_2−theta33_12N4 ) +v3_1∗v4_2∗ y34_12 ∗ s i n ( d3_1−d4_2−theta34_12 ) ) = 0 ; C33 : Q34_2−(v3_2∗v3_0∗y33_20N4∗ s i n ( d3_2−d3_0−theta33_20N4 ) +v3_2∗v4_0∗ y34_20 ∗ s i n ( d3_2−d4_0−theta34_20 ) +v3_2∗v3_1∗y33_21N4∗ s i n ( d3_2−d3_1−theta33_21N4 ) +v3_2∗v4_1∗ y34_21 ∗ s i n ( d3_2−d4_1−theta34_21 ) +v3_2∗v3_2∗y33_22N4∗ s i n ( d3_2−d3_2−theta33_22N4 ) +v3_2∗v4_2∗ y34_22 ∗ s i n ( d3_2−d4_2−theta34_22 ) ) = 0 ; C34 : Q43_0−(v4_0∗v4_0∗ y44_00 ∗ s i n ( d4_0−d4_0−theta44_00 ) +v4_0∗v3_0∗ y34_00 ∗ s i n ( d4_0−d3_0−theta34_00 ) +v4_0∗v4_1∗ y44_01 ∗ s i n ( d4_0−d4_1−theta44_01 ) +v4_0∗v3_1∗ y34_01 ∗ s i n ( d4_0−d3_1−theta34_01 ) +v4_0∗v4_2∗ y44_02 ∗ s i n ( d4_0−d4_2−theta44_02 ) +v4_0∗v3_2∗ y34_02 ∗ s i n ( d4_0−d3_2−theta34_02 ) ) = 0 ; C35 : Q43_1−(v4_1∗v4_0∗ y44_10 ∗ s i n ( d4_1−d4_0−theta44_10 ) +v4_1∗v3_0∗ y34_10 ∗ s i n ( d4_1−d3_0−theta34_10 ) +v4_1∗v4_1∗ y44_11 ∗ s i n ( d4_1−d4_1−theta44_11 ) +v4_1∗v3_1∗ y34_11 ∗ s i n ( d4_1−d3_1−theta34_11 ) +v4_1∗v4_2∗ y44_12 ∗ s i n ( d4_1−d4_2−theta44_12 ) +v4_1∗v3_2∗ y34_12 ∗ s i n ( d4_1−d3_2−theta34_12 ) ) = 0 ; C36 : Q43_2−(v4_2∗v4_0∗ y44_20 ∗ s i n ( d4_2−d4_0−theta44_20 ) +v4_2∗v3_0∗ y34_20 ∗ s i n ( d4_2−d3_0−theta34_20 ) +v4_2∗v4_1∗ y44_21 ∗ s i n ( d4_2−d4_1−theta44_21 ) +v4_2∗v3_1∗ y34_21 ∗ s i n ( d4_2−d3_1−theta34_21 ) +v4_2∗v4_2∗ y44_22 ∗ s i n ( d4_2−d4_2−theta44_22 ) +v4_2∗v3_2∗ y34_22 ∗ s i n ( d4_2−d3_2−theta34_22 ) ) = 0 ; C37 : −P21_0 − P23_0=0; C38 : −P21_1 − P23_1=0; C39 : −P21_2 − P23_2=0; C40 : −P32_0 − P34_0=0; C41 : −P32_1 − P34_1=0; C42 : −P32_2 − P34_2=0; C43 : −P43_0 − PL_0=0; C44 : −P43_1 − PL_1=0;
187
Chapter B
389 390 391 392 393 394 395 396
C45 : C47 : C49 : C51 : C53 : C55 : C56 : C57 :
188
Appendix
−P43_2 − PL_2=0; C46 : −Q21_0 − Q23_0=0; −Q21_1 − Q23_1=0; C48 : −Q21_2 − Q23_2=0; −Q32_0 − Q34_0=0; C50 : −Q32_1 − Q34_1=0; −Q32_2 − Q34_2=0; C52 : −Q43_0 − QL_0=0; −Q43_1 − QL_1=0; C54 : −Q43_2 − QL_2=0; P12_0∗P12_0 + Q12_0∗Q12_0 − v1_0∗v1_0∗ I12_0 ∗ I12_0 =0; P12_1∗P12_1 + Q12_1∗Q12_1 − v1_1∗v1_1∗ I12_1 ∗ I12_1 =0; P12_2∗P12_2 + Q12_2∗Q12_2 − v1_2∗v1_2∗ I12_2 ∗ I12_2 =0;
C. Appendix C.1. C++ Programming This section explains how to solve some simple problems using C++ programming. Method used here is Newton-Raphson method and whole procedure consists of just few steps. First is to initialize values of all variables, such as voltages, currents, values of Lagrange multipliers, etc. Next step is enter elements of Jacobian matrix, and elements of right hand side as explained in Section 2.4.2. Finally, method is solved and iterated until the convergence criteria is satisfied.
C.1.1. Assign Initial Values This part performs initialization of all variables used. It is done defining integer, double, float or any other type of variables and assigning the value to those variables. Example of assigning the initial value to real and imaginary part of current at bus 2, and assigning initial value to the resistance is shown in Listing C.1. 1 double R= 0 . 1 ; 2 double I 2 r = 0 . 2 ; 3 double I2im = 0 . 3 ;
Listing C.1: Initial Values
C.1.2. Jacobian Matrix and right hand side (RHS) Entering elements of Jacobian matrix is performed using command addTriple, where just nonzero elements are entered and other are zero by default. Example of entering first and second row of Jacobian matrix from Example 3.1 is given in Listing C.2.
189
Chapter C
1 2 3 4
Appendix
p S o l v e r −>a d d T r i p l e ( 0 , 0 ,R) ; p S o l v e r −>a d d T r i p l e ( 0 , 4 , 1 ) ; p S o l v e r −>a d d T r i p l e ( 1 , 1 ,R) ; p S o l v e r −>a d d T r i p l e ( 1 , 6 , 1 ) ;
Listing C.2: Entering elements of Jacobian matrix For entering right hand side value command setRHS is used. Example of entering functions f1 and f2 from Example 3.1 is given in Listing C.3. 1 p S o l v e r −>setRHS ( 0 , −( I 1 2 r ∗R+L1 ) ) ; 2 p S o l v e r −>setRHS ( 1 , −(I12im ∗R+L3 ) ) ;
Listing C.3: Entering right hand side
C.1.3. Solve problem and Display Results Problem is solved using command solve, and results can be displayed in standard way in command window using function cout. Solving problem and displaying results for real and imaginary component of current between buses 1 and 2 is shown in Listing C.4. 1 i f ( p S o l v e r −>s o l v e ( ) ) 2 { 3 cout addTriple (2 ,4 , -1) ; pSolver - > addTriple (2 ,5 ,1) ; pSolver - > addTriple (3 ,3 , R ) ; pSolver - > addTriple (3 ,6 , -1) ; pSolver - > addTriple (3 ,7 ,1) ; pSolver - > addTriple (4 ,0 ,1) ; pSolver - > addTriple (4 ,2 , -1) ; pSolver - > addTriple (5 ,2 ,1) ; pSolver - > addTriple (6 ,1 ,1) ; pSolver - > addTriple (6 ,3 , -1) ;
191
Chapter C
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
Appendix
pSolver - > addTriple (6 ,8 , I2im ) ; pSolver - > addTriple (7 ,3 ,1) ; pSolver - > addTriple (8 ,6 , I2im ) ; if (! pSolver - > factorize () ) { cout setRHS (1 , -( I12im * R + L3 ) ) ; pSolver - > setRHS (2 , -( I23r *R - L1 + L2 ) ) ; pSolver - > setRHS (3 , -( I23im *R - L3 + L4 ) ) ; pSolver - > setRHS (4 , -( I12r + I2r - I23r ) ) ; pSolver - > setRHS (5 , -( I23r - I3r ) ) ; pSolver - > setRHS (6 , -( I12im + I2im *t - I23im ) ) ; pSolver - > setRHS (7 , -( I23im - I3im ) ) ; pSolver - > setRHS (8 , -( L3 * I2im ) ) ; if ( pSolver - > solve () ) { cout < < " ␣ I12r = ␣ " 0.000001)||( abs ( I23r - I3r ) >0.000001)|| ( abs ( I12im + I2im - I23im - Icim ) >0.000001)||( abs ( I23im - I3im ) >0.000001)|| ( abs ((( V1r - V2r )* G -( V1im - V2im )* B ) - I12r ) >0.000001)|| ( abs ((( V1r - V2r )* B +( V1im - V2im )* G ) - I12im ) >0.000001)|| ( abs ((( V2r - V3r )* G -( V2im - V3im )* B ) - I23r ) >0.000001) || ( abs ((( V2r - V3r )* B +( V2im - V3im )* G ) - I23im ) >0.000001)|| ( abs ( - bc * V2im - Icr ) >0.000001)||( abs ( bc * V2r - Icim ) >0.000001)|| ( abs ( P2 - V2r * I2r - V2im * I2im ) >0.000001)|| ( abs ( P3 - V3r * I3r - V3im * I3im ) >0.000001)|| ( abs ( Q2 + V2r * I2im - V2im * I2r ) >0.000001)|| ( abs ( Q3 + V3r * I3im - V3im * I3r ) >0.000001) ) { int NMAT =29; I D b l S p a r s e So l v e r * pSolver = c r e a t e D b l S p a r s e S o l v e r ( NMAT ,100 , matrix :: NonSymmetric , matrix :: FastSolver , matrix :: D i a g o n a l P i v o t i n g M u l t i P a s s ); pSolver - > addTriple (0 ,0 , R ); pSolver - > addTriple (0 ,15 ,1); pSolver - > addTriple (0 ,19 , -1); pSolver - > addTriple (1 ,1 , R ); pSolver - > addTriple (1 ,17 ,1); pSolver - > addTriple (1 ,20 , -1); pSolver - > addTriple (2 ,2 , R ); pSolver - > addTriple (2 ,15 , -1); pSolver - > addTriple (2 ,16 ,1); pSolver - > addTriple (2 21 , -1); pSolver - > addTriple (3 ,3 , R ); pSolver - > addTriple (3 ,17 , -1); pSolver - > addTriple (3 ,18 ,1); pSolver - > addTriple (3 ,22 , -1); pSolver - > addTriple (4 ,15 , -1); pSolver - > addTriple (4 ,23 , -1); pSolver - > addTriple (5 ,17 , -1); pSolver - > addTriple (5 ,24 , -1); pSolver - > addTriple (6 ,7 , L10 ); pSolver - > addTriple (6 ,8 , - L9 );
193
Chapter C
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
Appendix
pSolver - > addTriple (6 ,23 , - V2im ); pSolver - > addTriple (6 ,24 , V2r ); pSolver - > addTriple (7 ,6 , L10 ); pSolver - > addTriple (7 ,11 , - L11 ); pSolver - > addTriple (7 ,12 , L13 ); pSolver - > addTriple (7 ,19 , - G ); pSolver - > addTriple (7 ,20 , - B ); pSolver - > addTriple (7 ,21 , G ); pSolver - > addTriple (7 ,22 , B ); pSolver - > addTriple (7 ,24 , bc ); pSolver - > addTriple (7 ,25 , - I2r ); pSolver - > addTriple (7 ,27 , I2im ); pSolver - > addTriple (8 ,6 , - L9 ); pSolver - > addTriple (8 ,11 , - L13 ); pSolver - > addTriple (8 ,12 , - L11 ); pSolver - > addTriple (8 ,19 , B ); pSolver - > addTriple (8 ,20 , - G ); pSolver - > addTriple (8 ,21 , - B ); pSolver - > addTriple (8 ,22 , G ); pSolver - > addTriple (8 ,23 , - bc ); pSolver - > addTriple (8 ,25 , - I2im ); pSolver - > addTriple (8 ,27 , - I2r ); pSolver - > addTriple (9 ,13 , - L12 ); pSolver - > addTriple (9 ,14 , L14 ); pSolver - > addTriple (9 ,21 , - G ); pSolver - > addTriple (9 ,22 , - B ); pSolver - > addTriple (9 ,26 , - I3r ); pSolver - > addTriple (9 ,28 , I3im ); pSolver - > addTriple (10 ,13 , - L14 ); pSolver - > addTriple (10 ,14 , - L12 ); pSolver - > addTriple (10 ,21 , B ); pSolver - > addTriple (10 ,22 , - G ); pSolver - > addTriple (10 ,26 , - I3im ); pSolver - > addTriple (10 ,28 , - I3r ); pSolver - > addTriple (11 ,7 , - L11 ); pSolver - > addTriple (11 ,8 , - L13 ); pSolver - > addTriple (11 ,15 ,1); pSolver - > addTriple (11 ,25 , - V2r ); pSolver - > addTriple (11 ,27 , - V2im ); pSolver - > addTriple (12 ,7 , L13 ); pSolver - > addTriple (12 ,8 , - L11 ); pSolver - > addTriple (12 ,17 ,1); pSolver - > addTriple (12 ,25 , - V2im ); pSolver - > addTriple (12 ,27 , V2r ); pSolver - > addTriple (13 ,9 , - L12 ); pSolver - > addTriple (13 ,10 , - L14 ); pSolver - > addTriple (13 ,16 , -1); pSolver - > addTriple (13 ,26 , - V3r ); pSolver - > addTriple (13 ,28 , - V3im ); pSolver - > addTriple (14 ,9 , L14 ); pSolver - > addTriple (14 ,10 , - L12 ); pSolver - > addTriple (14 ,18 , -1); pSolver - > addTriple (14 ,26 , - V3im ); pSolver - > addTriple (14 ,28 , V3r ); pSolver - > addTriple (15 ,0 ,1); pSolver - > addTriple (15 ,2 , -1); pSolver - > addTriple (15 ,4 , -1); pSolver - > addTriple (15 ,11 ,1); pSolver - > addTriple (16 ,2 ,1); pSolver - > addTriple (16 ,13 , -1); pSolver - > addTriple (17 ,1 ,1); pSolver - > addTriple (17 ,3 , -1); pSolver - > addTriple (17 ,5 , -1); pSolver - > addTriple (17 ,12 ,1); pSolver - > addTriple (18 ,3 ,1); pSolver - > addTriple (18 ,14 , -1); pSolver - > addTriple (19 ,0 , -1); pSolver - > addTriple (19 ,7 , - G ); pSolver - > addTriple (19 ,8 , B ); pSolver - > addTriple (20 ,1 , -1); pSolver - > addTriple (20 ,7 , - B ); pSolver - > addTriple (20 ,8 , - G ); pSolver - > addTriple (21 ,2 , -1); pSolver - > addTriple (21 ,7 , G ); pSolver - > addTriple (21 ,8 , - B ); pSolver - > addTriple (21 ,9 , - G ); pSolver - > addTriple (21 ,10 , B ); pSolver - > addTriple (22 ,3 , -1); pSolver - > addTriple (22 ,7 , B ); pSolver - > addTriple (22 ,8 , G ); pSolver - > addTriple (22 ,9 , - B ); pSolver - > addTriple (22 ,10 , - G ); pSolver - > addTriple (23 ,4 , -1); pSolver - > addTriple (23 ,6 , - V2im ); pSolver - > addTriple (23 ,8 , - bc ); pSolver - > addTriple (24 ,5 , -1); pSolver - > addTriple (24 ,6 , V2r ); pSolver - > addTriple (24 ,7 , bc ); pSolver - > addTriple (25 ,7 , - I2r ); pSolver - > addTriple (25 ,8 , - I2im ); pSolver - > addTriple (25 ,11 , - V2r ); pSolver - > addTriple (25 ,12 , - V2im ); pSolver - > addTriple (26 ,9 , - I3r ); pSolver - > addTriple (26 ,10 , - I3im ); pSolver - > addTriple (26 ,13 , - V3r ); pSolver - > addTriple (26 ,14 , - V3im ); pSolver - > addTriple (27 ,7 , I2im ); pSolver - > addTriple (27 ,8 , - I2r ); pSolver - > addTriple (27 ,11 , - V2im ); pSolver - > addTriple (27 ,12 , V2r ); pSolver - > addTriple (28 ,9 , I3im ); pSolver - > addTriple (28 ,10 , - I3r ); pSolver - > addTriple (28 ,13 , - V3im ); pSolver - > addTriple (28 ,14 , V3r ); // pSolver - > s e r i a l i z e (" A " , cout , matrix :: V I E W _ S C I L A B ); if (! pSolver - > factorize ()) { cout setRHS (1 , pSolver - > setRHS (2 , pSolver - > setRHS (3 , pSolver - > setRHS (4 , pSolver - > setRHS (5 , pSolver - > setRHS (6 , pSolver - > setRHS (7 ,
-( I12r * R + L1 - L5 )); -( I12im * R + L3 - L6 )); -( I23r *R - L1 + L2 - L7 )); -( I23im *R - L3 + L4 - L8 )); -( - L1 - L9 )); -( - L3 - L10 )); -( - L9 * V2im + L10 * V2r )); -( - L5 *G - L6 * B + L7 * G + L8 * B + L10 * bc - L11 * I2r + L13 * I2im )); pSolver - > setRHS (8 , -( L5 *B - L6 *G - L7 * B + L8 *G - L9 * bc - L11 * I2im - L13 * I2r )); pSolver - > setRHS (9 , -( - L7 *G - L8 *B - L12 * I3r + L14 * I3im )); pSolver - > setRHS (10 , -( L7 *B - L8 *G - L12 * I3im - L14 * I3r )); pSolver - > setRHS (11 , -( L1 - L11 * V2r - L13 * V2im )); pSolver - > setRHS (12 , -( L3 - L11 * V2im + L13 * V2r )); pSolver - > setRHS (13 , -( - L2 - L12 * V3r - L14 * V3im )); pSolver - > setRHS (14 , -( - L4 - L12 * V3im + L14 * V3r )); pSolver - > setRHS (15 , -( I12r + I2r - I23r - Icr )); pSolver - > setRHS (16 , -( I23r - I3r )); pSolver - > setRHS (17 , -( I12im + I2im - I23im - Icim )); pSolver - > setRHS (18 , -( I23im - I3im )); pSolver - > setRHS (19 , -(( V1r - V2r )* G -( V1im - V2im )* B - I12r )); pSolver - > setRHS (20 , -(( V1r - V2r )* B +( V1im - V2im )* G - I12im )); pSolver - > setRHS (21 , -(( V2r - V3r )* G -( V2im - V3im )* B - I23r )); pSolver - > setRHS (22 , -(( V2r - V3r )* B +( V2im - V3im )* G - I23im )); pSolver - > setRHS (23 , -( - bc * V2im - Icr )); pSolver - > setRHS (24 , -( bc * V2r - Icim )); pSolver - > setRHS (25 , -( P2 - V2r * I2r - V2im * I2im )); pSolver - > setRHS (26 , -( P3 - V3r * I3r - V3im * I3im )); pSolver - > setRHS (27 , -( Q2 + V2r * I2im - V2im * I2r )); pSolver - > setRHS (28 , -( Q3 + V3r * I3im - V3im * I3r )); if ( pSolver - > solve ()) { // * * * * * * * * * * * * * * * * RESULTS * * * * * * * * * * * * * * * * * * * * * * cout < < " ␣ I12r = ␣ "