Constrained nonlinear least-squares state estimation
Kind: Problem specification (compiled) · Maturity: prototype · Direction: inverse · Temporal: single snapshot or sequential time series
This is the new four-wire estimator. It solves the equality-constrained nonlinear least-squares problem
\[\min_x \frac12\lVert r(x)\rVert_2^2 \qquad \text{subject to}\qquad c(x)=0.\]
It also offers a classic Ipopt backend over the same compiled evaluator. Every solver reports the conventional statistic J=sum(abs2,r) and degrees of freedom through solve_diagnostics; the factor one half above is only an internal optimization convention. The original native WLS formulation remains separate; see Choosing a formulation for the head-to-head. Use this API when the distinction between uncertain information and a genuinely exact electrical equation matters, or when branch telemetry, exact nonlinear devices, or selective covariance are required. Both estimators retain explicitly modelled ungrounded neutral voltages.
The dense, sparse and shared Ipopt solvers are reference/prototype implementations. The sparse Hachtel step and 5–40-bus feeder comparisons are available, but broader scaling studies, bad-data processing, topology hypotheses, ideal-transformer current states, and sparse rank/covariance backends remain future work.
Electrical support preflight and initialization
Call state_estimator_preflight(net, measurements; zero_injection, exact_devices, injection_connections) before compiling to inspect the snapshot interpretation. The same report is retained as structure.preflight; compilation throws SEUnsupportedNetwork with its report if any error is present. supported means representable by this compiled finite-primitive model. It does not certify observability, a correct network calibration, or convergence.
Switch topology follows BMOPFTools: open_switch=true leaves the terminals separate; false or an absent field closes the switch. Preflight reports this interpretation and rejects non-Boolean values and the unsupported legacy status field, which would otherwise be ignored by upstream Ybus assembly.
report = state_estimator_preflight(net, measurements)
report.findings # severity, code, element, explanation
report.elements # passive elements, aliases, fixed taps
report.omitted # injections, controls, operating bounds
report.sources # prescribed phasors
report.grounded_terminals # declared perfect grounds
report.measurements # locations and voltage references
report.exact_equations # requested zero injections and devices
s = compile_state_estimator(net, measurements)
p = SEParameters(s, measurements)
x0 = initial_state_estimator(s, p)
result = solve_sparse_state_estimator(s, p, x0)The initializer solves the free-conductor, load-free current equations with sparse QR using the current source phasors. Transformer ratios and phase shifts therefore enter the initial guess. This is a numerical starting point, not a load-flow operating point, a prior, or an extra measurement. A source-free or reference-deficient network may require a physical warm start; floating modes are not repaired by initialization. Trust-region voltage scaling uses local load-free bus levels (with a 1 V floor), so a low-voltage secondary does not inherit the primary's voltage scale. Neutral components inherit their bus's phase scale without being grounded.
| Electrical feature | Contract |
|---|---|
| Finite lines, shunts and capacitors | Valid finite primitives and declared terminal maps required |
| Closed ideal switches / negligible-impedance line aliases | Imported as node aliases; open switches remain open |
| Single-phase, center-tap, wye–delta, delta–wye transformers | Finite leakage, valid winding maps and positive fixed ratios |
| Single-phase and open-delta regulators | Finite leakage and known fixed taps; no automatic control or tap estimation |
| General n-winding transformers | Finite primitive, positive winding voltages, nonnegative winding resistance, WYE/DELTA connections, equal nonzero phase counts and a/b/c/n names required; independent three-winding tests include mixed connections and grounding |
| Ideal or degenerate transformers | Rejected; auxiliary current states and exact winding relations require a future augmented formulation |
| Loads, generators and inverters in network data | Not automatically imported as injections; listed in omitted |
| Operating limits and controls | Inventoried but not imposed on the estimated state |
Do not insert an arbitrary small transformer impedance to bypass rejection. Use physical leakage data or an appropriate augmented formulation. The guard matches the pinned BMOPFTools exporter: ordinary transformer leakage components all at or below 1e-6 ohm are classified as ideal, and series-line norm at or below 1e-4 ohm follows its alias rule. These are exporter thresholds, not physical accuracy guarantees. Primitive warnings become preflight errors, rather than allowing a skipped or shunt-only substitute to pass silently.
For n-winding data, fixed ratios are encoded in the winding v_nom values; separate tap fields, including winding-local taps, are rejected because the exporter does not apply them. Use configuration="WYE" or "DELTA", not connection. WYE v_nom is the phase-neutral coil voltage; DELTA v_nom is the phase-phase coil voltage. r_winding is in ohms on that winding's coil base, and every pair in x_sc is referred to winding 1's coil base.
A DELTA map contains phases only. delta_roll=1 connects each phase to the next phase in its ordered map; -1 connects it to the preceding phase. These are explicit coil orientations, not universal OpenDSS lead/lag labels: matching vector groups also depends on the reference connection and conductor order. Other roll values are rejected. For an explicit WYE neutral, include n in the winding and bus maps. Leaving that neutral ungrounded preserves its state; use perfectly_grounded_terminals for an ideal earth bond or a separate finite shunt for an electrode. N-winding r_neutral/x_neutral fields are rejected because the exporter ignores them. A WYE map without n references its coils directly to earth and cannot represent a floating star point.
Recompile after changing taps, topology, impedances or terminal maps. SEParameters updates measurements, source phasors and supported exact-device parameters; it cannot change compiled transformer ratios. A forecast remains an uncertain measurement with an appropriate covariance, rather than an exact zero-injection constraint. A successful preflight does not turn nominal load data into pseudomeasurements.
Transformer and regulator validation
test/state_estimation_network_tests.jl exercises both compiled solvers on single-phase (including a 1.03 primary tap), wye–delta, delta–wye and center-tap transformers, single-phase and open-delta fixed regulators, and SE-IEEE13-finite. The component fixtures and OpenDSS decks are versioned under test/; their provenance and modifications are recorded alongside the decks.
SE-IEEE13-finite is a deliberately modified IEEE 13-node network: finite winding resistance of 0.5% per winding, regulator XHL of 1%, transformer XHL of 2%, fixed unequal phase taps, constant-power loads, omitted line shunts, and a source at bus 650. It includes mixed phases, delta loads, mutual line coupling and a 4.16 kV / 480 V voltage transition. It is not a reproduction of the original IEEE operating case. The open-delta component includes physical 1 kΩ phase-to-earth shunts; compilation also preserves its ideal shared-phase copper bond.
OpenDSS supplies conductor voltages. Injection readings are constructed from specified load currents and those voltages, independently of the estimator's Ybus evaluator. Actual OpenDSS source-terminal voltages are used as the fixed boundary, avoiding an artificial disagreement from source impedance. Tests use redundant rectangular-voltage and active/reactive injection readings, exact zero-injection equations, and reproducible Gaussian perturbations. Both solvers start from the load-free initializer. They must converge uniquely, satisfy the exact equations, agree with each other, and yield finite selected covariance.
Voltage-component errors are divided by the corresponding oracle phasor magnitude (100 V floor), rather than by an imaginary component near zero. The regression bounds are 0.2% for clean data and 0.6% for the noisy realization. Voltage standard deviations are 0.2% of that phasor scale; power standard deviations are 1% of apparent injection (10 W/var floor). Noise is one standard deviation with seed 349. The estimator stationarity tolerance is 1e-6 in its residual-equivalent norm; exact-current constraints retain the default solver tolerance. JuMP objective agreement is checked at atol=rtol=1e-5, and fitted state components agree within 0.01 V. These tolerances are regression acceptance criteria, not confidence bounds.
A separate JuMP/Ipopt WLS formulation differentiates scalar measurement equations independently and checks the fitted state and objective. This is an independent optimization check, not an independent admittance model: it shares the compiled electrical matrices. OpenDSS provides the separate physical-model comparison. Noisy fits need not interpolate every reading.
This is a regression matrix, not a Monte Carlo uncertainty-calibration study or a proof of coverage for general distribution networks. It uses generous redundant instrumentation; sparse field telemetry, correlated load forecasts, bad data, unknown taps, switching hypotheses, automatic regulator controls, ideal transformers and large-feeder runtime/memory scaling need separate validation. Finite transformer-port telemetry has a separate compatibility regression suite, including all three shared solvers.
Run the complete reproducible matrix with julia --project -e 'using Pkg; Pkg.test()'; OpenDSSDirect is a declared test dependency.
Modelling decisions
Three kinds of information
The formulation deliberately keeps three categories separate.
| Category | Representation | Examples |
|---|---|---|
| Network identity | compiled into SEStructure | passive Ybus, conductor incidence, closed-switch aliases |
| Exact equation | c(x)=0 | true zero injection, exact device law, ideal source relationship |
| Stochastic information | whitened residual r(x) | meters, forecasts, nominal loads, state priors |
A small meter variance does not make a reading exact. Exact constraints reduce the feasible tangent space and can make a model inconsistent; use them only for physics known without uncertainty.
State, grounding, and references
The state is rectangular conductor-to-ground voltage, [real(V_free); imag(V_free)]. A source terminal with an imposed phasor is eliminated into the fixed-voltage parameter vector. Perfectly grounded BMOPF terminals are earth (V=0); an ungrounded neutral remains an explicit state. Thus a global phasor reference is not silently confused with a neutral ground. Floating/common-mode freedoms appear in the tangent-space observability result.
Four-wire KCL is stated per conductor against earth, so a bare bus id in zero_injection expands over all of the bus's non-grounded terminals, its neutral included: nothing attached to a bus means nothing injected into any of its conductors. The WLS estimator states zero injection per phase against a return terminal and deliberately expands over phase terminals only. Passing (bus, terminal) tuples is explicit either way.
An unknown customer path cannot touch a declared zero-injection conductor, including through an electrical alias. Preflight reports :conflicting_injection_declaration for that contradictory input, consistently across formulations. Customer P/Q Measurements declare such paths; use NetInjectionMeasurement to observe a known zero without declaring an unknown customer. Exact-device currents remain included in KCL when zero injection is declared alongside a known device.
compile_state_estimator imports BMOPFTools' passive I = YV in SI units. Closed ideal switches use BMOPFTools' node aliases. The compiled structure owns ordering and sparsity; SEParameters owns readings, standard deviations, source phasors, device values, and priors. Update parameters between snapshots instead of recompiling whenever topology is unchanged.
SEParameters(structure, measurements; exact_devices=...) checks measurement kinds, element locations, references, callbacks, and row order against the compiled pattern. It also checks exact device kinds and oriented connections. Reordering measurements or changing a device's location or law requires recompilation; having the same number of rows or devices is insufficient. Values and standard deviations may change freely within their finite-value contracts.
Sign convention
Passive and branch currents are positive from a bus into an element. An exact device branch current is positive from TerminalConnection.positive to .negative; positive constant power therefore denotes consumption. Use signed negative power for generation. Branch :pflow/:qflow have the same into-the-line convention at the requested side.
Build and solve
using PowerOptLab
using BMOPFTools: parse_bmopf
# Minimal runnable feeder, with all quantities in SI units.
net = parse_bmopf("""
{"bus":{"src":{"terminal_names":["1"]},
"b1":{"terminal_names":["1"]},"b2":{"terminal_names":["1"]}},
"voltage_source":{"s":{"bus":"src","terminal_map":["1"],
"v_magnitude":[230.0],"v_angle":[0.0]}},
"linecode":{"lc":{"R_series_1_1":0.1}},
"line":{"l1":{"bus_from":"src","bus_to":"b1","terminal_map_from":["1"],
"terminal_map_to":["1"],"linecode":"lc","length":1.0},
"l2":{"bus_from":"b1","bus_to":"b2","terminal_map_from":["1"],
"terminal_map_to":["1"],"linecode":"lc","length":1.0}}}
"""; from_string=true)
measurements = [
Measurement(kind=:vr, bus="b1", terminal="1", reference=nothing,
value=230.0, sigma=1.0),
Measurement(kind=:vi, bus="b1", terminal="1", reference=nothing,
value=0.0, sigma=1.0),
Measurement(kind=:vmag, bus="b2", terminal="1", reference=nothing,
value=230.0, sigma=1.0),
]
structure = compile_state_estimator(net, measurements;
neutral="n",
zero_injection=[("b2", "1")])
parameters = SEParameters(structure, measurements)
nf = length(structure.free_state_map)
x0 = vcat(fill(230.0, nf), zeros(nf)) # nonzero magnitude start
# Dense: transparent small-system reference solver.
dense = solve_compiled_state_estimator(structure, parameters, x0)
# Sparse: augmented Hachtel/SuiteSparse-QR step solver.
sparse = solve_sparse_state_estimator(structure, parameters, x0)Successful first-order termination is reported as :converged_unique or :converged_underobserved. The latter has locally unobserved directions. Neither status certifies a global solution or a strict local minimum. Other statuses distinguish, among other conditions, constraint restoration failure, invalid_initial_domain, trust-region stall, :undefined_derivative (a :vmag or :imag row sitting exactly at zero, where the magnitude derivative does not exist), and numerical failure. A numerical reduced-Lagrangian curvature check rejects negative curvature with :stationary_not_minimum; :curvature_check_failed means a nearby domain/derivative evaluation prevented the check. These are non-publishable statuses. The check is performed at nonlinear stationary points with non-negligible residuals; it is not a formal second-order certificate.
It reports that the reduced Jacobian $HZ$ has full rank at the returned point. It is not a global uniqueness certificate. Two distinct states can each earn it while fitting the same data exactly — see current-magnitude measurements.
Step acceptance and convergence
penalty is the initial merit weight. Both solvers increase it when a step's predicted objective cost would overwhelm its predicted feasibility improvement. The merit penalty uses max(norm(c) - ctol, 0), where ctol is the same absolute/relative feasibility threshold used for convergence. Predicted and actual reductions use this identical numerical deadband: roundoff in an already feasible KCL equation cannot veto a final objective improvement. Convergence still requires both feasibility and stationarity; a small step or merit change alone is insufficient. Objective reductions use difference-of-squares identities to reduce cancellation near a nonzero-residual optimum. The history records the changing penalty and separates measurement from prior objectives, so merit values can be interpreted with their associated weight. The dense solver uses SVD least-squares steps for rank-deficient systems; the sparse system uses a negative primal diagonal so eliminating the residual block adds positive damping to the reduced least-squares operator. These safeguards do not constitute a general global-convergence or infeasibility certificate.
Convergence tolerances are scale relative
norm(c) is a difference of $YV$ products, so the smallest value it can reach in double precision scales with the network's SI current magnitude — near $5\times10^3$ A on a 230 V feeder with 20 S conductors, near $3\times10^9$ A on a 132 kV feeder with short 20 kS segments. Feasibility is therefore tested against max(constraint_tolerance, constraint_rtol * current_scale): the absolute request acts as a floor, so small networks behave exactly as before, while a high-voltage network is no longer asked for a precision that double precision cannot deliver. Stationarity is divided by norm(H, Inf), so optimality_tolerance reads in units of the whitened residual rather than in whatever units $\partial h/\partial x$ happens to carry.
Both solvers require finite, non-negative feasibility, stationarity, and rank tolerances. Trust-region radii and the merit penalty must be finite and positive; sparse damping must be finite and non-negative. In particular, constraint_tolerance=Inf is rejected rather than turning every initial point into a feasible estimate. Zero absolute or relative tolerances are allowed.
Measurements
All values are SI and every scalar has an independent standard deviation sigma; residual rows are (prediction - value) / sigma.
Terminal measurements
Measurement supports:
:vr,:vi,:vmag— voltage component/magnitude across terminal to itsreference(default:neutral;nothing: earth);:pinj,:qinj— terminal injection power into the passive network.
Declare unknown injection paths independently of telemetry with compile_state_estimator(...; injection_connections=[TerminalConnection(("b1", "1"), ("b1", "n"))]). Pass the same keyword to preflight. A declaration fixes only the electrical connection, not its power or current. Retain all physical connections when compiling a snapshot with missing P/Q channels. With the default injection_connections=nothing, paths are inferred from power measurements for compatibility; removing the last P/Q row for a customer then removes its path. An explicit list is authoritative: each power measurement must match a declared positive terminal and electrical return. Voltage and line readings declare no paths. injection_connections=[] declares none.
For a customer connected between a phase and an ungrounded neutral, the estimator enforces $I_{\mathrm{phase}} + I_n = 0$ exactly. Several measured phases sharing a neutral give one combined equation, $\sum_p I_p + I_n = 0$. The P/Q readings remain stochastic residuals; their values and standard deviations do not set the return current. These equations also include any explicit device currents.
Return equations are assembled from connected components of the declared terminal-to-reference injection paths, using the merged Ybus node index. A component connected to earth (reference=nothing or a perfectly grounded terminal) or an ideal-source terminal has an unconstrained boundary return, so it adds no current-sum constraint. All unknown injections sharing an ungrounded return must be included in the declared or inferred connections; use an earth reference only for an actual earth return.
P and Q readings of one original (bus, terminal) describe one customer and must use the same electrical return. Grounded-terminal and explicit earth references are equivalent. Conflicting references are rejected, independently of row order. The default formulation=:auto adds explicit unknown-current states for overlapping paths, merged customers and partially exact shared conductors. Mixed delta/wye customers and a known device sharing a neutral with an unknown customer are supported. formulation=:voltage explicitly requests the narrower elimination contract; :current uses current states for all unknown customer paths. Current indices are available through injection_state_indices(s) and follow the rectangular voltage entries.
Customers on merged buses
Ideal-switch aliases share voltage, but distinct original (bus, terminal) identities retain distinct customer powers. Their powers add to the merged node's total; repeated readings of the same original customer measure the same quantity. The optional formulation=:voltage evaluator profiles out these individual powers: it fuses repeated readings by precision, sums customer means and independent variances, and allocates any discrepancy according to those variances. evaluation.predicted reports these conditional customer predictions in the original row order. Residuals and the objective retain disagreement between repeat readings; the voltage Jacobian and covariance use the profiled information. Predictions for these rows therefore depend on both readings and sigmas, as well as voltage. The default explicit-current formulation uses finite branch currents and S=U*conj(I) directly, including at zero voltage. Optional power profiling assumes a nonzero connection voltage: individual powers cannot be allocated to finite customer currents at zero voltage. Evaluation and Jacobians reject voltage drops below SEParameters.voltage_min_model (default 0.001 V); solvers reject such initial points as :invalid_initial_domain and reject trials outside that domain. This domain guard also applies when positive and negative customer powers cancel to zero net power.
If any declared customer lacks a P or Q component, other customers' readings of that component alone do not constrain the node total: the unmeasured customer can absorb the remaining power. Neither a missing channel nor an unmeasured declared connection implies zero injection. To represent a meter of the entire node total, declare one aggregate injection identity and supply its aggregate readings rather than labelling a customer reading as a total.
evaluation.constraints and the sparse solver's multipliers list explicit zero-injection/device conductor equations first, followed by the return-current component equations, with real and imaginary rows interleaved in both blocks.
Magnitude derivatives are undefined at zero. Set SEParameters(...; magnitude_epsilon=...) only when smoothing below the instrument's meaningful resolution is appropriate. It applies to :vmag; branch and net-injection :imag use current_epsilon in amperes. Note that a smoothed magnitude row evaluated at exactly zero is differentiable but information-free — its gradient there is zero — so zero gradient is not evidence of minimisation. If the requested magnitude is larger than the smoothed prediction, the point can be a local maximum and the solver reports :stationary_not_minimum. See current-magnitude measurements.
Line telemetry
BranchMeasurement attaches to a named BMOPF line and side=:from or :to:
BranchMeasurement(kind=:imag, line="l1", side=:from, terminal="1",
value=12.3, sigma=0.2) # amperes
BranchMeasurement(kind=:pflow, line="l1", side=:to, terminal="1",
value=-2_000.0, sigma=50.0) # watts into the lineSupported kinds are :ire, :iim, :imag, :pflow, and :qflow. They use BMOPFTools' public line_yprim primitive, so linecode truncation and shunt stamping match the passive network model exactly. This requires the BMOPFTools release containing line_yprim (introduced by PR #348). Current telemetry on a grounded neutral conductor remains meaningful and is supported. Its earth-referenced active/reactive power is identically zero, because that conductor's voltage is fixed at zero.
Element power defaults to earth-referenced voltage. Pass reference="n" for phase-to-neutral power on that element's bus. The compiled API also accepts TransformerMeasurement, ShuntMeasurement, NetInjectionMeasurement and FunctionalMeasurement; see measurement and electrical compatibility for port semantics, grounding restrictions and user-defined functions. All three shared solvers, including solve_ipopt_state_estimator, use the same equations.
Exact devices and continuation
Use ExactDeviceEquation only when a device law is truly exact. TerminalConnection is a general oriented branch: phase-neutral connections model wye/single-phase devices; phase-phase connections model delta devices.
Known and unknown customer devices may share free conductors, including a neutral. The default compiler assigns explicit states to the unknown currents and includes every known device current in KCL. Without an explicit unknown declaration, a measurement matching an original exact-device connection meters that known device. An explicit injection_connections path declares an additional unknown customer even on those same endpoints; matching P/Q meters then describe the unknown customer. Preflight records an :info finding with code :reinterpreted_customer_measurement for each affected row, naming its row number and customer terminal. Positive exact-device power is consumption, while positive customer power injects into the network.
An ideal source supplies its attached devices through a free boundary current. An exact device at a source therefore adds KCL only on any free endpoint; it does not impose zero net current at a source-fixed conductor.
load = ExactDeviceEquation(ConstantPowerDevice(
[TerminalConnection(("b1", "1"), nothing)] # earth return in this one-wire example,
ComplexF64[4_000 + 1_000im],
))
structure = compile_state_estimator(net, measurements; exact_devices=[load])
parameters = SEParameters(structure, measurements; exact_devices=[load],
voltage_min_model=1.0)
result = solve_with_continuation(structure, parameters, x0;
alphas=[0.0, 0.5, 1.0])The constant-current term is a fixed complex phasor; it does not rotate with the terminal voltage to preserve power factor. ZIPDevice implements the explicit law conj(S/V) + I + YV, rather than every conventional ZIP-load parameterisation.
Available models are ConstantPowerDevice, ConstantCurrentDevice, and ZIPDevice. Constant-power evaluation rejects trial states below voltage_min_model. Continuation starts with a regularised internal law and must finish at α=1 before accepting a physical result.
A converged stage with a nonzero constant-power term and α<1 reports :converged_regularized. It is not publishable through solve_status, and a time-series driver stops instead of accepting it as a physical snapshot. The continuation driver accepts it only as an intermediate stage, and publishes only after reaching the physical α=1 model. Failed or interrupted-by-exception continuation restores the caller's original continuation_alpha; success leaves it at one.
A named perfectly grounded return, such as TerminalConnection(("b1", "1"), ("b1", "n")) when that neutral is declared grounded, is equivalent to an explicit earth return. A source may explicitly list its grounded neutral at zero volts; a nonzero source phasor on an ideally grounded terminal is rejected.
Diagnostics, multipliers, and uncertainty
observability_diagnostics evaluates rank on the tangent space H*Z, where C*Z=0; rank of the raw measurement Jacobian alone is not the relevant test. unobservable_directions generates local directions only on request.
Use selected_state_covariance or derived_covariance for requested covariance blocks/derived quantities. They throw when the tangent requested quantity depends on an unobservable tangent direction. A locally identifiable quantity can have finite first-order covariance even when other state directions remain unobserved. This does not establish global identifiability.
The sparse result exposes constraint_multipliers in the same order as evaluation.constraints. Large, physically scaled multipliers are a useful lead for a bad zero-injection label or an incorrect exact-device specification; they are diagnostics, not automatic proof of a bad constraint.
Time series
For unchanged topology, provide one parameter object per snapshot:
p1 = SEParameters(structure, measurements_t1; exact_devices=[load])
p2 = SEParameters(structure, measurements_t2; exact_devices=[load])
series = solve_time_series_state_estimator(structure, [p1, p2], x0;
previous_state_sigma=10.0,
solver=:sparse)The prior from snapshot t-1 is a whitened residual, not a hard voltage constraint. The driver warm-starts each snapshot, stops on the first failed one, and returns :time_series_stalled without publishing later estimates. solve_diagnostics(series).requested_snapshots retains the original request count, while length(series.snapshots) includes only attempted solves and completed_snapshots counts successful ones.
A prior the caller configured on an SEParameters is preserved. When previous_state_sigma is supplied the previous-state prior is layered on top of it rather than replacing it. Algebraically, duplicated indices add independent quadratic rows. That is statistically justified only if the information sources can be treated as independent; a previous estimate usually reuses earlier meter data and therefore should not be described as a second independent meter.
This driver is temporal regularisation, not a state-space filter: it does not propagate the previous covariance, specify process noise, or account for cross-time correlation. Choose previous_state_sigma as an explicit movement assumption and do not interpret the resulting local covariance as a complete filtered posterior.
Current limitations
- Diagonal measurement covariance only; no correlated whitening yet.
- Finite line, transformer-port and shunt telemetry and custom voltage functions are supported. Uncertain source-phasor and reference-angle error models remain pending; ideal-device reaction currents need additional equipment equations.
- No robust bad-data test, automated bad-constraint ranking, topology-error hypothesis search, or full filter globalisation.
- Jacobians use sparse triplets and cached transposed operators for row access. Sparse rank/uncertainty methods and cached symbolic factorisations are not yet production-scale implementations. Native WLS current-observability diagnostics compile the current model twice and use dense Jacobians, null-space SVDs and
pinv(A)to eliminate current directions; this diagnostic can dominate runtime and memory on large networks.
See SEStructure, SEParameters, and the solver/result types in the API reference for the full callable interface.
Validation and computational scope
Run the focused suite with julia --project=. -e 'using Test, PowerOptLab; include("test/constrained_state_estimation_tests.jl"); include("test/state_estimation_regression_tests.jl"); include("test/state_estimation_quality_tests.jl"); include("test/state_estimation_injection_tests.jl")'. It includes loaded four-wire finite-difference checks with complex and mutual impedance, both line ends, an independent analytic noisy reactive-power optimum, conflicting exact constraints, square rank deficiency, negative-curvature rejection, identifiable covariance, and seeded Monte Carlo variance of a linear estimate. These checks complement the existing power-flow recovery tests; they do not establish robustness on operational feeders. The separate review suite adds independent 5/20/40-bus four-wire circuits and a seeded 500-draw nonlinear covariance/J calibration; these remain finite synthetic studies. The regression suite also checks merged source/measurement aliases, noisy customer injections with exact neutral return, shared and earth returns, both shared solvers against native JuMP/Ipopt, and angle-aware current starts in SI and per-unit units. The quality suite exercises immutable snapshot identities, exact device topology and finite-value validation, named grounded returns, explicit zero source neutrals, solver-option validation, and the distinction between regularised continuation stages and physical estimates. The injection suite checks summed merged-customer powers with unequal uncertainties, repeated and missing channels, aggregate-equivalent voltage covariance, return-reference order independence, persistent connection declarations, grounded-neutral line telemetry, and time-series request counts.
Run julia --project=. scripts/benchmark_compiled_state_estimation.jl to reproduce sparse-chain allocation and timing measurements. With Julia 1.12.6, 12 BLAS threads, and compilation excluded, the September 2026 check gave:
| States | Residual evaluation allocated | Residual Jacobian allocated |
|---|---|---|
| 100 | 28 kB | 115 kB |
| 400 | 105 kB | 457 kB |
| 1,600 | 420 kB | 1,969 kB |
The previous implementation allocated about 21 MB and 91 MB respectively at 1,600 states. Sparse assembly removes that quadratic allocation in this case. The complete sparse solve still performs dense rank/null-space diagnostics: an already exact 1,600-state warm start allocated about 196 MB. No real-time or large-feeder performance claim follows from these synthetic measurements.
Remaining validation priorities are operational feeder oracles, broader noise and measurement-dropout Monte Carlo studies, bad-data and model-error experiments, and end-to-end time-series benchmarks. Remaining implementation priorities include correlated whitening, robust and leverage-adjusted bad-data processing, ideal-transformer and bond-reaction current states, multistart, symbolic factorisation reuse, reusable numerical workspaces, and sparse rank/covariance.
Compatibility notes
residual_jacobian and constraint_jacobian now return SparseMatrixCSC. Use collect(Float64, H) when calling a dense-only routine such as svdvals. Covariance calls may now succeed for identifiable quantities on a partially observed state. Failure to reach feasibility at the iteration limit is :constraint_not_satisfied, not a claim that the mathematical problem is infeasible. Invalid initial device domains and detected negative curvature have explicit non-publishable statuses described above.
API reference
The state estimation API lists the public types, functions and result fields for this guide.
For backend-specific time-series options use, for example, solver_kwargs=(dense=(initial_radius=0.5,),ipopt=(max_iterations=100,)). Options unsupported by the selected backend raise an explanatory ArgumentError, including damping for :dense and normal_fraction for :sparse. Shared keyword arguments must be meaningful for the selected backend; Ipopt rejects trust-region-only options with an explanatory ArgumentError. See compatibility and validation for explicit current layouts, missing-conductor semantics, statistical calibration and the Gauss–Newton Ipopt approximation.