Sensitivities
Sensitivities
This section shows how the power flow sensitivities can be used.
All gradient-based optimization methods require sensitivities. By sensitivities we mean one (or all) of the following:
- gradients,
- Jacobians, and/or
- Hessians.
Broadly speaking, there are three ways to obtain sensitivities:
- symbolically,
- numerically,
- by automatic differentiation,
with each method having its own pros and cons. The case file parser does not just provide the mathematical problem formulation in terms of function handles, but also sensitivities.
Computation
Naming for sensitivities
The naming of the sensitivities is inspired by the naming conventions from Aladin.
Letting problem
be the output of the case file parser, you find it has an entry sens
1 2 3 4 5 6 7 8 9 |
|
which has again three entries. The following table gives some background information.
Entry | Meaning | Definition | Exact |
---|---|---|---|
gg |
Gradient of each local cost function (see Algorithm 1 here) | \nabla f_i(x_i) (zero for power flow problems) | Yes |
JJac |
Jacobian of each local power flow problem | J_{g_i}(x_i, z_i) where g_i(x_i, z_i) = \begin{bmatrix} g^{\text{pf}}_i( x_i, z_i ) \\ g^{\text{bus}}_i ( x_i )) \end{bmatrix} | Yes |
HH |
Hessian of each local problem for Aladin problem formulation (see Algorithm 1 here) | \nabla^2 B_i with B_i = f_i(x_i) + \kappa_i^\top g_i(x_i, z_i), where \kappa_i are the Lagrange multipliers w.r.t. the equality constraints g_i | No |
The Hessian is computed numerically using central differences per default for the feasibility formulation, and by the Gauss-Newton method for the least-squares formulation.
These sensitivities should be supplied to numerical solvers to increase both accuracy and speed.
Where sensitivities are computed
The sensitivities are computed in the file generate_local_power_flow_problem.m
.
Example
Suppose we are interested in power flow for a single-region problem, i.e. a traditional non-distributed setup. Then, we know that we can just apply Newton’s method, for which we need both the equality constraints that specify the power flow problem, and its Jacobian. So, purely for cross validation, let’s solve a power flow problem using the information the case file splitter provides.
1 2 3 4 |
|
Lines 2 and 3 are needed purely for code convention routines: they introduce a sense of global numbering, and specify no neighors. The last line calls the case file parser which returns the Jacobian. Running a prototypical Newton scheme is then straightforward
1 2 3 4 5 6 7 8 9 |
|
Putting this together for our example system we have
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|