VeraGridEngine.Simulations.OPF.NumericalMethods package

Submodules

VeraGridEngine.Simulations.OPF.NumericalMethods.ac_opf_derivatives module

VeraGridEngine.Simulations.OPF.NumericalMethods.ac_opf_derivatives.compute_branch_power_derivatives(all_tap_m: ndarray[tuple[Any, ...], dtype[float64]], all_tap_tau: ndarray[tuple[Any, ...], dtype[float64]], V: ndarray[tuple[Any, ...], dtype[complex128]], k_m: ndarray[tuple[Any, ...], dtype[float64]], k_tau: ndarray[tuple[Any, ...], dtype[float64]], Cf: csc_matrix, Ct: csc_matrix, F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], R: ndarray[tuple[Any, ...], dtype[float64]], X: ndarray[tuple[Any, ...], dtype[float64]]) Tuple[csr_matrix, lil_matrix, lil_matrix, csr_matrix, lil_matrix, lil_matrix][source]
Parameters:
  • all_tap_m – Vector with all the tap module, including the non-controlled ones

  • all_tap_tau – Vector with all the tap phases, including the non-controlled ones

  • V – Complex voltages

  • k_m – List with the index of the module controlled transformers

  • k_tau – List with the index of the phase controlled transformers

  • Cf – From connectivity matrix

  • Ct – To connectivity matrix

  • F – Array of β€œfrom” buses of each branch

  • T – Array of β€œto” buses of each branch

  • R – Line resistances

  • X – Line inductances

Returns:

First power derivatives with respect to the tap variables [dSbusdm, dSfdm, dStdm, dSbusdt, dSfdtau, dStdtau]

VeraGridEngine.Simulations.OPF.NumericalMethods.ac_opf_derivatives.compute_branch_power_second_derivatives(all_tap_m: ndarray[tuple[Any, ...], dtype[float64]], all_tap_tau: ndarray[tuple[Any, ...], dtype[float64]], vm: ndarray[tuple[Any, ...], dtype[float64]], va: ndarray[tuple[Any, ...], dtype[float64]], k_m: ndarray[tuple[Any, ...], dtype[int64]], k_tau: ndarray[tuple[Any, ...], dtype[int64]], mon_idx: ndarray[tuple[Any, ...], dtype[int64]], R: ndarray[tuple[Any, ...], dtype[float64]], X: ndarray[tuple[Any, ...], dtype[float64]], F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], lam: ndarray[tuple[Any, ...], dtype[float64]], mu: ndarray[tuple[Any, ...], dtype[float64]], Sf: ndarray[tuple[Any, ...], dtype[complex128]], St: ndarray[tuple[Any, ...], dtype[complex128]]) Tuple[lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix, lil_matrix][source]
Parameters:
  • all_tap_m – Vector with all the tap module, including the non-controlled ones

  • all_tap_tau – Vector with all the tap phase, including the non-controlled ones

  • vm – Voltage modules

  • va – Voltage angles

  • k_m – List with the index of the module controlled transformers

  • k_tau – List with the index of the phase controlled transformers

  • mon_idx – List with the index of the monitored lines

  • R – Line resistances

  • X – Line inductances

  • F – Indexes of the β€˜from’ buses

  • T – Indexes of the β€˜to’ buses

  • lam – Lambda multiplier

  • mu – Mu multiplier

  • Sf – From powers

  • St – To powers

Returns:

Power second derivatives with respect to tap variables

VeraGridEngine.Simulations.OPF.NumericalMethods.ac_opf_derivatives.eval_f(x: ndarray[tuple[Any, ...], dtype[float64]], Cg: csc_matrix, k_m: ndarray[tuple[Any, ...], dtype[float64]], k_tau: ndarray[tuple[Any, ...], dtype[float64]], nll: int, c0: ndarray[tuple[Any, ...], dtype[float64]], c1: ndarray[tuple[Any, ...], dtype[float64]], c2: ndarray[tuple[Any, ...], dtype[float64]], c_s: ndarray[tuple[Any, ...], dtype[float64]], nslcap: int, nodal_capacity_sign: float, c_v: ndarray[tuple[Any, ...], dtype[float64]], ig: ndarray[tuple[Any, ...], dtype[float64]], npq: int, ndc: int, Sbase: float, acopf_mode: AcOpfMode) float[source]

Calculates the value of the objective function at the current state (given by x) :param x: State vector # ////////////////////////////////////////////////////// :param Cg: Generation connectivity matrix :param k_m: List with the index of the module controlled transformers :param k_tau: List with the index of the phase controlled transformers :param nll: Number of monitored lines :param c0: Base cost of generators :param c1: Linear cost of generators :param c2: Quadratic cost of generators :param c_s: Cost of overloading a line :param nslcap: :param nodal_capacity_sign: :param c_v: Cost of over or undervoltages :param ig: Dispatchable generators :param npq: Number of pq buses :param ndc: Number of dispatchable DC links :param Sbase: Base power (per unit reference) :param acopf_mode: AcOpfMode :return: Scalar value: Cost of operation (objective function)

VeraGridEngine.Simulations.OPF.NumericalMethods.ac_opf_derivatives.eval_g(x: ndarray[tuple[Any, ...], dtype[float64]], Ybus: csc_matrix, Yf: csc_matrix, Cg: csc_matrix, Sd: ndarray[tuple[Any, ...], dtype[complex128]], ig: ndarray[tuple[Any, ...], dtype[float64]], nig: ndarray[tuple[Any, ...], dtype[float64]], nll: int, nslcap: int, nodal_capacity_sign: float, capacity_nodes_idx: ndarray[tuple[Any, ...], dtype[int64]], npq: int, pv: ndarray[tuple[Any, ...], dtype[float64]], f_nd_dc: ndarray[tuple[Any, ...], dtype[float64]], t_nd_dc: ndarray[tuple[Any, ...], dtype[float64]], fdc: ndarray[tuple[Any, ...], dtype[float64]], tdc: ndarray[tuple[Any, ...], dtype[float64]], Pf_nondisp: ndarray[tuple[Any, ...], dtype[float64]], k_m: ndarray[tuple[Any, ...], dtype[float64]], k_tau: ndarray[tuple[Any, ...], dtype[float64]], Vm_max: ndarray[tuple[Any, ...], dtype[float64]], Sg_undis: ndarray[tuple[Any, ...], dtype[complex128]], slack: ndarray[tuple[Any, ...], dtype[float64]], acopf_mode: AcOpfMode) Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]

Calculates the equality constraints at the current state (given by x) :param x: State vector :param Ybus: Bus admittance matrix :param Yf: From admittance matrix :param Cg: Generators connectivity matrix :param Sd: Loads vector :param ig: indices of dispatchable gens :param nig: indices of non dispatchable gens :param nll: Number of monitored lines :param nslcap: :param nodal_capacity_sign: :param capacity_nodes_idx: :param npq: Number of pq buses :param pv: Index of PV buses :param f_nd_dc: Index of β€˜from’ buses of non dispatchable DC links :param t_nd_dc: Index of β€˜to’ buses of non dispatchable DC links :param fdc: Index of β€˜from’ buses of dispatchable DC links :param tdc: Index of β€˜to’ buses of dispatchable DC links :param Pf_nondisp: :param k_m: Index of module controlled transformers :param k_tau: Index of phase controlled transformers :param Vm_max: Maximum bound for voltage :param Sg_undis: undispatchable complex power :param slack: Index of slack buses :param acopf_mode: :return: Vector with the value of each equality constraint G = [g1(x), … gn(x)] s.t. gi(x) = 0.

It also returns the value of the power injections S

VeraGridEngine.Simulations.OPF.NumericalMethods.ac_opf_derivatives.eval_h(x: ndarray[tuple[Any, ...], dtype[float64]], Yf: csc_matrix, Yt: csc_matrix, from_idx: ndarray[tuple[Any, ...], dtype[float64]], to_idx: ndarray[tuple[Any, ...], dtype[float64]], nslcap: int, pq: ndarray[tuple[Any, ...], dtype[float64]], k_m: ndarray[tuple[Any, ...], dtype[float64]], k_tau: ndarray[tuple[Any, ...], dtype[float64]], Cg: csc_matrix, Inom: ndarray[tuple[Any, ...], dtype[float64]], Vm_max: ndarray[tuple[Any, ...], dtype[float64]], Vm_min: ndarray[tuple[Any, ...], dtype[float64]], Pg_max: ndarray[tuple[Any, ...], dtype[float64]], Pg_min: ndarray[tuple[Any, ...], dtype[float64]], Qg_max: ndarray[tuple[Any, ...], dtype[float64]], Qg_min: ndarray[tuple[Any, ...], dtype[float64]], tapm_max: ndarray[tuple[Any, ...], dtype[float64]], tapm_min: ndarray[tuple[Any, ...], dtype[float64]], tapt_max: ndarray[tuple[Any, ...], dtype[float64]], tapt_min: ndarray[tuple[Any, ...], dtype[float64]], Pdcmax: ndarray[tuple[Any, ...], dtype[float64]], rates: ndarray[tuple[Any, ...], dtype[float64]], il: ndarray[tuple[Any, ...], dtype[float64]], ig: ndarray[tuple[Any, ...], dtype[float64]], ctQ: bool, acopf_mode: AcOpfMode) Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[complex128]], ndarray[tuple[Any, ...], dtype[complex128]]][source]

Calculates the inequality constraints at the current state (given by x) :param x: State vector :param Yf: From admittance matrix :param Yt: To admittance matrix :param from_idx: Vector with the indices of the β€˜from’ buses for each line :param to_idx: Vector with the indices of the β€˜from’ buses for each line :param nslcap: :param pq: Index of PQ buses :param k_m: Index of module controlled transformers :param k_tau: Index of phase controlles transformers :param Vm_max: upper bound for voltage module per bus :param Vm_min: lower bound for voltage module per bus :param Pg_max: upper bound for active power generation per generator :param Pg_min: lower bound for active power generation per generator :param Qg_max: upper bound for reactive power generation per generator :param Qg_min: lower bound for reactive power generation per generator :param tapm_max: Upper bound for tap module per transformer :param tapm_min: Lower bound for tap module per transformer :param tapt_max: Upper bound for tap phase per transformer :param tapt_min: Lower bound for tap phase per transformer :param Pdcmax: Bound for power transmission in a DC link :param rates: Rates for branch power at each line :param il: Index of monitored lines :param ig: Index of dispatchable generators :param tanmax: Maximum value of tan(phi), where phi is the angle of the complex generation, for each generator :param ctQ: Boolean indicating if limits to reactive power generation realted to active generation apply :param acopf_mode: AcOpfMode :return: Vector with the value of each inequality constraint

H = [h1(x), … hn(x)] s.t. hi(x) <= 0 and the calculated from and to branch powers.

VeraGridEngine.Simulations.OPF.NumericalMethods.ac_opf_derivatives.jacobians_and_hessians(x: ndarray[tuple[Any, ...], dtype[float64]], c1: ndarray[tuple[Any, ...], dtype[float64]], c2: ndarray[tuple[Any, ...], dtype[float64]], c_s: ndarray[tuple[Any, ...], dtype[float64]], c_v: ndarray[tuple[Any, ...], dtype[float64]], Cg: csc_matrix, Cf: csc_matrix, Ct: csc_matrix, Inom: ndarray[tuple[Any, ...], dtype[float64]], Yf: csc_matrix, Yt: csc_matrix, Ybus: csc_matrix, Sbase: float, mon_br_idx: ndarray[tuple[Any, ...], dtype[int64]], ig: ndarray[tuple[Any, ...], dtype[int64]], slack: ndarray[tuple[Any, ...], dtype[float64]], nslcap: int, nodal_capacity_sign: float, capacity_nodes_idx: ndarray[tuple[Any, ...], dtype[int64]], pq: ndarray[tuple[Any, ...], dtype[int64]], pv: ndarray[tuple[Any, ...], dtype[int64]], alltapm: ndarray[tuple[Any, ...], dtype[float64]], alltapt: ndarray[tuple[Any, ...], dtype[float64]], F_hvdc: ndarray[tuple[Any, ...], dtype[int64]], T_hvdc: ndarray[tuple[Any, ...], dtype[int64]], nsh: int, k_m: ndarray[tuple[Any, ...], dtype[int64]], k_tau: ndarray[tuple[Any, ...], dtype[int64]], mu, lmbda, R: ndarray[tuple[Any, ...], dtype[float64]], X: ndarray[tuple[Any, ...], dtype[float64]], F: ndarray[tuple[Any, ...], dtype[int64]], T: ndarray[tuple[Any, ...], dtype[int64]], ctQ: bool, acopf_mode: AcOpfMode, compute_jac: bool, compute_hess: bool) Tuple[ndarray[tuple[Any, ...], dtype[float64]], csc_matrix, csc_matrix, csc_matrix, csc_matrix, csc_matrix, ndarray[tuple[Any, ...], dtype[float64]]][source]

Calculates the jacobians and hessians of the objective function and the equality and inequality constraints at the current state given by x :param x: State vector :param c1: Linear cost of each generator :param c2: Quadratic cost of each generator :param c_s: Cost of overloading each line :param c_v: Cost of over or undervoltage for each bus :param Cg: Generator connectivity matrix :param Cf: From connectivity matrix :param Ct:To connectivity matrix :param Yf: From admittance matrix :param Yt: To admittance matrix :param Ybus: Bus admittance matrix :param Sbase: Base power :param mon_br_idx: Index of monitored branches :param ig: Index of dispatchable generators :param slack: Index of slack buses :param nslcap: :param nodal_capacity_sign: :param capacity_nodes_idx: :param pq: Index of PQ buses :param pv: Index of PV buses # :param tanmax: Maximum value of tan(phi), where phi is the angle of the complex generation, for each generator :param alltapm: value of all the tap modules, including the non controlled ones :param alltapt: value of all the tap phases, including the non controlled ones :param F_hvdc: Index of the β€˜from’ buses for the dispatchable DC links :param T_hvdc: Index of the β€˜to’ buses for the dispatchable DC links :param k_m: Index of the module controlled transformers :param k_tau: Index of the phase controlled transformers :param mu: Vector of mu multipliers :param lmbda: Vector of lambda multipliers :param R: Line Resistance :param X: Line inductance :param F: Index of the β€˜form’ bus for each line :param T: Index of the β€˜to’ bus for each line :param ctQ: Boolean that indicates if the Reactive control applies :param acopf_mode: AcOpfMode :param compute_jac: Boolean that indicates if the Jacobians have to be calculated :param compute_hess: Boolean that indicates if the Hessians have to be calculated :return: Jacobians and hessians matrices for the objective function and the equality and inequality constraints

VeraGridEngine.Simulations.OPF.NumericalMethods.ac_opf_derivatives.var2x(Va: ndarray[tuple[Any, ...], dtype[float64]], Vm: ndarray[tuple[Any, ...], dtype[float64]], Pg: ndarray[tuple[Any, ...], dtype[float64]], Qg: ndarray[tuple[Any, ...], dtype[float64]], sl_sf: ndarray[tuple[Any, ...], dtype[float64]], sl_st: ndarray[tuple[Any, ...], dtype[float64]], sl_vmax: ndarray[tuple[Any, ...], dtype[float64]], sl_vmin: ndarray[tuple[Any, ...], dtype[float64]], slcap: ndarray[tuple[Any, ...], dtype[float64]], tapm: ndarray[tuple[Any, ...], dtype[float64]], tapt: ndarray[tuple[Any, ...], dtype[float64]], Pfdc: ndarray[tuple[Any, ...], dtype[float64]]) ndarray[tuple[Any, ...], dtype[float64]][source]

Compose the x vector from its components :param Va: Voltage angles :param Vm: Voltage modules :param Pg: Generator active powers :param Qg: Generator reactive powers :param sl_sf: Bound slacks for the β€˜from’ power through a line :param sl_st: Bound slacks for the β€˜to’ power through a line :param sl_vmax: Bound slacks for the maximum voltage of the buses :param sl_vmin: Bound slacks for the minimum voltage of the buses :param slcap: :param tapm: Tap modules :param tapt: Tap phases :param Pfdc: From power of the dispatchable DC links :return: The stacked state vector [Va, Vm, Pg, Qg, sl_sf, sl_st, sl_vmax, sl_vmin, tapm, tapt, Pfdc]

VeraGridEngine.Simulations.OPF.NumericalMethods.ac_opf_derivatives.x2var(x: ndarray[tuple[Any, ...], dtype[float64]], nVa: int, nVm: int, nPg: int, nQg: int, npq: int, M: int, ntapm: int, ntapt: int, ndc: int, nslcap: int, acopf_mode: AcOpfMode) Tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]][source]

Convert the x solution vector to its composing variables :param x: solution vector :param nVa: number of voltage angle vars :param nVm: number of voltage module vars :param nPg: number of generator active power vars :param nQg: number of generator reactive power vars :param npq: number of PQ buses :param M: number of monitored lines :param ntapm: number of module controlled transformers :param ntapt: number of phase controlled transformers :param ndc: number of dispatchable DC links :param nslcap: :param acopf_mode: AcOpfMode :return: Tuple of sliced variables

VeraGridEngine.Simulations.OPF.NumericalMethods.newton_raphson_ips_fx module

class VeraGridEngine.Simulations.OPF.NumericalMethods.newton_raphson_ips_fx.IpsFunctionReturn(f: float, G: ndarray[tuple[Any, ...], dtype[float64]], H: ndarray[tuple[Any, ...], dtype[float64]], fx: ndarray[tuple[Any, ...], dtype[float64]], Gx: csc_matrix, Hx: csc_matrix, fxx: csc_matrix, Gxx: csc_matrix, Hxx: csc_matrix, S: ndarray[tuple[Any, ...], dtype[complex128]], Sf: ndarray[tuple[Any, ...], dtype[complex128]], St: ndarray[tuple[Any, ...], dtype[complex128]])[source]

Bases: object

Represents the returning value of the interior point evaluation

G: ndarray[tuple[Any, ...], dtype[float64]]
Gx: csc_matrix
Gxx: csc_matrix
H: ndarray[tuple[Any, ...], dtype[float64]]
Hx: csc_matrix
Hxx: csc_matrix
S: ndarray[tuple[Any, ...], dtype[complex128]]
Sf: ndarray[tuple[Any, ...], dtype[complex128]]
St: ndarray[tuple[Any, ...], dtype[complex128]]
compare(other: IpsFunctionReturn, h: float) Dict[str, float | ndarray[tuple[Any, ...], dtype[float64]] | csc_matrix][source]

Returns the comparison between this structure and another structure of this type :param other: IpsFunctionReturn :param h: finite differences step :return: Dictionary with the structure name and the difference

f: float
fx: ndarray[tuple[Any, ...], dtype[float64]]
fxx: csc_matrix
get_data() List[float | ndarray[tuple[Any, ...], dtype[float64]] | csc_matrix][source]

Returns the structures in a list :return: List of float, Vec, and csc

static get_headers() List[str][source]

Returns the structures’ names :return: list of str

class VeraGridEngine.Simulations.OPF.NumericalMethods.newton_raphson_ips_fx.IpsSolution(x: ndarray[tuple[Any, ...], dtype[float64]], error: float, gamma: float, lam: ndarray[tuple[Any, ...], dtype[float64]], dlam: ndarray[tuple[Any, ...], dtype[float64]], mu: ndarray[tuple[Any, ...], dtype[float64]], z: ndarray[tuple[Any, ...], dtype[float64]], residuals: ndarray[tuple[Any, ...], dtype[float64]], converged: bool, iterations: int, error_evolution: ndarray[tuple[Any, ...], dtype[float64]])[source]

Bases: object

Represents the returning value of the interior point solution

converged: bool
dlam: ndarray[tuple[Any, ...], dtype[float64]]
error: float
error_evolution: ndarray[tuple[Any, ...], dtype[float64]]
gamma: float
iterations: int
lam: ndarray[tuple[Any, ...], dtype[float64]]
mu: ndarray[tuple[Any, ...], dtype[float64]]
plot_error()[source]

Plot the IPS error

residuals: ndarray[tuple[Any, ...], dtype[float64]]
x: ndarray[tuple[Any, ...], dtype[float64]]
z: ndarray[tuple[Any, ...], dtype[float64]]
VeraGridEngine.Simulations.OPF.NumericalMethods.newton_raphson_ips_fx.calc_c_cond(mu: ndarray[tuple[Any, ...], dtype[float64]], z: ndarray[tuple[Any, ...], dtype[float64]], x: ndarray[tuple[Any, ...], dtype[float64]]) float[source]
Parameters:
  • mu – Vector of mu multipliers

  • z – Vector of z slack variables

  • x – State vector

Returns:

Vector of c-cond

VeraGridEngine.Simulations.OPF.NumericalMethods.newton_raphson_ips_fx.calc_error(dx: ndarray[tuple[Any, ...], dtype[float64]], dz: ndarray[tuple[Any, ...], dtype[float64]], dmu: ndarray[tuple[Any, ...], dtype[float64]], dlmbda: ndarray[tuple[Any, ...], dtype[float64]]) float[source]

Calculate the error of the process :param dx: x increments array :param dz: z increments array :param dmu: mu increments array :param dlmbda: lambda increments array :return: max abs value of all the increments

VeraGridEngine.Simulations.OPF.NumericalMethods.newton_raphson_ips_fx.calc_feas_cond(g: ndarray[tuple[Any, ...], dtype[float64]], h: ndarray[tuple[Any, ...], dtype[float64]], x: ndarray[tuple[Any, ...], dtype[float64]], z: ndarray[tuple[Any, ...], dtype[float64]]) float[source]

Calculate the feasible conditions :param g: Equality values :param h: Inequality values :param x: State vector :param z: Vector of z slack variables :return: Feasibility condition value

VeraGridEngine.Simulations.OPF.NumericalMethods.newton_raphson_ips_fx.calc_grad_cond(lx: ndarray[tuple[Any, ...], dtype[float64]], lam: ndarray[tuple[Any, ...], dtype[float64]], mu: ndarray[tuple[Any, ...], dtype[float64]]) float[source]

calculate the gradient conditions :param lx: Gradient of the lagrangian :param lam: Vector of lambda multipliers :param mu: Vector of mu multipliers :return: Gradient condition value

VeraGridEngine.Simulations.OPF.NumericalMethods.newton_raphson_ips_fx.calc_o_cond(f: float, f_prev: float) float[source]
Parameters:
  • f – Value of objective function

  • f_prev – Previous value of objective function

Returns:

Variation of the objective function

VeraGridEngine.Simulations.OPF.NumericalMethods.newton_raphson_ips_fx.interior_point_solver(problem, max_iter=100, tol=1e-06, pf_init=False, trust=0.9, verbose: int = 0, step_control=False) IpsSolution[source]

Solve a non-linear problem of the form:

min: f(x) s.t.

G(x) = 0 H(x) <= 0 xmin <= x <= xmax

The problem is specified by a function f_eval This function is called with (x, mu, lmbda) and returns (f, G, H, fx, Gx, Hx, fxx, Gxx, Hxx)

where:

x: array of variables lambda: Lagrange Multiplier associated with the inequality constraints pi: Lagrange Multiplier associated with the equality constraints f: objective function value (float) G: Array of equality mismatches (vec) H: Array of inequality mismatches (vec) fx: jacobian of f(x) (vec) Gx: Jacobian of G(x) (CSC mat) Hx: Jacobian of H(x) (CSC mat) fxx: Hessian of f(x) (CSC mat) Gxx: Hessian of G(x) (CSC mat) Hxx: Hessian of H(x) (CSC mat)

See: On Computational Issues of Market-Based Optimal Power Flow by

Hongye Wang, Carlos E. Murillo-SΓ‘nchez, Ray D. Zimmerman, and Robert J. Thomas IEEE TRANSACTIONS ON POWER SYSTEMS, VOL. 22, NO. 3, AUGUST 2007

Parameters:
  • problem – Optimization problem structure

  • max_iter – Maximum number of iterations

  • tol – Convergence tolerance

  • pf_init – Use the power flow solution as initial values

  • trust – Amount of trust in the initial Newton derivative length estimation

  • verbose – 0 to 3 (the larger, the more verbose)

  • step_control – Use step control to improve the solution process control

Returns:

IpsSolution

VeraGridEngine.Simulations.OPF.NumericalMethods.newton_raphson_ips_fx.max_abs(x: ndarray[tuple[Any, ...], dtype[float64]]) float[source]

Compute max abs efficiently :param x: State vector :return: Inf-norm of the state vector

VeraGridEngine.Simulations.OPF.NumericalMethods.newton_raphson_ips_fx.split(sol: ndarray[tuple[Any, ...], dtype[float64]], n: int)[source]

Split the solution vector in two :param sol: solution vector :param n: integer position at whic to split the solution :return: A before, B after the splitting point

VeraGridEngine.Simulations.OPF.NumericalMethods.newton_raphson_ips_fx.step_calculation(v: ndarray[tuple[Any, ...], dtype[float64]], dv: ndarray[tuple[Any, ...], dtype[float64]], tau: float = 0.99995)[source]

This function calculates for each Lambda multiplier or its associated Slack variable the maximum allowed step in order to not violate the KKT condition Lambda > 0 and S > 0 :param v: Array of multipliers or slack variables :param dv: Variation calculated in the Newton step :param tau: Factor to be not exactly 1 :return: step size value for the given multipliers

Module contents