Bilevel PV and tap control API

The bilevel example optimises a utility tap setting while PV systems respond through their local controls. The search uses local voltage sensitivities and is compared with a centralised optimisation. This is a proof of concept for the specified network and control model.

PowerOptLab.BilevelPVResult — Type
BilevelPVResult

Result of solve_bilevel_pv_tap. tap is the user-facing tap multiplier, exported_power_W is the lower-level aggregate PV export, and voltages_V contains monitored voltage magnitudes keyed by (bus, phase). converged and termination_reason describe the upper-level search; a lower-level LOCALLY_SOLVED status alone is not an upper-level convergence certificate.

The lower-level consumers are represented by one BMOPFTools native IBR each. Their Volt-var and Volt-watt curves are therefore part of the differentiated network model. lower_level=:aggregate uses a shared aggregate-export objective; lower_level=:local_controller instead ties each PV's active output to its own Volt-watt response, with Volt-var priority enforced through a smooth apparent-power cap.

source
PowerOptLab.BilevelPVResponse — Type
BilevelPVResponse

Fixed-tap lower-level response used for sensitivity validation and experiment scripts. The response contains the solved PV export, monitored voltages, and the local DiffOpt derivative of each monitored voltage with respect to the utility tap multiplier.

source
PowerOptLab.solve_bilevel_pv_tap — Function
solve_bilevel_pv_tap(net; transformer_id, pv_ids, monitored_buses,
    tap_initial=1.0, tap_bounds=(0.95, 1.05), ...)

Solve the POC hierarchy. With lower_level=:aggregate, the lower level maximises aggregate PV active export with native BMOPFTools Volt-var/Volt-watt control curves active. With lower_level=:local_controller, each PV follows its own Volt-var/Volt-watt response and the lower-level objective is constant; the extra equations are differentiated as part of the network equilibrium. The upper level minimises a smooth fourth-power voltage-stress metric plus tap movement, using DiffOpt's implicit KKT derivative and a safeguarded one-dimensional derivative search. voltage_measurement selects the monitored phase-to-neutral, phase-to-ground, or cyclic phase-to-phase quantity.

This is intentionally a local, smooth-region experiment: it is not a global solution method for a nonconvex bilevel problem. Each upper-level trial builds and solves a fresh lower-level model, which avoids making the reported response path depend on a rejected warm start. At a Volt-watt kink or active-set transition, inspect differentiability_report and validate the final point by perturbing the tap and resolving the lower level.

source
PowerOptLab.solve_bilevel_pv_response — Function
solve_bilevel_pv_response(net; transformer_id, pv_ids, monitored_buses,
    tap=1.0, tap_bounds=(0.95, 1.05), lower_level=:aggregate, ...)

Solve one fixed-tap lower-level response and return its local voltage sensitivity with respect to the tap. This is the public diagnostic counterpart to the differentiated response used by solve_bilevel_pv_tap: it is useful for comparing DiffOpt derivatives against finite differences and for checking sensitivity quality near Volt-watt transitions. voltage_measurement selects phase-to-neutral (:pn), phase-to-ground (:pg), or cyclic phase-to-phase (:pp) monitoring; outputs are keyed by (bus, phase).

source
PowerOptLab.solve_single_level_pv_tap — Function
solve_single_level_pv_tap(net; transformer_id, pv_ids, monitored_buses, ...)

Solve the centralized comparison: utility tap and all PV operating points are chosen in one BMOPFTools/JuMP OPF. The objective is the same voltage stress and tap movement used by the bilevel upper level. An optional normalized PV export reward can be enabled explicitly with export_weight. This is a benchmark for the coordination gap, not the consumer hierarchy.

source