Shared interfaces and API index
This reference describes solution status, time intervals and the interfaces used to add devices and measurements. The links below lead to the functions and input parameters for each study. The symbol index provides alphabetical lookup across all chapters.
Module
PowerOptLab — Module
PowerOptLabModels and numerical methods for studying four-wire distribution networks with uncertain states and parameters. The package provides separate methods for estimation, optimisation and checking operating points. Joint network-model identification and automatic experiment design remain research objectives.
PowerOptLab builds on the BMOPFTools reference current–voltage OPF engine, using its public model-building functions (model_hook! / solution_hook! and the staged build_opf_model / optimize_opf! / generation_cost / extract_result API) rather than forking the engine. Experimental devices and formulations reuse the engine's neutral-explicit physics, per-unit handling, and result extraction. Stable foundational work can later be proposed for the BMOPF spec.
Contributions are organised by what layer of the engine they extend:
Component models — new network elements (src/components/)
Added to the network equations through model_hook! / solution_hook!.
- Storage / EV (
StorageDevice,EVDevice) — battery/EV inverter currents included in KCL, with an energy-balance equation between intervals (an energy/power "PE" model with fixed efficiency). - IVQ battery (
IVQBattery) — the current–voltage counterpart: cells of aBatteryChemistrymodelled in the voltage–current–charge space (v = OCV(soc) − i·R), so voltage and current limits bind individually and a current-dependent cell efficiency emerges from the physics (a Rint proxy, not a full round-trip energy efficiency). Reuses theAdvancedInverterfor the AC↔DC converter. - Advanced inverter (
AdvancedInverter) — an experimental internal-AC-node IBR with an output filter, internal-EMF/DC-modulation bounds, grid-forming operation, converter losses, and double-frequency ripple limits.
Problem specifications — new formulations over the staged API (src/problems/)
A different objective/variable/constraint structure on the same physics.
- Multi-period OPF (
solve_multiperiod_opf) — several network snapshots co-optimised in one model with storage/EV state linking each step to the next. - State estimation (
solve_state_estimation) — weighted least-squares estimation of the network state from noisy measurements (an inverse problem on the same physics). - Constrained NLLS state estimation (
solve_sparse_state_estimator) — a neutral-explicit model of measurement residuals and network equations with tangent-space observability, selected local covariance, and sparse or dense reference solves. - Parameter estimation (
solve_parameter_estimation) — calibration of uncertain line lengths and transformer tap ratios from smart-meter data across multiple time steps (the shared-parameter dual of state estimation). - Inverse Carson reconstruction (
solve_inverse_carson) — screens discrete overhead construction candidates against diagonal sequence data, retaining ambiguity and local identifiability diagnostics while reconstructing a full primitive, neutral-explicit line model. - Dynamic operating envelopes (
solve_operating_envelope) — per-connection-point active-power import/export capacity with parameterized fairness, forecast/model scenarios, explicit corner-security semantics, and prescribed IBR Q-V controls retained from the network model. - Bilevel PV/tap POC (
solve_bilevel_pv_tap) — differentiated aggregate-export and local-controller lower levels with native Volt-var/ Volt-watt controls, compared with a centralized single-level tap/export solve. - Network-scale inverter-control studies (
solve_controlled_inverter_fleet) — selected dataset IBRs are replaced by phase-aware advanced inverters in one simultaneous snapshot, with records of the model used for each device and quantities for equipment rating comparisons.
Solution methods (src/algorithms/)
Alternative numerical methods for solving the network equations.
- HELM (
solve_pf_helm) — the Holomorphic Embedding Load-flow Method: a non-iterative power flow that expands each voltage as a power series in a load-scaling parameter and evaluates it by Padé analytic continuation. Physical mismatch, Padé spread, and coefficient-tail diagnostics distinguish convergence from finite-order numerical divergence without treating the latter as a non-existence certificate.
Everything is SI at the interface; per-unit conditioning inside the solve is handled via the engine's opf_bases(ctx) accessor.
Results and time intervals
PowerOptLab.SolveOutcome — Type
SolveOutcomeNormalized MathOptInterface solve status used by PowerOptLab entry points. has_primal records whether the optimizer returned a candidate point, feasible requires a fully feasible primal status, and optimal additionally requires OPTIMAL or LOCALLY_SOLVED termination. Only optimal outcomes are published as final numerical results by the research optimization wrappers.
acceptable identifies MOI's relaxed ALMOST_OPTIMAL / ALMOST_LOCALLY_SOLVED outcomes. It is exposed for diagnostics but is not silently promoted to an optimal result.
PowerOptLab.SolveStatus — Type
Normalized, user-facing status returned by solve_status.
PowerOptLab.AbstractSolveResult — Type
Common supertype for structured solver results. Use solve_status and solve_diagnostics instead of interpreting result-specific strings.
PowerOptLab.solve_status — Function
solve_status(result)
solve_status(model::JuMP.Model)Return the normalized SolveStatus for a structured result or a composed JuMP model. Use the model overload after solving an external OPF and pass its status to extract_device; unsuccessful or unstarted solves are not publishable. A publishable local optimum does not establish global optimality. Standalone inverter results additionally require an independent SI-model feasibility report; their solver status strings and feasible/optimal flags remain available even when physical acceptance rejects publication. The model overload reports solver evidence only.
PowerOptLab.solve_diagnostics — Function
Return result-specific numerical diagnostics as a named tuple.
PowerOptLab.TimeGrid — Type
TimeGrid(durations_h)
TimeGrid(periods, duration_h=1.0)Validated period durations in hours. durations_h[t] weights both the period's rate objective and its state transition, so nonuniform horizons do not silently assume one-hour snapshots.
PowerOptLab.MultiContext — Type
A JuMP model and the BMOPFTools contexts built into that shared model.
PowerOptLab.build_multi_context — Function
build_multi_context(nets; hook_factory, kwargs...) -> MultiContextBuild every network snapshot into one JuMP model through BMOPFTools' staged API. hook_factory(t) returns the model_hook! for snapshot t. The builder centralizes the shared optimizer, solver options, time index, and common unit settings; callers add linking constraints/objectives and then call BMOPFTools.optimize_opf!(multi.contexts...) to finalize KCL and solve once. Pass an existing model when shared variables/operators must be created first. configure! = identity receives the model before optimizer attachment when this builder creates it. With an existing model, the caller owns optimizer attachment. optimizer=nothing leaves a newly created model unattached.
Extension interfaces
PowerOptLab.AbstractDevice — Type
Common supertype for network devices contributed by PowerOptLab.
PowerOptLab.device_id — Function
Return the stable identifier used to key a device's handles and results.
PowerOptLab.validate_device — Function
Validate a device against a horizon before adding variables or constraints.
PowerOptLab.stamp_device! — Function
Stamp one device into one BMOPFTools model context and return its handles.
PowerOptLab.link_device! — Function
Link one device's per-period handles across a TimeGrid.
PowerOptLab.extract_device — Function
Extract one device's published numerical result from its model handles.
PowerOptLab.AbstractMeasurement — Type
Common supertype for scalar telemetry consumed by estimation problems.
PowerOptLab.measurement_kind — Function
Return the symbolic quantity represented by a scalar measurement.
PowerOptLab.measurement_value — Function
Return a scalar measurement's SI value.
PowerOptLab.measurement_sigma — Function
Return a scalar measurement's positive SI standard deviation.
PowerOptLab.measurement_prediction — Function
measurement_prediction(kind, dvr, dvi;
ir=nothing, ii=nothing, magnitude=nothing, magnitude_epsilon=0)Evaluate the shared scalar measurement model from a complex voltage drop dvr + im*dvi and, for power/current quantities, a complex current ir + im*ii.
Supported node kinds are :vr, :vi, :vmag, :pinj, and :qinj; supported branch kinds are :ire, :iim, :imag, :pflow, and :qflow. Injection and flow powers use the same V * conj(I) convention. Pass an auxiliary nonnegative magnitude when a JuMP formulation represents |V| explicitly; otherwise the magnitude is evaluated directly. A positive magnitude_epsilon supplies the smooth magnitude used by compiled state estimation.
The function is generic over numbers, automatic-differentiation values, and JuMP expressions so every estimation formulation uses the same physical measurement equations.
Devices
Generator models, battery storage and electric vehicles each have their own API reference.
Multi-period OPF
See the multi-period scheduling API.
Legacy WLS state estimation
See the state estimation API.
Constrained NLLS state estimation
See the state estimation API.
Parameter estimation
See the parameter calibration API.
Inverse Carson reconstruction
See the line reconstruction API.
Bilevel distribution-network proof of concept
See the bilevel PV and tap control API.
Advanced inverter
See the advanced inverter API.
Phase-aware inverter controls
See the phase-aware control API, fleet study reference and closed-loop evidence reference.
Current–voltage (IVQ) battery
See the battery storage API.
HELM power flow
See the HELM API.
Explicit-neutral Kron reduction
See the neutral reduction reference and API.
Post-OPF operability
See the operability API.
Numerical formulations
See the function formulation API.