hynet.loadability package

Submodules

hynet.loadability.calc module

Calculation of the maximum loadability.

hynet.loadability.calc.calc_loadability(data, scenario_id=0, solver=None, solver_type=<SolverType.QCQP: 'QCQP'>, initial_point_generator=None, converter_loss_error_tolerance=0.0005)[source]

Calculate the maximum loadability.

This function formulates and solves the maximum loadability problem as defined in equations (1) - (3) in [1] based on the feasibility set of the OPF problem in hynet, i.e., hynet’s the power balance equations are extended with a scaled load increment and the scaling of the increment is maximized. The nodal load increment is defined by the column 'load_increment' in the bus data frame of the scenario. If this column is not present, the load increment is set to the nodal load (i.e., the 'load' column of the bus data frame), which maintains a constant power factor at the loads.

Parameters:
  • data (DBConnection or Scenario or LoadabilityModel) – Connection to a hynet grid database, a Scenario object, or a LoadabilityModel object.
  • scenario_id (hynet_id_, optional) – Identifier of the scenario. This argument is ignored if data is a Scenario or LoadabilityModel object.
  • solver (SolverInterface, optional) – Solver for the QCQP problem; the default automatically selects an appropriate solver of the specified solver type.
  • solver_type (SolverType, optional) – Solver type for the automatic solver selection (default SolverType.QCQP). It is ignored if solver is not None.
  • initial_point_generator (InitialPointGenerator or None, optional) – Initial point generator for QCQP solvers (ignored for relaxation-based solvers). By default (None), the initial point generation is skipped.
  • converter_loss_error_tolerance (hynet_float_, optional) – Tolerance for the converter loss error in MW (default 5e-4). If None, the loadability model’s (default) setting is retained.
Returns:

result – Solution of the maximum loadability problem.

Return type:

LoadabilityResult

References

[1]G. D. Irisarri, X. Wang, J. Tong and S. Mokhtari, “Maximum loadability of power systems using interior point nonlinear optimization method,” IEEE Trans. Power Syst., vol. 12, no. 1, pp. 162-172, Feb. 1997.

hynet.loadability.model module

Model to evaluate the maximum loadability of a system with hynet.

class hynet.loadability.model.LoadabilityModel(scenario, verify_scenario=True)[source]

Bases: hynet.system.model.SystemModel

Maximum loadability model for a steady-state scenario of a grid.

Based on the specification of a scenario via a Scenario object, this class provides the methods to generate a quadratically constrained quadratic program (QCQP) that captures the maximum loadability problem. The maximum loadability problem is considered as in equations (1) - (3) in [1] based on the feasibility set of the OPF problem in hynet, i.e., hynet’s the power balance equations are extended with a scaled load increment and the scaling of the increment is maximized. The nodal load increment is defined by the column 'load_increment' in the bus data frame of the scenario. If this column is not present, the load increment is set to the nodal load (i.e., the 'load' column of the bus data frame), which maintains a constant power factor at the loads.

See also

hynet.scenario.representation.Scenario
Specification of a steady-state grid scenario.
hynet.loadability.calc.calc_loadability
Calculate the maximum loadability.

References

[1]G. D. Irisarri, X. Wang, J. Tong and S. Mokhtari, “Maximum loadability of power systems using interior point nonlinear optimization method,” IEEE Trans. Power Syst., vol. 12, no. 1, pp. 162-172, Feb. 1997.
create_result(qcqp_result, total_time=nan, qcqp_result_pre=None)[source]

Create and return a loadability result object.

Parameters:
  • qcqp_result (hynet.qcqp.result.QCQPResult) – Solution of the loadability QCQP.
  • total_time (hynet_float_, optional) – Total time for solving the loadability problem.
  • qcqp_result_pre (QCQPResult, optional) – Pre-solution of the loadability QCQP for converter mode detection.
Returns:

result

Return type:

hynet.loadability.result.LoadabilityResult

dim_z

Return the dimension of the state variable z.

The loadability problem only requires a single auxiliary variable, which is the nonnegative scaling factor for the load increment.

get_balance_constraints()[source]

Return the active and reactive power balance constraints.

For the loadability problem, the power balance equations are augmented by a scaled load increment term, where the scaling is maximized by the objective.

get_z_bounds()[source]

Return the auxiliary variable bounds z_lb <= z <= z_ub.

The lower is set to zero and the upper bound is omitted.

hynet.loadability.result module

Representation of a maximum loadability result.

class hynet.loadability.result.LoadabilityResult(model, qcqp_result, total_time=nan, qcqp_result_pre=None)[source]

Bases: hynet.system.result.SystemResult

Result of a maximum loadability calculation.

Remark: In the data frames below, the respective column for the dual variables of a type of constraint (e.g., voltage drop) is only present if at least one constraint of this constraint type appears in the problem formulation.

Parameters:
  • model (LoadabilityModel) – Model for the processed maximum loadability problem.
  • empty (bool) – True if the object does not contain any result data and False otherwise.
  • solver (SolverInterface) – Solver object by which the result was obtained.
  • solver_status (SolverStatus) – Status reported by the solver.
  • solver_time (float) – Duration of the call to the solver in seconds.
  • optimal_value (float) – Optimal objective value or numpy.nan if the solver failed.
  • total_time (float or numpy.nan) – Total time for the loadability calculation, including the modeling, solving, and result assembly. If not provided, this time is set to numpy.nan.
  • reconstruction_mse (float) – Unavailable if the result is empty and, otherwise, the mean squared error of the reconstructed bus voltages in case of a relaxation and numpy.nan otherwise.
  • load_increment_scaling (float) – Maximum load increment scaling (cf. \(\lambda\) in equation (1) and (2) in [1]) or numpy.nan if the solver failed.
  • bus (pandas.DataFrame, optional) –

    Unavailable if the result is empty and, otherwise, a data frame with the bus result data, indexed by the bus ID, which comprises the following columns:

    v: (hynet_complex_)
    Bus voltage rms phasor (AC) or bus voltage magnitude (DC).
    s_shunt: (hynet_complex_)
    Shunt apparent power in MVA. The real part constitutes the shunt losses in MW and the negated imaginary part constitutes the reactive power injection.
    bal_err: (hynet_complex_)
    Power balance residual in MVA, i.e., the evaluation of the complex-valued power balance equation at the system state. Theoretically, this should be identical to zero, but due to a limited solver accuracy and/or inexactness of the relaxation it is only approximately zero. This residual supports the assessment of solution accuracy and validity.
    dv_bal_p: (hynet_float_)
    Dual variable or KKT multiplier of the active power balance constraint.
    dv_bal_q: (hynet_float_)
    Dual variable or KKT multiplier of the reactive power balance constraint.
    dv_v_min: (hynet_float_)
    Dual variable or KKT multiplier of the voltage lower bound.
    dv_v_max: (hynet_float_)
    Dual variable or KKT multiplier of the voltage upper bound.
  • branch (pandas.DataFrame, optional) –

    Unavailable if the result is empty and, otherwise, a data frame with the branch result data, indexed by the branch ID, which comprises the following columns:

    s_src: (hynet_complex_)
    Apparent power flow in MVA at the source bus (measured as a flow into the branch).
    s_dst: (hynet_complex_)
    Apparent power flow in MVA at the destination bus (measured as a flow into the branch).
    i_src: (hynet_complex_)
    Current flow in p.u. at the source bus (measured as a flow into the branch).
    i_dst: (hynet_complex_)
    Current flow in p.u. at the destination bus (measured as a flow into the branch).
    v_drop: (hynet_float_)
    Relative voltage magnitude drop from the source bus to the destination bus.
    angle_diff: (hynet_float_)
    Bus voltage angle difference in degrees between the source and destination bus.
    effective_rating: (hynet_float_)
    Ampacity in terms of a long-term MVA rating at the actual bus voltage. If no rating is available, it is set to numpy.nan.
    rel_err: (hynet_float_)
    Branch-related relative reconstruction error \(\kappa_k(V^\star)\) as defined in equation (24) in [2] in case of a relaxed QCQP or numpy.nan otherwise.
    dv_i_max_src: (hynet_float_)
    Dual variable or KKT multiplier of the ampacity constraint at the source bus or numpy.nan if unavailable.
    dv_i_max_dst: (hynet_float_)
    Dual variable or KKT multiplier of the ampacity constraint at the destination bus or numpy.nan if unavailable.
    dv_angle_min: (hynet_float_)
    Dual variable or KKT multiplier of the angle difference lower bound constraint or numpy.nan if unavailable.
    dv_angle_max: (hynet_float_)
    Dual variable or KKT multiplier of the angle difference upper bound constraint or numpy.nan if unavailable.
    dv_real_part: (hynet_float_)
    Dual variable or KKT multiplier of the +/-90 degrees constraint on the angle difference (cf. equation (27) in [3]) or numpy.nan if unavailable.
    dv_drop_min: (hynet_float_)
    Dual variable or KKT multiplier of the voltage drop lower bound constraint or numpy.nan if unavailable.
    dv_drop_max: (hynet_float_)
    Dual variable or KKT multiplier of the voltage drop upper bound constraint or numpy.nan if unavailable.
  • converter (pandas.DataFrame) –

    Unavailable if the result is empty and, otherwise, a data frame with the converter result data, indexed by the converter ID, which comprises the following columns:

    p_src: (hynet_float_)
    Active power flow in MW at the source bus into the converter.
    p_dst: (hynet_float_)
    Active power flow in MW at the destination bus into the converter.
    q_src: (hynet_float_)
    Reactive power injection in Mvar at the source bus into the grid.
    q_dst: (hynet_float_)
    Reactive power injection in Mvar at the destination bus into the grid.
    loss_err: (hynet_float_)
    Loss error in MW due to noncomplementary modes of the converter.
    loss_err_pre: (hynet_float_)
    Only available if the QCQP was pre-solved to detect and fix the converter modes. Loss error in MW in the pre-solution due to noncomplementary modes of the converter.
    dv_p_fwd_min: (hynet_float_)
    Dual variable or KKT multiplier of the lower bound on the converter’s forward mode active power flow or numpy.nan if unavailable.
    dv_p_fwd_max: (hynet_float_)
    Dual variable or KKT multiplier of the upper bound on the converter’s forward mode active power flow or numpy.nan if unavailable.
    dv_p_bwd_min: (hynet_float_)
    Dual variable or KKT multiplier of the lower bound on the converter’s backward mode active power flow or numpy.nan if unavailable.
    dv_p_bwd_max: (hynet_float_)
    Dual variable or KKT multiplier of the upper bound on the converter’s backward mode active power flow or numpy.nan if unavailable.
    dv_cap_src_q_min: (hynet_float_)
    Dual variable or KKT multiplier of the reactive power lower bound of the capability region at the source bus or numpy.nan if unavailable.
    dv_cap_src_q_max: (hynet_float_)
    Dual variable or KKT multiplier of the reactive power upper bound of the capability region at the source bus or numpy.nan if unavailable.
    dv_cap_dst_q_min: (hynet_float_)
    Dual variable or KKT multiplier of the reactive power lower bound of the capability region at the destination bus or numpy.nan if unavailable.
    dv_cap_dst_q_max: (hynet_float_)
    Dual variable or KKT multiplier of the reactive power upper bound of the capability region at the destination bus or numpy.nan if unavailable.
    dv_cap_src_lt: (hynet_float_)
    Dual variable or KKT multiplier of the left-top half-space of of the capability region at the source bus or numpy.nan if unavailable.
    dv_cap_src_rt: (hynet_float_)
    Dual variable or KKT multiplier of the right-top half-space of of the capability region at the source bus or numpy.nan if unavailable.
    dv_cap_src_lb: (hynet_float_)
    Dual variable or KKT multiplier of the left-bottom half-space of of the capability region at the source bus or numpy.nan if unavailable.
    dv_cap_src_rb: (hynet_float_)
    Dual variable or KKT multiplier of the right-bottom half-space of of the capability region at the source bus or numpy.nan if unavailable.
    dv_cap_dst_lt: (hynet_float_)
    Dual variable or KKT multiplier of the left-top half-space of of the capability region at the destination bus or numpy.nan if unavailable.
    dv_cap_dst_rt: (hynet_float_)
    Dual variable or KKT multiplier of the right-top half-space of of the capability region at the destination bus or numpy.nan if unavailable.
    dv_cap_dst_lb: (hynet_float_)
    Dual variable or KKT multiplier of the left-bottom half-space of of the capability region at the destination bus or numpy.nan if unavailable.
    dv_cap_dst_rb: (hynet_float_)
    Dual variable or KKT multiplier of the right-bottom half-space of of the capability region at the destination bus or numpy.nan if unavailable.
  • injector (pandas.DataFrame) –

    Unavailable if the result is empty and, otherwise, a data frame with the injector result data, indexed by the injector ID, which comprises the following columns:

    s: (hynet_complex_)
    Apparent power injection in MVA.
    cost_p: (hynet_float_)
    Cost of the active power injection in dollars or numpy.nan if no cost function was provided.
    cost_q: (hynet_float_)
    Cost of the reactive power injection in dollars or numpy.nan if no cost function was provided.
    dv_cap_p_min: (hynet_float_)
    Dual variable or KKT multiplier of the active power lower bound of the capability region or numpy.nan if unavailable.
    dv_cap_q_min: (hynet_float_)
    Dual variable or KKT multiplier of the reactive power lower bound of the capability region or numpy.nan if unavailable.
    dv_cap_p_max: (hynet_float_)
    Dual variable or KKT multiplier of the active power upper bound of the capability region or numpy.nan if unavailable.
    dv_cap_q_max: (hynet_float_)
    Dual variable or KKT multiplier of the reactive power upper bound of the capability region or numpy.nan if unavailable.
    dv_cap_lt: (hynet_float_)
    Dual variable or KKT multiplier of the left-top half-space of the capability region or numpy.nan if unavailable.
    dv_cap_rt: (hynet_float_)
    Dual variable or KKT multiplier of the right-top half-space of the capability region or numpy.nan if unavailable.
    dv_cap_lb: (hynet_float_)
    Dual variable or KKT multiplier of the left-bottom half-space of the capability region or numpy.nan if unavailable.
    dv_cap_rb: (hynet_float_)
    Dual variable or KKT multiplier of the right-bottom half-space of the capability region or numpy.nan if unavailable.

References

[1]G. D. Irisarri, X. Wang, J. Tong and S. Mokhtari, “Maximum loadability of power systems using interior point nonlinear optimization method,” IEEE Trans. Power Syst., vol. 12, no. 1, pp. 162-172, Feb. 1997.
[2]M. Hotz and W. Utschick, “The Hybrid Transmission Grid Architecture: Benefits in Nodal Pricing,” in IEEE Trans. Power Systems, vol. 33, no. 2, pp. 1431-1442, Mar. 2018.
[3]M. Hotz and W. Utschick, “A Hybrid Transmission Grid Architecture Enabling Efficient Optimal Power Flow,” in IEEE Trans. Power Systems, vol. 31, no. 6, pp. 4504-4516, Nov. 2016.
original_scenario

Return the original scenario data.

scenario

Return the scenario with the identified maximum load.

Module contents

Maximum loadability functionality in hynet.