GridCal.Engine.Simulations.ContinuationPowerFlow package

Submodules

GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow module

class GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow.VCParametrization

Bases: enum.Enum

An enumeration.

ArcLength = 'Arc Length'
Natural = 'Natural'
PseudoArcLength = 'Pseudo Arc Length'
class GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow.VCStopAt

Bases: enum.Enum

An enumeration.

Full = 'Full curve'
Nose = 'Nose'
GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow.continuation_nr(Ybus, Ibus_base, Ibus_target, Sbus_base, Sbus_target, V, pv, pq, step, approximation_order: GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow.VCParametrization, adapt_step, step_min, step_max, error_tol=0.001, tol=1e-06, max_it=20, stop_at=<VCStopAt.Nose: 'Nose'>, verbose=False, call_back_fx=None)

Runs a full AC continuation power flow using a normalized tangent predictor and selected approximation_order scheme. :param Ybus: Admittance matrix :param Ibus_base: :param Ibus_target: :param Sbus_base: Power array of the base solvable case :param Sbus_target: Power array of the case to be solved :param V: Voltage array of the base solved case :param pv: Array of pv indices :param pq: Array of pq indices :param step: Adaptation step :param approximation_order: order of the approximation {Natural, Arc, Pseudo arc} :param adapt_step: use adaptive step size? :param step_min: minimum step size :param step_max: maximum step size :param error_tol: Error tolerance :param tol: Solutions tolerance :param max_it: Maximum iterations :param stop_at: Value of Lambda to stop at. It can be a number or {‘NOSE’, ‘FULL’} :param verbose: Display additional intermediate information? :param call_back_fx: Function to call on every iteration passing the lambda parameter :return: Voltage_series: List of all the voltage solutions from the base to the target

Lambda_series: Lambda values used in the continuation
Ported from MATPOWER

Copyright (c) 1996-2015 by Power System Engineering Research Center (PSERC) by Ray Zimmerman, PSERC Cornell, Shrirang Abhyankar, Argonne National Laboratory, and Alexander Flueck, IIT

$Id: runcpf.m 2644 2015-03-11 19:34:22Z ray $

This file is part of MATPOWER. Covered by the 3-clause BSD License (see LICENSE file for details). See http://www.pserc.cornell.edu/matpower/ for more info.

GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow.corrector(Ybus, Ibus, Sbus, V0, pv, pq, lam0, Sxfr, Vprv, lamprv, z, step, parametrization, tol, max_it, verbose)

Solves the corrector step of a continuation power flow using a full Newton method with selected parametrization scheme.

solves for bus voltages and lambda given the full system admittance matrix (for all buses), the complex bus power injection vector (for all buses), the initial vector of complex bus voltages, and column vectors with the lists of bus indices for the swing bus, PV buses, and PQ buses, respectively. The bus voltage vector contains the set point for generator (including ref bus) buses, and the reference angle of the swing bus, as well as an initial guess for remaining magnitudes and angles.

Uses default options if this parameter is not given. Returns the final complex voltages, a flag which indicates whether it converged or not, the number of iterations performed, and the final lambda.
Parameters:
  • Ybus – Admittance matrix (CSC sparse)
  • Ibus – Bus current injections
  • Sbus – Bus power injections
  • V0 – Bus initial voltages
  • pv – list of pv nodes
  • pq – list of pq nodes
  • lam0 – initial value of lambda (loading parameter)
  • Sxfr – [delP+j*delQ] transfer/loading vector for all buses
  • Vprv – final complex V corrector solution from previous continuation step
  • lamprv – final lambda corrector solution from previous continuation step
  • z – normalized predictor for all buses
  • step – continuation step size
  • parametrization
  • tol
  • max_it
  • verbose
Returns:

V, CONVERGED, I, LAM

GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow.corrector_new(Ybus, Ibus, Sbus, V0, pv, pq, lam0, Sxfr, Vprv, lamprv, z, step, parametrization, tol, max_it, verbose, max_it_internal=10)

Solves the corrector step of a continuation power flow using a full Newton method with selected parametrization scheme.

solves for bus voltages and lambda given the full system admittance matrix (for all buses), the complex bus power injection vector (for all buses), the initial vector of complex bus voltages, and column vectors with the lists of bus indices for the swing bus, PV buses, and PQ buses, respectively. The bus voltage vector contains the set point for generator (including ref bus) buses, and the reference angle of the swing bus, as well as an initial guess for remaining magnitudes and angles.

Uses default options if this parameter is not given. Returns the final complex voltages, a flag which indicates whether it converged or not, the number of iterations performed, and the final lambda.
Parameters:
  • Ybus – Admittance matrix (CSC sparse)
  • Ibus – Bus current injections
  • Sbus – Bus power injections
  • V0 – Bus initial voltages
  • pv – list of pv nodes
  • pq – list of pq nodes
  • lam0 – initial value of lambda (loading parameter)
  • Sxfr – [delP+j*delQ] transfer/loading vector for all buses
  • Vprv – final complex V corrector solution from previous continuation step
  • lamprv – final lambda corrector solution from previous continuation step
  • z – normalized predictor for all buses
  • step – continuation step size
  • parametrization
  • tol
  • max_it
  • verbose
Returns:

V, CONVERGED, I, LAM

GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow.cpf_p(parametrization: GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow.VCParametrization, step, z, V, lam, V_prev, lamprv, pv, pq, pvpq)

Computes the value of the Current Parametrization Function :param parametrization: Value of option (1: Natural, 2:Arc-length, 3: pseudo arc-length) :param step: continuation step size :param z: normalized tangent prediction vector from previous step :param V: complex bus voltage vector at current solution :param lam: scalar lambda value at current solution :param V_prev: complex bus voltage vector at previous solution :param lamprv: scalar lambda value at previous solution :param pv: vector of indices of PV buses :param pq: vector of indices of PQ buses :param pvpq: vector of indices of PQ and PV buses :return: value of the parametrization function at the current point

GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow.cpf_p_jac(parametrization: GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow.VCParametrization, z, V, lam, Vprv, lamprv, pv, pq, pvpq)

Computes partial derivatives of Current Parametrization Function (CPF). :param parametrization: :param z: normalized tangent prediction vector from previous step :param V: complex bus voltage vector at current solution :param lam: scalar lambda value at current solution :param Vprv: complex bus voltage vector at previous solution :param lamprv: scalar lambda value at previous solution :param pv: vector of indices of PV buses :param pq: vector of indices of PQ buses :param pvpq: vector of indices of PQ and PV buses :return: partial of parametrization function w.r.t. voltages

partial of parametrization function w.r.t. lambda
GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow.predictor(V, Ibus, lam, Ybus, Sxfr, pv, pq, step, z, Vprv, lamprv, parametrization: GridCal.Engine.Simulations.ContinuationPowerFlow.continuation_power_flow.VCParametrization)

Computes a prediction (approximation) to the next solution of the continuation power flow using a normalized tangent predictor. :param V: complex bus voltage vector at current solution :param Ibus: :param lam: scalar lambda value at current solution :param Ybus: complex bus admittance matrix :param Sxfr: complex vector of scheduled transfers (difference between bus injections in base and target cases) :param pv: vector of indices of PV buses :param pq: vector of indices of PQ buses :param step: continuation step length :param z: normalized tangent prediction vector from previous step :param Vprv: complex bus voltage vector at previous solution :param lamprv: scalar lambda value at previous solution :param parametrization: Value of cpf parametrization option. :return: V0 : predicted complex bus voltage vector

LAM0 : predicted lambda continuation parameter Z : the normalized tangent prediction vector

GridCal.Engine.Simulations.ContinuationPowerFlow.voltage_collapse_driver module

class GridCal.Engine.Simulations.ContinuationPowerFlow.voltage_collapse_driver.VoltageCollapse(circuit: GridCal.Engine.Core.multi_circuit.MultiCircuit, options: GridCal.Engine.Simulations.ContinuationPowerFlow.voltage_collapse_driver.VoltageCollapseOptions, inputs: GridCal.Engine.Simulations.ContinuationPowerFlow.voltage_collapse_driver.VoltageCollapseInput)

Bases: PySide2.QtCore.QThread

cancel()
done_signal = <PySide2.QtCore.Signal object>
get_steps()

List of steps

progress_callback(l)

Send progress report :param l: lambda value :return: None

progress_signal = <PySide2.QtCore.Signal object>
progress_text = <PySide2.QtCore.Signal object>
run()

run the voltage collapse simulation @return:

staticMetaObject = <PySide2.QtCore.QMetaObject object>
class GridCal.Engine.Simulations.ContinuationPowerFlow.voltage_collapse_driver.VoltageCollapseInput(Sbase, Vbase, Starget)

Bases: object

class GridCal.Engine.Simulations.ContinuationPowerFlow.voltage_collapse_driver.VoltageCollapseOptions(step=0.01, approximation_order=<VCParametrization.Natural: 'Natural'>, adapt_step=True, step_min=0.0001, step_max=0.2, error_tol=0.001, tol=1e-06, max_it=20, stop_at=<VCStopAt.Nose: 'Nose'>, verbose=False)

Bases: object

class GridCal.Engine.Simulations.ContinuationPowerFlow.voltage_collapse_driver.VoltageCollapseResults(nbus, nbr)

Bases: object

apply_from_island(voltage_collapse_res, pf_res: GridCal.Engine.Simulations.PowerFlow.power_flow_results.PowerFlowResults, bus_original_idx, branch_original_idx, nbus_full)

Apply the results of an island to this VoltageCollapseResults instance :param voltage_collapse_res: VoltageCollapseResults instance of the island :param pf_res: Power flow results instance :param bus_original_idx: indices of the buses in the complete grid :param branch_original_idx: indices of the branches in the complete grid :param nbus_full: total number of buses in the complete grid

get_results_dict()

Returns a dictionary with the results sorted in a dictionary :return: dictionary of 2D numpy arrays (probably of complex numbers)

plot(result_type=<ResultTypes.BusVoltage: ('Bus voltage', <DeviceType.BusDevice: 'Bus'>)>, ax=None, indices=None, names=None)

Plot the results :param result_type: :param ax: :param indices: :param names: :return:

save(fname)

Export as pickle