State Estimation and Measurements Reference

Sparlectra.MeasurementType
Measurement

Generic state-estimation measurement model.

Fields:

  • typ: Measurement type.
  • value: Measured value (Vm in p.u., powers in MW/MVar).
  • sigma: Standard deviation in measurement units.
  • weight: Weight used in WLS (1/sigma^2).
  • active: If false, measurement is ignored by estimator.
  • busIdx: Bus index for bus measurements.
  • branchIdx: Branch index for branch flow measurements.
  • direction: Branch direction :from or :to, otherwise :none.
  • id: Optional measurement identifier.
source
Sparlectra.addMeasurement!Method
addMeasurement!(measurements; typ, value, sigma, active=true, busIdx=nothing, branchIdx=nothing, direction=:none, id="")

Append a state-estimation measurement to measurements and return it.

source
Sparlectra.addPflowMeasurement!Method
addPflowMeasurement!(measurements; net, value, sigma, direction=:from, branchNr=nothing, fromBus=nothing, toBus=nothing, active=true, id="")

Append an active-power flow measurement identified by branchNr or a unique fromBus/toBus branch pair.

source
Sparlectra.addPinjMeasurement!Method
addPinjMeasurement!(measurements; net, busName, value, sigma, active=true, id="")

Append an active-power injection measurement identified by busName.

source
Sparlectra.addQflowMeasurement!Method
addQflowMeasurement!(measurements; net, value, sigma, direction=:from, branchNr=nothing, fromBus=nothing, toBus=nothing, active=true, id="")

Append a reactive-power flow measurement identified by branchNr or a unique fromBus/toBus branch pair.

source
Sparlectra.addQinjMeasurement!Method
addQinjMeasurement!(measurements; net, busName, value, sigma, active=true, id="")

Append a reactive-power injection measurement identified by busName.

source
Sparlectra.addVmMeasurement!Method
addVmMeasurement!(measurements; net, busName, value, sigma, active=true, id="")

Append a bus voltage-magnitude measurement identified by busName.

source
Sparlectra.addZeroInjectionMeasurements!Method
addZeroInjectionMeasurements!(measurements; net, sigma=1e-6, busNames=nothing, busIdxs=nothing, active=true, idPrefix="ZI") -> Vector{Measurement}

Append active- and reactive-power zero-injection pseudo-measurements for the selected buses and return the newly added measurements.

Selection rules:

  • If busIdxs is provided, those indices are used.
  • Else if busNames is provided, names are resolved to indices.
  • Else passive buses are detected automatically via findPassiveBuses(net).

These pseudo-measurements are the current way to encode equality constraints P_inj = 0 and Q_inj = 0 in the WLS estimator.

source
Sparlectra.findPassiveBusesMethod
findPassiveBuses(net; atol=1e-9, includeSlack=false) -> Vector{Int}

Return bus indices that have no generation, no load, and no shunt contribution within the given tolerance atol.

This is useful for state-estimation workflows where passive / transit buses are often modeled through zero-injection pseudo-measurements.

source
Sparlectra.generateMeasurementsFromPFMethod
generateMeasurementsFromPF(net; kwargs...) -> Vector{Measurement}

Generate synthetic measurements from the current solved network state.

Keyword options:

  • includeVm, includePinj, includeQinj, includePflow, includeQflow
  • noise: add Gaussian noise if true
  • stddev: dictionary from MeasurementType => sigma
  • rng: random number generator
source
Sparlectra.measurementStdDevsMethod
measurementStdDevs(; vm=0.005, pinj=1.0, qinj=1.0, pflow=1.0, qflow=1.0)

Create default standard-deviation map for synthetic measurement generation.

source
Sparlectra.evaluate_global_observabilityMethod
evaluate_global_observability(net, measurements; kwargs...) -> NamedTuple

Evaluate global observability on active measurements using the finite-difference measurement Jacobian.

Includes global redundancy metrics

  • redundancy = r = m - n
  • redundancy_ratio = ρ = m / n
  • dof = ν = m - n

Quality classes:

  • :good: observable and no critical single measurement
  • :critical: observable, but at least one single critical measurement (or ν <= 0)
  • :not_observable: not observable
source
Sparlectra.evaluate_local_observabilityMethod
evaluate_local_observability(net, measurements, stateCols; kwargs...) -> NamedTuple

Evaluate local observability on selected Jacobian columns (stateCols).

Procedure:

  1. Build global Jacobian H from currently active measurements.
  2. Keep only rows that have at least one nonzero entry in the selected columns. These rows correspond to measurements that are locally sensitive to the requested states.
  3. Evaluate observability/redundancy on the reduced matrix Hlocal.

Returned NamedTuple extends global metrics with:

  • rows: selected row indices (within global active-Jacobian row numbering)
  • stateCols: copied input state-column selection.

Interpretation:

  • :good means local states are observable with positive redundancy and no single critical measurement.
  • :critical means still observable but vulnerable to a single outage (or ν <= 0).
  • :not_observable means local states cannot be uniquely reconstructed.
source
Sparlectra.evaluate_observability_matrixMethod
evaluate_observability_matrix(H; tol=nothing) -> NamedTuple

Evaluate global observability and single-row criticality directly on a matrix H (without building a network model).

source
Sparlectra.numerical_observableMethod
numerical_observable(H; tol=nothing) -> Bool

Numerical observability test on a Jacobian-like matrix H. Returns true when rank(H) == n (full column rank).

source
Sparlectra.print_se_diagnosticsMethod
print_se_diagnostics(io, diag; topN=10)

Pretty-print diagnostics from validate_measurements or runse_diagnostics including:

  • explanation of global_consistency
  • tabular measurement ranking
  • BAD/OK marker per measurement
  • optional rerun comparison if present
source
Sparlectra.runse!Method
runse!(net, measurements; kwargs...) -> SEResult

Run a first classical nonlinear weighted least-squares state estimator.

State representation:

  • bus voltage angles for all non-slack buses (radians)
  • bus voltage magnitudes for all buses (p.u.)
source
Sparlectra.runse_diagnosticsMethod
runse_diagnostics(net, measurements; deactivate_and_rerun=false, kwargs...) -> NamedTuple

Extended diagnostics workflow around validate_measurements with optional deactivate-and-rerun logic for the currently largest suspicious measurement.

source
Sparlectra.structural_observableMethod
structural_observable(H) -> Bool

Structural observability test on a Jacobian-like matrix H. Returns true when the maximum bipartite matching size equals the number of state columns n.

source
Sparlectra.summarize_se_diagnosticsMethod
summarize_se_diagnostics(diag) -> NamedTuple

Create a compact interpretation summary for a diagnostics object returned by validate_measurements or runse_diagnostics.

global_consistency is interpreted as:

  • true: SE converged and objective is inside χ²-like 3σ plausibility band
  • false: either non-convergence or implausibly large objective
source
Sparlectra.validate_measurementsMethod
validate_measurements(net, measurements; kwargs...) -> NamedTuple

Run state-estimation diagnostics on currently active measurements and return a machine-readable report with:

  • global bad-data consistency check (global_consistency)
  • χ²-like objective plausibility summary
  • largest-normalized-residual ranking
  • suspicious measurement list (threshold-based)
source