Power flow surrogates¶
Fixed-point linear power flow model¶
uot.PowerFlowSurrogateSpec_Bernstein2017_LP¶
-
class
PowerFlowSurrogateSpec_Bernstein2017_LP¶ Bases:
uot.AbstractPowerFlowSurrogateSpecClass to specify the power flow surrogate presented in [Bernstein2017].
Synopsis:
spec = PowerFlowSurrogateSpec_Bernstein2017_LP()
-
Create(varargin)¶ Returns an instance of
uot.PowerFlowSurrogate_Bernstein2017_LP.
-
uot.PowerFlowSurrogate_Bernstein2017_LP¶
-
class
PowerFlowSurrogate_Bernstein2017_LP(spec, opf_problem)¶ Bases:
uot.AbstractPowerFlowSurrogateImplements the power flow surrogate presented in [Bernstein2017]
Synopsis:
obj = uot.PowerFlowSurrogate_Bernstein2017_LP(spec,opf_problem)
- Description:
This power flow surrogate uses an explicit linear formulation to approximate the power flow equation. The formulation is based on the fixed-point solution to the power flow equation.
This implementation does not keep track of phase since it is not necessary for implementing the required constraints.
Parameters: - spec (
uot.PowerFlowSurrogateSpec_Bernstein2017_LP) – Object specification - opf_problem (
uot.OPFproblem) – OPF problem where the power flow surrogate will be used
Note
The paper considers the possibility of delta-connected loads. However, we do not use them here since
uot.OPFproblemdoes not support them.Example:
% This class should be instantiated via its specification spec = uot.PowerFlowSurrogateSpec_Bernstein2017_LP(); pf_surrogate = spec.Create(opf_problem);
-
linearization_point= 'uot.enum.CommonLinearizationPoints.FlatVoltage'¶ Linearization point (
uot.enum.CommonLinearizationPoints)
-
GetConstraintArray(obj)¶ (protected) Creates the array of constraints that result from applying the power flow surrogate to the OPF problem
Synopsis:
constraint_array = pf_surrogate.GetConstraintArray()
- Description:
- The power flow surrogate implements at least the following constraints: - Voltage magnitude limits - Power injection at pcc - Voltage at PCC
Returns: - constraint_array (constraint) - Array of constraints
-
SolveApproxPowerFlow(load_case, u_pcc_array, t_pcc_array)¶ (static) Solves the power flow equations approximately using a power flow surrogate
Synopsis:
[U_array,T_array,p_pcc_array,q_pcc_array,opf_problem] = PowerFlowSurrogate_Bernstein2017_LP.SolveApproxPowerFlow(load_case,u_pcc_array,t_pcc_array)
- Description:
- Tells
uot.AbstractPowerFlowSurrogate.SolveApproxPowerFlowHelperwhich power flow surrogate to use for approximately solving the power flow equations
Parameters: - load_case (
uot.LoadCasePy) – Load case for which power flow will be solved - u_pcc_array (double) – Array(n_phase,n_time_step) of voltage magnitudes at PCC
- t_pcc_array (double) – Array(n_phase,n_time_step) of voltage angles at PCC
Returns: - U_array (double) - Phase-consistent array (n_bus,n_phase,n_timestep) with voltage magnitudes
- T_array (double) - Phase-consistent array (n_bus,n_phase,n_timestep) with voltage angles
- p_pcc_array (double) - Array (n_timestep,n_phase_pcc) with active power injection at the PCC
- q_pcc_array (double) - Array (n_timestep,n_phase_pcc) with reactive power injection at the PCC
- opf_problem (
uot.OPFproblem) - Power flow problem used to approximately solve power flow
See also
uot.AbstractPowerFlowSurrogate.SolveApproxPowerFlowHelper
-
SolveApproxPowerFlowAlt(load_case, u_pcc_array, t_pcc_array, varargin)¶ (static) Approximately solve power flow
Synopsis:
[U_array,T_array,p_pcc_array,q_pcc_array,extra_data] = uot.PowerFlowSurrogate_Bernstein2017_LP.SolveApproxPowerFlowAlt(load_case,u_pcc_array,t_pcc_array) [U_array,T_array,p_pcc_array,q_pcc_array,extra_data] = uot.PowerFlowSurrogate_Bernstein2017_LP.SolveApproxPowerFlowAlt(load_case,u_pcc_array,t_pcc_array,U_ast,T_ast)
- Description:
Compute an approximate solution to the power flow equation using eqs. 5a and 5c in [Bernstein2017]. Additionally, use eq. 5c together with eq. 9 or 12 to compute another two approximations of voltage magnitude.
If no additional arguments are passed, the solution is computed by linearizing at the flat voltage solution. Alternatively, the linearization can be done at an arbitrary voltage.
Parameters: - load_case (
uot.LoadCasePy) – Load case for which power flow will be approximately solved - u_pcc_array (double) – Array(n_phase,n_time_step) of voltage magnitudes at the PCC
- t_pcc_array (double) – Array(n_phase,n_time_step) of voltage angles at the PCC
- U_ast (double) – Phase-consistent array (n_bus,n_phase) with voltage magnitudes for linearization
- T_ast (double) – Phase-consistent array (n_bus,n_phase) with voltage angles for linearization
Returns: - U_array (double) - Phase-consistent array (n_bus,n_phase,n_timestep) with voltage magnitudes
- T_array (double) - Phase-consistent array (n_bus,n_phase,n_timestep) with voltage angles
- p_pcc_array (double) - Array (n_timestep,n_phase_pcc) with active power injection at the PCC
- q_pcc_array (double) - Array (n_timestep,n_phase_pcc) with reactive power injection at the PCC
- extra_data (struct) - Struct with fields U_array_eq9 and U_array_eq12 containing the other two approximations of voltage magnitude.
See also
uot.AbstractPowerFlowSurrogate.SolveApproxPowerFlowHelper
Protected¶
-
AssignBaseCaseSolution(obj)¶ (protected) Assigns the base case solution to the decision variables in the surrogate. Returns approximate power flow solution that is consistent with these values.
Synopsis:
[U_array,T_array,p_pcc_array,q_pcc_array] = pf_surrogate.AssignBaseCaseSolution()
Returns: - U_array (double) - Phase consistent array (n_bus,n_phase,n_timestep) with voltage magnitudes
- T_array (double) - Empty array
- p_pcc_array (double) - Array (n_timestep,n_phase_pcc) with active power injection at the PCC
- q_pcc_array (double) - Array (n_timestep,n_phase_pcc) with reactive power injection at the PCC
Note
T_array is empty because this surrogate does not keep track of voltage angles.
-
ComputeVoltageEstimate(obj)¶ (protected) Computes the estimate for complex voltages given by the power flow surrogate
Synopsis:
[U_array,T_array] = pf_surrogate.ComputeVoltageEstimate()
Returns: - U_array (double) - Phase-consistent array (n_bus,n_phase,n_timestep) with voltage magnitudes
- T_array (double) - empty array
Note
T_array is empty because this surrogate does not keep track of voltage angles.
Private¶
-
ComputeMyMatrix(network, V_ast_nopcc_stack)¶ (static), (private) Computes the M_y matrix defined below eq. 7 in [Bernstein2017]
Synopsis:
M_y = ComputeMyMatrix(network,V_ast_nopcc_stack)
Parameters: V_ast_nopcc_stack (double) – phase-consistent stack with complex voltages at the linearization point (excluding those for the PCC) Returns: - M_y (double) - M_y matrix
-
ComputeVoltageMagnitudeWithEq9(network, u_pcc_array, x_y_array, x_y_ast, V_ast_nopcc_stack, M_y)¶ (static), (private) Computes the voltage magnitude according to eqs. 5b and 9 in [Bernstein2017]
Synopsis:
U_array_eq9 = PowerFlowSurrogate_Bernstein2017_LP.ComputeVoltageMagnitudeWithEq9(network,u_pcc_array,x_y,x_y_ast,V_ast_nopcc_stack,M_y)
Description:
Parameters: - network (
uot.Network_Unbalanced) – Power network - u_pcc_array (double) – Array(n_phase,n_time_step) of voltage magnitudes at PCC
- x_y_array (double) – Array of power injections (according to definition in paper)
- x_y_ast (double) – Array of power injections at linearization point
- V_ast_nopcc_stack (double) – phase-consistent stack with complex voltages at the linearization point (excluding those for the PCC)
- M_y (double) – M_y matrix defined below eq. 7
Returns: - U_array_eq9 (double) - phase-consistent array of voltage magnitudes
- network (
-
DefineDecisionVariables(opf_problem)¶ (static), (private) Defines the decision variables used by this power flow surrogate
Synopsis:
decision_variables = PowerFlowSurrogate_Bernstein2017_LP.DefineDecisionVariables(opf_problem)
- Description:
- Create the sdpvars that will be used as decision variables. Namely, a phase-consistent stack of voltage magnitudes
Parameters: opf_problem ( uot.OPFproblem) – OPF problem where the power flow surrogate will be usedReturns: - decision_variables (struct) - Struct with field U_array_stack which
Note
The method is static so that it can be safely called from the constructor
-
GetLinearizationXy(load_case, U_ast, T_ast)¶ (private), (static) Returns the linearization power injections at the linearization point as defined above eq. 5 in [Bernstein2017]
Synopsis:
[U_ast,T_ast] = PowerFlowSurrogate_Bernstein2017_LP.GetLinearizationVoltage(load_case,U_ast,T_ast)
Parameters: - U_ast (double) – Phase-consistent array (n_bus,n_phase) with voltage magnitudes at the linearization point
- T_ast (double) – Phase-consistent array (n_bus,n_phase) with voltage angles at the linearization point
Returns: - x_y_ast (double) - Array of power injections at linearization point
- V_ast_nopcc_stack (double) - phase-consistent stack with complex voltages at the linearization point (excluding those for the PCC)
Linearized power flow manifold model¶
uot.PowerFlowSurrogateSpec_Bolognani2015_LP¶
-
class
PowerFlowSurrogateSpec_Bolognani2015_LP¶ Bases:
uot.AbstractPowerFlowSurrogateSpecClass to specify the power flow surrogate presented in [Bolognani2015].
Synopsis:
spec = PowerFlowSurrogateSpec_Bolognani2015_LP()
-
Create(varargin)¶ Returns an instance of
uot.PowerFlowSurrogate_Bolognani2015_LP.
-
uot.PowerFlowSurrogate_Bolognani2015_LP¶
-
class
PowerFlowSurrogate_Bolognani2015_LP(spec, opf_problem)¶ Bases:
uot.AbstractPowerFlowSurrogateImplements the power flow surrogate presented in [Bolognani2015]
Synopsis:
obj = uot.PowerFlowSurrogate_Bolognani2015_LP(spec,opf_problem)
- Description:
This power flow surrogate uses an implicit linear formulation to approximate the power flow equation. The formulation is based on the linearization of the power flow manifold.
This implementation does not keep track of phase since it is not necessary for implementing the required constraints.
Parameters: - spec (
uot.PowerFlowSurrogateSpec_Bolognani2015_LP) – Object specification - opf_problem (
uot.OPFproblem) – OPF problem where the power flow surrogate will be used
Example:
% This class should be instantiated via its specification spec = uot.PowerFlowSurrogateSpec_Bolognani2015_LP(); pf_surrogate = spec.Create(opf_problem);
Todo
- Check if sparse_precision is necessary. Maybe we can get rid of it.
Linear branch flow model¶
uot.PowerFlowSurrogateSpec_Gan2014_LP¶
-
class
PowerFlowSurrogateSpec_Gan2014_LP¶ Bases:
uot.AbstractPowerFlowSurrogateSpecClass to specify the linear power flow surrogate presented in [Gan2014].
Synopsis:
spec = PowerFlowSurrogateSpec_Gan2014_LP()
See also
-
Create(varargin)¶ Returns an instance of
uot.PowerFlowSurrogate_Gan2014_LP.
-
uot.PowerFlowSurrogate_Gan2014_LP¶
-
class
PowerFlowSurrogate_Gan2014_LP(spec, opf_problem)¶ Bases:
uot.PowerFlowSurrogate_Gan2014Implements the linear power flow surrogate presented in [Gan2014].
Synopsis:
obj = uot.PowerFlowSurrogate_Gan2014_LP(spec,opf_problem)
- Description:
This power flow surrogate is derived from the branch flow model SDP used in
uot.PowerFlowSurrogate_Gan2014_SDPby assuming fixed ratios of voltages between phases in a bus and fixed line losses.This implementation does not keep track of phase since it is not necessary for implementing the required constraints.
Parameters: - spec (
uot.PowerFlowSurrogateSpec_Gan2014_LP) – Object specification - opf_problem (
uot.OPFproblem) – OPF problem where the power flow surrogate will be used
Note
This implementation uses the linearization method from [Sankur2016]. The linearization used in the original paper [Gan2014] is a special case that can be recovered by setting:
pf_surrogate.linearization_point = uot.enum.CommonLinearizationPoints.FlatVoltage
Example:
% This class should be instantiated via its specification spec = uot.PowerFlowSurrogateSpec_Gan2014_LP(); pf_surrogate = spec.Create(opf_problem);
Convex branch flow model¶
uot.PowerFlowSurrogateSpec_Gan2014_SDP¶
-
class
PowerFlowSurrogateSpec_Gan2014_SDP¶ Bases:
uot.AbstractPowerFlowSurrogateSpecClass to specify the convex (SDP) power flow surrogate presented in [Gan2014].
Synopsis:
spec = PowerFlowSurrogateSpec_Gan2014_SDP()
See also
-
Create(varargin)¶ Returns an instance of
uot.PowerFlowSurrogate_Gan2014_SDP.
-
uot.PowerFlowSurrogate_Gan2014_SDP¶
-
class
PowerFlowSurrogate_Gan2014_SDP(spec, opf_problem)¶ Bases:
uot.PowerFlowSurrogate_Gan2014Implements the convex (SDP) power flow surrogate presented in [Gan2014].
Synopsis:
obj = uot.PowerFlowSurrogate_Gan2014_SDP(spec,opf_problem)
- Description:
This power flow surrogate is a relaxation of the power flow equations for a radial power distribution network. The relaxation consists in removing a non-convex rank-constraint.
Since the surrogate is a relaxation, if the optimal solution happens to fulfill the rank constraint, then the solution is optimal for the original problem as well. If this is not the case, ComputeVoltageEstimate will throw a warning: “Max M eigenvalue ratio = %d is too high, solution is inaccurate.”.
Parameters: - spec (
uot.PowerFlowSurrogateSpec_Gan2014_SDP) – Object specification - opf_problem (
uot.OPFproblem) – OPF problem where the power flow surrogate will be used
Example:
% This class should be instantiated via its specification spec = uot.PowerFlowSurrogateSpec_Gan2014_SDP(); pf_surrogate = spec.Create(opf_problem);
uot.PowerFlowSurrogate_Gan2014¶
-
class
PowerFlowSurrogate_Gan2014(spec, opf_problem, decision_variables)¶ Bases:
uot.AbstractPowerFlowSurrogateAbstract class with common functionality for
uot.PowerFlowSurrogate_Gan2014_LPanduot.PowerFlowSurrogate_Gan2014_SDP.
Interface for power flow surrogates¶
uot.AbstractPowerFlowSurrogateSpec¶
-
class
AbstractPowerFlowSurrogateSpec¶ Bases:
uot.Spec,uot.Factory,matlab.mixin.HeterogeneousAbstract class to specify a power flow surrogate
- Description:
- The main purpose of an AbstractPowerFlowSurrogateSpec is telling
the
uot.OPFproblemhow to instantiate the powerflow surrogate. This is necessary because there is a chicken and egg problem: to instantiate the surrogate, we need to pass it the OPFproblem. At the same time, to instantiate the OPFproblem we need the power flow surrogate.
uot.AbstractPowerFlowSurrogate¶
-
class
AbstractPowerFlowSurrogate(spec, opf_problem, decision_variables)¶ Bases:
uot.ConstraintProviderInterface to implement power flow surrogates
- Description:
- This abstract class specifies the interface to implement power flow surrogates.
Parameters: - spec (
uot.AbstractPowerFlowSurrogateSpec) – Power flow surrogates specification - opf_problem (
uot.OPFproblem) – OPF problem - decision_variables (struct) – Struct with decision variables (as sdpvars)
-
SolveApproxPowerFlowAlt(load_case, u_pcc_array, t_pcc_array, varargin)¶ (static) Approximately solve power flow
Synopsis:
[U_array,T_array,p_pcc_array,q_pcc_array,extra_data] = uot.AbstractPowerFlowSurrogate.SolveApproxPowerFlowAlt(load_case,u_pcc_array,t_pcc_array,varargin)
- Description:
- It is very common that power flow surrogates offer a way of approximately solving power flow.
This is typically an algebraic approach that does not rely on solving an optimization
problem as done in
uot.AbstractPowerFlowSurrogate.SolveApproxPowerFlowThis method can be overriden for this purpose.
Parameters: - load_case (
uot.LoadCasePy) – Load case for which power flow will be approximately solved - u_pcc_array (double) – Array(n_phase,n_time_step) of voltage magnitudes at PCC
- t_pcc_array (double) – Array(n_phase,n_time_step) of voltage angles at PCC
- varargin – Additional arguments (implementation dependent)
Returns: - U_array (double) - Phase-consistent array (n_bus,n_phase,n_timestep) with voltage magnitudes
- T_array (double) - Phase-consistent array (n_bus,n_phase,n_timestep) with voltage angles
- p_pcc_array (double) - Array (n_timestep,n_phase_pcc) with active power injection at the PCC
- q_pcc_array (double) - Array (n_timestep,n_phase_pcc) with reactive power injection at the PCC
- extra_data (struct) - Struct with extra data (implementation dependent)
See also
uot.AbstractPowerFlowSurrogate.SolveApproxPowerFlowHelper