Three Phase Distribution System State Estimation

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 215

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 5
1.1. Distribution System State Estimation (DSSE) . . . . . . 5
1.2. Mathematical formulation . . . . . . . . . . . . . . . . . 8

2. Distribution Power Flow 13


2.1. Modeling of System Components . . . . . . . . . . . . . 14
2.1.1. Single phase branch π equivalent . . . . . . . . . 14
2.1.2. Generator Modeling . . . . . . . . . . . . . . . . 16
2.1.3. Load Modeling . . . . . . . . . . . . . . . . . . . 17
2.2. Active and Reactive Power Flows . . . . . . . . . . . . . 18
2.3. Basic Power Flow Problem . . . . . . . . . . . . . . . . 19
2.3.1. Equality constraints . . . . . . . . . . . . . . . . 21
2.3.2. Inequality constraints . . . . . . . . . . . . . . . 21
2.4. Solution of the Power Flow Problem . . . . . . . . . . . 21
2.4.1. Gauss-Seidel (G-S) Method . . . . . . . . . . . . 22
2.4.2. Newton-Raphson (N-R) Method . . . . . . . . . 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 con-
ditions . . . . . . . . . . . . . . . . . . . . . . . . 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 con-
straints . . . . . . . . . . . . . . . . . . . . . . . 39
3.3. Classical Optimization Techniques . . . . . . . . . . . . 41
3.3.1. Unconstrained Optimization Approaches . . . . . 41

i
Contents Contents

3.3.2. Linear Programming . . . . . . . . . . . . . . . . 41


3.3.3. Nonlinear Programming . . . . . . . . . . . . . . 42
3.3.4. Quadratic Programming . . . . . . . . . . . . . . 42
3.3.5. Newton’s Method . . . . . . . . . . . . . . . . . . 43
3.3.6. Interior Point Methods . . . . . . . . . . . . . . . 43
3.3.7. Mixed-Integer Programming . . . . . . . . . . . . 43
3.3.8. Network Flow Programming . . . . . . . . . . . . 44
3.4. Mixed Integer Nonlinear Programming . . . . . . . . . . 44
3.4.1. Mixed Integer Linear Programming . . . . . . . . 45
3.4.2. Non-Linear Programming . . . . . . . . . . . . . 46
3.4.3. Convex Mixed Integer Non-Linear Programming 46
3.4.4. Non-convex Mixed Integer Non-Linear Program-
ming . . . . . . . . . . . . . . . . . . . . . . . . . 47
3.5. MINLP Methods . . . . . . . . . . . . . . . . . . . . . . 48
3.5.1. Branch and Bound (B&B) . . . . . . . . . . . . . 48
3.5.2. Outer Approximation (OA) . . . . . . . . . . . . 50
3.5.3. Generalized Benders Decomposition (GBD) . . . 52
3.5.4. Extended Cutting Plane (ECP) . . . . . . . . . . 54
3.5.5. LP/NLP based Branch and Bound . . . . . . . . 54
3.6. Sequential Quadratic Programming . . . . . . . . . . . . 56
3.7. SQP Methods . . . . . . . . . . . . . . . . . . . . . . . . 56
3.7.1. Line search method . . . . . . . . . . . . . . . . 57
3.7.2. Trust region method . . . . . . . . . . . . . . . . 57
3.7.3. Han-Powell method . . . . . . . . . . . . . . . . 58
3.7.4. Sequential unconstrained methods . . . . . . . . 59
3.7.5. Filter methods . . . . . . . . . . . . . . . . . . . 59
3.7.6. Merit function . . . . . . . . . . . . . . . . . . . 60
3.7.7. Sequential programming algorithm and basic prin-
ciple . . . . . . . . . . . . . . . . . . . . . . . . . 60
3.7.8. Lagrange Newton Iteration with SQP approach . 63
3.8. Example 3.1 . . . . . . . . . . . . . . . . . . . . . . . . . 65
3.9. Example 3.2 . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.10. Example 3.3 . . . . . . . . . . . . . . . . . . . . . . . . . 72

4. Single-phase modeling 77
4.1. Problem Description and Basic Principles . . . . . . . . 79
4.2. Load Estimation with 4-connections . . . . . . . . . . . 82
4.2.1. WLS Estimation with Y -connected loads . . . . 83
4.2.2. Consideration of 4-connected loads . . . . . . . 85

ii
Contents

4.2.3. Consideration of Measurement Area Losses as Vari-


ables . . . . . . . . . . . . . . . . . . . . . . . . 89
4.2.4. Handling of Bad Data . . . . . . . . . . . . . . . 90
4.2.5. Summary of the Load Estimation Algorithm . . 91
4.3. Numerical Results . . . . . . . . . . . . . . . . . . . . . 92
4.3.1. Load Estimation Accuracy Test . . . . . . . . . . 92
4.3.2. Bad Data Identification . . . . . . . . . . . . . . 95
4.3.3. Load Estimation Performance Test . . . . . . . . 96
4.4. Numerical Sensitivity Factors . . . . . . . . . . . . . . . 99

5. Multiphase modeling 101


5.1. Multiphase branch π equivalent . . . . . . . . . . . . . . 101
5.1.1. Active and reactive power in multiphase branch
element . . . . . . . . . . . . . . . . . . . . . . . 103
5.1.2. Active and reactive branch power sensitivity . . . 105
5.1.3. Shunt equivalent . . . . . . . . . . . . . . . . . . 109
5.1.4. Three phase transformers with OLTC . . . . . . 109
5.1.5. Branch Measurements . . . . . . . . . . . . . . . 112
5.1.6. Node Measurements . . . . . . . . . . . . . . . . 117
5.1.7. Injection Measurements . . . . . . . . . . . . . . 119
5.1.8. PV Nodes . . . . . . . . . . . . . . . . . . . . . . 123
5.1.9. LVC with OLTC . . . . . . . . . . . . . . . . . . 124
5.2. Three-Phase State Estimation Method . . . . . . . . . . 125
5.2.1. Formulation . . . . . . . . . . . . . . . . . . . . . 125
5.2.2. Solution . . . . . . . . . . . . . . . . . . . . . . . 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 157
A.1. MATLAB Programming . . . . . . . . . . . . . . . . . . 157
A.1.1. Import Files to M-file . . . . . . . . . . . . . . . 157
A.1.2. Introduction of Symbolic Variables . . . . . . . . 158
A.1.3. Define Measurements and Parameters . . . . . . 160
A.1.4. Calculate Constraints . . . . . . . . . . . . . . . 161
A.1.5. Matrix Calculation . . . . . . . . . . . . . . . . . 162
A.1.6. Assign Initial Values . . . . . . . . . . . . . . . . 163
A.1.7. Solve Gauss-Newton Method and show Results . 164
A.2. MATLAB code . . . . . . . . . . . . . . . . . . . . . . . 166

iii
Contents Contents

B. Appendix 177
B.1. AMPL Programming . . . . . . . . . . . . . . . . . . . . 177
B.1.1. AMPL Model File . . . . . . . . . . . . . . . . . 177
B.1.2. Declaration of Variables and Parameters . . . . . 178
B.1.3. Objective function and constraints . . . . . . . . 179
B.1.4. Solve problem and Display Results . . . . . . . . 180
B.2. AMPL Code . . . . . . . . . . . . . . . . . . . . . . . . 181

C. Appendix 189
C.1. C++ Programming . . . . . . . . . . . . . . . . . . . . . 189
C.1.1. Assign Initial Values . . . . . . . . . . . . . . . . 189
C.1.2. Jacobian Matrix and right hand side (RHS) . . . 189
C.1.3. Solve problem and Display Results . . . . . . . . 190
C.1.4. C++ Code for Example 3.1 . . . . . . . . . . . 191
C.1.5. C++ Code for Example 3.2 . . . . . . . . . . . . 192

Bibliography 197

Index 201

Nomenclature 205

iv
List of Figures

1.1. State Estimation block diagram . . . . . . . . . . . . . . 7


1.2. Weighted Least Square Algorithm . . . . . . . . . . . . 11

2.1. Equivalent circuit of a line element of length dx . . . . . 15


2.2. π-equivalent of single-phase element . . . . . . . . . . . 16
2.3. Model of a generator connected to bus p . . . . . . . . . 17
2.4. Model of a load connected to bus i . . . . . . . . . . . . 18
2.5. Bus connected to a subset of n buses . . . . . . . . . . . 18
2.6. Different types of buses . . . . . . . . . . . . . . . . . . . 20

3.1. Convex Function . . . . . . . . . . . . . . . . . . . . . . . 32


3.2. Convexity of differentiable function on (a,b) . . . . . . . . . 33
3.3. Penalty functions . . . . . . . . . . . . . . . . . . . . . . . 35
3.4. Pruning rules . . . . . . . . . . . . . . . . . . . . . . . . . 49
3.5. Outer Approximation . . . . . . . . . . . . . . . . . . . . 52
3.6. (a) Extended Cutting Plane, (b) LP/NLP Based Branch and
Bound . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
3.7. Three bus network with linear compensation of reactive power 66
3.8. System with capacitor for reactive power compensation . . . 70
3.9. Six node network . . . . . . . . . . . . . . . . . . . . . . 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 open-
Y /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 po-


tential 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 . . . . . . . . . . . . . . . . . . . . . 69


3.2. System with Capacitor . . . . . . . . . . . . . . . . . . . . 72

4.1. Connection type and phases with load in the IEEE-13


test feeder . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.2. SCADA measurements, estimated values, and error de-
viation using current balancing [4] and DSSE (13-node
test feeder) . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.3. Active and Reactive power load scaling factors using DSSE
(13-node test feeder) . . . . . . . . . . . . . . . . . . . . 95
4.4. Average and maximum values of the error deviations in
% using current balancing [4] and DSSE (13-node test
feeder) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4.5. Estimated load error versus the number of MAs (13-node
test feeder) . . . . . . . . . . . . . . . . . . . . . . . . . 96
4.6. Bad data identification in the 13-node test system with
3 MAs . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
4.7. Computing time of DSSE for a 642-node distribution net-
work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
4.8. Performance network key numbers . . . . . . . . . . . . 98

6.1. Measurement set for IEEE 4-bus network . . . . . . . . 141


6.2. Bus Voltages . . . . . . . . . . . . . . . . . . . . . . . . 141
6.3. Estimated voltages, current, load and power flow for 4
bus system . . . . . . . . . . . . . . . . . . . . . . . . . 148
6.4. Convergence summary . . . . . . . . . . . . . . . . . . . 148
6.5. Measurement set for IEEE 13-bus network . . . . . . . . 150
6.6. Bus Voltages . . . . . . . . . . . . . . . . . . . . . . . . 151
6.7. Line Segment Data . . . . . . . . . . . . . . . . . . . . . 152
6.8. Estimated voltages for 13 bus system . . . . . . . . . . . 154
6.9. Convergence Summary . . . . . . . . . . . . . . . . . . . 155

3
1. Introduction

1.1. Distribution System State Estimation (DSSE)

With the development of information and communication technolo-


gies (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 com-
municating 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 de-
vices 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 pro-
tection 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 sit-
uation. 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 ap-
plications 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 show-
ing 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 as-
sure 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 re-
mote 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 al-
ready known about active and reactive power and voltage magnitude
measurements, voltage angle measurements are relatively new in prac-
tice. Direct measurement of voltage phase angle was impossible for a
long time. In order to be valid, those measurements should be synchro-
nized, i.e. a time reference should be provided. The global positioning
system (GPS) signal made synchronization possible with accuracy bet-
ter 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 sta-
tus 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 us-
ing 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, trans-
former taps, and generator outputs.
• Detection/identification of bad data: Bad data processing
detects the existence of gross errors in the measurement set, iden-
tifies and eliminates bad measurements provided that there is
enough redundancy in the measurement configuration, parameter
and structural error processing, estimates various network param-
eters, such as transmission line model parameters, tap changing
transformer parameters, shunt capacitor or reactor parameters,
detects structural errors in the network configuration and iden-
tifies 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 net-
works, 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 net-
works, 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 un-
predictable loads and generation. Distribution state estimation (DSSE)
provides a very useful role in providing network operators with im-
proved, consistent and complete information about the present operat-
ing 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 mini-
mization, 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 mea-
surements taken on the network, e.g. voltage or current flow mea-
surements. The classical approach of state estimation in power systems
consists of the application of the Weighted Least Square (WLS) method-
ology, 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 (1.3)
∂x
where H(x) is the measurement Jacobian matrix

∂h(x)
H(x) = (1.4)
∂x
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) = 1
2 [z − h(x)]T W [z − h(x)]
(1.8)
subject to c(x) = 0

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 multi-
pliers 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
(1.10)
∂L(x)/∂λ = 0 ⇒ c(x) = 0

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 4x H T W 4z k
= (1.11)
C 0 −λ −c(xk )

where:

4z k = z − h(xk ) (1.12)

Iteration step 4x can be found only when the gain matrix is nonsingu-
lar. 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

x = x0

(z − h(x ))
k

[ H T WH ]

[ ]−1
[
∆x = H TWH H TW z − h(x k ) ]

Max ( ∆x ) < ε
x = x + ∆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 de-
veloped, 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 prob-
lems. These applications place two primary requirements on a distri-
bution 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 meth-
ods 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 begin-
ning can oscillate without converging toward the solution. In order to
avoid this problem, the load-flow solution is often started with a Gauss-
Seidel algorithm followed by the Newton-Raphson algorithm after a few
iterations. There is also an approximate but faster method for the load-
flow 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 sta-
tionary sinusoidal conditions the long line equations, ordinary differen-
tial 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 con-
ductor 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) be-
tween 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
gpq = 2 +x2
rpq
(2.4)
pq
xpq
bpq = − r2 +x 2
pq pq

15
Chapter 2 Distribution Power Flow

sh sh
y pq y pq

Figure 2.2.: π-equivalent of single-phase element

For actual transmission lines the series reactance and the series resis-
tance 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:

ip = y pq (v p − v q ) + y sh v
pq p
(2.5)
sh
iq = y pq (v q − v p ) + y pq v q

The corresponding Kirchoff’s equations are

y + y sh
" # " #" #
ip −y pq vp
= pq pq
(2.6)
iq −y pq y pq + y sh
pq
vq

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 deter-
mined 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 op-
erate 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 character-
istics, 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 trans-
formers 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
p = iload
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 ) (2.8)


Qload
p = Qload
p (vp ).

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:


N
X
ip = y pq v q (2.10)
q=1

18
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 Equa-


tion 2.11 results in a set of nonlinear algebraic equations in terms of
voltage magnitude in per unit, and angle in radians:
n
X
Pp + jQp = vp ∠ − δp 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

n
X
Pp = vp vq ypq cos(θpq − δp + δq ) (2.13)
q=1

n
X
Qp = − 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 as-
sociated to each bus (network node) p: voltage magnitude (Vp ) ,voltage
angle (δp ), net active power (Pp ) and net reactive power (Qp ). De-
pending 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 corre-
sponds 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 volt-
age 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:


n
X
Ppgen − Ppload = Pp = vp vq ypq cos(θpq − δp + δq ) (2.15)
q=1

n
X
Qgen
p − Qload
p = Qp = − vp vq ypq sin(θpq − δp + δq ) (2.16)
q=1

where Ppgen and Qgen


p are active and reactive power generation at bus
load
p, and Pp load
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 implementa-


tions, including voltage magnitudes at PQ buses, branch current flows,
branch power flows, active and reactive power generation levels, trans-
former 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
min ≤ P max
Pgen gen ≤ Pgen (2.17)
Qmin max
gen ≤ Qgen ≤ Qgen

Another example are real and reactive components of the complex load
power that are given within the boundaries
min ≤ P max
Pload load ≤ Pload (2.18)
Qload ≤ Qload ≤ Qmax
min
load

2.4. Solution of the Power Flow Problem

In all realistic cases the power flow problem cannot be solved analyti-
cally, and hence iterative solutions implemented in computers must be
used. In this chapter we will review two solutions methods, Gauss it-
eration 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 guar-
anteed in case that the system matrix is diagonally dominant, or sym-
metric 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:

xn+1
1 = c1 + g1 (xn1 , xn2 , ..., xnN )
n+1
x2 = c2 + g2 (xn1 , xn2 , ..., xnN )
.. (2.21)
.
xn+1
N = cN + gN (xn1 , xn2 , ..., xnN )

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 12 ··· Y 1N V1 I1
 Y 21

Y 22 ··· Y 2N 
  V 2   I2 
   
 .  =  .  (2.22)
 . .. .. 
 . ..    
 . . . .   ..   .. 
Y N1 Y N2 · · · Y NN VN IN

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, Gauss-
Seidel 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
(2.24)
= V ∗p Ypp V p + V ∗p Ypq V q
P

⇒ V ∗p Ypp V p = (Pp − jQp ) − V ∗p Ypq V q


X
(2.25)

(Pp − jQp ) X
⇒ Ypp V p = − Ypq V q (2.26)
V ∗p

(Pp −jQp )

P
V ∗p Ypq V q
⇒Vp = (2.27)
Ypq
Solution can be obtained using iterative method:
(Pp −jQp ) (k)

P
V ∗p (k)
Ypq V q
V (k+1)
p = (2.28)
Ypq

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 lin-
earization. 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 ) P (k)
(k)
− Ypq V q
(k+1) V∗p
V p = Ypq
For voltage-controlled buses, first find reactive power and
then corresponding
n voltage
 o
(k+1) ∗ (k) (k) (k)
= −Im V p
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
n less
o than na tolerance
o value). Iterate until
(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 +


(4x0 )2 (4x0 )n (2.31)
f 00 (x0 ) + ... + f (n) (x0 ) + ... = 0
2! n!

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

f (x0 )
4x0 = − (2.33)
f 0 (x0 )

The new solution will be

f (x0 )
x1 = x0 + 4x0 = x0 − (2.34)
f 0 (x0 )

The iteration equation is

f (xk )
xk+1 = xk + 4xk = xk − (2.35)
f 0 (xk )

24
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 ∂f1 ∂f1
f1 + ∂x1 4x1 + ∂x2 4x2 + ... + ∂xn 4xN =0
∂f2 ∂f2 ∂f2
f2 + ∂x1 4x1 + ∂x2 4x2 + ... + ∂xn 4xN =0
.. (2.37)
.
∂fN ∂fN ∂fN
fN + ∂x1 4x1 + ∂x2 4x2 + ... + ∂xn 4xN =0

Last equation can also be written in matrix form

∂f1 (n) ∂f1 (n) ∂f1 (n)


       
...
   
(n) (n)
 ∂x
 1 (n)
∂x
 2 (n)
∂x
 n (n)  4x1 f1
∂f ∂f ∂f   4x(n) (n)
    
 2
 ∂x1
2
∂x2 ··· ∂xn
2
2
  f2 
 = −
   
 .. .. .. ..  .. .. 

 . . . .

 . 


 . 

  (n) (n) (n)  (n) (n)
4x fN
 
∂fN ∂fN ∂f N
∂x1 ∂x2 ... ∂xn
N

(2.38)

Newton-Raphson algorithm for the n-dimensional case


h i−1
−f (n) = J (n) 4X (n) ⇒ 4X (n) = − J (n) f (n) (2.39)

h i−1
⇒ X (n+1) = X (n) + 4X (n) = X (n) − J (n) f (n) (2.40)

Newton-Raphson iteration method can be applied for power flow equa-


tions. Firstly, the state vector of unknown voltage angles and magni-
tudes is ordered such that:
" #
δ
x= (2.41)
V

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)
f (x) = (2.42)
4Q(x)

The Jacobian matrix J can be written as


  n  n  n  n 
∂P2 ∂P2 ∂P2 ∂P2
··· ···
∂δ2 ∂δn ∂v2 ∂vn 4δ2n 4P2n
   
 
 .. .. 
..  ..
 . .   
 
 ∂PN n n   .   . 
∂PN n
   n 
∂PN ∂PN    

 ∂δ2 · · · ∂δn ∂v2 · · · ∂Vn 

 4δN n   4P n
  N


−−  =  −−
    
     
 ∂Q n ∂Q2 n ∂Q2 n ∂Q2 n   4v2n   4Qn
        

∂δ2
2
· · · ∂δn ∂v2 · · · ∂vn 2

.. ..
    
.. ..
    

 . .

 .   . 
  n  n  n  n  n
4vN 4QnN
∂QN ∂QN ∂QN ∂QN
∂δ2 ··· ∂δn ∂v2 ··· ∂vn
(2.43)

" # " #" #


4P n J1n J2n 4δ n
= (2.44)
4Qn J3n J4n 4v n

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]:
∂Pp X
= vp vq ypq sin(θpq − δp + δq ) (2.45)
∂δp q6=p

∂Pp
= −vp vq ypq sin(θpq − δp + δq ), q 6= p (2.46)
∂δq
The diagonal and off-diagonal elements of J2 are:
∂Pp X
= 2vp ypp cos(θpp ) + vq ypq cos(θpq − δp + δq ) (2.47)
∂vp q6=p

∂Pp
= vp ypq cos(θpq − δp + δq ), q 6= p (2.48)
∂vq

26
2.4 Solution of the Power Flow Problem

The diagonal and off-diagonal elements of J3 are:


∂Qp X
= vp vq ypq cos(θpq − δp + δq ) (2.49)
∂δp q6=p

∂Qp
= −vp vq ypq cos(θpq − δp + δq ), q 6= p (2.50)
∂δq

The diagonal and off-diagonal elements of J4 are:


∂Qp X
= −2vp ypp sin(θpp ) − vq ypq sin(θpq − δp + δq ) (2.51)
∂vp q6=p

∂Qp
= −vp ypq sin(θpq − δp + δq ), q 6= p (2.52)
∂vq

New estimates for voltage magnitudes and phase angles are computed
from:

δin+1 = δin + 4δin (2.53)


vin+1 = vin + 4vin

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
4X (n) = − J (n) f (n)
Set X at iteration (n + 1) as X (n+1) =X
(n) + 4X (n)

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 sev-
eral 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 govern-
ments, politicians, large industries and investors, field of power sys-
tem optimization has always been subject of considerable changes and
new challenges. From the optimization point of view, various tech-
niques 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, in-
terior 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 hi-
erarchical process). In this chapter, the main concepts for optimiza-
tions are discussed such as feasibility and optimality, convexity, duality,
penalty functions, Lagrange function, multipliers and optimality condi-
tions. Further more, this chapter contains description of unconstrained
and constrained optimization. The most popular Mixed Integer Non-
liner 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 corre-
sponds 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 sin-
gle 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 establish-
ing 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 con-
tinuously 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 re-
ferred 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 opti-
mum 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 con-
ditions 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 be-
come necessary and sufficient conditions for a global minimum. Kuhn-
Tucker (KT) theorem is generalization of Lagrange multipliers methods,
which gives opportunities for solving problems with constraints with in-
equality. It is given with:
Theorem 3.2. (Karush -Kuhn-Tucker Theorem). Let x̊ denote
local minimum of nonlinear problem. There exists λ̊ ∈ Rm such that:
X
(i) ∇f (x̊) + λ̊i ∇gi (x̊) = 0
(ii) λ̊i ∇gi (x̊) = 0, i = 1, ..., m
(3.7)
(iii) λ̊ ≥ 0
(iv) gi (x̊) ≤ 0, i = 1, ..., m

32
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 comple-
mentarity 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 non-
linear 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
(3.8)
Ax ≥ b AT y ≤ c
x≥0 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
cT x̊ = bT ẙ (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 op-


timization problems by unconstrained problems. Consider the problem

min f (x)
(3.11)
gi (x) ≤ 0, i = 1, ..., m
If infinity penalty for leaving feasible set X is introduced
(
0, x∈X
q(x) = (3.12)
+∞, x∈
/X
Problem from Equation 3.11 can be changed to the problem of uncon-
strained 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, approxima-
tion 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:


X
L(x, λ) = f (x) + λi gi (x) (3.14)

34
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 (3.15)
∂x1 ∂xn ∂λ1 ∂λm
These solutions are stationary points of Lagrange function, which are
the candidates for extremes. Matrix H(x, λ) is defined as:
 ∂g1 ∂g1 
0 ... 0 ∂x1 ··· ∂xn
 . .. .. .. .. .. 
 . . .
 . . . . 

 ∂gm ∂gm  "
··· ···
#
 0 0  0 J
∂x1 ∂xn
= (3.16)
 
 ∂g1 ∂gm ∂2L ∂2L
 ∂x1 ··· ∂x1 ∂x12 ··· ∂x1 ∂xn  JT ∇2xx L
 
 . .. .. .. .. ..
 ..

 . . . . . 

∂g1 ∂hgm ∂2L ∂2L
∂xn ··· ∂xn ∂xn ∂x1 ··· ∂xn2

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̊, λ̊)
is stationary point of Lagrange function L, and if matrix ∇2xx 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
y T ∇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 single-
variable 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 ≤
x̊ ≤ b , and if the derivative df (x)/dx = f 0 (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̊) = ... =
f (n−1) (x̊) = 0, but f (n) (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 con-
sidered.
Theorem 3.10 (Necessary Condition). If f (X) has an extreme
point (maximum or minimum) at X = X̊ and if the first partial deriva-
tives of f (X) exist at X̊, then
∂f ∂f ∂f
(X̊) = (X̊) = ... = (X̊) = 0 (3.17)
∂x1 ∂x2 ∂xn
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 sub-


jected 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
 
x1

 x2 

X= .. .
.
 
 
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 )


(3.19)
= f (X) + λ1 g1 (X) + λ2 g2 (X) + ... + +λm gm (X)

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
∂L ∂f X ∂gj
= + λj = 0, i = 1, 2, ..., n (3.20)
∂xi ∂xi j=1 ∂xi

∂L
= gj (X) = 0, j = 1, 2, ..., m (3.21)
∂λj
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̊1 λ̊1

 x̊2 


 λ̊2


X̊ =  ..  and λ̊ =  .. 
. .
   
   
x̊n λ̊m

The vector X̊ corresponds to the local constrained minimum of f (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
n X
m
X ∂2L
Q= dxi dxj (3.22)
i=1 j=1
∂xi ∂xj

evaluated at X = X̊ must be positive definite for all values of dX for


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 λ̊).
3. Best X̊ is optimum if optimum exists.

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:
m
X
L(X, Y, λ) = f (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
∂L ∂f X ∂gj
(X, Y, λ) = (X) + λj (X) = 0, i = 1, 2, ..., n (3.27)
∂xi ∂xi j=1
∂xi

∂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 (3.29)
∂yi
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.27-
3.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:

X
(i) ∇f (x̊) + λ̊i ∇gi (x̊) = 0
(ii) λ̊i ∇gi (x̊) = 0, i = 1, ..., m
(3.30)
(iii) λ̊ ≥ 0
(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 tradi-


tional 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 op-
timization approaches, Nonlinear programming (NLP), Linear pro-
gramming (LP), Quadratic programming (QP), Generalized re-
duced gradient method, Newton method, Network flow program-
ming (NFP), Mixed - integer programming (MIP), Interior point
(IP) methods
2. Intelligence search methods such as: Neural network (NN), Evo-
lutionary 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 opti-
mization problems in power system operation can be converted into
unconstrained optimization problems. The major unconstrained opti-
mization approaches that are used in power system operation are gradi-
ent 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 func-
tion 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 prob-


lems. 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 con-
straints. The disadvantages of LP-based techniques are inaccurate eval-
uation of system losses and insufficient ability to find an exact solu-
tion compared with an accurate nonlinear power system model. How-
ever, 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 security-
constrained economic dispatch, optimal power flow, steady-state secu-
rity regions, reactive power optimization, etc.[2].

3.3.3. Nonlinear Programming

Power system operation problems are nonlinear. Thus nonlinear pro-


gramming (NLP) based techniques can easily handle power system op-
eration 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 it-
erative 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 gra-
dient (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 program-


ming. 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 often-
used 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 Hes-
sian) 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 pro-
gramming. It is faster and perhaps better than the conventional sim-
plex 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 approxi-
mation 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 Ben-
ders’ decomposition method (BDM) can greatly improve efficiency in
solving a large-scale network by reducing the dimensions of the indi-
vidual 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 net-
work [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 effi-
cient 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. Con-
taining 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 mod-
eling many optimization problems. Over the last five years there has
been a significant increase in the development of these models in pro-
cess systems engineering. In the most recent years, considerable number
of researchers including chemical engineers, operations researchers, in-
dustrial engineers, mechanical engineers, economists, statisticians, com-
puter scientists, operations managers, and mathematical programmers
are interested in solving large-scale Mixed Integer Nonlinear Program-
ming (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 prob-
lems 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 Mixed-


Integer 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 sub-
classes of problems. If both objective and constraints are linear func-
tions, 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 in-
stance, 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 analy-
sis 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
(3.31)
x∈X
y ∈ Y, integer
The function f (x, y) is a nonlinear objective function and g(x, y) a non-
linear 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 in-
equalities. 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 bi-
nary 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
(3.32)
x∈X
y∈Y

where A and B are, matrices of coefficients, b is vector, called right-


hand 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 (3.33)
y∈Y

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 vari-
ables 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 func-
tion. 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 Non-
linear 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 ex-
ample, 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 feasi-
ble region. For this reason, when non-convex constraints are involved,
one has to carefully use linearization cuts. The relaxation of the orig-
inal 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 (3.34)
x∈X
y∈Y

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 es-
tablished 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 General-
ized Benders Decomposition. Here the background and fundamental
concepts of those three approaches will be illustrated. Further avail-
able 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 intro-
duced in 1960 by Land and Doig for combinatorial optimization prob-
lems. 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 con-
tinuous 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 descen-
dant 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,
(3.35)
x∈X
li ≤ xi ≤ ui, ∀i ∈ I

The branch–and–bound algorithm starts by solving above problem, giv-


ing 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 k
(l,u)
li+ = xi , 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)
(j)
subject to c(x) ≤ 0 (N LP (xI )) (3.36)
(j)
x ∈ X and xI = xI

50
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 o
(j)
χ = 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 opti-
mal 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 Gross-
mann (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 o
η < U k = min f (j) |N LP (x(j) ) is f easible (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 Equa-
tion 3.38 weighted with (1, λ(j) ), where λ(j) ≥ 0 are the multipliers
(j)
of (N LP (xI )), the following valid inequality can be obtained:

(j) T
 X (j) 
η ≥ (f (j) + λ(j)T c(j) ) + ∇f (j) + λi ∇ci (x − x(j) ) (3.43)

52
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
X (j) (j)
∇C f (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
(j) T
 X (j) 
(j)
η ≥ f (j) + ∇I f (j) + λi ∇I ci (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
 
(j)
η ≥ f (j) + µi (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
(3.47)
gj (x̊) + ∇gj (x̊)T (x − x̊) ≤ 0, j ∈ J, x̊ ∈ K
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 lin-
earizations of all violated constraints to problem. In that case, J(K) =
{j|gj (x̊) > 0}. The optimal values z(k) of problem generate a non-
decreasing 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 , x̊i ) be optimal solution to (RM-ECP(K)).
Terminate?
is gj (x̊i ) < ε, ∀j ∈ J and f (x̊i ) − η̊ i < ε? If so, x̊i is
optimal with ε feasibility.
Refine 
K ← K ∪ x̊i , t ∈ argmaxi gj (x̊i ) and J(K) ← J(K) ∪ {t}
i ← i + 1. Go to 1.

nodes in which feasible integer solutions are found. Whenever an inte-


ger solution is found at a node, the standard branch-and-bound is in-
terrupted 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 mas-
ter 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 signifi-
cantly 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 disser-
tation, where his algorithm represents special case of convex problems
solving an inequality constrained quadratic sub-problem in each itera-
tion. Sequential quadratic programming has become popular with the
work of Big and Han. Bigg proposed algorithm where quadratic sub-
problem 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 pro-
posed 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 ba-
sic structure of an SQP method involves major and minor iterations.
The major iterations generate a sequence of iterates (xk , k) that con-
verge 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. Vec-
tor 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 lin-
ear 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 iter-
ation of a conventional line-search method for unconstrained optimiza-
tion 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 con-
straint is present. This algorithm is related to the conventional trust-
region approach in unconstrained optimization. Trust region method
solves sub-problem as is stated
1
mindRn gkT d + dT Hk d subject to kdk ≤ δk ,
2

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 trust-
region methods which do not enforce a reduction in f at every step.
Trust-region problem need to be solved more than once before satisfac-
tion 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 min-
imization. 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 positive-
definite 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 ) (3.51)
2

subject to

ck + Jk (x − xk = 0, x ≥ 0, )

58
3.7 SQP Methods

3.7.4. Sequential unconstrained methods

Fletcher in his work suggested that penalty function l1 can be min-


imized subject to bounds by solving a sequence of non-differentiable
unconstrained sub-problems of the form

minimizexRn fˆk (x) + ρ kĉk (x)k1 + ρ k[x]k1 (3.52)

where cˆk (x) is a linearized constraint function. Fletcher proposed min-


imizing of this function using a trust-region method, rather than line-
search method. Using trust region method form is now changed to
sub-problem form of

minimizexRn fˆk (xk + d) + ρ kĉk (xk + d)k1 + ρ k[xk + d]k1 (3.53)

subject to kdk ≤ δk . Each sub-problem has a quadratic objective func-


tion. 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ĉk (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 ≤ ĉk (xk + d) ≤ θe θ ≥ 0 (3.55)
− δk e ≤ d ≤ δk e, xk + d + σe ≥ 0, σ≥0

3.7.5. Filter methods

Filters can be used to force convergence. Filters represent two dimen-


sional 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 min-
imizers for the NLP problem are unconstrained minimizers for the exact
penalty function. Also Lagrangian function can be used as merit func-
tion, but this function includes Lagrange multipliers. For calculating
variables x it is necessary to obtain correct value for the multiplier es-
timate 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 sub-
problem 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, engi-


neering, industry etc. When problem is formulated in NLP it is general
model depending which type of objective function is included if the func-
tion 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 so-
lution 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

δ 2 f (x)
Hf (x)i,j = (3.58)
δxi , δxj
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, ů,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 (3.62)
2

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 re-
placed 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


(3.63)
hj (x) = 0, jE = {1, 2, ..., p}

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
X
L(x, λ) = f (x) + λj hj (x) = f (x) + λT h(x) (3.64)
jE

with defined KKT conditions:


" # " #
∇f (x) + λj ∇hj (x)
P
j 0
∇L(x, λ) = = (3.65)
h(x) 0

Hessian matrix has the following structure:


" #
2 Q BT
∇ L(x, λ) = (3.66)
B 0

X
Q = ∇2 f (x) + λj ∇2 hj (x) = ∇2xx L(x, λ), (3.67)
j

∇h1 (x)T
 

B = h0 (x) = 
 .. 
(3.68)
. 
∇hp (x) T

Here Newton equation can be further transformed to:


" #" # " #
Q BT 4x ∇f (x)
+ =− (3.69)
B 0 λ h(x)

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
" #" # " #
Q BT 4x ∇f (x)
=−
B 0 λ+ h(x)

64
3.8 Example 3.1

Algorithm 3.5 Lagrange Newton


Initialize
choose (x0 , λ0 )T R(n+p)
Calculate " #
k 0 k k ∇f (xk ) + B T λk
∇f (x ), B = h (x ), F =
h(xk )
Solve
" the
# "system
# of linear
" equations
#
Q B T 4x ∇f (x)
=−
B 0 λ+ h(x)
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

X X
Q = Q(x, λ, µ) = ∇2 f (x) + λi ∇2 gi (x) + µj ∇2 hj (x) (3.71)
iI 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
Q = ∇2 f (xk ) + iI λki ∇2 gi (xk ) + jE µj ∇2 hj (xk )
P P

Determine the value of Lagrange multiplicators λlin and


µlin
Choose xk+1 = xk + 4x, λk+1 i = λi,lin in a case where
iIlin (4x), and otherwise set
λk+1
i = 0, µk+1 = µlin , k = k + 1 go to step Calculate.

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  (3.72)
    
I3 0 −Y23 Y23 V3

66
3.8 Example 3.1

    
E1 1 0 0 V1
 0.2 + j0.3  =  −1 + j3 2 − j6 −1 + j3   V2 
    
−1 − j5 0 −1 + j3 1 − j3 V3
(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. Prob-


lem can be formulated as follows:
 
Ploss = M in |I12 |2 R + |I23 |2 R =
X
M in
     (3.77)
M in (I12r )2 + (I12im )2 R + (I23r )2 + (I23im )2 R

subject to

c1 : I12r + I2r − I23r = 0


c2 : I23r − I3r = 0
(3.78)
c3 : I12im + I2im t − I23im = 0
c4 : I23im − I3im = 0

Now, we can form function


1 h    i
f= (I12r )2 + (I12im )2 R + (I23r )2 + (I23im )2 R
2
+ λ1 (I12r + I2r − I23r ) + λ2 (I23r − I3r ) (3.79)
+ λ3 (I12im + I2im t − I23im ) + λ4 (I23im − I3im )

67
Chapter 3 Optimization for Power Systems

where
∂f ∂f
= I12r R + λ1 = f1 = I12r + I2r − I23r = f5
∂I12r ∂λ1
∂f ∂f
= I12im R + λ3 = f2 = I23r − I3r = f6
∂I12im ∂λ2
∂f ∂f
= I23r R − λ1 + λ2 = f3 = I12im + I2im t − I23im = f7
∂I23r ∂λ3
∂f ∂f
= I23im R − λ3 + λ4 = f4 = I23im − I3im = f8
∂I23im ∂λ4
∂f
= λ3 I2im = f9
∂t
(3.80)
Next step is to calculate Jacobian matrix J:
 ∂f ∂f1 ∂f1 ∂f1 ∂f1 ∂f1 ∂f1 ∂f1 ∂f1

1
 ∂I
∂f
12r
2
∂I12im
∂f2
∂I23r
∂f2
∂I23im
∂f2
∂λ1
∂f2
∂λ2
∂f2
∂λ3
∂f2
∂λ4
∂f2
∂t
∂f2 
 
 ∂I12r ∂I12im ∂I23r ∂I23im ∂λ1 ∂λ2 ∂λ3 ∂λ4 ∂t 
 ∂f3 ∂f3 ∂f3 ∂f3 ∂f3 ∂f3 ∂f3 ∂f3 ∂f3 
 ∂I12r ∂I12im ∂I23r ∂I23im ∂λ1 ∂λ2 ∂λ3 ∂λ4 ∂t 
 ∂f4 ∂f4 ∂f4 ∂f4 ∂f4 ∂f4 ∂f4 ∂f4 ∂f4 
 
 ∂I12r ∂I12im ∂I23r ∂I23im ∂λ1 ∂λ2 ∂λ3 ∂λ4 ∂t 
 ∂f5 ∂f5 ∂f5 ∂f5 ∂f5 ∂f5 ∂f5 ∂f5 ∂f5 
 ∂I12r ∂I12im ∂I23r ∂I23im ∂λ1 ∂λ2 ∂λ3 ∂λ4 ∂t 
 ∂f ∂f6 ∂f6 ∂f6 ∂f6 ∂f6 ∂f6 ∂f6 ∂f6

 6 
 ∂I12r ∂I12im ∂I23r ∂I23im ∂λ1 ∂λ2 ∂λ3 ∂λ4 ∂t 
 ∂f7 ∂f7 ∂f7 ∂f7 ∂f7 ∂f7 ∂f7 ∂f7 ∂f7 
 ∂I ∂I12im ∂I23r ∂I23im ∂λ1 ∂λ2 ∂λ3 ∂λ4 ∂t

 12r 
 ∂f8 ∂f8 ∂f8 ∂f8 ∂f8 ∂f8 ∂f8 ∂f8 ∂f8 
 ∂I12r ∂I12im ∂I23r ∂I23im ∂λ1 ∂λ2 ∂λ3 ∂λ4 ∂t 
∂f9 ∂f9 ∂f9 ∂f9 ∂f9 ∂f9 ∂f9 ∂f9 ∂f9
∂I12r ∂I12im ∂I23r ∂I23im ∂λ1 ∂λ2 ∂λ3 ∂λ4 ∂t
(3.81)
In Newton-Raphson method, the vector of system variables is given
with
h i−1
4X (n) = − J (n) f (n) (3.82)
or, when it is applied to the given model, vector of system variables
becomes
(n) −1  (n)
4I12r R f1
 
0 0 0 1 0 0 0 0
 4I12im   0 R 0 0 0 0 1 0 0   f2 

 4I23r 


 0 0 R 0 −1 1 0 0 0 


 f3 


 4I23im 


 0 0 0 R 0 0 −1 1 0 


 f4 


 4λ1 
 =− 
 1 0 −1 0 0 0 0 0 0 


 f5 

 4λ2   0 0 1 0 0 0 0 0 0   f6 
4λ3 −1
     
   0 1 0 0 0 0 0 I2im   f7 
4λ4 0 0 0 1 0 0 0 0 0 f8
     
4t 0 0 0 0 0 0 I2im 0 0 f9

68
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 effective-
ness 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 per-
formance 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

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)

70
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 reac-
tive 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 capac-
ity 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 Optimization for Power Systems

Variable Initial Value Iteration(1) Iteration(2)


I12r 0.2 0.205635 0.205706
I12im -0.2 -0.117572 0.0154148
I23r 0.4 0.404755 0.402168
I23im -0.6 -0.621332 -0.619911
Icr 0 0.000499334 0.00193964
Icim 0.1 0.201086 0.333592
bc 0.1 0.201644 0.334656
V2r 1 0.994416 0.998405
V2im 0 -0.00499334 -0.00632533
V3r 1 0.971729 0.975786
V3im 0 -0.0109227 -0.0121913
I2r 0.2 0.199619 0.198402
I2im -0.3 -0.302674 -0.301734
I3r 0.4 0.404755 0.402168
I3im -0.6 -0.621332 -0.619911
loss 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
are: C1 = 0.1PG1 + 0.2PG1 2 ,C = 0.15P 2
2 G2 + 0.18PG2 , C3 = 0.2PG3 +
0.15PG3 2 . On three nodes are connected three consumers with their

active powers PL1 , PL2 , PL3 . Impedance of the line in the network is the
same ZL = 0.01 + j0.05. Aim is to find min 3i=1 Ci , where PGi min ≤
P

PGi ≤ PGi max . In order to solve this problem power flow analysis and

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:
n
X
Pi = Vi Vj Yij cos(θij − δi + δj )
j=1
n (3.109)
X
Qi = − 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 (3.110)

− V2 V1 Y21 cos(θ21 −δ2 +δ1 )−V22 Y22 cosθ22 −


h2 :
V2 V3 Y23 cos(θ23 −δ2 +δ3 )−(V2 V5 Y25 cos(θ25 −δ2 +δ5 ))−PL1 =0
(3.111)

− V3 V2 Y32 cos(θ32 − δ3 + δ2 ) − V32 Y33 cosθ33


h3 : (3.112)
− V3 V4 Y34 cos(θ34 − δ3 + δ4 ) + PG3 = 0

− V4 V3 Y43 cos(θ43 − δ4 + δ3 ) − V42 Y44 cosθ44


h4 : (3.113)
− V4 V5 Y45 cos(θ45 − δ4 + δ5 ) − PL3 = 0

− V5 V2 Y52 cos(θ52 −δ5 +δ2 ))−V5 V4 Y54 cos(θ54 −δ5 +δ4 )−


h5 : (3.114)
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.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.

V2 V1 Y21 sin(θ21 −δ2 +δ1 )+V22 Y22 sinθ22


h7 :
+V2 V3 Y23 sin(θ23 −δ2 +δ3 )+V2 V5 Y25 sin(θ25 −δ2 +δ5 )−QL1 =0
(3.116)

V3 V2 Y32 sin(θ32 − δ3 + δ2 ) + V32 Y33 sinθ33


h8 : (3.117)
V3 V4 Y34 sin(θ34 − δ3 + δ4 ) + QG3 = 0

V4 V3 Y43 sin(θ43 − δ4 + δ3 ) + V42 Y44 sinθ44


h9 : (3.118)
V4 V5 Y45 sin(θ45 − δ4 + δ5 ) − QL3 = 0

74
3.10 Example 3.3

V5 V2 Y52 sin(θ52 −δ5 +δ2 )+V5 V4 Y54 sin(θ54 −δ5 +δ4 )


h10 : (3.119)
+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.120)

Voltages in the initial state have values 1 V. Elements Yxx are elements
of admittance matrix.
1 1
Admittance matrix YL = ZL = 0.01+j0.05 = ... = 19.61∠ − 1.37S.
 
Y11 Y12 ... Y1n
Y Y22 ... Y2n 
YL =  21
 
 ... ... ... ... 

Yn1 Yn2 ... 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 calcula-
tion. 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 repre-
sents sum of the power in the nodes. Lagrangian function state as:
2 2
L(x, λ)=0.1PG1 +0.2PG1 +0.15PG2 +0.18PG2
11
X
2
+0.2PG3 +0.15PG3 + λi hi
i=1

For Hessian matrix it is important to calculate elements of the matrix


" #
2 Q BT
∇ L(x, λ) =
B 0

where
X
Q = ∇2 f (x) + λj ∇2 hj (x) = ∇2xx L(x, λ),
j

75
Chapter 3 Optimization for Power Systems

and
∇h1 (x)T
 

B = h0 (x) = 
 .. 
. 
∇hp (x) T

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 

 . .. .. .. .. 
 .. . . . . 0

 
 . .. .. .. .. 
 .. . . . . −V5 V6 Y56 cos(θ56 − δ5 + δ6 )

0 0 0 −V6 Y56 cos(θ56 − δ5 + δ6 ) 0 0

For given optimization problem it is necessary to find values of param-


eters for adjusting generators. So, for the formulated problem
" #" # " #
Q BT 4x ∇f (x)
=−
B 0 λ+ h(x)

these parameters can be found like:


" # " #" #−1
4x ∇f (x) Q BT
+ =−
λ h(x) B 0

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 esti-


mate 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 trans-
mission networks. These challenges include: (i) a limited number of real
time measurements many of which are current magnitudes, (ii) an un-
symmetrical 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 alloca-
tion 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 me-
ter 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 compre-
hensive 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 pre-
dictable; 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 es-
timation, but uses load data as psedo-measurements. References [24]
and [25] employed the WLS method and a three-phase model to esti-
mate 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 ex-
pressed 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 measure-
ments in distribution state estimation. Unlike [24, 25, 26], reference
[27] proposed a branch current distribution state estimator which em-
ploys 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 effi-
ciency 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 im-
prove 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 dis-
tribution 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 esti-
mation 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 addi-
tion, 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 cur-
rent 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 strate-
gic points in the network. The loads are not telemetered in real time;
rather their values are defined by making use of load curves and auto-
mated 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 cus-
tomer load information which is transmitted to the central computing
unit at specified times during the day. The bus loads are initially fore-
casted using the load curves, AMRs, and other relevant meteorological
conditions. The real time measurements are employed in the state es-
timator 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 oper-


ated 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 down-


stream from the feeder head. Fig. 4.1 also shows eight measurement ar-
eas (MAs), denoted by MA1 to MA 8. A measurement area is defined
as a connected sub-network which does not include any branch mea-
surements 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 mea-
surements 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, illus-


trated 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 prob-
lem 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 mea-
surements 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 es-
timated and forecasted quantities. The solution to the WLS problem
yields the real/reactive load scaling factors, i.e. the ratios of the esti-
mated 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 be-
cause 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 be-
tween 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 measure-
ments, 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 4-
connected 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

 
The real time analog measurements Pφ,n M , QM , I M , V M in a distribu-
φ,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 mea-
surements are often current magnitudes, a measurement type known to
be the least effective in state estimation [1]. The mathematical formu-
lation described in this section employs the available real time measure-
ments 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 net-
work 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 speci-
fied power factor. The MA constraints include the active and reactive
area balance constraints in (4.3) and (4.4), the apparent power con-
straints associated with the current magnitude measurements in (4.5)
and (4.6), and the bound limits of the scaling factors in (4.7):

X
minimize J = Jφ (4.1)
φ∈P HY

83
Chapter 4 Single-phase modeling

where Jφ is given in (4.2):

X (i) (i)
Jφ = [ωnP M (Pφ,n − Pφ,n
M 2
) + ωnQM (Qφ,n − QM 2
φ,n ) ]
n∈P QM
X (i)
+ [ωnCM (Iφ,n − Iφ,n
M 2
) ]
n∈CM
X (i)
+ [ωnV M (Vφ,n − Vφ,n
M 2
) ]
n∈V M
X (i) (i)
+ [ωnP LG (Pφ,n
LG
(KPφ,n − 1))2 + ωnQLG (QLG 2
φ,n (KQφ,n − 1)) ]
n∈LG
X (i) (i)
+ [ωnP F G (KPφ,n − KQφ,n )2 ]
n∈P F G
(4.2)

and subject to (4.3)-(4.6):

X (i) X (i)
LG (i)
Pφ,n = KPφ,n Pφ,n + P LOSSφ,M A(m) ,
n∈IM (m) n∈LG(m) (4.3)
m = 1, . . . , MY , φ ∈ P HY

X (i) X (i) (i)


Qφ,n = KQφ,n QLG
φ,n + QLOSSφ,M A(m) ,
n∈IM (m) n∈LG(m) (4.4)
m = 1, . . . , MY , φ ∈ P HY

(i) (i) LF (i−1) (i) 2


(Pφ,n )2 + (Qφ,n )2 = (Vφ,n Iφ,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 (4.6)

min ≤ KP max (i) min max (i)


KPφ,n φ,n ≤ KPφ,n , KQφ,n ≤ KQφ,n ≤ KQφ,n (4.7)
n ∈ LG(m), m = 1, . . . , MY , φ ∈ P HY

84
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 measure-
ment 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 con-
straints on the load group scaling factors (4.7). A solution can be ob-
tained 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 de-
coupled 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 4-
connected 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)
LG (i)
LG (i) LG
Pa(i) + Pb = KPab Pab + KPbc Pbc + KPca Pca + P LOSS (i)
(4.8)

(i) LG(i) LG (i)(i) LG


Q(i)
a + Qb = KQab Qab + KQbc Qbc + KQca Qca + QLOSS
(i)

(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:

(i−1)
∂Pa

(i) (i−1)
Pa(i) = PaLF (i−1) + (KPab − KPab )
∂KPab
∂Pa (i−1)
 
(i) (i−1)
+ (KPbc − KPbc ) (4.10)
∂KPbc
∂Pa (i−1)
 
(i) (i−1)
+ (KPca − KPca )
∂KPca

(i−1)
∂Pb

(i) LF (i−1) (i) (i−1)
Pb = Pb + (KPab − KPab )
∂KPab
∂Pb (i−1)
 
(i) (i−1)
+ (KPbc − KPbc ) (4.11)
∂KPbc
∂Pb (i−1)
 
(i) (i−1)
+ (KPca − KPca )
∂KPca

(i−1)
∂Qa

LF (i−1) (i) (i−1)
Q(i)
a = Qa + (KQab − KQab )
∂KQab
(i−1)
∂Qa

(i) (i−1)
+ (KQbc − KQbc ) (4.12)
∂KQbc
(i−1)
∂Qa

+ (KQ(i) (i−1)
ca − KQca )
∂KQca

(i−1)
∂Qb

(i) LF (i−1) (i) (i−1)
Qb = Qb + (KQab − KQab )
∂KQab
(i−1)
∂Qb

(i) (i−1)
+ (KQbc − KQbc ) (4.13)
∂KQbc
(i−1)
∂Qb

+ (KQ(i) (i−1)
ca − KQca )
∂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 connec-
tivity 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 P (i) P P (i)LG + P LOSS (i)


Pφ,n = KPρ,k Pρ,k M A(m)
φ∈P HY n∈IM (m) ρ∈P H∆ k∈LG(m)
m = MY + 1, . . . , MY + M∆
(4.14)

(i) (i) (i)


KQρ,k QLG
P P P P
Qφ,n = ρ,k + QLOSSM A(m)
φ∈P HY n∈IM (m) ρ∈P H∆ k∈LG(m)
m = MY + 1, . . . , MY + M∆
(4.15)

∂Pφ,n (i−1)
h i
(i) LF (i−1) (i) (i−1)
− KPρ,k
P P
Pφ,n = Pφ,n + ∂KPρ,k (KPρ,k )
ρ∈P H∆ k∈LG(m)
m = MY + 1, . . . , MY + M∆ , n ∈ IM (m), , φ ∈ P HY
(4.16)

∂Qφ,n (i−1)
h i
(i) LF (i−1) (i) (i−1)
− KQρ,k )
P P
Qφ,n = Qφ,n + ∂KQρ,k (KQρ,k
ρ∈P H∆ k∈LG(m)
m = MY + 1, . . . , MY + M∆ , n ∈ IM (m), , φ ∈ P HY
(4.17)

min ≤ KP (i) max min max (i)


KPρ,k ρ,k ≤ KPρ,k , KQρ,k ≤ KQρ,k ≤ KQρ,k (4.18)
k ∈ LG(m), m = MY + 1, . . . , MY + M∆ , ρ ∈ P H∆

88
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:

(i) LF (i−1)
P LOSSφ,M A(m) = P LOSSφ,M A(m)
" #(i−1)
X ∂P LOSSφ,M A(m) (i) (i−1)
+ (KPφ,n − KPφ,n ) (4.19)
n∈LG(m)
∂KPφ,n

m = 1, . . . , MY , φ ∈ P HY

(i) LF (i−1)
QLOSSφ,M A(m) = QLOSSφ,M A(m)
" #(i−1)
X ∂QLOSSφ,M A(m) (i) (i−1)
+ (KQφ,n − KQφ,n ) (4.20)
n∈LG(m)
∂KQφ,n

m = 1, . . . , MY , φ ∈ P HY

(i) LF (i−1)
P LOSSM A(m) = P LOSSM A(m)
" #(i−1)
X X ∂P LOSSM A(m) (i) (i−1)
+ (KPρ,k − KPρ,k )
ρ∈P H∆ k∈LG(m)
∂KPρ,k

m = MY + 1, . . . , MY + M∆
(4.21)

89
Chapter 4 Single-phase modeling

(i) LF (i−1)
QLOSSM A(m) = QLOSSM A(m)
" #(i−1)
X X ∂QLOSSM A(m) (i) (i−1)
+ (KQρ,k − KQρ,k )
ρ∈P H∆ k∈LG(m)
∂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 han-


dled using normalized residuals [1]. Whilst such an approach is appli-
cable in this case, performance requirements for real time computations
would be more easily met if the detection of obviously bad measure-
ments [36] is carried out separately. In DSSE, obviously bad measure-
ments 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 scal-
ing 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 eas-
ily 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 sys-
tem 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 nega-
tive 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 adjust-
ing 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 re-
active 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 mea-
surement area losses to the active/reactive load group scal-
ing factors, and the sensitivity of the active/reactive power
injections at the boundary of 4-connection areas to the ac-
tive/reactive load group scaling factors (see 4.23-4.26). In-
crement 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 demon-
strate 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 distribu-
tion 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 dif-
ference 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 devia-
tion 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
Node
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)

REF.[4] DSSE
Load Increase [%]
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)

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 can-


not be properly gauged on the 13-node network model due to its small
size. The load estimation test was conducted in a full operational sys-
tem 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 net-
work 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 Distribu-
tion Management System (DMS) server, clients may require running

97
Chapter 4 Single-phase modeling

Computing Time
# MA
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

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 charac-
terizing 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 speci-
fied 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 im-


plementation of a distribution system state estimator that combines
unbalanced three-phase load flow and WLS estimation over measure-
ment areas. The WLS estimation integrates real time measurements
(active/reactive power flow and current magnitude) and load pseudo-
measurements (from short-term load forecasting) through weighting fac-
tors that account for the accuracy of the available information. Numer-
ical results show that the DSSE produces highly accurate results and
complies with the real time computational requirements for DMS con-
trol 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 com-
putation and treated as constant values; the corresponding values of
Pa , Pb , Qa and Qb are denoted by LF. In order to obtain all the sensitiv-
ity factors, the procedure below is executed six times, each time slightly
changing the real or reactive power of the load value (Sab , Sbc , Sca ) con-
nected between two phases. Consider the case in Fig. 4.7 where the
active power of Sca is incremented by a small amount; after this in-
crement, 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 (4.23)
∂KPca ∆KPca →0 ∆KPca ∆KPca

∂Pb PbSLF − PbLF P SLF − PbLF


= Lim ≈ b (4.24)
∂KPca ∆KPca →0 ∆KPca ∆KPca

99
Chapter 4 Single-phase modeling

∂Qa QSLF
a − QLF
a QSLF − QLF
= Lim ≈ a a
(4.25)
∂KPca ∆KPca →0 ∆KPca ∆KPca

∂Qb QSLF
b − QLF
b QSLF − QLF
= Lim ≈ b b
(4.26)
∂KPca ∆KPca →0 ∆KPca ∆KPca

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 open-


Y /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 approxi-


mating it by the π equivalent approach. Magnetic and electric field cou-
plings 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 cou-
pling 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 Vp
= (5.1)
Iq −Y s Y s + Y gq Vq

or
" # " #" #
Ip Y pp Y pq Vp
= (5.2)
Iq Y qp Y qq Vq

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 OY-
OD 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 Y pq Vp
 |{z}   |{z} |{z}   |{z} 
 nϕp ×1
nϕp ×1 nϕp ×nϕp nϕp ×nϕq   
 I = Y (5.3)
  
Y qq   V 
 q   qp q 
  |{z}
|{z} |{z} |{z}
nϕq ×1 nϕq ×nϕp nϕq ×nϕq nϕq ×1

102
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
" #   ∗ 
S pq diag(V p ) I p
=  ∗  (5.4)
S qp diag(V q ) I q

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
S (k) (k) 
pq = v p y (k,l)
pp
v (l)
p + y (k,l)
pq
v (l)
q
 ∀k ∈ {0, .., n − 1}
l=0 l=0
(5.6)

After applying Euler’s transformations


(l)
(l) jδp
v (l)
p = vp e (5.7)
1
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
y (k,l)
pp
= ypp e (5.10)

(k,l)
(k,l) jθpq
y (k,l)
pq
= ypq e (5.11)

complex power at node p and phase k becomes:


nϕp −1
 
(k) (l) (k,l)
(k,l) j δp −δp −θpp
X
S (k)
pq = vp(k) vp(l) ypp e +
l=0
nϕq −1
  (5.12)
(k) (l) (k,l)
(k,l) j δp −δq −θpq
X
vp(k) vq(l) ypq e
l=0

Active and reactive powers entering terminal p of phase k at n-phase


element is calculated then as

nϕp −1  
X
(k)
Ppq = vp(k) vp(l) ypp
(k,l)
cos δp(k) − δp(l) − θpp
(k,l)
+
l=0
nϕq −1
(5.13)
X  
vp(k) vq(l) ypq
(k,l)
cos δp(k) − δq(l) − (k,l)
θpq
l=0

nϕp −1  
X
Q(k)
pq = vp(k) vp(l) ypp
(k,l)
sin δp(k) − δp(l) − θpp
(k,l)
+
l=0
nϕq −1
(5.14)
X  
vp(k) vq(l) ypq
(k,l)
sin δp(k) − δq(l) − θpq
(k,l)

l=0

104
5.1 Multiphase branch π equivalent

5.1.2. Active and reactive branch power sensitivity


∂Pp ∂Pp
5.1.2.1. ∂vp and ∂δp

Derivations of active power at node p with respect to phase voltage


magnitudes and node p are (k 6= l)

(l)
∂Ppq  
(k)
|k6=l = vp(l) ypp
(l,k)
cos δp(l) − δp(k) − θpp
(l,k)
(5.15)
∂vp

and for the case when (k = l)


(l) nϕp −1
∂Ppq X  
(l)
= vp(k) ypp
(l,k)
cos δp(l) − δp(k) − θpp
(l,k)
+
∂vp k=0,k6=l
nϕq −1
X   (5.16)
+ vq(k) ypq
(l,k)
cos δp(l) − δq(k) − θpq
(l,k)
+
k=0
 
+ 2vp(l) ypp
(l,l) (l,l)
cos θpp

Equation (5.16) can be rewritten as


(l) nϕp −1
∂Ppq X  
(l)
= vp(k) ypp
(l,k)
cos δp(l) − δp(k) − θpp
(l,k)
+
∂vp k=0
nϕq −1
X   (5.17)
+ vq(k) ypq
(l,k)
cos δp(l) − δq(k) − θpq
(l,k)
+
k=0
 
+ vp(l) ypp
(l,l) (l,l)
cos θpp

which can be further simplified to

(l) (l)
∂Ppq Ppq  
(l)
= (l)
+ vp(l) ypp
(l,l) (l,l)
cos θpp (5.18)
∂vp vp

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)
|k6=i = vp(l) vp(k) ypp
(l,k)
sin δp(l) − δp(k) − θpp
(l,k)
(5.19)
∂δp

105
Chapter 5 Multiphase modeling

and when (k = l)


(l) nϕp −1
∂Ppq X  
(l)
= − vp(l) vp(k) ypp
(l,k)
sin δp(l) − δp(k) − θpp
(l,k)
∂δp k=0,k6=i

nϕq −1  
X
+ vp(l) vq(k) ypq
(l,k)
sin δp(l) − δq(k) − θpq
(l,k) 

k=0

nϕp −1
X   (5.20)
= − vp(l) vp(k) ypp
(l,k)
sin δp(l) − δp(k) − θpp
(l,k)

k=0
nϕq −1  
X
+ vp(l) vq(k) ypq
(l,k)
sin δp(l) − δq(k) − θpq
(l,k)

k=0
 2  
+ vp(l) (l,l)
ypp sin (l,l)
θpp

This can be further simplified to

(l)
∂Ppq
  2  
(l)
= − Q(l) (l)
pq + vp
(l,l)
ypp (l,l)
sin θpp (5.21)
∂δp

∂Pp ∂Pp
5.1.2.2. ∂vq and ∂δq

Derivations of active power at node p with respect to phase voltage


magnitudes and node q are

(l)
∂Ppq  
(k)
= vp(l) ypq
(l,k)
cos δp(l) − δq(k) − θpq
(l,k)
, ∀k (5.22)
∂vq

Derivations of active power at node p with respect to phase voltage


angles and node q are

(l)
∂Ppq  
(k)
= vp(l) vq(k) ypq
(l,k)
sin δp(l) − δq(k) − θpq
(l,k)
, ∀k (5.23)
∂δq

106
5.1 Multiphase branch π equivalent

∂Qp ∂Qp
5.1.2.3. ∂vp and ∂δp

Derivations of reactive power at node p with respect to phase voltage


magnitudes and node p are (k 6= l)

(l)
∂Qpq  
(k)
|k6=l = vp(l) ypp
(l,k)
sin δp(l) − δp(k) − θpp
(l,k)
(5.24)
∂vp

and for (k = i)

(l) nϕp −1
∂Qpq X  
(l)
= vp(k) ypp
(l,k)
sin δp(l) − δp(k) − θpp
(l,k)
+
∂vp k=0,k6=l
nϕq −1
X   (5.25)
+ vq(k) ypq
(l,k)
sin δp(l) − δq(k) − θpq
(l,k)

k=0
 
− 2vp(l) ypp
(l,l) (l,l)
sin θpp

Equation (5.25) can be rewrite as

(l) nϕp −1
∂Qpq X  
(l)
= vp(k) ypp
(l,k)
sin δp(l) − δp(k) − θpp
(l,k)
+
∂vp k=0
nϕq −1
X   (5.26)
+ vq(k) ypq
(l,k)
sin δp(l) − δq(k) − θpq
(l,k)

k=0
 
− vp(l) ypp
(l,l) (l,l)
sin θpp

which can be further simplified to

(l) (l)
∂Qpq Qpq  
(l)
= (l)
− vp(l) ypp
(l,l) (l,l)
sin θpp (5.27)
∂vp vp

Derivations of reactive power at node p with respect to phase voltage


angles and node p are (k 6= l)

(l)
∂Qpq  
(k)
|k6=l = −vp(l) vp(k) ypp
(l,k)
cos δp(l) − δp(k) − θpp
(l,k)
(5.28)
∂δp

107
Chapter 5 Multiphase modeling

and for (k = l)

(l) nϕp −1
∂Qpq X  
(l)
= vp(l) vp(k) ypp
(l,k)
cos δp(l) − δp(k) − θpp
(l,k)
+
∂δp k=0,k6=l
nϕq −1  
X
+ vp(l) vq(k) ypq
(l,k)
cos δp(l) − δq(k) − θpq
(l,k)

k=0
nϕp −1
X   (5.29)
= vp(l) vp(k) ypp(l,k)
cos δp(l) − δp(k) − θpp(l,k)
+
k=0
nϕq −1  
X
+ vp(l) vq(k) ypq
(l,k)
cos δp(l) − δq(k) − θpq(l,k)

k=0
 2  
− vp(l) ypp (l,l)
cos θpp (l,l)

which can be further simplified to

(l)
∂Qpq  2  
(l)
= P (l) (l)
pq − vp
(l,l)
ypp (l,l)
cos θpp (5.30)
∂δp

∂Qp ∂Qp
5.1.2.4. ∂vq and ∂δq

Derivations of reactive power at node p with respect to phase voltage


magnitudes and node q are

(l)
∂Qpq  
(k)
= vp(l) ypq
(l,k)
sin δp(l) − δq(k) − θpq
(l,k)
, ∀k (5.31)
∂vq

Derivations of reactive power at node p with respect to phase voltage


angles and node q are

(l)
∂Qpq  
(k)
= −vp(l) vq(k) ypq
(l,k)
cos δp(l) − δq(k) − θpq
(l,k)
, ∀k (5.32)
∂δq

108
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:
nϕ  
(k) X (k,l) (k,l)
Pshp = vp(k) vp(l) yshp cos δp(k) − δp(l) − θshp (5.33)
l=1
nϕ  
(k) X (k,l) (k,l)
Qshp = vp(k) vp(l) yshp sin δp(k) − δp(l) − θshp (5.34)
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. As-
suming 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


nϕp −1 h  
(l) (l) X (l) (k)(l,k) (l) (k)
(l,k)
Ppq = Pp 0 q = vp0 vp0 ypp cos δp0 − δp0 − θpp +
k=0
 i
(l) (l)
+vp0 vq(k) ypq
(l,k)
cos δp0 − δq(k) − θpq
(l,k)

nϕp −1 h  
(l) X (l) (k) (l) (k)
Q(l)
pq = Qp0 q = (l,k)
vp0 vp0 ypp (l,k)
sin δp0 − δp0 − θpp +
k=0
 i
(l) (l)
+vp0 vq(k) ypq
(l,k)
sin δp0 − δq(k) − θpq
(l,k)

(5.35)
Voltages at side p and p’ of phase k are defined as

(k)
v (k) (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 (5.38)

110
5.1 Multiphase branch π equivalent

Considering (5.37) and (5.38) then equations (5.35) can be written as

nϕp −1 " (k) (l)


(l) X vp vp 
(l) (k)

(l) (l,k) (l,k)
Ppq = Pp 0 q = y
(l) (k) pp
cos δp0 − δ p0 − θ pp +
k=0 tpq tpq

(l)
vp0 (k) (l,k) 
(l)

+ (l) vq ypq cos δp0 − δq(k) − θpq (l,k) 
tpq
nϕp −1 " (k) (l)
(l) X vp vp 
(l) (k)

Q(l)
pq = Qp0 q = (l) (k)
y (l,k)
pp sin δ p 0 − δp 0 − θ (l,k)
pp +
k=0 tpq tpq

(l)
vp0 (k) (l,k) 
(l)

+ (l) vq ypq sin δp0 − δq(k) − θpq (l,k) 
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)
v (k) (l) (k,l)
p − v p = tpq v p0 − v p0 (5.40)

(k)
Similarly, after separating real and imaginary parts, considering δp =
(k)
δp0 we obtain
    h    i
(k) (l)
vp(k) cos δp(k) −vp(l) cos δp(l) = t(k,l)
pq vp0 cos δp(k) − vp0 cos δp(l)
(5.41)

and
    h    i
(k) (l)
vp(k) sin δp(k) −vp(l) sin δp(l) = t(k,l)
pq vp0 sin δp(k) − vp0 sin δp(l)
(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 volt-
age 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 measure-
ments 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 po-
tential 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 three-
phase 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 (cu-
mulative) 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



X
BC (ϕ)
Ppq = 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 sub-


station. 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) X (k)
Pmbp = Ppj (5.46)
j∈Ωb (p)
(k) X (k)
Qmbp = Qpj (5.47)
j∈Ωb (p)

(k) (k)
Three phase state estimation algorithm has to calculate Pmbp and Qmbp values
(k) (k)
with minimum deviation to P̃mbp and Q̃mbp values, respectively.

114
5.1 Multiphase branch π equivalent

5.1.5.4. Cumulative multi-branch power measurements

Measurements are typically connected on switching equipment of sub-


station. 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:

¯
X dim(X
pj,p)−1
(ϕ)
Pcmbp = Ppj (5.48)
j∈Ωb (p) ϕ=0
¯
X dim(X
pj,p)−1
(ϕ)
Qcmbp = Qpj (5.49)
j∈Ωb (p) ϕ=0

Three phase state estimation algorithm has to calculate Pcmbp and


Qcmbp values with minimum deviation to P̃cmbp and Q̃cmbp values, re-
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


r
(k) 1 
(k) 2
 
(k) 2

Ipq = (k)
Ppq + Qpq (5.50)
vp
(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:


v
1 u
 
(k) 2 (k) 2
  
(k) u X
Imbp = (k)
t Ppj + Qpj (5.51)
vp 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 ṽ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

v (k,l)
p = v (k) (l)
p − vp (5.52)

117
Chapter 5 Multiphase modeling

Figure 5.15.: Phase-to-phase voltage magnitude measurement

after separating real and imaginary part


     
vp(k,l) cos δp(k,l) = vp(k) cos δp(k) − vp(l) cos δp(l) (5.53)
     
vp(k,l) sin δp(k,l) = vp(k) sin δp(k) − vp(l) sin δp(l) (5.54)

After adding squares of (5.53) and (5.54)


r
(l) 2 (l) 2
   
(k) (k) (l) (k) (k) (l)
vp(k,l) = vp cos δp − vp cos δp + vp sin δp − vp sin δp
(5.55)

After squaring and applying

cos(x − y) = cos x cos y + sin x sin y (5.56)

we obtain
r
(k) 2 (l) 2
     
(k) (l) (k) (l)
vp(k,l) = vp + vp − 2vp vp cos δp − δp (5.57)

(k,l)
Value vp as given by (5.55) is to be calculated with minimum devia-
(k,l)
tion to phase-to-phase voltage magnitude measurement ṽ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 in-
jected active and reactive power measurement at node i and phase k
(k) (k) (k)
are given by P̃inji and Q̃inji then the corresponding state variables Pinji
(k) (k) (k)
and Qinji are to be calculated with minimum to P̃inji and Q̃inji .

5.1.7.2. Cumulative power injection measurements

Handling cumulative injections requires adding additional equations:



X
Pcinjp = Pp(k) (5.58)
k=1
Xnϕ
Qcinjp = Q(k)
p (5.59)
k=1

Values Pcinjp and Qcinjp should be calculated with minimum deviation


to the corresponding measurements P̃cinjp and Q̃cinjp .

5.1.7.3. Two-phase delta power injection measurements

Fig. 5.16 shows phase-to-phase injection measurements on bus p be-


tween 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

−I (k,l) (l,k)
injp − I injp = 0 (5.60)

After placing injection powers


 ∗
(k)
S injp
I (k,l)
p = (k)

vp

and
 ∗
(l)
S injp
I (l,k)
p = (l)

vp

we obtain:
 ∗  ∗
(k) (k) (l) (l)
Pinjp + jQinjp Pinjp + jQinjp
− (k)
 −
(l)
 =0 (5.61)
vp vp

In order to remove denominators we have to multiply equation (5.61)


(k) ∗ (l) ∗
 
with − v p v p . This yields
  ∗   ∗
(k) (k) (l) (l)
Pinjp − jQinjp v (l)
p + Pinjp − jQinjp v (k)
p =0 (5.62)

or after expanding complex voltages:


   
(k) (k)
Pinjp − jQinjp vp(l) cos δp(l) − j sin δp(l) +

(l) (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)
Pinjp + Pinjp − P4p = 0 (5.66)
(k) (l) (k,l)
Qinjp + Qinjp − Q4p = 0 (5.67)

(kl) (kl)
Three phase state estimation has to calculate P4p and Q4p with mini-
(kl) (kl)
mum deviation to P̃4p and Q̃4p , respectively. Additionally, equations
(5.64), (5.65), (5.66), and (5.67) have to be satisfied.
Approach described by equations (5.64)-(5.67) introduces four addi-
tional unknowns and four equations. An alternative approach, that
does not introduce additional unknowns, can be also implemented:
(k,l) (k,l)
!∗
(l,k)
P4p + jQ4p
I injp = (k) (l)
vp − vp
 h    i (5.68)
(k,l) (k,l) (k) (k) (k) (l) (l) (l)
P4p −jQ4p vp cos δp +j sin δp −vp cos δp +j sin δp
=  2  2  
(k) (l) (k) (l) (k) (l)
vp + vp −2vp vp cos δp −δp

After multiplying and grouping real and imaginary part


   
(k,l) (k) (k) (l) (l) (k,l) (k) (k) (l) (l)
P4p vp cos δp −vp cos δp +Q4p vp sin δp −vp sin δp
(l,k)
I injp =  2  2  
(k) (l) (k) (l) (k) (l)
vp + vp −2vp vp cos δp −δp
   
(k,l) (k) (k) (l) (l) (k,l) (k) (k) (l) (l)
P4p vp sin δp −vp sin δp −Q4p vp cos δp −vp cos δp (5.69)
+j  2  2  
(k) (l) (k) (l) (k) (l)
vp + vp −2vp vp cos δp −δp
(l,k) (l,k)
= Iinjrep + jIinjiim
p

Complex injection powers are then calculated as


(l,k) ∗
 
(k)
S injp = − v (k)
p I injp
(5.70)
(l,k) ∗
 
(l)
S injp =v (l)
p I injp

After applying (5.69) into (5.70)


  
(k) (l,k) (l,k)
S injp = −vp(k) cos δp(k) + j sin δp(k) Iinjrep − jIinjimp
h 
(l,k) (l,k)
= −vp(k) Iinjrep cos δp(k) + Iinjimp sin δp(k) (5.71)
 i
(l,k) (l,k)
+j Iinjrep sin δp(k) − Iinjimp cos δp(k)

121
Chapter 5 Multiphase modeling

and
  
(l) (l,k) (l,k)
S injp = vp(l) cos δp(l) + j sin δp(l) Iinjrep − jIinjimp
h 
(l,k) (l,k)
= vp(l) Iinjrep cos δp(l) + Iinjimp sin δp(l) (5.72)
 i
(l,k) (l,k)
+j Iinjrep sin δp(l) − Iinjimp cos δp(l)

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)
p sin δp(k) +vp(l) Pp(k,l) cos δp(l) −Q(k,l)
p sin δp(l) =0
(5.73)
   
vp(k) Pp(l,k) sin δp(k) +Q(l,k)
p cos δp(k) +vp(l) Pp(k,l) sin δp(l) +Q(k,k)
p cos δp(l) =0
(5.74)

Further we can write


(k,l)
Pp(k,l) + Pp(l,k) − P4p = 0 (5.75)
(k,l)
Q(k,l)
p + Q(l,k)
p − Q4p = 0 (5.76)

122
5.1 Multiphase branch π equivalent

and finally
(k)
Pp(k,x) + Pp(k,y) − Pinjp =0 (5.77)
(k)
Q(k,x)
p + Q(k,y)
p − Qinjp =0 (5.78)

where (x, y) = (0, 1, 2) \ (k).


Equations (5.73)-(5.78) have to be satisfied for all possible (k, l) com-
binations:

(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)
minimum deviation to P̃4p and Q̃4p , respectively, while satisfying
equations(5.73)-(5.78).
The approach described by (5.73)-(5.78) introduces 12 additional un-
knowns and 12 equations. An alternative approach, that does not in-
troduce additional unknowns, can be implemented:

5.1.7.5. Cumulative delta injections

Cumulative delta injections are handled on the same way as Wye-


grounded injections (see sec. 5.1.7.2).

5.1.8. PV Nodes

Fig. 5.18 shows simplified power generator voltage regulation block di-
agram. The excitation circuit is supplied by DC voltage is
vreg = f (vref − vf b )
(0) (1) (2)
!!
vp + vp + vp (5.79)
= f vref − g
3

Since the rectifier circuit is placed in negative feed-back loop, the ex-
citation 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) (1) (2)
vp + vp + vp
vP Vp = (5.80)
3

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) (1) (2)


Pinjp + P injp + Pinjp
PP Vp = (5.81)
3

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 con-
straints 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 con-


strained 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 de-
viations of the estimated measurements from the actual measurements.
These measurements are obtained from SCADA systems through re-
mote terminal unit. The objective function is expressed with the fol-
lowing set of equations:


N QB
1 NXPB 
(k) (k) 2
 X 
(k) (k) 2

J=  wPij Pij − P̃ij + wQij Qij − Q̃ij (5.82)
2 ij∈Ω ij∈Ω
b b

NX
P BC  2 NX
QBC  2
+ wpbcij Pbcij −P̃bcij + wqbcij Qbcij −Q̃bcij (5.83)
ij∈Ωb ij∈Ωb
N QI  2 N QI  2
X (k) (k) X (k) (k)
+ wP Ii Pinji − P̃inji + wQIi Qinji − Q̃inji (5.84)
i=1 i=1
NX
P IC  2 NXQIC  2
+ wpici Pcinji −P̃cinji + wqici Qcinji −Q̃cinji
i=1 i=1
(5.85)
N BI
(k) 2
 
(k)
wIij Iij − I˜ij
X
+ (5.86)
ij∈Ωb
NX
VG NX
V LL
(k) 2 (k,l) 2
   
(k) (k,l)
+ wv i v i − ṽi + wvLLi vi − ṽi (5.87)
i=1 i=1

NX
TG  2 NX
T LL  2
(k) (k) (k,l) (k,l)
+ wti tij −t̃ij + wtLLi tij −t̃ij  (5.88)
ij∈Ωb ,i=1 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 ∀ij, k ∈ Ωb (5.90)
X (k) X (k) (k)
cP N ≡ Pij − P inji,j + Pshi = 0 ∀i, k ∈ Ωn (5.91)
j∈Ωb (l) j∈Ωinji
X (k) X (k) (k)
cQN ≡ Qij − Qinji,j + Qshi = 0 ∀i ∈ Ωn (5.92)
j∈Ωb (l) j∈Ωinji

(k) 2 (k) 2 (k) (k) 2


     
cI ≡ Pij + Qij − vi Iij =0 (5.93)
(k) (k) (k)
ct ≡tij vi0 − vi =0 (5.94)
 
(k) (k) (l) (l) (k,l) (k) (k) (l) (l)
ctrLL ≡vi cos δi −vi cos δi −tij vi0 cos δi −vi0 cos δi =0
(5.95)
 
(k) (k) (l) (l) (k,l) (k) (k) (l) (l)
ctiLL ≡vi sin δi −vi sin δi −tij vi0 sin δi −vi0 sin δi =0
(5.96)

X (ϕ)
cPBC ≡PijBC − Pij = 0 (5.97)
ϕ=0

X (ϕ)
cQBC ≡QBC
ij − Qij = 0 (5.98)
ϕ=0
(k) 2 (l) 2 (k,l) 2
       
(k) (l) (k) (l)
cvLL ≡ vi + vi − vi −2vi vi cos δi −δi =0 (5.99)

X (ϕ)
cPcinj ≡Pcinji − Pinji = 0 (5.100)
ϕ=1

X (ϕ)
cQcinj ≡Qcinji − Qinji = 0 (5.101)
ϕ=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
1
minimize J(x) = (x − x̃)T W (x − x̃) (5.102)
2

126
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 =⇒ W (x − x̃) − C T λ = 0 (5.105)
∂x
∂L(x)
= 0 =⇒ c(x) = 0 (5.106)
∂λ
∂c(x)
where the matrix C = ∂x 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:
" #(iter) " #(iter) " #(iter−1)
W CT 4x W (x − x̃)
=− (5.107)
C 0 −λ c(x)

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 iT
x = [vδ]T [P Q]T [P Qinj ]T [P Qcinj ]T I T PBC
T
QTBC vLL
T
v 0T tT tTLL

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 in-
jection (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 line-
to-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 C1,2 0 0 0 0 0 0 C1,9 0 0
C C2,2 C2,3 0 0 0 0 0 0 0 0 
 2,1 
 C3,1 C3,2 0 0 C3,5 0 0 0 0 0 0 
 
 
 C4,1 0 0 0 0 0 0 0 C4,9 C4,10 0 
C=
C
 (5.108)
 5,1 0 0 0 0 0 0 0 C5,9 0 C5,11 

 0

C6,2 0 0 0 C6,6 C6,7 0 0 0 0 

 0 0 C7,3 C7,4 0 0 0 0 0 0 0 
 

C8,1 0 0 0 0 0 0 C8,8 0 0 0

128
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) (x)
∂cP B ∂fij (vi , vj , vi0 , vj 0 , δi , δj )
i
(y)
= (y)
(5.109)
∂vj ∂vi
(x) (x)
∂cP Bi ∂fij (vi , vj , vi0 , vj 0 , δi , δj )
(y)
= (y)
(5.110)
∂δj ∂δj
(x) (x)
∂cQB ∂g ij (vi , vj , vi0 , vj 0 , δi , δj )
i
(y)
= (y)
(5.111)
∂vj ∂vi
(x) (x)
∂cQBi ∂g ij (vi , vj , vi0 , vj 0 , δi , δj )
(y)
= (y)
(5.112)
∂δj ∂δ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) (x)
∂cP B
(
i
∂Pij −1 ∀x, y, ij, pq : x = y ∧ ij = pq
(y)
= (y)
= (5.113)
∂Ppq ∂Ppq 0 ∀x, y, ij, pq : x 6= y ∨ ij 6= pq
(x)
∂cP B
i
(y)
=0 (5.114)
∂Qpq
(x)
∂cQB
i
(y)
=0 (5.115)
∂Qpq
(x) (x)
∂cQB
(
i
∂Qij −1 ∀x, y, ij, pq : x = y ∧ ij = pq
(y)
= (y)
= (5.116)
∂Qpq ∂Qpq 0 ∀x, y, ij, pq : x 6= y ∨ ij 6= pq

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) (x)
∂cP B ∂fij (vi , vj , vi0 , vj 0 , δi , δj )
i
(y)
=− (y)
(5.117)
∂vj 0 ∂vj 0
(x) (x)
∂cQB ∂g ij (vi , vj , vi0 , vj 0 , δi , δj )
i
(y)
=− (y)
(5.118)
∂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 con-
straints cP N (5.91) and cQN (5.92) with respect to [vδ] variables:
 (x)
 Pshi +v (x) cos θ (k,l)
 
∀xy, ij : x=y∧i=j

(x)  i shi,i
∂cP N  vi (x)
i
= (5.119)
 
(x) (x) (y) (x,y)
∂vj
(y) 
 v i cos δ i −δ i −θ shi,i ∀xy, ij : x6=y∧i=j

∀ij : i6=j

0

(x) 0
 ∀xy, ij : x=y∧i=j
∂cP Ni
  
(x) (y) (x) (y) (x,y)
(y)
= vi vi sin δi −δi −θshi,i ∀xy, ij : x6=y∧i=j (5.120)
∂δj 


0 ∀ij : i6=j

 (x)
 Qshi −v (x) sin θ (k,l)
 
∀xy, ij : x=y∧i=j

(x)  i shi,i
∂cQN  vi  (x)
i
= (5.121)
 
(x) (x) (y) (x,y)
∂vj
(y) 
 v i sin δi −δ i −θ shi,i ∀xy, ij : x6=y∧i=j

∀ij : i6=j

0

(x) 0
 ∀xy, ij : x=y∧i=j
∂cQNi
  
(x) (y) (x) (y) (x,y)
(y)
= −vi vi cos δi −δi −θshi,i ∀xy, ij : x6=y∧i=j (5.122)
∂δj 


0 ∀ij : i6=j

130
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 con-
straints cP N (5.91) and cQN (5.92) with respect to [P Q] variables:

(x) (x)
∂cP N
(
i
∂Pij 1 ∀x, y, ij, pq : x = y ∧ ij = pq
(y)
= (y)
= (5.123)
∂Ppq ∂Ppq 0 ∀x, y, ij, pq : x 6= y ∨ ij 6= pq
(x)
∂cP N
i
(y)
=0 (5.124)
∂Qpq
(x)
∂cQN
i
(y)
=0 (5.125)
∂Qpq
(x) (x)
∂cQN
(
i
∂Qij 1 ∀x, y, ij, pq : x = y ∧ ij = pq
(y)
= (y)
= (5.126)
∂Qpq ∂Qpq 0 ∀x, y, ij, pq : x 6= y ∨ ij 6= pq

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) (x)
∂cP N
(
i
∂Pinji −1 ∀x, y, i, j : x = y ∧ i = j
(y)
=− (y)
= (5.127)
∂Pinjj ∂Pinjj 0 ∀x, y, i, j : x 6= y ∨ ij 6= pq
(x)
∂cP N
i
(y)
=0 (5.128)
∂Qinjj
(x)
∂cQN
i
(y)
=0 (5.129)
∂P injj
(x) (x)
∂cQN
(
i
∂Qinji −1 ∀x, y, i, j : x = y ∧ ij = pq
(y)
=− (y)
= (5.130)
∂Qinjj ∂Qinjj 0 ∀x, y, i, j : x 6= y ∨ ij 6= pq

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:

−2v (x) I (x) 2



(x)  
∂cIi,j ∀xy, ij, p : x = y ∧ (i = p ∨ j = p)
i ij
(y)
=
∂vp 0 ∀ij, p : i 6= p ∧ j 6= p
(5.131)
(x)
∂cIi,j
(y)
=0 (5.132)
∂δp

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) ( (x)
∂cIi,j 2Pi,j ∀xy, ij, pq : x = y ∧ ij = pq
(y)
= (5.133)
∂Pp,q 0 ∀ij, pq : ij 6= pq
(x) ( (x)
∂cIi,j 2Qi,j ∀xy, ij, pq : x = y ∧ ij = pq
(y)
= (5.134)
∂Qp,q 0 ∀ij, pq : ij 6= pq

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:

−2 v (x) 2 I (x)



(x)  
∂cIi,j ∀xy, ij, pq : x = y ∧ ij = pq
i i,j
(y)
= (5.135)
∂Ip,q 0 ∀ij, pq : ij 6= pq

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 ∀xy, i, p : x = y ∧ i = p
(y)
= (5.136)
∂vp 0 ∀i, p : i 6= p
(x)
∂cIi,j
(y)
=0 (5.137)
∂δp

Matrix C4,9

C4,9 is matrix of dimension N T ×N V 0 and contains derivations of equal-


ity constraints cI (5.94) with respect to [v 0 ] variables:
(x) ( (x)
∂cti,j tij ∀xy, i, p : x = y ∧ i = p
(y)
= (5.138)
∂vp0 0 ∀i, p : i 6= p

Matrix C4,10

C4,10 is matrix of dimension N T ×N T and contains derivations of equal-


ity constraints cI (5.94) with respect to [t] variables:
(x) ( (x)
∂cti,j vi 0 ∀xy, ij, pq : x = y ∧ ij = pq
(y)
= (5.139)
∂tpq 0 ∀ij, pq : ij 6= pq

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)
(x,y)
∂ctrLL cos δi

 ∀xy, k, ij, p : x = k ∧ i = p
ij (y)
(k)
= − cos δi ∀xy, k, ij, p : y = k ∧ i = p (5.140)
∂vp 

0 otherwise
 (x,y) (x) (x)

(x)
(x,y) t
 ij
v i0 − v i  sin δi ∀xy, k, ij, p : x=k∧i=p
∂ctrLL


ij (y) (x,y) (y) (y)
(k)
= vi − tij vi0 sin δi ∀xy, k, ij, p : y=k∧i=p
∂δp 

0 otherwise

(5.141)

133
Chapter 5 Multiphase modeling

and


(x)
(x,y)
∂ctiLL sin δi

 ∀xy, k, ij, p : x = k ∧ i = p
ij (y)
(k)
= − sin δi ∀xy, k, ij, p : y = k ∧ i = p (5.142)
∂vp 

0 otherwise
 (x) (x,y) (x)

(x)
(x,y) v i − tij v 0 cos δi ∀xy, k, ij, p : x=k∧i=p
∂ctiLL i


 
ij (y) (x,y) (y) (y)
(k)
= vi0 tij − vi cos δi ∀xy, k, ij, p : y=k∧i=p
∂δp 

0 otherwise

(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) (x)
−tij cos δi ∀xy, k, ij, p : x = k ∧ i = p
(x,y)
∂ctrLL


ij (x,y) (y)
= t cos δi ∀xy, k, ij, p : y = k ∧ i = p (5.144)
(k)
∂vp0  ij

0 otherwise

and


(x,y) (x)
(x,y)
∂ctiLL −tij sin δi

 ∀xy, k, ij, p : x = k ∧ i = p
ij (x,y) (y)
= t sin δi ∀xy, k, ij, p : y = k ∧ i = p (5.145)
∂vp
(k)  ij

0 otherwise

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 − v (x) cos δ (x) − v (y)
0 cos δ
(y)
xy = kl ∧ ij = pq
ij i i i i
(k,l)
=
∂tLLpq 0 otherwise
(5.146)

134
5.2 Three-Phase State Estimation Method

and

(x,y)   
∂ctiLL − v (x) sin δ (x) − v (y)
0 sin δ
(y)
xy = kl ∧ ij = pq
ij i i i i
(k,l)
=
∂tLLpq 0 otherwise
(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 −1 ∀ij, pq : ij = pq ∧ x ∈ Ωb (ij)
= (5.148)
∂Ppq 0 otherwise
∂cP BCij
=0 (5.149)
∂Qpq
∂cQBCij
=0 (5.150)
∂Ppq
(
∂cQBCij −1 ∀ij, pq : ij = pq ∧ x ∈ Ωb (ij)
= (5.151)
∂Qpq 0 otherwise

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 1 ∀ij, pq : ij = pq
= (5.152)
∂PBCpq 0 otherwise
∂cQBCij
=0 (5.153)
∂P BCpq

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
=0 (5.154)
∂QBCpq
(
∂cQBCij 1 ∀ij, pq : ij = pq
= (5.155)
∂QBCpq 0 otherwise

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 equal-
ity constraints cPcinj (5.100) and cQcinj (5.101) with respect to [P Qinj ]
variables:

(
∂cPcinji −1 ∀i, p : i = p ∧ x ∈ Ωinj (l)
(x)
= (5.156)
∂Pinjp 0 otherwise
∂cPcinji
(x)
=0 (5.157)
∂Qinjp
∂cQcinji
(x)
=0 (5.158)
∂Pinjp
(
∂cQcinji −1 ∀i, p : i = p ∧ x ∈ Ωinj (l)
(x)
= (5.159)
∂Qinjp 0 otherwise

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 1 ∀i, p : i = p
= (5.160)
∂Pcinjp 0 otherwise
∂cPcinji
=0 (5.161)
∂Qcinjp
∂cQcinji
=0 (5.162)
∂Pcinjp
(
∂cQcinji 1 ∀i, p : i = p
= (5.163)
∂Qcinjp 0 otherwise

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) (x) (y)
(x,y) 2vi − 2v i cos δ i − δi ∀xy, k, i, p : x=k∧i=p
∂cVLL


  
i (y) (x) (x) (y)
= 2v − 2vi cos δi − δi ∀xy, k, i, p : y=k∧i=p
(k)
∂vp  i

0 otherwise

(5.164)

(x) (y) (x)
(x,y)
∂cVLL 2vi vi sin δi

 ∀xy, k, i, p : x = k ∧ i = p
i (x) (y) (y)
(k)
= −2vi vi sin δi ∀xy, k, i, p : y = k ∧ i = p (5.165)
∂δp 

0 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) (x,y)
∂cVLL
(
i
−2vi ∀xy, kl, i, p : xy = kl ∧ i = p
(k,l)
= (5.166)
∂vp 0 otherwise

137
6. Three Phase DSSE IEEE Tests

Power System State Estimation (SE) is one of the most important appli-
cation necessary for efficient Distribution Management System (DMS)
applications. Introduction of near to real time state estimation in elec-
tricity 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 optimiza-
tion 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 re-
active 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 4-


bus 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 con-


sidered. 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. Mea-
surement 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 fi-
nally branch current between nodes 1 and 2. According to the Tab. 6.1,
the measurement vector z is composed of measurements including volt-
age magnitude, active power flow, reactive power flow, active load flow,
reactive load flow and current. The measurement vector is in the fol-
lowing form:
h i
(i) (i) (i) (i) (i) (i) (i) (i)
z T = V2 V3 V4 P43 Q43 PL QL I12 (6.1)

where i denotes i − th phase for a three-phase network.

140
6.1 IEEE 4 bus network case

Measured Value

Var. Ph-0 Ph-1 Ph-2 Var. Ph-0 Ph-1 Ph-2


|V2 | 0.9877 0.9921 0.9895 PL 0.9000 0.9000 0.9000
|V3 | 0.9368 0.9451 0.9397 QL 0.4359 0.4359 0.4359
|V4 | 0.8061 0.8635 0.8311 P43 -0.9000 -0.9000 -0.9000
I12 1.2405 1.1580 1.2030 Q43 -0.4359 -0.4359 -0.4359
Table 6.1.: Measurement set for IEEE 4-bus network

The bus voltage magnitudes and angles were considered as state vari-
ables 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) (i) (i) (i) (i) (i) (i) (i) (i) (i) (i)
[V2 V3 V4 δ2 δ3 δ4 P12 P21 P23 P32 P34
xT = (i) (i) (i) (i) (i) (i) (i) (i) (i) (i) (6.2)
P43 Q12 Q21 Q23 Q32 Q34 Q43 QL PL I12 ]

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

Voltage Mag. |V |(p.u) Phase Angle δ (rad)


Bus
Ph-0 Ph-1 Ph-2 Ph-0 Ph-1 Ph-2
1 1.000 1.000 1.000 0 -2.0944 2.0944
2 1.000 1.000 1.000 0 -2.0944 2.0944
3 1.000 1.000 1.000 0 -2.0944 2.0944
4 1.000 1.000 1.000 0 -2.0944 2.0944
Table 6.2.: Bus Voltages

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:
 
0.403 + j1.063 0.128 + j0.486 0.126 + j0.370
Z12/34 =  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:

Vh2 (12.47kV )2
Z12(base) = = (6.4)
Sbase 6000kV A

Vl2 (4.16kV )2
Z23(base) = = (6.5)
Sbase 6000kV A
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
Z12(p.u) = (6.6)
Z12(base)

Z23
Z23(p.u) = (6.7)
Z23(base)

Admittance matrix is calculated simply by inversion of impedance ma-


trix. Expressions and calculated values are defined in the following
equations.
−1
y12 = Z12 = G + jB
−1
y23 = Z23 = G + jB (6.8)
−1
y34 = Z34 = G + jB

 
31.30 − j71.67 −15.47 + j24.75 −5.41 + j15.41
y12 =  −15.47 + j24.75 35.16 − j74.69 −9.36 + j19.16 
 
−5.41 + j15.41 −9.36 + j19.16 28.01 − j69.03

142
6.1 IEEE 4 bus network case

(6.9)

 
2.70 − j16.22 0 0
y23(p.u) = 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
(6.11)
θ = tan−1 BG

For obtaining the states from the measurements, LS estimator needs to


minimize the following objective function:

(i) 2 (i) 2 (i) 2
     
(i) (i) (i)
J(x) = wV1 V2 − V2m + wV2 V3 − V3m + wV3 V4 − V4m
 2  2  2
(i) (i) (i) (i) (i) (i)
+ wP43 P43 −P43m +wQ43 Q43 −Q43m +wPL PL −PLm

(i) 2
   2
(i) (i) (i)
+wQL QL − QLm + wI I12 − I12m =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:
n−1
Xh  
(i) (i) (k) (i,k) (i) (k) (i,k)
cP12 ≡ P12 − V1 V1 Y11 cos δ1 − δ1 − θ11
k=0 (6.13)
 i
(i) (k) (i,k) (i) (k) (i,k)
+V1 V2 Y12 cos δ1 − δ2 − θ12 =0

n−1
Xh  
(i) (i) (k) (i,k) (i) (k) (i,k)
cP23 ≡ P23 − V2 V2 Y22 cos δ2 − δ2 − θ22
k=0 (6.14)
 i
(i) (k) (i,k) (i) (k) (i,k)
+V2 V3 Y23 cos δ2 − δ3 − θ23 =0

143
Chapter 6 Three Phase DSSE IEEE Tests

n−1
Xh  
(i) (i) (0) (i,0) (i) (k) (i,k)
cP34 ≡ P34 − V3 V3 Y33 cos δ3 − δ3 − θ33
k=0 (6.15)
 i
(i) (k) (i,k) (i) (k) (i,k)
+V3 V4 Y34 cos δ3 − δ4 − θ34 =0

n−1
Xh  
(i) (i) (k) (i,k) (i) (k) (i,k)
cP21 ≡ P21 − V2 V2 Y22 cos δ2 − δ2 − θ22
k=0 (6.16)
 i
(i) (k) (i,k) (i) (k) (i,k)
+V2 V1 Y21 cos δ2 − δ1 − θ21 =0

n−1
Xh  
(i) (i) (k) (i,k) (i) (k) (i,k)
cP32 ≡ P32 − V3 V3 Y33 cos δ3 − δ3 − θ33
k=0 (6.17)
 i
(i) (k) (i,k) (i) (k) (i,k)
+V3 V2 Y32 cos δ3 − δ2 − θ32 =0

n−1
Xh  
(i) (i) (0) (i,0) (i) (k) (i,k)
cP43 ≡ P43 − V4 V4 Y44 cos δ4 − δ4 − θ44
k=0 (6.18)
 i
(i) (k) (i,k) (i) (k) (i,k)
+V4 V3 Y43 cos δ4 − δ3 − θ43 =0

n−1
Xh  
(i) (i) (k) (i,k) (i) (k) (i,k)
cQ12 ≡ Q12 − V1 V1 Y11 sin δ1 − δ1 − θ11
k=0 (6.19)
 i
(i) (k) (i,k) (i) (k) (i,k)
+V1 V2 Y12 sin δ1 − δ2 − θ12 =0

n−1
Xh  
(i) (i) (k) (i,k) (i) (k) (i,k)
cQ23 ≡ Q23 − V2 V2 Y22 sin δ2 − δ2 − θ22
k=0 (6.20)
 i
(i) (k) (i,k) (i) (k) (i,k)
+V2 V3 Y23 sin δ2 − δ3 − θ23 =0

n−1
Xh  
(i) (i) (0) (i,0) (i) (k) (i,k)
cQ34 ≡ Q34 − V3 V3 Y33 sin δ3 − δ3 − θ33
k=0 (6.21)
 i
(i) (k) (i,k) (i) (k) (i,k)
+V3 V4 Y34 sin δ3 − δ4 − θ34 =0

144
6.1 IEEE 4 bus network case

n−1
Xh  
(i) (i) (k) (i,k) (i) (k) (i,k)
cQ21 ≡ Q21 − V2 V2 Y22 sin δ2 − δ2 − θ22
k=0 (6.22)
 i
(i) (k) (i,k) (i) (k) (i,k)
+V2 V1 Y21 sin δ2 − δ1 − θ21 =0

n−1
Xh  
(i) (i) (k) (i,k) (i) (k) (i,k)
cQ32 ≡ Q32 − V3 V3 Y33 sin δ3 − δ3 − θ33
k=0 (6.23)
 i
(i) (k) (i,k) (i) (k) (i,k)
+V3 V2 Y32 sin δ3 − δ2 − θ32 =0

n−1
Xh  
(i) (i) (0) (i,0) (i) (k) (i,k)
cQ43 ≡ Q43 − V4 V4 Y44 sin δ4 − δ4 − θ44
k=0 (6.24)
 i
(i) (k) (i,k) (i) (k) (i,k)
+V4 V3 Y43 sin δ4 − δ3 − θ43 =0

(i) (i)
cP N 2 : −P21 − P23 = 0
(i) (i)
cQN 2 : −Q21 − Q23 = 0
(i) (i)
cP N 3 : −P32 − P34 = 0
(i) (i)
cQN 3 : −Q32 − Q34 = 0 (6.25)
(i) (i)
cP N 4 : −P43 − PL = 0
(i) (i)
cQN 4 : −Q43 − QL = 0
(i) 2 (i) 2 (i) (i) 2
     
cI12 : P12 + Q12 − V1 I12

Using above constraints vector of equality constraints c(x) from Equa-


tion 1.11 is defined as:
 
cPpq
cPqp
 
 
cQpq
 
 
 
c(x) = 
 cQqp 
 (6.26)

 cP Nn 

cQNn
 
 
cI

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 ∂cPpq ∂cPpq ∂cPpq ∂cPpq ∂cPpq ∂cPpq ∂cPpq 


∂V ∂δ ∂Ppq ∂Pqp ∂Qpq ∂Qqp ∂PL ∂QL ∂I
 ∂cPqp ∂cPqp ∂cPqp ∂cPqp ∂cPqp ∂cPqp ∂cPqp ∂cPqp ∂cPqp 
 
 ∂V ∂δ ∂Ppq ∂Pqp ∂Qpq ∂Qqp ∂PL ∂QL ∂I 
 ∂cQpq ∂cQpq ∂cQpq ∂cPpq ∂cQpq ∂cP Qpq ∂cQpq ∂cQpq ∂cQpq 
 ∂V ∂δ ∂Ppq ∂Pqp ∂Qpq ∂Qqp ∂PL ∂QL ∂I

 
 ∂cQqp ∂cQqp ∂cQqp ∂cQqp ∂cQqp ∂cQqp ∂cQqp ∂cQqp ∂cP Qqp 
 ∂V ∂δ ∂Ppq ∂Pqp ∂Qpq ∂Qqp ∂PL ∂QL ∂I 
 
 ∂cP Nn ∂cP Nn ∂cP Nn ∂cP Nn ∂cP Nn ∂cP Nn ∂cP Nn ∂cCP Nn ∂cP Nn 
 ∂V ∂δ ∂Ppq ∂Pqp ∂Qpq ∂Qqp ∂PL ∂QL ∂I 
∂cP QNn ∂cQNn ∂cQNn ∂cQNn ∂cQNn ∂cQNn ∂cQNn ∂cQNn ∂cQNn
∂V ∂δ ∂Ppq ∂Pqp ∂Qpq ∂Qqp ∂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)
 (6.28)
 P − P (i)


 43 43m 
0
 
 
 

 0 


 0 


 0 

0
 
 
 (i)
 P − P (i)


 43 43m 
 (i)
 P − P (i)


 L Lm 
 (i) (i)
Q − Q

 L Lm 
(i) (i)
I12 − I12m

146
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:

" # " #−1 " #


4x HT W H CT H T W 4z k
− = (6.30)
−λ C 0 −c(xk )

This procedure is repeated the for the rest of the iterations until the dif-
ference 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 es-
timation 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 MAT-
LAB. 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 illus-
trate 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


Var.
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

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

0.37
Objective function J(x)

0.36

0.35

0.34

0.33

0.32
1 1.5 2 2.5 3 3.5 4 4.5 5
Number of iterations

Figure 6.2.: Objective function

148
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 inves-
tigate 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 stan-
dard distribution models developed by the IEEE Power Engineering
Society’s Power System Analysis Computing and Economics Commit-
tee. 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 mod-
ified 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 magni-


tudes, 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) (i) (i) (i) (i)
(i) (i) [PL2 PL4 PL5 PL6 PL7 PL8 PL9 PL11
xT = [Vp(i) δp(i) Ppq Qpq PLp QLp ]; z T =
(i) (i)
(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. Ph-0 Ph-1 Ph-2 Var. Ph-0 Ph-1 Ph-2


PL2 0.0510 0.4080 0.1140 QL2 0.1980 1.0200 0.2040
PL4 0.9600 0.3510 0.5400 QL4 0.7200 0.0300 0.5400
PL5 0 0.7200 0.0034 QL5 0 0.6600 0.8260
PL6 0 0.4754 0 QL6 0 2.0091 0
PL7 2.6142 3.3467 0.7500 QL7 0.9700 1.1400 1.6458
PL8 2.9100 1.7400 1.5584 QL8 1.0200 0.5160 1.2720
PL9 0 0 0.3600 QL9 0 0 0.4800
PL11 0.7680 0 0 QL11 2.5801 0 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:
 
0.347 + j1.018 0.156 + j0.502 0.158 + j0.424
Z601 =  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
Z602 =  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

 
0 0 0
Z603 =  0 1.329 + j1.347 0.207 + j0.459  (6.34)
 
0 0.207 + j0.459 1.324 + j1.357

150
6.2 IEEE 13 bus network case

Voltage Mag. |V |(p.u) Phase Angle δ (rad)


Bus Ph-0 Ph-1 Ph-2 Ph-0 Ph-1 Ph-2
1 1.0689 1.0569 1.0851 0 -2.0944 2.0944
2 1.0210 1.0420 1.0174 -0.0435 -2.1244 2.0565
3 1.0180 1.0401 1.0148 -0.0447 -2.1253 2.0563
4 0.9940 1.0218 0.9960 -0.0564 -2.1331 2.0480
5 - 1.0311 1.0134 - -2.1290 2.0577
6 - 1.0329 1.0155 - -2.1276 2.0570
7 0.9900 1.0529 0.9778 -0.0925 -2.1352 2.0249
8 0.9835 1.0553 0.9758 -0.0970 -2.1384 2.0251
9 - - 0.9738 - - 2.0207
10 0.9881 - 0.9758 -0.0929 - 2.0232
11 0.9825 - - -0.0916 - -
12 0.9900 1.0529 0.9778 -0.0925 -2.1352 2.0249
Table 6.6.: Bus Voltages

 
1.324 + j1.357 0 0.207 + j0.459
Z604 = 0 0 0 (6.35)
 

0.207 + j0.459 0 1.330 + j1.347

 
0 0 0
Z605 =0 0 0 (6.36)
 

0 0 1.329 + j1.348

 
0.798 + j0.446 0.319 + j0.033 0.285 − j0.014
Z606 =  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

 
1.343 + j0.5124 0 0
Z607 = 0 0 0 (6.38)
 
0 0 0

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:

Vh2 (4.16kV )2 Z
Z(base) = = ; Z(p.u) = (6.39)
Sbase 500kV A Z(base)

Admittance matrices are obtained by inversion of the impedance ma-


trices. For given impedance configurations, admittance matrices are
calculated for IEEE 13 node network:
 
39.63 − j114.24 −16.82 + j42.24 −9.21 + j31.57
y601 =  −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)

 
192.6 − j246.9 −51.75 + j52.12 −74.05 + j58.50
y602 =  −51.75 + j52.1 169.9 − j244.47 −37.66 + j47.85 
 
−74.05 + j58.5 −37.66 + j47.85 179.6 − j245.2

152
6.2 IEEE 13 bus network case

(6.41)

 
0 0 0
y603 =  0 250.06 − j229.99 −83.33 + j34.59  (6.42)
 
0 −83.33 + j34.59 248.34 − j231.04

 
248.34 − j231.04 0 −83.33 + j34.59
y604 = 0 0 0 (6.43)
 

−83.33 + j34.59 0 250.06 − j229.99

 
0 0 0
y605 =0 0 0 (6.44)
 

0 0 1226.01 − j229.12

 
357.14 − j268.9 −83.79 + j103.9 −37.30 + j85.1
y606 =  −83.8 + j104 396.2 − j280 −83.8 + j103.95 
 
−37.30 + j85.1 −83.79 + j103.9 357.14 − j269
(6.45)

 
148.52 − j56.686 0 0
y607 = 0 0 0 (6.46)
 
0 0 0

and the admittance matrix for line segment between nodes 3 and 4
where transformer is placed:
 
21.11 − j38.388 0 0
yXF M = 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:
1
  2  2
(i) (i) (i) (i)
J(x) = wPL2 PL2 − PL2m + wPL4 PL4 − PL4m
2
 2  2
(i) (i) (i) (i)
+ wPL5 PL5 − PL5m + wPL6 PL6 − PL6m
 2  2
(i) (i) (i) (i)
+ wPL7 PL7 − PL7m + wPL8 PL8 − PL8m
 2  2
(i) (i) (i) (i)
+ wPL9 PL9 − PL9m + wPL11 PL11 − PL11m
 2  2 (6.48)
(i) (i) (i) (i)
+ wQL2 QL2 − QL2m + wQL4 QL4 − QL4m
 2  2
(i) (i) (i) (i)
+ wQL5 QL5 − QL5m + wQL6 QL6 − QL6m
 2  2
(i) (i) (i) (i)
+ wQL7 QL7 − QL7m + wQL8 QL8 − QL8m
 2  2
(i) (i) (i) (i)
+ wQL9 QL9 − QL9m + wQL11 QL11 − QL11m
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 Gauss-
Newton 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 Gauss-


Newton algorithm, the solution is obtained in four iterations. Con-
vergence 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 tar-
get system conditions.

155
A. Appendix

A.1. MATLAB Programming

The goal of this section is to introduce the fundamental ideas of pro-


gramming 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 net-
work 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 V_1 V_2 d_0 d_1 d_2
2 1 1.0689 1.0569 1.0851 0 −120 120

157
Chapter A Appendix

3 2 1.0210 1.0420 1.0174 −2.49 −121.72 117.83


4 3 1.0180 1.0401 1.0148 −2.56 −121.77 117.82
5 4 0.9940 1.0218 0.9960 −3.23 −122.22 117.34
6 5 0 1.0311 1.0134 0 −121.98 117.90
7 6 0 1.0329 1.0155 0 −121.90 117.86
8 7 0.9900 1.0529 0.9778 −5.30 −122.34 116.02
9 8 0.9835 1.0553 0.9758 −5.56 −122.52 116.03
10 9 0 0 0.9738 0 0 115.78
11 10 0.9881 0 0.9758 −5.32 0 115.92
12 11 0.9825 0 0 −5.25 0 0
13 12 0.9900 1.0529 0.9778 −5.30 −122.34 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 Ppq_0=sym ( ’ Ppq_0 ’ , [ 1 l e n g t h ( branch ) ] ) ;
2 Ppq_1=sym ( ’ Ppq_1 ’ , [ 1 l e n g t h ( branch ) ] ) ;
3 Ppq_2=sym ( ’ Ppq_2 ’ , [ 1 l e n g t h ( branch ) ] ) ;
4 PL_0=sym ( ’PL_0 ’ , [ 1 l e n g t h ( bus ) ] ) ;
5 PL_1=sym ( ’PL_1 ’ , [ 1 l e n g t h ( bus ) ] ) ;
6 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 vari-
able 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 sim-
plify the complexity of calculation since all calculations are done in
general, symbolically, and at the end results are obtained for differ-
ent 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 sym-


bolic 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 ded-
icated metering and communication systems. The classic state estima-
tion 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 PL_0m=n o n z e r o s ( Pload_0m/ Sbase1P ) ;
2 PL_1m=n o n z e r o s ( Pload_1m/ Sbase1P ) ;
3 PL_2m=n o n z e r o s ( Pload_2m/ Sbase1P ) ;
4 PL_0m=n o n z e r o s ( Qload_0m/ Sbase1P ) ;
5 QL_1m=n o n z e r o s ( Qload_1m/ Sbase1P ) ;
6 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 de-
fined 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 %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
2 V_01=BUS . data ( 1 , 2 ) ;
3 V_11=BUS . data ( 1 , 3 ) ;
4 V_21=BUS . data ( 1 , 4 ) ;
5 d_01=BUS . data ( 1 , 5 ) ∗ p i / 1 8 0 ;
6 d_11=BUS . data ( 1 , 6 ) ∗ p i / 1 8 0 ;
7 d_21=BUS . data ( 1 , 7 ) ∗ p i / 1 8 0 ;
8
9 %Y and t h e t a
10 f o r k =1: l e n g t h ( branch )
11 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 ) ] ;
12 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 ) ] ;
13 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 ) ] ;
14 Zpu=[Zpu1 ( Zpu1~=0) ; Zpu2 ( Zpu2~=0) ; Zpu3 ( Zpu3~=0) ] ; ypu=
i n v ( Zpu ) ;
15 Y=abs ( ypu ) ;
16 t h e t a p p=atan2 ( imag ( ypu ) , r e a l ( ypu ) ) ;
17 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 ad-
mittance 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 Appendix

1 f o r n=2:Nn
2 sumP_0=0;
3 f o r k =1: l e n g t h ( branch )
4 i f ismember ( n , from ( k ) ) & PhaseA ( k ) ~=0
5 sumP_0=sumP_0+Ppq_0 ( k ) ;
6 e l s e i f ismember ( n , t o ( k ) )& PhaseA ( k ) ~=0
7 sumP_0=sumP_0+Pqp_0 ( k ) ; end ; end ;
8
9 sumP_0=Pgen_0 ( n )−Pload_0−sumP_0 ;
10
11 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 itera-
tive 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 %Matrix o f e q u a l i t y c o n s t r a i n t s
2 Con=[Eq1 Eq2 ] ;
3
4%Matrix o f v a r i a b l e s
5X=[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 v_0=BUS . data ( : , 2 ) ;
2 v_1=BUS . data ( : , 3 ) ;
3 v_2=BUS . data ( : , 4 ) ;
4 dd_0=BUS . data ( : , 5 ) ∗ p i / 1 8 0 ;
5 dd_1=BUS . data ( : , 6 ) ∗ p i / 1 8 0 ;
6 dd_2=BUS . data ( : , 7 ) ∗ p i / 1 8 0 ;
7 Pload_0m=BUSM. data ( : , 2 ) ;
8 Pload_1m=BUSM. data ( : , 3 ) ;
9 Pload_2m=BUSM. data ( : , 4 ) ;
10 Qload_0m=BUSM. data ( : , 5 ) ;
11 Qload_1m=BUSM. data ( : , 6 ) ;
12 Qload_2m=BUSM. data ( : , 7 ) ;
13 L=o n e s ( 1 , l e n g t h ( Con ) ) ;
14
15 %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
16 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. Con-


vergence criteria is set to 10−5 . The algorithm is repeated until conver-
gence 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 %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 )
2 e p s = 1 e −5;
3
4 %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
5 epsObtained = 1 ;
6
7 %number o f i t e r a t i o n

164
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 contin-
uous 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 de-
scribing 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 im-
plementing iterative optimization schemes. Available solvers include
the most popular and powerful optimization engines: linear and con-
vex 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 ex-
ample 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 (chang-
ing 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 var v2_0 : = 1 ;
2 var v2_1 : = 1 ;
3 var v2_2 : = 1 ;
4 var d2_0 : = 0 ;
5 var d2_1 := −2.0943951024;
6 var 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 exam-


ple, parameters are used for defining magnitudes and angles of admit-
tances, 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 param y12_00:= 7 8 . 2 0 8 4 ;
2 param y12_01:= 2 9 . 1 8 7 1 ;
3 param y12_02:= 1 6 . 3 2 7 0 ;
4 param theta12_00 := 1 . 9 8 2 5 ;
5 param theta12_01 := −1.0121;
6 param 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), fol-
lowed 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 minimize S q u a r e E r r o r :
2
3 wP0∗ ( P43_0−P43_0m) ^2+ wP1∗ ( P43_1−P43_1m) ^2
4 + wP2∗ ( P43_2−P43_2m) ^2+ wQ0∗ ( Q43_0−Q43_0m) ^2
5 + wQ1∗ ( Q43_1−Q43_1m) ^2+ wQ2∗ ( Q43_2−Q43_2m) ^2
6 + wV20∗ ( v2_0−v2_0m) ^2 + wV21∗ ( v2_1−v2_1m) ^2
7 + wV22∗ ( v2_2−v2_2m) ^2 + wV30∗ ( v3_0−v3_0m) ^2
8 + wV31∗ ( v3_1−v3_1m) ^2 + wV32∗ ( v3_2−v3_2m) ^2
9 + wV40∗ ( v4_0−v4_0m) ^2 + wV41∗ ( v4_1−v4_1m) ^2
10 + wV42∗ ( v4_2−v4_2m) ^2 + wPL0∗ (PL_0−PL_0m) ^2
11 + wPL1∗ (PL_1−PL_1m) ^2 + wPL2∗ (PL_2−PL_2m) ^2
12 + wQL0∗ (QL_0−QL_0m) ^2 + wQL1∗ (QL_1−QL_1m) ^2
13 + wQL2∗ (QL_2−QL_2m) ^2 + wI0 ∗ ( I12_0−I12_0m ) ^2
14 + wI1 ∗ ( I12_1−I12_1m ) ^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 corre-
sponding logical constraint. Here we provide examples of how to express
active power flow between nodes 1 and 2 for zero phase. All other con-
straints 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 reset ;
2 option s o l v e r knitroampl ;
3
4 # WEIGHTING GROUPS
5 param wVoltage =0; param wP=0;
6 param wQ=0; param wPLoad=100;
7 param wQLoad=100; param wCurrent =0;
8 param wV20:= wVoltage ; param wV21:= wVoltage ;
9 param wV22:= wVoltage ; param wV30:= wVoltage ;
10 param wV31:= wVoltage ; param wV32:= wVoltage ;
11 param wV40:= wVoltage ; param wV41:= wVoltage ;
12 param wV42:= wVoltage ; param wP0:=wP ;
13 param wP1:=wP; param wP2:=wP;
14 param wQ0:=wQ; param wQ1:=wQ;
15 param wQ2:=wQ; param wPL0:=wPLoad ;
16 param wPL1:=wPLoad ; param wPL2:=wPLoad ;
17 param wQL0:=wQLoad ; param wQL1:=wQLoad ;
18 param wQL2:=wQLoad ; param wI0 := wCurrent ;
19 param wI1 := wCurrent ; param wI2 := wCurrent ;
20
21 # MEASUREMENTS
22 param PL_0m: = 0 . 9 0 0 0 ; param PL_1m: = 0 . 9 0 0 0 ;
23 param PL_2m: = 0 . 9 0 0 0 ; param QL_0m: = 0 . 4 3 5 9 ;
24 param QL_1m: = 0 . 4 3 5 9 ; param QL_2m: = 0 . 4 3 5 9 ;
25 param P43_0m=−PL_0m ; param P43_1m=−PL_1m ;
26 param P43_2m=−PL_2m ; param Q43_0m=−QL_0m;
27 param Q43_1m=−QL_1m; param Q43_2m=−QL_2m;
28 param I12_0m : = 1 . 2 4 0 5 ; param I12_1m : = 1 . 1 5 8 1 ;
29 param I12_2m : = 1 . 2 0 3 1 ;
30
31 # PARAMETERS
32 param v2_0m= 0 . 9 8 7 7 ; param v2_1m= 0 . 9 9 2 1 ;
33 param v2_2m= 0 . 9 8 9 5 ; param v3_0m= 0 . 9 3 6 8 ;
34 param v3_1m= 0 . 9 4 5 1 ; param v3_2m= 0 . 9 3 9 7 ;
35 param v4_0m= 0 . 8 0 6 1 ; param v4_1m= 0 . 8 6 3 5 ;
36 param v4_2m= 0 . 8 3 1 1 ; param y12_00 := 7 8 . 2 0 8 4 ;
37 param y12_01 := 2 9 . 1 8 7 1 ; param y12_02 := 1 6 . 3 2 7 0 ;
38 param y12_10 := 2 9 . 1 8 7 1 ; param y12_11 := 8 2 . 5 4 7 4 ;
39 param y12_12 := 2 1 . 3 2 2 3 ; param y12_20 := 1 6 . 3 2 7 0 ;
40 param y12_21 := 2 1 . 3 2 2 3 ; param y12_22 := 7 4 . 4 9 7 3 ;
41 param y23_00 := 1 6 . 4 3 9 9 ; param y23_01 := 0 ;
42 param y23_02 := 0 ; param y23_10 := 0 ;
43 param y23_11 := 1 6 . 4 3 9 9 ; param y23_12 := 0 ;
44 param y23_20 := 0 ; param y23_21 := 0 ;
45 param y23_22 := 1 6 . 4 3 9 9 ; param y34_00 := 6 . 9 6 3 0 ;
46 param y34_01 := 2 . 5 9 8 6 ; param y34_02 := 1 . 4 5 3 6 ;
47 param y34_10 := 2 . 5 9 8 6 ; param y34_11 := 7 . 3 4 9 3 ;
48 param y34_12 := 1 . 8 9 8 4 ; param y34_20 := 1 . 4 5 3 6 ;
49 param y34_21 := 1 . 8 9 8 4 ; param y34_22 := 6 . 6 3 2 6 ;
50 param y11_00 := 7 8 . 2 0 8 4 ; param y11_01 := 2 9 . 1 8 7 1 ;
51 param y11_02 := 1 6 . 3 2 7 0 ; param y11_10 := 2 9 . 1 8 7 1 ;
52 param y11_11 := 8 2 . 5 4 7 4 ; param y11_12 := 2 1 . 3 2 2 3 ;

181
Chapter B Appendix

53 param y11_20 := 1 6 . 3 2 7 0 ; param y11_21 := 2 1 . 3 2 2 3 ;


54 param y11_22 := 7 4 . 4 9 7 3 ; param y22_00N1:= 7 8 . 2 0 8 4 ;
55 param y22_01N1:= 2 9 . 1 8 7 1 ; param y22_02N1:= 1 6 . 3 2 7 0 ;
56 param y22_10N1:= 2 9 . 1 8 7 1 ; param y22_11N1:= 8 2 . 5 4 7 4 ;
57 param y22_12N1:= 2 1 . 3 2 2 3 ; param y22_20N1:= 1 6 . 3 2 7 0 ;
58 param y22_21N1:= 2 1 . 3 2 2 3 ; param y22_22N1:= 7 4 . 4 9 7 3 ;
59 param y22_00N3:= 1 6 . 4 3 9 9 ; param y22_01N3:= 0 ;
60 param y22_02N3:= 0 ; param y22_10N3:= 0 ;
61 param y22_11N3:= 1 6 . 4 3 9 9 ; param y22_12N3:= 0 ;
62 param y22_20N3:= 0 ; param y22_21N3:= 0 ;
63 param y22_22N3:= 1 6 . 4 3 9 9 ; param y33_00N2:= 1 6 . 4 3 9 9 ;
64 param y33_01N2:= 0 ; param y33_02N2:= 0 ;
65 param y33_10N2:= 0 ; param y33_11N2:= 1 6 . 4 3 9 9 ;
66 param y33_12N2:= 0 ; param y33_20N2:= 0 ;
67 param y33_21N2:= 0 ; param y33_22N2:= 1 6 . 4 3 9 9 ;
68 param y33_00N4:= 6 . 9 6 3 0 ; param y33_01N4:= 2 . 5 9 8 6 ;
69 param y33_02N4:= 1 . 4 5 3 6 ; param y33_10N4:= 2 . 5 9 8 6 ;
70 param y33_11N4:= 7 . 3 4 9 3 ; param y33_12N4:= 1 . 8 9 8 4 ;
71 param y33_20N4:= 1 . 4 5 3 6 ; param y33_21N4:= 1 . 8 9 8 4 ;
72 param y33_22N4:= 6 . 6 3 2 6 ; param y44_00 := 6 . 9 6 3 0 ;
73 param y44_01 := 2 . 5 9 8 6 ; param y44_02 := 1 . 4 5 3 6 ;
74 param y44_10 := 2 . 5 9 8 6 ; param y44_11 := 7 . 3 4 9 3 ;
75 param y44_12 := 1 . 8 9 8 4 ; param y44_20 := 1 . 4 5 3 6 ;
76 param y44_21 := 1 . 8 9 8 4 ; param y44_22 := 6 . 6 3 2 6 ;
77 param theta12_00 := 1 . 9 8 2 5 ; param theta12_01 := − 1 . 0 1 2 1 ;
78 param theta12_02 := − 1 . 2 3 3 3 ; param theta12_10 := − 1 . 0 1 2 1 ;
79 param theta12_11 := 2 . 0 1 0 8 ; param theta12_12 := − 1 . 1 1 6 2 ;
80 param theta12_20 := − 1 . 2 3 3 3 ; param theta12_21 := − 1 . 1 1 6 2 ;
81 param theta12_22 := 1 . 9 5 6 2 ; param theta23_00 := 1 . 7 3 5 9 ;
82 param theta23_01 := 0 ; param theta23_02 := 0 ;
83 param theta23_10 := 0 ; param theta23_11 := 1 . 7 3 5 9 ;
84 param theta23_12 := 0 ; param theta23_20 := 0 ;
85 param theta23_21 := 0 ; param theta23_22 := 1 . 7 3 5 9 ;
86 param theta34_00 := 1 . 9 8 2 5 ; param theta34_01 := − 1 . 0 1 2 1 ;
87 param theta34_02 := − 1 . 2 3 3 3 ; param theta34_10 := − 1 . 0 1 2 1 ;
88 param theta34_11 := 2 . 0 1 0 8 ; param theta34_12 := − 1 . 1 1 6 2 ;
89 param theta34_20 := − 1 . 2 3 3 3 ; param theta34_21 := − 1 . 1 1 6 2 ;
90 param theta34_22 := 1 . 9 5 6 2 ; param theta11_00 := − 1 . 1 5 9 1 ;
91 param theta11_01 := 2 . 1 2 9 5 ; param theta11_02 := 1 . 9 0 8 3 ;
92 param theta11_10 := 2 . 1 2 9 5 ; param theta11_11 := − 1 . 1 3 0 8 ;
93 param theta11_12 := 2 . 0 2 5 4 ; param theta11_20 := 1 . 9 0 8 3 ;
94 param theta11_21 := 2 . 0 2 5 4 ; param theta11_22 := −1.1854;
95 param theta22_00N1 := − 1 . 1 5 9 1 ; param theta22_01N1 := 2 . 1 2 9 5 ;
96 param theta22_02N1 := 1 . 9 0 8 3 ; param theta22_10N1 := 2 . 1 2 9 5 ;
97 param theta22_11N1 := − 1 . 1 3 0 8 ; param theta22_12N1 := 2 . 0 2 5 4 ;
98 param theta22_20N1 := 1 . 9 0 8 3 ; param theta22_21N1 := 2 . 0 2 5 4 ;
99 param theta22_22N1 := − 1 . 1 8 5 4 ; param theta22_00N3 := − 1 . 4 0 5 6 ;
100 param theta22_01N3 := 0 ; param theta22_02N3 := 0 ;
101 param theta22_10N3 := 0 ; param theta22_11N3:=− 1 . 4 0 5 6 ;
102 param theta22_12N3 := 0 ; param theta22_20N3 := 0 ;
103 param theta22_21N3 := 0 ; param theta22_22N3 := − 1 . 4 0 5 6 ;
104 param theta33_00N2:=− 1 . 4 0 5 6 ; param theta33_01N2 := 0 ;
105 param theta33_02N2 := 0 ; param theta33_10N2 := 0 ;
106 param theta33_11N2 := − 1 . 4 0 5 6 ; param theta33_12N2 := 0 ;
107 param theta33_20N2 := 0 ; param theta33_21N2 := 0 ;
108 param theta33_22N2 := − 1 . 4 0 5 6 ; param theta33_00N4 := − 1 . 1 5 9 1 ;

182
B.2 AMPL Code

109 param theta33_01N4 := 2 . 1 2 9 5 ; param theta33_02N4 := 1 . 9 0 8 3 ;


110 param theta33_10N4 := 2 . 1 2 9 5 ; param theta33_11N4 := − 1 . 1 3 0 8 ;
111 param theta33_12N4 := 2 . 0 2 5 4 ; param theta33_20N4 := 1 . 9 0 8 3 ;
112 param theta33_21N4 := 2 . 0 2 5 4 ; param theta33_22N4 := − 1 . 1 8 5 4 ;
113 param theta44_00 := − 1 . 1 5 9 1 ; param theta44_01 := 2 . 1 2 9 5 ;
114 param theta44_02 := 1 . 9 0 8 3 ; param theta44_10 := 2 . 1 2 9 5 ;
115 param theta44_11 := − 1 . 1 3 0 8 ; param theta44_12 := 2 . 0 2 5 4 ;
116 param theta44_20 := 1 . 9 0 8 3 ; param theta44_21 := 2 . 0 2 5 4 ;
117 param theta44_22 := − 1 . 1 8 5 4 ; param v1_0 : = 1 ;
118 param v1_1 : = 1 ; param v1_2 : = 1 ;
119 param d1_0=0; param d1_1= −2.0944;
120 param d1_2 = 2 . 0 9 4 4 ;
121
122 # VARIABLES
123 v a r P12_0 := PL_0m ; var P12_1 := PL_1m ;
124 v a r P12_2 := PL_2m ; var P23_0 := PL_0m ;
125 v a r P23_1 := PL_1m ; var P23_2 := PL_2m ;
126 v a r P34_0 := PL_0m ; var P34_1 := PL_1m ;
127 v a r P34_2 := PL_2m ; var P21_0 := −PL_0m ;
128 v a r P21_1 := −PL_1m ; var P21_2 := −PL_2m ;
129 v a r P32_0 := −PL_0m ; var P32_1 := −PL_1m ;
130 v a r P32_2 := −PL_2m ; var P43_0 := −PL_0m ;
131 v a r P43_1 := −PL_1m ; var P43_2 := −PL_2m ;
132 v a r Q12_0 := QL_0m; var Q12_1 := QL_1m;
133 v a r Q12_2 := QL_2m; var Q23_0 := QL_0m;
134 v a r Q23_1 := QL_1m; var Q23_2 := QL_2m;
135 v a r Q34_0 := QL_0m; var Q34_1 := QL_1m;
136 v a r Q34_2 := QL_2m; var Q21_0 := −QL_0m;
137 v a r Q21_1 := −QL_1m; var Q21_2 := −QL_2m;
138 v a r Q32_0 := −QL_0m; var Q32_1 := −QL_1m;
139 v a r Q32_2 := −QL_2m; var Q43_0 := −QL_0m;
140 v a r Q43_1 := −QL_1m; var Q43_2 := −QL_2m;
141 v a r PL_0 := PL_0m ; var PL_1 := PL_1m ;
142 v a r PL_2 := PL_2m ; var QL_0 := QL_0m;
143 v a r QL_1 := QL_1m; var QL_2 := QL_2m;
144 v a r I12_0 : = 1 . 2 4 0 5 ; var I12_1 : = 1 . 1 5 8 0 ;
145 v a r I12_2 : = 1 . 2 0 3 0 ; var v2_0 : = 1 ;
146 v a r v2_1 : = 1 ; var v2_2 : = 1 ;
147 v a r v3_0 : = 1 ; var v3_1 : = 1 ;
148 v a r v3_2 : = 1 ; var v4_0 : = 1 ;
149 v a r v4_1 : = 1 ; var v4_2 : = 1 ;
150 v a r d2_0 : = 0 ; var d2_1 := −2.0944;
151 v a r d2_2 : = 2 . 0 9 4 4 ; var d3_0 : = 0 ;
152 v a r d3_1 := −2.0944; var d3_2 : = 2 . 0 9 4 4 ;
153 v a r d4_0 : = 0 ; var d4_1 := −2.0944;
154 v a r d4_2 : = 2 . 0 9 4 4 ;
155
156 #OBJECTIVE FUNCTION
157 minimize SquareError :
158 wP0∗ ( P43_0−P43_0m)^2+ wP1∗ ( P43_1−P43_1m)^2+ wP2∗ ( P43_2−P43_2m) ^ 2
159 + wQ0∗ ( Q43_0−Q43_0m)^2+ wQ1∗ ( Q43_1−Q43_1m)^2+ wQ2∗ ( Q43_2−Q43_2m) ^ 2
160 + wV20∗ ( v2_0−v2_0m) ^ 2 + wV21∗ ( v2_1−v2_1m) ^ 2 + wV22∗ ( v2_2−v2_2m) ^ 2
161 + wV30∗ ( v3_0−v3_0m) ^ 2 + wV31∗ ( v3_1−v3_1m) ^ 2 + wV32∗ ( v3_2−v3_2m) ^ 2
162 + wV40∗ ( v4_0−v4_0m) ^ 2 + wV41∗ ( v4_1−v4_1m) ^ 2 + wV42∗ ( v4_2−v4_2m) ^ 2
163 + wPL0∗ (PL_0−PL_0m) ^ 2 + wPL1∗ (PL_1−PL_1m) ^ 2 + wPL2∗ (PL_2−PL_2m) ^ 2
164 + wQL0∗ (QL_0−QL_0m) ^ 2 + wQL1∗ (QL_1−QL_1m) ^ 2 + wQL2∗ (QL_2−QL_2m) ^ 2

183
Chapter B Appendix

165 + wI0 ∗ ( I12_0−I12_0m ) ^ 2 + wI1 ∗ ( I12_1−I12_1m ) ^ 2 + wI2 ∗ ( I12_2−I12_2m ) ^ 2 ;


166
167 #CONSTRAINTS
168 s u b j e c t to
169 C1 : P12_0−(v1_0∗v1_0∗ y11_00 ∗ c o s ( d1_0−d1_0−theta11_00 )
170 +v1_0∗v2_0∗ y12_00 ∗ c o s ( d1_0−d2_0−theta12_00 )
171 +v1_0∗v1_1∗ y11_01 ∗ c o s ( d1_0−d1_1−theta11_01 )
172 +v1_0∗v2_1∗ y12_01 ∗ c o s ( d1_0−d2_1−theta12_01 )
173 +v1_0∗v1_2∗ y11_02 ∗ c o s ( d1_0−d1_2−theta11_02 )
174 +v1_0∗v2_2∗ y12_02 ∗ c o s ( d1_0−d2_2−theta12_02 ) ) = 0 ;
175 C2 : P12_1−(v1_1∗v1_0∗ y11_10 ∗ c o s ( d1_1−d1_0−theta11_10 )
176 +v1_1∗v2_0∗ y12_10 ∗ c o s ( d1_1−d2_0−theta12_10 )
177 +v1_1∗v1_1∗ y11_11 ∗ c o s ( d1_1−d1_1−theta11_11 )
178 +v1_1∗v2_1∗ y12_11 ∗ c o s ( d1_1−d2_1−theta12_11 )
179 +v1_1∗v1_2∗ y11_12 ∗ c o s ( d1_1−d1_2−theta11_12 )
180 +v1_1∗v2_2∗ y12_12 ∗ c o s ( d1_1−d2_2−theta12_12 ) ) = 0 ;
181 C3 : P12_2−(v1_2∗v1_0∗ y11_20 ∗ c o s ( d1_2−d1_0−theta11_20 )
182 +v1_2∗v2_0∗ y12_20 ∗ c o s ( d1_2−d2_0−theta12_20 )
183 +v1_2∗v1_1∗ y11_21 ∗ c o s ( d1_2−d1_1−theta11_21 )
184 +v1_2∗v2_1∗ y12_21 ∗ c o s ( d1_2−d2_1−theta12_21 )
185 +v1_2∗v1_2∗ y11_22 ∗ c o s ( d1_2−d1_2−theta11_22 )
186 +v1_2∗v2_2∗ y12_22 ∗ c o s ( d1_2−d2_2−theta12_22 ) ) = 0 ;
187 C4 : P21_0−(v2_0∗v2_0∗y22_00N1∗ c o s ( d2_0−d2_0−theta22_00N1 )
188 +v2_0∗v1_0∗ y12_00 ∗ c o s ( d2_0−d1_0−theta12_00 )
189 +v2_0∗v2_1∗y22_01N1∗ c o s ( d2_0−d2_1−theta22_01N1 )
190 +v2_0∗v1_1∗ y12_01 ∗ c o s ( d2_0−d1_1−theta12_01 )
191 +v2_0∗v2_2∗y22_02N1∗ c o s ( d2_0−d2_2−theta22_02N1 )
192 +v2_0∗v1_2∗ y12_02 ∗ c o s ( d2_0−d1_2−theta12_02 ) ) = 0 ;
193 C5 : P21_1−(v2_1∗v2_0∗y22_10N1∗ c o s ( d2_1−d2_0−theta22_10N1 )
194 +v2_1∗v1_0∗ y12_10 ∗ c o s ( d2_1−d1_0−theta12_10 )
195 +v2_1∗v2_1∗y22_11N1∗ c o s ( d2_1−d2_1−theta22_11N1 )
196 +v2_1∗v1_1∗ y12_11 ∗ c o s ( d2_1−d1_1−theta12_11 )
197 +v2_1∗v2_2∗y22_12N1∗ c o s ( d2_1−d2_2−theta22_12N1 )
198 +v2_1∗v1_2∗ y12_12 ∗ c o s ( d2_1−d1_2−theta12_12 ) ) = 0 ;
199 C6 : P21_2−(v2_2∗v2_0∗y22_20N1∗ c o s ( d2_2−d2_0−theta22_20N1 )
200 +v2_2∗v1_0∗ y12_20 ∗ c o s ( d2_2−d1_0−theta12_20 )
201 +v2_2∗v2_1∗y22_21N1∗ c o s ( d2_2−d2_1−theta22_21N1 )
202 +v2_2∗v1_1∗ y12_21 ∗ c o s ( d2_2−d1_1−theta12_21 )
203 +v2_2∗v2_2∗y22_22N1∗ c o s ( d2_2−d2_2−theta22_22N1 )
204 +v2_2∗v1_2∗ y12_22 ∗ c o s ( d2_2−d1_2−theta12_22 ) ) = 0 ;
205 C7 : P23_0−(v2_0∗v2_0∗y22_00N3∗ c o s ( d2_0−d2_0−theta22_00N3 )
206 +v2_0∗v3_0∗ y23_00 ∗ c o s ( d2_0−d3_0−theta23_00 )
207 +v2_0∗v2_1∗y22_01N3∗ c o s ( d2_0−d2_1−theta22_01N3 )
208 +v2_0∗v3_1∗ y23_01 ∗ c o s ( d2_0−d3_1−theta23_01 )
209 +v2_0∗v2_2∗y22_02N3∗ c o s ( d2_0−d2_2−theta22_02N3 )
210 +v2_0∗v3_2∗ y23_02 ∗ c o s ( d2_0−d3_2−theta23_02 ) ) = 0 ;
211 C8 : P23_1−(v2_1∗v2_0∗y22_10N3∗ c o s ( d2_1−d2_0−theta22_10N3 )
212 +v2_1∗v3_0∗ y23_10 ∗ c o s ( d2_1−d3_0−theta23_10 )
213 +v2_1∗v2_1∗y22_11N3∗ c o s ( d2_1−d2_1−theta22_11N3 )
214 +v2_1∗v3_1∗ y23_11 ∗ c o s ( d2_1−d3_1−theta23_11 )
215 +v2_1∗v2_2∗y22_12N3∗ c o s ( d2_1−d2_2−theta22_12N3 )
216 +v2_1∗v3_2∗ y23_12 ∗ c o s ( d2_1−d3_2−theta23_12 ) ) = 0 ;
217 C9 : P23_2−(v2_2∗v2_0∗y22_20N3∗ c o s ( d2_2−d2_0−theta22_20N3 )
218 +v2_2∗v3_0∗ y23_20 ∗ c o s ( d2_2−d3_0−theta23_20 )
219 +v2_2∗v2_1∗y22_21N3∗ c o s ( d2_2−d2_1−theta22_21N3 )
220 +v2_2∗v3_1∗ y23_21 ∗ c o s ( d2_2−d3_1−theta23_21 )

184
B.2 AMPL Code

221 +v2_2∗v2_2∗y22_22N3∗ c o s ( d2_2−d2_2−theta22_22N3 )


222 +v2_2∗v3_2∗ y23_22 ∗ c o s ( d2_2−d3_2−theta23_22 ) ) = 0 ;
223 C10 : P32_0−(v3_0∗v3_0∗y33_00N2∗ c o s ( d3_0−d3_0−theta33_00N2 )
224 +v3_0∗v2_0∗ y23_00 ∗ c o s ( d3_0−d2_0−theta23_00 )
225 +v3_0∗v3_1∗y33_01N2∗ c o s ( d3_0−d3_1−theta33_01N2 )
226 +v3_0∗v2_1∗ y23_01 ∗ c o s ( d3_0−d2_1−theta23_01 )
227 +v3_0∗v3_2∗y33_02N2∗ c o s ( d3_0−d3_2−theta33_02N2 )
228 +v3_0∗v2_2∗ y23_02 ∗ c o s ( d3_0−d2_2−theta23_02 ) ) = 0 ;
229 C11 : P32_1−(v3_1∗v3_0∗y33_10N2∗ c o s ( d3_1−d3_0−theta33_10N2 )
230 +v3_1∗v2_0∗ y23_10 ∗ c o s ( d3_1−d2_0−theta23_10 )
231 +v3_1∗v3_1∗y33_11N2∗ c o s ( d3_1−d3_1−theta33_11N2 )
232 +v3_1∗v2_1∗ y23_11 ∗ c o s ( d3_1−d2_1−theta23_11 )
233 +v3_1∗v3_2∗y33_12N2∗ c o s ( d3_1−d3_2−theta33_12N2 )
234 +v3_1∗v2_2∗ y23_12 ∗ c o s ( d3_1−d2_2−theta23_12 ) ) = 0 ;
235 C12 : P32_2−(v3_2∗v3_0∗y33_20N2∗ c o s ( d3_2−d3_0−theta33_20N2 )
236 +v3_2∗v2_0∗ y23_20 ∗ c o s ( d3_2−d2_0−theta23_20 )
237 +v3_2∗v3_1∗y33_21N2∗ c o s ( d3_2−d3_1−theta33_21N2 )
238 +v3_2∗v2_1∗ y23_21 ∗ c o s ( d3_2−d2_1−theta23_21 )
239 +v3_2∗v3_2∗y33_22N2∗ c o s ( d3_2−d3_2−theta33_22N2 )
240 +v3_2∗v2_2∗ y23_22 ∗ c o s ( d3_2−d2_2−theta23_22 ) ) = 0 ;
241 C13 : P34_0−(v3_0∗v3_0∗y33_00N4∗ c o s ( d3_0−d3_0−theta33_00N4 )
242 +v3_0∗v4_0∗ y34_00 ∗ c o s ( d3_0−d4_0−theta34_00 )
243 +v3_0∗v3_1∗y33_01N4∗ c o s ( d3_0−d3_1−theta33_01N4 )
244 +v3_0∗v4_1∗ y34_01 ∗ c o s ( d3_0−d4_1−theta34_01 )
245 +v3_0∗v3_2∗y33_02N4∗ c o s ( d3_0−d3_2−theta33_02N4 )
246 +v3_0∗v4_2∗ y34_02 ∗ c o s ( d3_0−d4_2−theta34_02 ) ) = 0 ;
247 C14 : P34_1−(v3_1∗v3_0∗y33_10N4∗ c o s ( d3_1−d3_0−theta33_10N4 )
248 +v3_1∗v4_0∗ y34_10 ∗ c o s ( d3_1−d4_0−theta34_10 )
249 +v3_1∗v3_1∗y33_11N4∗ c o s ( d3_1−d3_1−theta33_11N4 )
250 +v3_1∗v4_1∗ y34_11 ∗ c o s ( d3_1−d4_1−theta34_11 )
251 +v3_1∗v3_2∗y33_12N4∗ c o s ( d3_1−d3_2−theta33_12N4 )
252 +v3_1∗v4_2∗ y34_12 ∗ c o s ( d3_1−d4_2−theta34_12 ) ) = 0 ;
253 C15 : P34_2−(v3_2∗v3_0∗y33_20N4∗ c o s ( d3_2−d3_0−theta33_20N4 )
254 +v3_2∗v4_0∗ y34_20 ∗ c o s ( d3_2−d4_0−theta34_20 )
255 +v3_2∗v3_1∗y33_21N4∗ c o s ( d3_2−d3_1−theta33_21N4 )
256 +v3_2∗v4_1∗ y34_21 ∗ c o s ( d3_2−d4_1−theta34_21 )
257 +v3_2∗v3_2∗y33_22N4∗ c o s ( d3_2−d3_2−theta33_22N4 )
258 +v3_2∗v4_2∗ y34_22 ∗ c o s ( d3_2−d4_2−theta34_22 ) ) = 0 ;
259 C16 : P43_0−(v4_0∗v4_0∗ y44_00 ∗ c o s ( d4_0−d4_0−theta44_00 )
260 +v4_0∗v3_0∗ y34_00 ∗ c o s ( d4_0−d3_0−theta34_00 )
261 +v4_0∗v4_1∗ y44_01 ∗ c o s ( d4_0−d4_1−theta44_01 )
262 +v4_0∗v3_1∗ y34_01 ∗ c o s ( d4_0−d3_1−theta34_01 )
263 +v4_0∗v4_2∗ y44_02 ∗ c o s ( d4_0−d4_2−theta44_02 )
264 +v4_0∗v3_2∗ y34_02 ∗ c o s ( d4_0−d3_2−theta34_02 ) ) = 0 ;
265 C17 : P43_1−(v4_1∗v4_0∗ y44_10 ∗ c o s ( d4_1−d4_0−theta44_10 )
266 +v4_1∗v3_0∗ y34_10 ∗ c o s ( d4_1−d3_0−theta34_10 )
267 +v4_1∗v4_1∗ y44_11 ∗ c o s ( d4_1−d4_1−theta44_11 )
268 +v4_1∗v3_1∗ y34_11 ∗ c o s ( d4_1−d3_1−theta34_11 )
269 +v4_1∗v4_2∗ y44_12 ∗ c o s ( d4_1−d4_2−theta44_12 )
270 +v4_1∗v3_2∗ y34_12 ∗ c o s ( d4_1−d3_2−theta34_12 ) ) = 0 ;
271 C18 : P43_2−(v4_2∗v4_0∗ y44_20 ∗ c o s ( d4_2−d4_0−theta44_20 )
272 +v4_2∗v3_0∗ y34_20 ∗ c o s ( d4_2−d3_0−theta34_20 )
273 +v4_2∗v4_1∗ y44_21 ∗ c o s ( d4_2−d4_1−theta44_21 )
274 +v4_2∗v3_1∗ y34_21 ∗ c o s ( d4_2−d3_1−theta34_21 )
275 +v4_2∗v4_2∗ y44_22 ∗ c o s ( d4_2−d4_2−theta44_22 )
276 +v4_2∗v3_2∗ y34_22 ∗ c o s ( d4_2−d3_2−theta34_22 ) ) = 0 ;

185
Chapter B Appendix

277 C19 : Q12_0−(v1_0∗v1_0∗ y11_00 ∗ s i n ( d1_0−d1_0−theta11_00 )


278 +v1_0∗v2_0∗ y12_00 ∗ s i n ( d1_0−d2_0−theta12_00 )
279 +v1_0∗v1_1∗ y11_01 ∗ s i n ( d1_0−d1_1−theta11_01 )
280 +v1_0∗v2_1∗ y12_01 ∗ s i n ( d1_0−d2_1−theta12_01 )
281 +v1_0∗v1_2∗ y11_02 ∗ s i n ( d1_0−d1_2−theta11_02 )
282 +v1_0∗v2_2∗ y12_02 ∗ s i n ( d1_0−d2_2−theta12_02 ) ) = 0 ;
283 C20 : Q12_1−(v1_1∗v1_0∗ y11_10 ∗ s i n ( d1_1−d1_0−theta11_10 )
284 +v1_1∗v2_0∗ y12_10 ∗ s i n ( d1_1−d2_0−theta12_10 )
285 +v1_1∗v1_1∗ y11_11 ∗ s i n ( d1_1−d1_1−theta11_11 )
286 +v1_1∗v2_1∗ y12_11 ∗ s i n ( d1_1−d2_1−theta12_11 )
287 +v1_1∗v1_2∗ y11_12 ∗ s i n ( d1_1−d1_2−theta11_12 )
288 +v1_1∗v2_2∗ y12_12 ∗ s i n ( d1_1−d2_2−theta12_12 ) ) = 0 ;
289 C21 : Q12_2−(v1_2∗v1_0∗ y11_20 ∗ s i n ( d1_2−d1_0−theta11_20 )
290 +v1_2∗v2_0∗ y12_20 ∗ s i n ( d1_2−d2_0−theta12_20 )
291 +v1_2∗v1_1∗ y11_21 ∗ s i n ( d1_2−d1_1−theta11_21 )
292 +v1_2∗v2_1∗ y12_21 ∗ s i n ( d1_2−d2_1−theta12_21 )
293 +v1_2∗v1_2∗ y11_22 ∗ s i n ( d1_2−d1_2−theta11_22 )
294 +v1_2∗v2_2∗ y12_22 ∗ s i n ( d1_2−d2_2−theta12_22 ) ) = 0 ;
295 C22 : Q21_0−(v2_0∗v2_0∗y22_00N1∗ s i n ( d2_0−d2_0−theta22_00N1 )
296 +v2_0∗v1_0∗ y12_00 ∗ s i n ( d2_0−d1_0−theta12_00 )
297 +v2_0∗v2_1∗y22_01N1∗ s i n ( d2_0−d2_1−theta22_01N1 )
298 +v2_0∗v1_1∗ y12_01 ∗ s i n ( d2_0−d1_1−theta12_01 )
299 +v2_0∗v2_2∗y22_02N1∗ s i n ( d2_0−d2_2−theta22_02N1 )
300 +v2_0∗v1_2∗ y12_02 ∗ s i n ( d2_0−d1_2−theta12_02 ) ) = 0 ;
301 C23 : Q21_1−(v2_1∗v2_0∗y22_10N1∗ s i n ( d2_1−d2_0−theta22_10N1 )
302 +v2_1∗v1_0∗ y12_10 ∗ s i n ( d2_1−d1_0−theta12_10 )
303 +v2_1∗v2_1∗y22_11N1∗ s i n ( d2_1−d2_1−theta22_11N1 )
304 +v2_1∗v1_1∗ y12_11 ∗ s i n ( d2_1−d1_1−theta12_11 )
305 +v2_1∗v2_2∗y22_12N1∗ s i n ( d2_1−d2_2−theta22_12N1 )
306 +v2_1∗v1_2∗ y12_12 ∗ s i n ( d2_1−d1_2−theta12_12 ) ) = 0 ;
307 C24 : Q21_2−(v2_2∗v2_0∗y22_20N1∗ s i n ( d2_2−d2_0−theta22_20N1 )
308 +v2_2∗v1_0∗ y12_20 ∗ s i n ( d2_2−d1_0−theta12_20 )
309 +v2_2∗v2_1∗y22_21N1∗ s i n ( d2_2−d2_1−theta22_21N1 )
310 +v2_2∗v1_1∗ y12_21 ∗ s i n ( d2_2−d1_1−theta12_21 )
311 +v2_2∗v2_2∗y22_22N1∗ s i n ( d2_2−d2_2−theta22_22N1 )
312 +v2_2∗v1_2∗ y12_22 ∗ s i n ( d2_2−d1_2−theta12_22 ) ) = 0 ;
313 C25 : Q23_0−(v2_0∗v2_0∗y22_00N3∗ s i n ( d2_0−d2_0−theta22_00N3 )
314 +v2_0∗v3_0∗ y23_00 ∗ s i n ( d2_0−d3_0−theta23_00 )
315 +v2_0∗v2_1∗y22_01N3∗ s i n ( d2_0−d2_1−theta22_01N3 )
316 +v2_0∗v3_1∗ y23_01 ∗ s i n ( d2_0−d3_1−theta23_01 )
317 +v2_0∗v2_2∗y22_02N3∗ s i n ( d2_0−d2_2−theta22_02N3 )
318 +v2_0∗v3_2∗ y23_02 ∗ s i n ( d2_0−d3_2−theta23_02 ) ) = 0 ;
319 C26 : Q23_1−(v2_1∗v2_0∗y22_10N3∗ s i n ( d2_1−d2_0−theta22_10N3 )
320 +v2_1∗v3_0∗ y23_10 ∗ s i n ( d2_1−d3_0−theta23_10 )
321 +v2_1∗v2_1∗y22_11N3∗ s i n ( d2_1−d2_1−theta22_11N3 )
322 +v2_1∗v3_1∗ y23_11 ∗ s i n ( d2_1−d3_1−theta23_11 )
323 +v2_1∗v2_2∗y22_12N3∗ s i n ( d2_1−d2_2−theta22_12N3 )
324 +v2_1∗v3_2∗ y23_12 ∗ s i n ( d2_1−d3_2−theta23_12 ) ) = 0 ;
325 C27 : Q23_2−(v2_2∗v2_0∗y22_20N3∗ s i n ( d2_2−d2_0−theta22_20N3 )
326 +v2_2∗v3_0∗ y23_20 ∗ s i n ( d2_2−d3_0−theta23_20 )
327 +v2_2∗v2_1∗y22_21N3∗ s i n ( d2_2−d2_1−theta22_21N3 )
328 +v2_2∗v3_1∗ y23_21 ∗ s i n ( d2_2−d3_1−theta23_21 )
329 +v2_2∗v2_2∗y22_22N3∗ s i n ( d2_2−d2_2−theta22_22N3 )
330 +v2_2∗v3_2∗ y23_22 ∗ s i n ( d2_2−d3_2−theta23_22 ) ) = 0 ;
331 C28 : Q32_0−(v3_0∗v3_0∗y33_00N2∗ s i n ( d3_0−d3_0−theta33_00N2 )
332 +v3_0∗v2_0∗ y23_00 ∗ s i n ( d3_0−d2_0−theta23_00 )

186
B.2 AMPL Code

333 +v3_0∗v3_1∗y33_01N2∗ s i n ( d3_0−d3_1−theta33_01N2 )


334 +v3_0∗v2_1∗ y23_01 ∗ s i n ( d3_0−d2_1−theta23_01 )
335 +v3_0∗v3_2∗y33_02N2∗ s i n ( d3_0−d3_2−theta33_02N2 )
336 +v3_0∗v2_2∗ y23_02 ∗ s i n ( d3_0−d2_2−theta23_02 ) ) = 0 ;
337 C29 : Q32_1−(v3_1∗v3_0∗y33_10N2∗ s i n ( d3_1−d3_0−theta33_10N2 )
338 +v3_1∗v2_0∗ y23_10 ∗ s i n ( d3_1−d2_0−theta23_10 )
339 +v3_1∗v3_1∗y33_11N2∗ s i n ( d3_1−d3_1−theta33_11N2 )
340 +v3_1∗v2_1∗ y23_11 ∗ s i n ( d3_1−d2_1−theta23_11 )
341 +v3_1∗v3_2∗y33_12N2∗ s i n ( d3_1−d3_2−theta33_12N2 )
342 +v3_1∗v2_2∗ y23_12 ∗ s i n ( d3_1−d2_2−theta23_12 ) ) = 0 ;
343 C30 : Q32_2−(v3_2∗v3_0∗y33_20N2∗ s i n ( d3_2−d3_0−theta33_20N2 )
344 +v3_2∗v2_0∗ y23_20 ∗ s i n ( d3_2−d2_0−theta23_20 )
345 +v3_2∗v3_1∗y33_21N2∗ s i n ( d3_2−d3_1−theta33_21N2 )
346 +v3_2∗v2_1∗ y23_21 ∗ s i n ( d3_2−d2_1−theta23_21 )
347 +v3_2∗v3_2∗y33_22N2∗ s i n ( d3_2−d3_2−theta33_22N2 )
348 +v3_2∗v2_2∗ y23_22 ∗ s i n ( d3_2−d2_2−theta23_22 ) ) = 0 ;
349 C31 : Q34_0−(v3_0∗v3_0∗y33_00N4∗ s i n ( d3_0−d3_0−theta33_00N4 )
350 +v3_0∗v4_0∗ y34_00 ∗ s i n ( d3_0−d4_0−theta34_00 )
351 +v3_0∗v3_1∗y33_01N4∗ s i n ( d3_0−d3_1−theta33_01N4 )
352 +v3_0∗v4_1∗ y34_01 ∗ s i n ( d3_0−d4_1−theta34_01 )
353 +v3_0∗v3_2∗y33_02N4∗ s i n ( d3_0−d3_2−theta33_02N4 )
354 +v3_0∗v4_2∗ y34_02 ∗ s i n ( d3_0−d4_2−theta34_02 ) ) = 0 ;
355 C32 : Q34_1−(v3_1∗v3_0∗y33_10N4∗ s i n ( d3_1−d3_0−theta33_10N4 )
356 +v3_1∗v4_0∗ y34_10 ∗ s i n ( d3_1−d4_0−theta34_10 )
357 +v3_1∗v3_1∗y33_11N4∗ s i n ( d3_1−d3_1−theta33_11N4 )
358 +v3_1∗v4_1∗ y34_11 ∗ s i n ( d3_1−d4_1−theta34_11 )
359 +v3_1∗v3_2∗y33_12N4∗ s i n ( d3_1−d3_2−theta33_12N4 )
360 +v3_1∗v4_2∗ y34_12 ∗ s i n ( d3_1−d4_2−theta34_12 ) ) = 0 ;
361 C33 : Q34_2−(v3_2∗v3_0∗y33_20N4∗ s i n ( d3_2−d3_0−theta33_20N4 )
362 +v3_2∗v4_0∗ y34_20 ∗ s i n ( d3_2−d4_0−theta34_20 )
363 +v3_2∗v3_1∗y33_21N4∗ s i n ( d3_2−d3_1−theta33_21N4 )
364 +v3_2∗v4_1∗ y34_21 ∗ s i n ( d3_2−d4_1−theta34_21 )
365 +v3_2∗v3_2∗y33_22N4∗ s i n ( d3_2−d3_2−theta33_22N4 )
366 +v3_2∗v4_2∗ y34_22 ∗ s i n ( d3_2−d4_2−theta34_22 ) ) = 0 ;
367 C34 : Q43_0−(v4_0∗v4_0∗ y44_00 ∗ s i n ( d4_0−d4_0−theta44_00 )
368 +v4_0∗v3_0∗ y34_00 ∗ s i n ( d4_0−d3_0−theta34_00 )
369 +v4_0∗v4_1∗ y44_01 ∗ s i n ( d4_0−d4_1−theta44_01 )
370 +v4_0∗v3_1∗ y34_01 ∗ s i n ( d4_0−d3_1−theta34_01 )
371 +v4_0∗v4_2∗ y44_02 ∗ s i n ( d4_0−d4_2−theta44_02 )
372 +v4_0∗v3_2∗ y34_02 ∗ s i n ( d4_0−d3_2−theta34_02 ) ) = 0 ;
373 C35 : Q43_1−(v4_1∗v4_0∗ y44_10 ∗ s i n ( d4_1−d4_0−theta44_10 )
374 +v4_1∗v3_0∗ y34_10 ∗ s i n ( d4_1−d3_0−theta34_10 )
375 +v4_1∗v4_1∗ y44_11 ∗ s i n ( d4_1−d4_1−theta44_11 )
376 +v4_1∗v3_1∗ y34_11 ∗ s i n ( d4_1−d3_1−theta34_11 )
377 +v4_1∗v4_2∗ y44_12 ∗ s i n ( d4_1−d4_2−theta44_12 )
378 +v4_1∗v3_2∗ y34_12 ∗ s i n ( d4_1−d3_2−theta34_12 ) ) = 0 ;
379 C36 : Q43_2−(v4_2∗v4_0∗ y44_20 ∗ s i n ( d4_2−d4_0−theta44_20 )
380 +v4_2∗v3_0∗ y34_20 ∗ s i n ( d4_2−d3_0−theta34_20 )
381 +v4_2∗v4_1∗ y44_21 ∗ s i n ( d4_2−d4_1−theta44_21 )
382 +v4_2∗v3_1∗ y34_21 ∗ s i n ( d4_2−d3_1−theta34_21 )
383 +v4_2∗v4_2∗ y44_22 ∗ s i n ( d4_2−d4_2−theta44_22 )
384 +v4_2∗v3_2∗ y34_22 ∗ s i n ( d4_2−d3_2−theta34_22 ) ) = 0 ;
385 C37 : −P21_0 − P23_0=0; C38 : −P21_1 − P23_1=0;
386 C39 : −P21_2 − P23_2=0; C40 : −P32_0 − P34_0=0;
387 C41 : −P32_1 − P34_1=0; C42 : −P32_2 − P34_2=0;
388 C43 : −P43_0 − PL_0=0; C44 : −P43_1 − PL_1=0;

187
Chapter B Appendix

389 C45 : −P43_2 − PL_2=0; C46 : −Q21_0 − Q23_0=0;


390 C47 : −Q21_1 − Q23_1=0; C48 : −Q21_2 − Q23_2=0;
391 C49 : −Q32_0 − Q34_0=0; C50 : −Q32_1 − Q34_1=0;
392 C51 : −Q32_2 − Q34_2=0; C52 : −Q43_0 − QL_0=0;
393 C53 : −Q43_1 − QL_1=0; C54 : −Q43_2 − QL_2=0;
394 C55 : P12_0∗P12_0 + Q12_0∗Q12_0 − v1_0∗v1_0∗ I12_0 ∗ I12_0 =0;
395 C56 : P12_1∗P12_1 + Q12_1∗Q12_1 − v1_1∗v1_1∗ I12_1 ∗ I12_1 =0;
396 C57 : P12_2∗P12_2 + Q12_2∗Q12_2 − v1_2∗v1_2∗ I12_2 ∗ I12_2 =0;

188
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 ad-


dTriple, 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 Appendix

1 p S o l v e r −>a d d T r i p l e ( 0 , 0 ,R) ;
2 p S o l v e r −>a d d T r i p l e ( 0 , 4 , 1 ) ;
3 p S o l v e r −>a d d T r i p l e ( 1 , 1 ,R) ;
4 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 prob-
lem 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<<" ␣ I 1 2 r=␣ "<< I 1 2 r <<e n d l ;
4 cout<<" ␣ I12im=␣ "<< I12im <<e n d l ;

Listing C.4: Solve problem and display results

Finally, to solve problem iteratively and update results in each iteration


following code is used (Listing C.5):
1 I12rNew = I 1 2 r + p S o l v e r −>getX ( 0 ) ;
2 I12imNew= I12im+ p S o l v e r −>getX ( 1 ) ;

Listing C.5: Update results in each iteration

Whole code is given in sec. C.1.4.

190
C.1 C++ Programming

C.1.4. C++ Code for Example 3.1

1 // S o l v e r E x a m p l e . cpp : Defines the entry point for the console


application .
2 // * * * * * * * * * * * * * Linear Power o p t i m i z a t i o n * * * * * * * * * * * * * * * *
3 # include " stdafx . h "
4 # include " matrix / ISparseSolver . h "
5 # include < iostream >
6 # include < fstream >
7 using n a m e s p a c e matrix ;
8 using n a m e s p a c e std ;
9 void main ( int argc , char * argv [])
10 {
11 // * * * * * * * * * * * * * * * * * * * * * * * * * initial values * * * * * * * * * * * *
12 double R =0.1;
13 double I2r =0.2;
14 double I2im =0.3;
15 double I3r =1;
16 double I3im =5;
17 double t =1;
18 double I12r =0.8;
19 double I12im =4.7;
20 double I23r =1;
21 double I23im =5;
22 double L1 =1;
23 double L2 =1;
24 double L3 =1;
25 double L4 =1;
26 double I12rNew ;
27 double I12imNew ;
28 double I23rNew ;
29 double I23imNew ;
30 double L1New ; double L2New ; double L3New ; double L4New ; double
tNew ;
31 for ( int iteration =0; iteration < 5; ++ iteration )
32 {
33 // * * * * * * * * * * * * * * * * * * * * Newton - Raphson Method * * * * * * * * *
34 int NMAT =9;
35 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 ,10 ,
36 matrix :: NonSymmetric , matrix :: FastSolver ,
37 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 ) ;
38 pSolver - > addTriple (0 ,0 , R ) ;
39 pSolver - > addTriple (0 ,4 ,1) ;
40 pSolver - > addTriple (1 ,1 , R ) ;
41 pSolver - > addTriple (1 ,6 ,1) ;
42 pSolver - > addTriple (2 ,2 , R ) ;
43 pSolver - > addTriple (2 ,4 , -1) ;
44 pSolver - > addTriple (2 ,5 ,1) ;
45 pSolver - > addTriple (3 ,3 , R ) ;
46 pSolver - > addTriple (3 ,6 , -1) ;
47 pSolver - > addTriple (3 ,7 ,1) ;
48 pSolver - > addTriple (4 ,0 ,1) ;
49 pSolver - > addTriple (4 ,2 , -1) ;
50 pSolver - > addTriple (5 ,2 ,1) ;
51 pSolver - > addTriple (6 ,1 ,1) ;
52 pSolver - > addTriple (6 ,3 , -1) ;

191
Chapter C Appendix

53 pSolver - > addTriple (6 ,8 , I2im ) ;


54 pSolver - > addTriple (7 ,3 ,1) ;
55 pSolver - > addTriple (8 ,6 , I2im ) ;
56 if (! pSolver - > factorize () )
57 {
58 cout << " Cannot ␣ factorize ␣ the ␣ matrix ! " << endl ;
59 return ;
60 }
61 pSolver - > setRHS (0 , -( I12r * R + L1 ) ) ;
62 pSolver - > setRHS (1 , -( I12im * R + L3 ) ) ;
63 pSolver - > setRHS (2 , -( I23r *R - L1 + L2 ) ) ;
64 pSolver - > setRHS (3 , -( I23im *R - L3 + L4 ) ) ;
65 pSolver - > setRHS (4 , -( I12r + I2r - I23r ) ) ;
66 pSolver - > setRHS (5 , -( I23r - I3r ) ) ;
67 pSolver - > setRHS (6 , -( I12im + I2im *t - I23im ) ) ;
68 pSolver - > setRHS (7 , -( I23im - I3im ) ) ;
69 pSolver - > setRHS (8 , -( L3 * I2im ) ) ;
70 if ( pSolver - > solve () )
71 {
72 cout < < " ␣ I12r = ␣ " << I12r << endl ;
73 cout < < " ␣ I12im = ␣ " << I12im << endl ;
74 cout < < " ␣ I23r = ␣ " << I23r << endl ;
75 cout < < " ␣ I23im = ␣ " << I23im << endl ;
76 cout < < " ␣ t = ␣ " << t << endl ;
77 cout << " Loss " << I12r * I12r * R + I12im * I12im * R
78 + I23r * I23r * R + I23im * I23im * R ;
79 cout < < endl ;
80 I12rNew = I12r + pSolver - > getX (0) ;
81 I12imNew = I12im + pSolver - > getX (1) ;
82 I23rNew = I23r + pSolver - > getX (2) ;
83 I23imNew = I23im + pSolver - > getX (3) ;
84 L1New = L1 + pSolver - > getX (4) ;
85 L2New = L2 + pSolver - > getX (5) ;
86 L3New = L3 + pSolver - > getX (6) ;
87 L4New = L4 + pSolver - > getX (7) ;
88 tNew = t + pSolver - > getX (8) ;
89 I12r = I12rNew ; I12im = I12imNew ; I23r = I23rNew ; I23im = I23imNew ;
90 L1 = L1New ; L2 = L2New ; L3 = L3New ; L4 = L4New ; t = tNew ;
91 }
92 }
93 }

C.1.5. C++ Code for Example 3.2


1 // S o l v e r E x a m p l e . cpp : Defines the entry point for the console
2 application .
3 // * * * * * * * * * * * * * Power o p t i m i z a t i o n using c a p a c i t o r * * * * * * * * * *
4 # include " stdafx . h "
5 # include " matrix / ISparseSolver . h "
6 # include < iostream >
7 # include < fstream >
8 using n a m e s p a c e matrix ;
9 using n a m e s p a c e std ;
10 void main ( int argc , char * argv [])
11 {
12 // * * * * * * * * * * * * * * * * * * * * * * * * * initial values * * * * * * * * * * * * * *

192
C.1 C++ Programming

13 double R =0.01; double G =10;


14 double B = -30; double P2 =0.2;
15 double Q2 =0.3; double P3 =0.4;
16 double Q3 =0.6; double bc =0.1;
17 double I2r =0.2; double I2im = -0.3;
18 double I3r =0.4; double I3im = -0.6;
19 double V1r =1; double V1im =0;
20 double V2r =1; double V2im =0;
21 double V3r =1; double V3im =0;
22 double Icr = - bc * V2im ;
23 double Icim = bc * V2r ;
24 double I23r = I3r ;
25 double I23im = I3im ;
26 double I12r = I23r + Icr - I2r ;
27 double I12im = I23im + Icim - I2im ;
28 double L1 =1; double L2 =1; double L3 =1; double L4 =1;
29 double L5 =1; double L6 =1; double L7 =1; double L8 =1;
30 double L9 =1; double L10 =1; double L11 =1; double L12 =1;
31 double L13 =1; double L14 =1;
32 double I12rNew ; double I12imNew ; double I23rNew ;
33 double I23imNew ; double IcrNew ; double IcimNew ;
34 double bcNew ; double V2rNew ; double V2imNew ;
35 double V3rNew ; double V3imNew ; double I2rNew ;
36 double I2imNew ; double I3rNew ; double I3imNew ;
37 double L1New ; double L2New ; double L3New ;
38 double L4New ; double L5New ; double L6New ;
39 double L7New ; double L8New ; double L9New ;
40 double L10New ; double L11New ; double L12New ;
41 double L13New ; double L14New ;
42 // * * * * * * * * * * * * * * * * * * Newton - Raphson Method * * * * * * * * * * * * * *
43 while (( abs ( I12r + I2r - I23r - Icr ) >0.000001)||( abs ( I23r - I3r ) >0.000001)||
44 ( abs ( I12im + I2im - I23im - Icim ) >0.000001)||( abs ( I23im - I3im ) >0.000001)||
45 ( abs ((( V1r - V2r )* G -( V1im - V2im )* B ) - I12r ) >0.000001)||
46 ( abs ((( V1r - V2r )* B +( V1im - V2im )* G ) - I12im ) >0.000001)||
47 ( abs ((( V2r - V3r )* G -( V2im - V3im )* B ) - I23r ) >0.000001) ||
48 ( abs ((( V2r - V3r )* B +( V2im - V3im )* G ) - I23im ) >0.000001)||
49 ( abs ( - bc * V2im - Icr ) >0.000001)||( abs ( bc * V2r - Icim ) >0.000001)||
50 ( abs ( P2 - V2r * I2r - V2im * I2im ) >0.000001)||
51 ( abs ( P3 - V3r * I3r - V3im * I3im ) >0.000001)||
52 ( abs ( Q2 + V2r * I2im - V2im * I2r ) >0.000001)||
53 ( abs ( Q3 + V3r * I3im - V3im * I3r ) >0.000001) )
54 {
55 int NMAT =29;
56 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 ,
57 matrix :: NonSymmetric , matrix :: FastSolver ,
58 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 );
59 pSolver - > addTriple (0 ,0 , R ); pSolver - > addTriple (0 ,15 ,1);
60 pSolver - > addTriple (0 ,19 , -1); pSolver - > addTriple (1 ,1 , R );
61 pSolver - > addTriple (1 ,17 ,1); pSolver - > addTriple (1 ,20 , -1);
62 pSolver - > addTriple (2 ,2 , R ); pSolver - > addTriple (2 ,15 , -1);
63 pSolver - > addTriple (2 ,16 ,1); pSolver - > addTriple (2 21 , -1);
64 pSolver - > addTriple (3 ,3 , R ); pSolver - > addTriple (3 ,17 , -1);
65 pSolver - > addTriple (3 ,18 ,1); pSolver - > addTriple (3 ,22 , -1);
66 pSolver - > addTriple (4 ,15 , -1); pSolver - > addTriple (4 ,23 , -1);
67 pSolver - > addTriple (5 ,17 , -1); pSolver - > addTriple (5 ,24 , -1);
68 pSolver - > addTriple (6 ,7 , L10 ); pSolver - > addTriple (6 ,8 , - L9 );

193
Chapter C Appendix

69 pSolver - > addTriple (6 ,23 , - V2im ); pSolver - > addTriple (6 ,24 , V2r );
70 pSolver - > addTriple (7 ,6 , L10 ); pSolver - > addTriple (7 ,11 , - L11 );
71 pSolver - > addTriple (7 ,12 , L13 ); pSolver - > addTriple (7 ,19 , - G );
72 pSolver - > addTriple (7 ,20 , - B ); pSolver - > addTriple (7 ,21 , G );
73 pSolver - > addTriple (7 ,22 , B ); pSolver - > addTriple (7 ,24 , bc );
74 pSolver - > addTriple (7 ,25 , - I2r ); pSolver - > addTriple (7 ,27 , I2im );
75 pSolver - > addTriple (8 ,6 , - L9 ); pSolver - > addTriple (8 ,11 , - L13 );
76 pSolver - > addTriple (8 ,12 , - L11 ); pSolver - > addTriple (8 ,19 , B );
77 pSolver - > addTriple (8 ,20 , - G ); pSolver - > addTriple (8 ,21 , - B );
78 pSolver - > addTriple (8 ,22 , G ); pSolver - > addTriple (8 ,23 , - bc );
79 pSolver - > addTriple (8 ,25 , - I2im ); pSolver - > addTriple (8 ,27 , - I2r );
80 pSolver - > addTriple (9 ,13 , - L12 ); pSolver - > addTriple (9 ,14 , L14 );
81 pSolver - > addTriple (9 ,21 , - G ); pSolver - > addTriple (9 ,22 , - B );
82 pSolver - > addTriple (9 ,26 , - I3r ); pSolver - > addTriple (9 ,28 , I3im );
83 pSolver - > addTriple (10 ,13 , - L14 ); pSolver - > addTriple (10 ,14 , - L12 );
84 pSolver - > addTriple (10 ,21 , B ); pSolver - > addTriple (10 ,22 , - G );
85 pSolver - > addTriple (10 ,26 , - I3im ); pSolver - > addTriple (10 ,28 , - I3r );
86 pSolver - > addTriple (11 ,7 , - L11 ); pSolver - > addTriple (11 ,8 , - L13 );
87 pSolver - > addTriple (11 ,15 ,1); pSolver - > addTriple (11 ,25 , - V2r );
88 pSolver - > addTriple (11 ,27 , - V2im ); pSolver - > addTriple (12 ,7 , L13 );
89 pSolver - > addTriple (12 ,8 , - L11 ); pSolver - > addTriple (12 ,17 ,1);
90 pSolver - > addTriple (12 ,25 , - V2im ); pSolver - > addTriple (12 ,27 , V2r );
91 pSolver - > addTriple (13 ,9 , - L12 ); pSolver - > addTriple (13 ,10 , - L14 );
92 pSolver - > addTriple (13 ,16 , -1); pSolver - > addTriple (13 ,26 , - V3r );
93 pSolver - > addTriple (13 ,28 , - V3im ); pSolver - > addTriple (14 ,9 , L14 );
94 pSolver - > addTriple (14 ,10 , - L12 ); pSolver - > addTriple (14 ,18 , -1);
95 pSolver - > addTriple (14 ,26 , - V3im ); pSolver - > addTriple (14 ,28 , V3r );
96 pSolver - > addTriple (15 ,0 ,1); pSolver - > addTriple (15 ,2 , -1);
97 pSolver - > addTriple (15 ,4 , -1); pSolver - > addTriple (15 ,11 ,1);
98 pSolver - > addTriple (16 ,2 ,1); pSolver - > addTriple (16 ,13 , -1);
99 pSolver - > addTriple (17 ,1 ,1); pSolver - > addTriple (17 ,3 , -1);
100 pSolver - > addTriple (17 ,5 , -1); pSolver - > addTriple (17 ,12 ,1);
101 pSolver - > addTriple (18 ,3 ,1); pSolver - > addTriple (18 ,14 , -1);
102 pSolver - > addTriple (19 ,0 , -1); pSolver - > addTriple (19 ,7 , - G );
103 pSolver - > addTriple (19 ,8 , B ); pSolver - > addTriple (20 ,1 , -1);
104 pSolver - > addTriple (20 ,7 , - B ); pSolver - > addTriple (20 ,8 , - G );
105 pSolver - > addTriple (21 ,2 , -1); pSolver - > addTriple (21 ,7 , G );
106 pSolver - > addTriple (21 ,8 , - B ); pSolver - > addTriple (21 ,9 , - G );
107 pSolver - > addTriple (21 ,10 , B ); pSolver - > addTriple (22 ,3 , -1);
108 pSolver - > addTriple (22 ,7 , B ); pSolver - > addTriple (22 ,8 , G );
109 pSolver - > addTriple (22 ,9 , - B ); pSolver - > addTriple (22 ,10 , - G );
110 pSolver - > addTriple (23 ,4 , -1); pSolver - > addTriple (23 ,6 , - V2im );
111 pSolver - > addTriple (23 ,8 , - bc ); pSolver - > addTriple (24 ,5 , -1);
112 pSolver - > addTriple (24 ,6 , V2r ); pSolver - > addTriple (24 ,7 , bc );
113 pSolver - > addTriple (25 ,7 , - I2r ); pSolver - > addTriple (25 ,8 , - I2im );
114 pSolver - > addTriple (25 ,11 , - V2r ); pSolver - > addTriple (25 ,12 , - V2im );
115 pSolver - > addTriple (26 ,9 , - I3r ); pSolver - > addTriple (26 ,10 , - I3im );
116 pSolver - > addTriple (26 ,13 , - V3r ); pSolver - > addTriple (26 ,14 , - V3im );
117 pSolver - > addTriple (27 ,7 , I2im ); pSolver - > addTriple (27 ,8 , - I2r );
118 pSolver - > addTriple (27 ,11 , - V2im ); pSolver - > addTriple (27 ,12 , V2r );
119 pSolver - > addTriple (28 ,9 , I3im ); pSolver - > addTriple (28 ,10 , - I3r );
120 pSolver - > addTriple (28 ,13 , - V3im ); pSolver - > addTriple (28 ,14 , V3r );
121 // pSolver - > s e r i a l i z e (" A " , cout , matrix :: V I E W _ S C I L A B );
122 if (! pSolver - > factorize ())
123 {
124 cout << " Cannot ␣ factorize ␣ the ␣ matrix ! " << endl ;

194
C.1 C++ Programming

125 return ;
126 }
127 pSolver - > setRHS (0 , -( I12r * R + L1 - L5 ));
128 pSolver - > setRHS (1 , -( I12im * R + L3 - L6 ));
129 pSolver - > setRHS (2 , -( I23r *R - L1 + L2 - L7 ));
130 pSolver - > setRHS (3 , -( I23im *R - L3 + L4 - L8 ));
131 pSolver - > setRHS (4 , -( - L1 - L9 ));
132 pSolver - > setRHS (5 , -( - L3 - L10 ));
133 pSolver - > setRHS (6 , -( - L9 * V2im + L10 * V2r ));
134 pSolver - > setRHS (7 , -( - L5 *G - L6 * B + L7 * G + L8 * B + L10 * bc
135 - L11 * I2r + L13 * I2im ));
136 pSolver - > setRHS (8 , -( L5 *B - L6 *G - L7 * B + L8 *G - L9 * bc
137 - L11 * I2im - L13 * I2r ));
138 pSolver - > setRHS (9 , -( - L7 *G - L8 *B - L12 * I3r + L14 * I3im ));
139 pSolver - > setRHS (10 , -( L7 *B - L8 *G - L12 * I3im - L14 * I3r ));
140 pSolver - > setRHS (11 , -( L1 - L11 * V2r - L13 * V2im ));
141 pSolver - > setRHS (12 , -( L3 - L11 * V2im + L13 * V2r ));
142 pSolver - > setRHS (13 , -( - L2 - L12 * V3r - L14 * V3im ));
143 pSolver - > setRHS (14 , -( - L4 - L12 * V3im + L14 * V3r ));
144 pSolver - > setRHS (15 , -( I12r + I2r - I23r - Icr ));
145 pSolver - > setRHS (16 , -( I23r - I3r ));
146 pSolver - > setRHS (17 , -( I12im + I2im - I23im - Icim ));
147 pSolver - > setRHS (18 , -( I23im - I3im ));
148 pSolver - > setRHS (19 , -(( V1r - V2r )* G -( V1im - V2im )* B - I12r ));
149 pSolver - > setRHS (20 , -(( V1r - V2r )* B +( V1im - V2im )* G - I12im ));
150 pSolver - > setRHS (21 , -(( V2r - V3r )* G -( V2im - V3im )* B - I23r ));
151 pSolver - > setRHS (22 , -(( V2r - V3r )* B +( V2im - V3im )* G - I23im ));
152 pSolver - > setRHS (23 , -( - bc * V2im - Icr ));
153 pSolver - > setRHS (24 , -( bc * V2r - Icim ));
154 pSolver - > setRHS (25 , -( P2 - V2r * I2r - V2im * I2im ));
155 pSolver - > setRHS (26 , -( P3 - V3r * I3r - V3im * I3im ));
156 pSolver - > setRHS (27 , -( Q2 + V2r * I2im - V2im * I2r ));
157 pSolver - > setRHS (28 , -( Q3 + V3r * I3im - V3im * I3r ));
158 if ( pSolver - > solve ())
159 {
160 // * * * * * * * * * * * * * * * * RESULTS * * * * * * * * * * * * * * * * * * * * * *
161 cout < < " ␣ I12r = ␣ " << I12r << endl ;
162 cout < < " ␣ I12im = ␣ " << I12im << endl ;
163 cout < < " ␣ I23r = ␣ " << I23r << endl ;
164 cout < < " ␣ I23im = ␣ " << I23im << endl ;
165 cout < < " ␣ Icr = ␣ " << Icr << endl ;
166 cout < < " ␣ Icim = ␣ " << Icim << endl ;
167 cout < < " ␣ bc = ␣ " << bc << endl ;
168 cout < < " ␣ V2r = ␣ " << V2r << endl ;
169 cout < < " ␣ V2im = ␣ " << V2im << endl ;
170 cout < < " ␣ V3r = ␣ " << V3r << endl ;
171 cout < < " ␣ V3im = ␣ " << V3im << endl ;
172 cout < < " ␣ I2r = ␣ " << I2r << endl ;
173 cout < < " ␣ I2im = ␣ " << I2im << endl ;
174 cout < < " ␣ I3r = ␣ " << I3r << endl ;
175 cout < < " ␣ I3im = ␣ " << I3im << endl ;
176 cout << " Loss " << I12r * I12r * R + I12im * I12im * R
177 + I23r * I23r * R + I23im * I23im * R ;
178 cout < < endl ;
179 I12rNew = I12r + pSolver - > getX (0);
180 I12imNew = I12im + pSolver - > getX (1);

195
Chapter C Appendix

181 I23rNew = I23r + pSolver - > getX (2);


182 I23imNew = I23im + pSolver - > getX (3);
183 IcrNew = Icr + pSolver - > getX (4);
184 IcimNew = Icim + pSolver - > getX (5);
185 bcNew = bc + pSolver - > getX (6);
186 V2rNew = V2r + pSolver - > getX (7);
187 V2imNew = V2im + pSolver - > getX (8);
188 V3rNew = V3r + pSolver - > getX (9);
189 V3imNew = V3im + pSolver - > getX (10);
190 I2rNew = I2r + pSolver - > getX (11);
191 I2imNew = I2im + pSolver - > getX (12);
192 I3rNew = I3r + pSolver - > getX (13);
193 I3imNew = I3im + pSolver - > getX (14);
194 L1New = L1 + pSolver - > getX (15);
195 L2New = L2 + pSolver - > getX (16);
196 L3New = L3 + pSolver - > getX (17);
197 L4New = L4 + pSolver - > getX (18);
198 L5New = L5 + pSolver - > getX (19);
199 L6New = L6 + pSolver - > getX (20);
200 L7New = L7 + pSolver - > getX (21);
201 L8New = L8 + pSolver - > getX (22);
202 L9New = L9 + pSolver - > getX (23);
203 L10New = L10 + pSolver - > getX (24);
204 L11New = L11 + pSolver - > getX (25);
205 L12New = L12 + pSolver - > getX (26);
206 L13New = L13 + pSolver - > getX (27);
207 L14New = L14 + pSolver - > getX (28);
208 I12r = I12rNew ; I12im = I12imNew ; I23r = I23rNew ;
209 I23im = I23imNew ; Icr = IcrNew ; Icim = IcimNew ;
210 bc = bcNew ; V2r = V2rNew ; V2im = V2imNew ; V3r = V3rNew ;
211 V3im = V3imNew ; I2r = I2rNew ; I2im = I2imNew ;
212 I3r = I3rNew ; I3im = I3imNew ; L1 = L1New ; L2 = L2New ; L3 = L3New ;
213 L4 = L4New ; L5 = L5New ; L6 = L6New ; L7 = L7New ; L8 = L8New ; L9 = L9New ;
214 L10 = L10New ; L11 = L11New ; L12 = L12New ; L13 = L13New ; L14 = L14New ;
215 // * * * * * * * * * * * * * * * * Check c o n v e r e g n c e * * * * * * * * * * * *
216 /* cout < < " C1 : " < < abs ( I12r + I2r - I23r - Icr ) < < endl ;
217 cout < < " C2 : " < < abs ( I23r - I3r ) < < endl ;
218 cout < < " C3 : " < < abs ( I12im + I2im - I23im - Icim ) < < endl ;
219 cout < < " C4 : " < < abs ( I23im - I3im ) < < endl ;
220 cout < < " C5 : " < < abs ((( V1r - V2r )* G -( V1im - V2im )* B ) - I12r ) << endl ;
221 cout < < " C6 : " < < abs ((( V1r - V2r )* B +( V1im - V2im )* G ) - I12im ) << endl ;
222 cout < < " C7 : " < < abs ((( V2r - V3r )* G -( V2im - V3im )* B ) - I23r ) << endl ;
223 cout < < " C8 : " < < abs ((( V2r - V3r )* B +( V2im - V3im )* G ) - I23im ) << endl ;
224 cout < < " C9 : " < < abs ( - bc * V2im - Icr ) << endl ;
225 cout < < " C10 : " < < abs ( bc * V2r - Icim ) < < endl ;
226 cout < < " C11 : " < < abs ( P2 - V2r * I2r - V2im * I2im ) < < endl ;
227 cout < < " C12 : " < < abs ( P3 - V3r * I3r - V3im * I3im ) < < endl ;
228 cout < < " C13 : " < < abs ( Q2 + V2r * I2im - V2im * I2r ) < < endl ;
229 cout < < " C14 : " < < abs ( Q3 + V3r * I3im - V3im * I3r ) < < endl ; */
230 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
231 }
232 }
233 }

196
Bibliography

[1] A. Abur and A. Exposito, Power System State Estimation, Theory


and Implementation. Marcel Dekker, 2004.
[2] J. Zhu, Optimization of Power System Operation. John Wiley and
Sons, 2009.
[3] I. Džafić, E. Halilović, and E. Karamehmedović, Introduction to
Power System Analysis. International University of Sarajevo,
2013.
[4] J. Lee and S. Leyffer, Mixed Integer Nonlinear Programming.
Springer, 2012.
[5] D. Luenberger and Y. Ye, Linear and Nonlinear Programming.
Springer, 2008.
[6] J. Abdallah, “Distribution network planning and design using
branch and bound methods,” American Journal of Applied Sci-
ence, vol. 2, no. 3, pp. 644–647, 2005.
[7] D. T. Phan, “Lagrangian duality and branch-and-bound algorithms
for optimal power flow,” Operations Research, vol. 60, no. 2, pp.
275–285, 2012.
[8] H. Nocedal and S. Wright, Numerical Optimization. Springer,
1999.
[9] A. Barclay, F. E. Gill, and J. B. Rosen, “SQP methods and their
aplication to numerical optimal control,” 2011.
[10] K. Schittkowski, Optimization in Industrial Engineering: SQP-
Methods and Applications. Text Road Publication, 2012.
[11] P. T. Boggs and J. W. Tolle, “Sequential quadratic programming,”
Acta Numerica, vol. 4, pp. 1–51, 1995.
[12] S. Leyffer and A. Mahajan, Nonlinear Constrained Optimization:
Methods and Software. Scientific Research Publishing, 2010.

197
Bibliography

[13] P. E. Gill and E. Wong, Sequential programming optimization meth-


ods, 2010.
[14] H. J. Oberle, Lagrange-Newton-Iteration, SQP Verfahren. IEEE,
2012.
[15] M. Baran and T. McDermott, “Distribution system state estima-
tion using AMI data,” in Power Systems Conference and Exposi-
tion, 2009. PSCE ’09. IEEE/PES, March 2009, pp. 1–3.
[16] M. Irving and C. N. Macqueen, “Robust algorithm for load esti-
mation in distribution networks,” Generation, Transmission and
Distribution, IEE Proceedings-, vol. 145, no. 5, pp. 499–504, Sep
1998.
[17] I. Roytelman and S. M. Shahidehpour, “State estimation for elec-
tric power distribution systems in quasi real-time conditions,”
Power Delivery, IEEE Transactions on, vol. 8, no. 4, pp. 2009–
2015, Oct 1993.
[18] M. Celik and W. Liu, “A practical distribution state calculation
algorithm,” in Power Engineering Society 1999 Winter Meeting,
IEEE, vol. 1, Jan 1999, pp. 442–447 vol.1.
[19] A. Ghosh, D. Lubkeman, and R. Jones, “Load modeling for distri-
bution circuit state estimation,” pp. 13–19, Sep 1996.
[20] D. Lubkeman, J. Zhang, A. Ghosh, and R. Jones, “Field results
for a distribution circuit state estimator implementation,” Power
Delivery, IEEE Transactions on, vol. 15, no. 1, pp. 399–406, Jan
2000.
[21] H. Wang and N. Schulz, “A load modeling algorithm for distri-
bution system state estimation,” in Transmission and Distribution
Conference and Exposition, 2001 IEEE/PES, vol. 1, 2001, pp. 102–
105 vol.1.
[22] Y. Deng, Y. He, and B. Zhang, “A branch-estimation-based state
estimation method for radial distribution systems,” Power Deliv-
ery, IEEE Transactions on, vol. 17, no. 4, pp. 1057–1062, Oct
2002.
[23] R. Hoffman, “Practical state estimation for electric distribution
networks,” in Power Systems Conference and Exposition, 2006.
PSCE ’06. 2006 IEEE PES, Oct 2006, pp. 510–517.

198
Bibliography

[24] M. Baran and A. Kelley, “State estimation for real-time monitoring


of distribution systems,” Power Systems, IEEE Transactions on,
vol. 9, no. 3, pp. 1601–1609, Aug 1994.
[25] C. Lu, J. Teng, and W.-H. Liu, “Distribution system state estima-
tion,” Power Systems, IEEE Transactions on, vol. 10, no. 1, pp.
229–240, Feb 1995.
[26] D. Haughton and G. Heydt, “A linear state estimation formulation
for smart distribution systems,” Power Systems, IEEE Transac-
tions on, vol. 28, no. 2, pp. 1187–1195, May 2013.
[27] M. Baran and A. Kelley, “A branch-current-based state estimation
method for distribution systems,” Power Systems, IEEE Transac-
tions on, vol. 10, no. 1, pp. 483–491, Feb 1995.
[28] E. Manitsas, R. Singh, B. Pal, and G. Strbac, “Distribution sys-
tem state estimation using an artificial neural network approach
for pseudo measurement modeling,” Power Systems, IEEE Trans-
actions on, vol. 27, no. 4, pp. 1888–1896, Nov 2012.
[29] I. Džafić, H.-T. Neisius, M. Gilles, S. Henselmeyer, and V. Lan-
derberger, “Three-phase power flow in distribution networks using
Fortescue transformation,” IEEE Transactions on Power Systems,
vol. 28, no. 2, pp. 1027–1034, May 2013.
[30] M. Brown Do Coutto Filho and J. C. S. De Souza, “Forecasting-
aided state estimation - Part I: Panorama,” Power Systems, IEEE
Transactions on, vol. 24, no. 4, pp. 1667–1677, Nov 2009.
[31] M. Brown Do Coutto Filho, J. C. S. De Souza, and R. Fre-
und, “Forecasting-aided state estimation-Part II: Implementation,”
Power Systems, IEEE Transactions on, vol. 24, no. 4, pp. 1678–
1685, Nov 2009.
[32] R. Baldick, Applied Optimization: Formulation and Algorithms for
Engineering Systems. Cambridge University Press, 2006.
[33] E. Caro, A. Conejo, and R. Minguez, “Power system state esti-
mation considering measurement dependencies,” Power Systems,
IEEE Transactions on, vol. 24, no. 4, pp. 1875–1885, Nov 2009.
[34] E. Caro, J.-M. Morales, A. Conejo, and R. Minguez, “Calculation
of measurement correlations using point estimate,” Power Deliv-
ery, IEEE Transactions on, vol. 25, no. 4, pp. 2095–2103, Oct
2010.

199
Bibliography

[35] E. Caro, A. Conejo, R. Minguez, M. Zima, and G. Andersson,


“Multiple bad data identification considering measurement depen-
dencies,” Power Systems, IEEE Transactions on, vol. 26, no. 4, pp.
1953–1961, Nov 2011.
[36] A. S. Debs, Modern Power Systems Control and Operation.
Boston: Kluwer Academic Publishers, 1988.
[37] “Distribution test feeders,” http://ewh.ieee.org/soc/pes/dsacom/
testfeeders/index.html.
[38] I. Džafić, B. C. Pal, M. Gilles, and S. Henselmeyer, “Generalized
π Fortescue equivalent admittance matrix approach to power flow
solution,” IEEE Trans. Power Syst., vol. 29, no. 1, pp. 193–202,
Jan. 2014.
[39] I. Džafić, “An object-oriented graphical framework for power
system analysis,” in Power Engineering, Energy and Electrical
Drives, 2007. POWERENG 2007. International Conference on,
April 2007, pp. 255–264.
[40] ——, “An object-oriented graphical modeling for power system
analysis,” International Journal of Modelling and Simulation,
vol. 29, no. 1, pp. 71–79, 2009.
[41] I. Džafić, S. Henselmeyer, and H.-T. Neisius, “High performance
state estimation for smart grid distribution network operation,” in
Innovative Smart Grid Technologies (ISGT), 2011 IEEE PES, Jan
2011, pp. 1–6.
[42] ——, “Real-time distribution system state estimation,” in IPEC,
2010 Conference Proceedings, Oct 2010, pp. 22–27.
[43] I. Džafić, I. Huseinagic, M. Music, and E. Halilovic, “Software pack-
age for power system analysis,” in Energy Conference (ENERGY-
CON), 2014 IEEE International, May 2014, pp. 610–615.
[44] I. Džafić, M. Gilles, R. A. Jabr, B. C. Pal, and S. Henselmeyer,
“Real time estimation of loads in radial and unsymmetrical three-
phase distribution networks,” IEEE Transactions on Power Sys-
tems, vol. 28, no. 4, pp. 4839–4848, Nov 2013.
[45] A. Gomez-Exposito, C. Gomez-Quiles, and I. Džafić, “State esti-
mation in two time scales for smart distribution systems,” IEEE
Transactions on Smart Grid, vol. PP, no. 99, pp. 1–10, in press
2014.

200
Index

A Equality constraints, 21
Accuracy Test, 92 evolutionary algorithms, 29
Active and Reactive Power Flows, Extended Cutting Plane, 54
18
analytic hierarchical process, 29 F
automated meter readings, 79 feasibility and optimality, 29
feasible region, 30
B Filter method, 59
Bad data, 90 Fortescue transformation, 79
Bad Data Factor, 90 fuzzy set application, 29
branch and bound, 48
G
Branch Measurements, 112
Gauss-Newton method, 10
C Gauss-Seidel algorithm, 14
Concave function, 32 Generalized Benders Decompo-
convergence criteria, 155 sition, 52
Convex function, 31 global minimum, 31
convexity, 29 global positioning system, 6
cross node phase coupling, 101 H
Han-Powell method, 58
D
delta transformer side, 128 I
Distribution Management System, inequality constraints, 21
97 information and communication
Distribution System State Esti- technologies, 5
mation, 5 information matrix, 9
DMS, 5 Injection Measurements, 119
DSSE, 5 intelligence search methods, 29
duality, 29 interior point methods, 29

E J
Energy Management System, 5 Jacobian matrix, 9

201
Index

K O
Karush -Kuhn-Tucker Theorem, objective function, 30
32 Observability analysis, 6
KCL, 18 OLTC on Delta side, 111
OLTC on Wye side, 109
L optimal power flow, 13
Lagrange function, 29 optimum solution, 30
Lagrange multipliers, 10 optimum value, 30
Least Absolute Value, 11 outer approximation, 51
Line search method, 57
P
linear programming, 29
particle swarm optimizations, 29
Load bus, 20
penalty functions, 29
load flow, 13
per unit, 19
local minimum, 31 phase mutual admittances, 101
LP/NLP-Based Branch and Bound, phasor measurement unit, 6
54 power flow, 13
probability optimization, 29
M protection systems, 5
measurement area (MA), 78 Pruning rules, 49
measurement devices, 5 psedo-measurements, 78
merit function, 60
Mixed Integer nonliner Program- Q
ming, 29 quadratic programming, 29
mixed-integer programming, 29
R
Multi-variable optimization with
real-time model, 5
equality constraints, 37
relaxation algorithm, 51
Multi-variable optimization with
remote terminal units, 6
inequality constraints, 39
Multi-variable unconstrained op- S
timization, 37 SCADA, 6
sensitivity factors, 99
N Sequantial Quadratic Program-
Network topology processing, 6 ming, 29
network-flow programming, 29 Shunt equivalent, 109
neural networks, 29 simple load flow (SLF), 99
Newton-Raphson algorithm, 14 single-line diagram, 101
Node Measurements, 117 Single-variable unconstrained op-
nonlinear programming, 29 timization, 36
normalized residuals, 90 Slack (swing) bus, 20

202
Index

star transformer side, 128


strict local minimum, 31
Strictly convex function, 32
Strong Duality, 34

T
tabu search, 29
three-phase model, 78
trust-region approach, 57

U
unbalanced load, 77
unsymmetrical network design,
77

V
virtual tap changer nodes, 128
volt/VAr control, 77
voltage controlled bus, 20

W
Weak Duality, 33
Weighted Least Square, 8

203
Nomenclature

k, l, x, y phase indices

p, q, i, j node indices

CM Set of all current measurements

IM (m) Set of estimated P/Q injection measurements (not nec-


essarily telemetered) at the boundary of measurement
area m
(i)
Iφ,n Estimated current magnitude at iteration i, phase φ,
and corresponding to measurement n
M
Iφ,n Measured current magnitude at phase φ, and corre-
sponding to measurement n.
(i)
KPφ,n Estimated active power scaling factor at iteration i,
phase φ, and load group n.
(i)
KQφ,n Estimated reactive power scaling factor at iteration i,
phase φ, and load group n.

LG Set of all P/Q load groups

LG(m) Set of P/Q load groups in measurement area m

M A(m) Measurement area m

My Number of measurement areas consisting of Y -connected


loads.

PFG Set of P/Q load groups in which loads are specified with
power factors

P HY Phases (a, b, c) in a Y -connection area

205
Nomenclature

(i)
P LOSSM A(m) Estimated active power loss at iteration i and in mea-
surement area m
(i)
P LOSSφ,M A(m) Estimated active power loss at iteration i and in phase
φ of measurement area m

P QM Set of all P/Q measurements


(i)
Pφ,n Estimated active power at iteration i, phase φ, and cor-
responding to measurement n (not necessarily teleme-
tered).
LG
Pφ,n Load group (forecasted) active power at phase φ and
corresponding to load group n
M
Pφ,n Measured active power at phase φ and corresponding
to measurement n
(i)
QLOSSM A(m) Estimated reactive power loss at iteration i and in mea-
surement area m
(i)
QLOSSφ,M A(m) Estimated reactive power loss at iteration i and in
phase φ of measurement area m
(i)
Qφ,n Estimated reactive power at iteration i, phase φ , and
corresponding to measurement n (not necessarily teleme-
tered).

QLG
φ,n Load group (forecasted) reactive power at phase φ and
corresponding to load group n

QM
φ,n Measured reactive power at phase φ and corresponding
to measurement n

VM Set of all voltage measurements (a current measure-


ment is normally incident at the node whose voltage is
measured).
(i)
Vφ,n Estimated voltage magnitude at iteration i, phase φ,
and corresponding to measurement n
LF (i)
Vφ,n Voltage magnitude at iteration i and in phase φ of the
branch with current measurement n (from load flow
computation)

206
Nomenclature

M
Vφ,n Measured voltage magnitude at phase φ and correspond-
ing to measurement n

•LF Indicates a quantity obtained from the load flow com-


putation.

•min/max Minimum/Maximum value operator

ωnCM Weighting factor for current magnitude measurement n

ωnP F G Weighting factor in a load group n where the loads are


specified with a power factor

ωnP LG Weighting factor for active power in load group n

ωnP M Weighting factor for active power measurement n

ωnQLG Weighting factor for reactive power in load group n

ωnQM Weighting factor for reactive power measurement n

ωnV M Weighting factor for voltage magnitude measurement n

nϕp number of phases at node p

δp , δq angle of bus voltage p and bus voltage p

θpq angle of complex admittance between nodes p and p

iload
p load current at bus p

Ppgen , Qgen
p active and reactive load power at bus p

Ppload , Qload
p active and reactive load power at bus p

Y pq complex admitance sub-matrix of π equivalent between


nodes nodes p and q

V p, V q vector of complex electrical phase-to-ground voltages at


nodes p and q

I p, I q vector of n-phase complex electrical currents entering


nodes p and q

207
Nomenclature

Sp, Sq vector of n-phase complex electrical powers entering


nodes p and q

˜• measurement of • value

(•)∗ conjugate complex value of complex value •


(k) (k)
Pij , Qij branch active and reactive power from node i to node
j through phase k
(k)
Iij branch current magnitude from node i to node j through
phase k
BC , QBC
Ppq branch cumulative active and reactive power from node
pq
p to node q
(x) (x)
Pinji , Qinji active and reactive power injection at node i through
phase x

Pcinjp , Qcinjp cumulative active and reactive power injection at node


i
(k)
tij tap position between nodes i and j on phase k

(k,l)
tij delta tap position between nodes i and j and between
phases k and l
(k)
vq voltage magnitude between phase k on node p
(k,l)
vp voltage magnitude between phases k and l on node p

N B1 number of single-hase branches

N B2 number of two-phase branches

N B3 number of three-phase branches

N IN J1 number of single-phase injections

N IN J2 number of two-phase injections

N IN J3 number of three-phase injections

208
Nomenclature

N CIN J1 number of single-phase cumulative injection measure-


ments

N CIN J2 number of two-phase cumulative injection measurements

N CIN J3 number of three-phase cumulative injection measure-


ments

NI number of current magnitude measurements

N P BC number cumulative active power branch measurements

N QBC number cumulative reactive power branch measurements

N LL number of phase-to-phase voltage measurements

NT number of single phase tap changers

N T LL number of phase-phase tap changers

209

You might also like