Configuration Reference

Public API

Sparlectra.ComputeBackendConfig — Type
ComputeBackendConfig

Where the sparse linear system of each Newton step is solved (power_flow.compute_backend):

  • mode: :cpu (default, the UMFPACK path of power_flow.linear_solver), :gpu (NVIDIA cuDSS through the CUDA extension) or :auto (the GPU advisor decides from the bus count, see gpu_advice).
  • gpu_precision: :float64 or :float32_mixed (Jacobian factorized and solved in Float32 on the GPU, mismatch and voltage update in Float64, same convergence criterion).
  • gpu_fallback_to_cpu: without the extension, without a working GPU or on a GPU error the step runs on the CPU and the reason is recorded; false makes these cases an error.
  • gpu_fast_mode: false (default) runs cuDSS in its deterministic mode, so two runs of one case give the same bits. true drops that mode: refactorization and solve are faster, but the last bits of a step vary from run to run, and a bus within rounding distance of its Q limit can end on either side.
source
Sparlectra.ContingencyConfig — Type
ContingencyConfig

Configuration of the contingency batch (issue #331), with the correlated events (events, a ContingencyEventsConfig) and the N-2 pairs (pairs, a ContingencyPairsConfig) of #355.

Fields

  • max_iter::Int: iteration limit of every outage and scenario solve (default 30); the base case of the batch is solved with power_flow.max_iter, so a lower value here keeps a batch fast without touching the base case.
  • rescue_ladder::Vector{Symbol}: the per-case start-value ladder, an ordered, duplicate-free subset of (:warm, :apslf, :dc, :flat). Default [:warm] reproduces the pre-#331 single warm solve. Each stage is one bounded solve with a distinct start recipe, tried in order until one converges. The allowed stages and their recipes are documented on runContingencies!; the set is validated (subset, no duplicates) by _validate_contingency_ladder.
  • screening_mode::Symbol: contingency screening on the base factorization :off (default) gives every scenario the full solve, :flag estimates every non-islanding outage with one Woodbury-corrected Newton step on the base Jacobian and runs the full solve only for flagged scenarios, :only reports the estimates without full runs (islanding and failed-screen scenarios still get the full solve). :off is the default DELIBERATELY: the gate calibration showed classes of outages a residual step cannot see (Q-capability loss behind a zero residual), so :flag is an opt-in for networks where the user has checked the screening share and the margins once. This config key drives the SERVICE path; the programmatic keyword default is :off as well.
  • warm_active_set::Bool: start every outage and scenario from the base case's PV/PQ state (default true since 0.30.3); see N-1 Contingency Analysis.
  • warm_cold_check::Bool: switch for the cold check below (default false: the warm result counts alone); true recomputes tight outages cold.
  • warm_cold_check_margin_pu::Float64: with the warm active set, an outage or scenario whose lowest voltage comes within this margin of the lower voltage limit, or that has an overload or a voltage violation, is solved a second time cold (from the file's PV/PQ state) and the less favourable of the two results counts (default 0.02).
  • screening_margin_pct::Float64: the flagging margin (default 10.0): a scenario is flagged for the full run when a branch's estimated loading plus the change the outage causes on it (at least 1 point, at most the margin) reaches 100 percent, or an estimated voltage comes within margin percent of the band width of a band limit.
source
Sparlectra.ContingencyEventsConfig — Type
ContingencyEventsConfig

Correlated contingency events (contingency.events.*): elements that trip together, added to a generated N-1 list of an SCF case (generateCorrelatedEvents).

Fields

  • enabled::Bool: add the events at all (default false).
  • double_circuits::Bool: branches with the same two endpoints (default true, effective once enabled).
  • busbars::Bool: one busbar section: its branches and its closed couplers (default false).
  • substations::Bool: a whole station, every branch at all its sections (default false).
  • links::Bool: each closed coupler alone (default false).
  • name_groups::Bool: branches whose file names share a stem (default false).
  • name_stem_pattern::String: the regular expression of the circuit suffix a name group strips (default "[ _#(-]?[0-9]{1,2}[)]?$").
  • max_members::Int: events with more members are skipped (default 6).
source
Sparlectra.ContingencyPairsConfig — Type
ContingencyPairsConfig

N-2 branch pairs (contingency.pairs.*) added to a generated N-1 list of an SCF case (generateBranchPairs).

Fields

  • enabled::Bool: add the pairs (default false).
  • rule::Symbol: which pairs; :all is every unordered pair of closed branches (the full enumeration).
  • max_pairs::Int: a run with more pairs stops with a message before anything is solved (default 50000); there is no silent truncation.
source
Sparlectra.DcPowerFlowConfig — Type
DcPowerFlowConfig

Typed configuration for the standalone DC power flow (rundcpf!), used when power_flow.solver == :dc.

angle_reference_deg is the uniform angle offset added to every bus after the slack-referenced linear solve (the slack bus itself is fixed at this reference), see solve_dc_powerflow for why this post-hoc shift is exact. ignore_out_of_service documents that status == 0 branches are always excluded from the B′ assembly (there is currently no supported way to include them; the field exists for forward compatibility with the YAML schema, not as a live toggle).

source
Sparlectra.DiagnosticsConfig — Type
DiagnosticsConfig

The diagnostics configuration section (deprecated keys live on in output); retained so old files keep loading.

source
Sparlectra.GcPauseConfig — Type
GcPauseConfig

Typed configuration of the GC pause of a run (runtime.gc_pause): with enabled the garbage collector is off while a power flow or a batch runs and on again when the last run of the process ends. max_resident_gb is the limit of the memory guard: "auto" is half of the physical memory, a number the limit in GB, "0" no guard. Above the limit the guard collects once and the pause goes on.

source
Sparlectra.MatpowerExportConfig — Type
MatpowerExportConfig

Typed MATPOWER export configuration.

write_solution selects whether writeMatpowerCasefile writes the solved AC power-flow state back into the exported case:

  • true (default): mpc.bus VM/VA reflect the solved node state and mpc.branch gains the standard MATPOWER result columns 14-17 (PF, QF, PT, QT), sourced from the existing branch-flow report path. A mpc.sparlectra.solution_written = 1 marker documents this. If the network has not been solved, the exporter warns and falls back to the 13-column model-only export instead of writing empty result columns.
  • false: the export is a pure model file. mpc.branch keeps its historical 13 columns, and VM = 1.0/VA = 0.0 for all non-slack/non-PV buses (slack and PV setpoints are preserved).
source
Sparlectra.ModelConfig — Type
ModelConfig

Typed model-construction configuration, the model: block: how any imported case becomes a network, independent of its format (the keys lived in matpower_import and transformer before, version-0 files are rewritten through the alias table).

bus_shunt_model selects how bus shunts enter the admittance model.

tap_changer_model selects how transformer tap changers act on the equivalent circuit:

  • :ideal: tap steps only change the complex winding ratio; the series impedance keeps its neutral-position value (no impedance feedback; previous Sparlectra behavior).
  • :impedance_correction: tap steps additionally re-refer the transformer series impedance through the tapped winding (R and X scaled with |1 + f·e^(jφ)|², implemented centrally in src/equicircuit.jl).

The option applies to all transformers of an imported case and is read by every importer.

auto_profile (:off, :recommend, :apply) drives the read-only import analysis with convention recommendations; auto_profile_log writes its artifact. auto_profile_max_fit_pu (default 0.1) is the largest power mismatch (pu, worst bus) at which the stored VM/VA columns still count as a solved state: when the best of the eight convention readings scores above it, the scan recommends no convention change, because a state that fits no reading says nothing about the file's convention. preallocate_network/preallocate_min_buses control container preallocation for large cases.

nominal_frequency_hz (default 50.0, positive) is the system frequency of the network. An import sets net.nominal_frequency_hz from it when the case states no frequency (an SCF meta.f_nom wins); a new Net starts with it. The field turns a line capacitance into a susceptance (addACLinePerKm!, SCF/PGM c1); the MATPOWER conversion to SCF writes it as f_nom.

source
Sparlectra.ObservabilityConfig — Type
ObservabilityConfig(; weak_flow_sigma_mw = 20.0, weak_vm_sigma_pu = 0.01, weak_check_after_estimation = true, on_unobservable = :abort, restore_sigma_rel = 0.30, restore_vm_sigma_nominal_pu = 0.05, placement_max_steps = 20)

State-estimation observability diagnostic configuration (state_estimation.observability).

weak_flow_sigma_mw (MW, positive) and weak_vm_sigma_pu (pu, positive) are the bounds of the weak class of evaluate_weak_observability: a branch whose active flow has a standard deviation above weak_flow_sigma_mw in the covariance of the estimate, or a bus whose voltage magnitude has one above weak_vm_sigma_pu, makes the set :weakly_observable. The magnitude bound is twice the default sigma of a Vm measurement.

weak_check_after_estimation (default true) lets runse! determine the weak class at the estimated state after a converged run with update_net (field weakObservability of the result) under on_unobservable = abort. It only reports; false switches it off for mass runs. Under observable_islands and scheduled runse! always determines the class at the estimate and estimates again without the affected buses while one is above the bounds.

on_unobservable decides what runse! does with a set that is not observable (a null direction of the decoupled P-theta or Q-V model):

  • :abort (default): the estimation runs as without this setting, with no observability check before it.
  • :observable_islands: the network islands are refined by the observable islands of evaluate_global_observability, and each observable island is estimated on its own with its own reference; see runse!.
  • :scheduled: replacement values from the schedule close the deficit first (restore_observability), the rest is estimated like :observable_islands.

restore_sigma_rel (positive, default 0.30) is the sigma of a P or Q replacement value as a share of its scheduled value; the floor is the default sigma of a P or Q measurement (measurementStdDevs), so a replacement value is never more accurate than a meter. restore_vm_sigma_nominal_pu (pu, positive, default 0.05, half of a +-10 % band) is the sigma of a U replacement value at the nominal voltage, the last rule of the U order.

placement_max_steps (positive integer, default 20) is the default cap on the steps of suggest_measurement_placement.

source
Sparlectra.OutputConfig — Type
OutputConfig

Typed output and logfile-format configuration. Console and logfile result streams are intentionally independent so example runners can disable classic logfile tables without suppressing compact console progress.

source
Sparlectra.ParallelRuntimeConfig — Type
ParallelRuntimeConfig

Typed configuration of the in-process parallel execution of independent work items (island solves, short-circuit sweeps, contingency batches). enabled = false forces every parallel site onto the serial path (the serial functions themselves, not copies). max_tasks = "auto" resolves to Threads.nthreads(); an integer string caps the task count (applied via chunking, so it caps Threads.@threads sites too). Work lists shorter than min_work_items run serially to avoid task overhead on tiny cases. executor picks how the batches of the scenario engine and the injection batch run: "threads" (Julia threads of this process), "processes" (the worker processes of the batch pool, one Julia thread each) or "auto" (the rule of Parallel Execution). max_processes = "auto" resolves to Sys.CPU_THREADS, fewer when the free memory holds fewer workers of the size of the network; an integer string caps the number of worker processes.

source
Sparlectra.PowerFlowConfig — Type
PowerFlowConfig

Typed power-flow configuration. It owns solver tolerances, sparse execution settings, automatic damping, start-mode controls, and Q-limit behavior.

source
Sparlectra.QstsConfig — Type
QstsConfig

Quasi-static time series (qsts.*).

Fields

  • mode::Symbol: run mode of a QSTS run, :off (default, a run is refused), :snapshots (every step solved on its own from the solution of the base step) or :sequential (the steps in order, the controller state carried from step to step).
  • base_step::Int: the step of a CGMES snapshot series whose snapshot is the base case, counted from 1 (default 1, the first snapshot); buildCGMESSeriesUnion takes it unless its base_step keyword is given.
  • snapshot_controls::Bool: run the outer-loop controllers of the control section in the base case and in every step of a snapshot run (default false: taps and shunt banks stay at the values of each snapshot).
  • sequential_start::Symbol: start voltages of a step in a sequential run, :previous (default, the solution of the last solved step) or :snapshot (the solution of the same step in a snapshot run without controllers).
  • resync_every::Int: in a sequential run, every n-th step (steps 1, n + 1, 2n + 1, ...) puts the taps and banks back on the values of the series instead of the carried ones; 0 (default) resyncs step 1 only.
  • dead_time_steps::Int: steps a controller stays locked after a counted move in a sequential run (default 0, no dead time).
  • hunting_window::Int: three net moves of one controller with alternating sign within this many steps count as one hunting pattern (default 3, at least 3).
  • vm_min_pu::Float64, vm_max_pu::Float64: voltage band of the violation metrics of a sequential run (defaults 0.9, 1.1).
  • loading_max_pct::Float64: branch loading above which a sequential run counts an overload (default 100.0).
  • series::QstsSeriesConfig: the series check, a QstsSeriesConfig.
source
Sparlectra.QstsSeriesConfig — Type
QstsSeriesConfig

Series check of CGMES snapshot deliveries (qsts.series.*, checkCGMESSeries): consecutive snapshots of one model belong to one series while their structure agrees.

Fields

  • min_structural_overlap::Float64: share of common mRIDs over the union of the structural classes (lines, transformers and their ends, busbar sections, breakers, disconnectors, connectivity nodes); below it a new series starts (default 0.95).
  • max_injection_churn::Union{Nothing,Float64}: churn (1 minus the share of common injection mRIDs) above which a pair is flagged in the report; it never splits a series (default nothing, no limit).
  • max_gap::Union{Nothing,Float64}: largest time step between two snapshots in minutes; a larger step starts a new series (default nothing, no limit).
source
Sparlectra.SparlectraConfig — Type
SparlectraConfig

Central typed configuration assembled once at application or example boundaries. Module-specific sections own their parsing and validation through constructors such as PowerFlowConfig(raw) and MatpowerImportConfig(raw).

source
Sparlectra.StartModeConfig — Type
StartModeConfig

Typed power-flow start-option configuration. These fields collect the flat-start and rectangular start-projection controls that otherwise tend to be forwarded as long keyword lists through example and benchmark call chains.

source
Sparlectra.StateEstimationConfig — Type
StateEstimationConfig

Typed state-estimation configuration for future SE runners and diagnostics.

imag_activation_iteration is the first WLS iteration in which branch current-magnitude measurements (ImagMeas) enter the update step; earlier iterations run without them (flat-start protection). report_residual_correlation enables the residual-correlation (K-matrix) columns in the bad-data diagnostics report.

No sparse field: sparse matrices are mandatory since 0.9.x, and a field that can never be anything but true is not a setting. The old key is still refused by name in the parser, so a stored configuration carrying it says what happened instead of failing with "unknown key".

source
Sparlectra.TapEstimationConfig — Type
TapEstimationConfig(; enabled = true, fallback = true, impedance_correction = :auto, exclude = String[], include_machine_transformers = false)

Settings of the transformer tap estimation, the state_estimation.tap_estimation block of the configuration.

enabled (default true) switches the tap estimation on. With false no regulator becomes a state, even one released with setTapEstimation!: every changer keeps its transferred step, nothing is written back, and each released changer is reported with status = :not_estimated, reason = :disabled.

fallback (default true): when the run with tap estimation does not converge (the estimation run, the fixation run, or non-finite values), runse! solves once more without tap estimation on the same measurements and start values, and that second run is the result (tapFixation.fallback_used, every changer reason = :fallback_not_converged). The SE service also falls back when the fixed estimate fits worse than its staged pre-solve (acceptance rule worse_fit, reason = :fallback_worse_fit). With false neither runs and the first run is returned as it is.

impedance_correction (:auto or :off, see STATE_ESTIMATION_TAP_IMPEDANCE_CORRECTION_VALUES) acts on the analytic correction only. A transformer with per-step data (tap table rows with r and x, the reactance curve of a phase tap changer with xMin/xMax, TapStepImpedance factors) always moves its impedance with the step by these data, and the analytic correction is off for it under both values. A typed model follows the power flow (resolve_winding_taps): its x_min/x_max curve or x table follows the step under both values, and the correction factor on r next to the curve applies under :auto only. Without per-step data :auto applies the impedance correction of typed models under model.tap_changer_model = impedance_correction, and :off keeps the impedance of the start position. The rows of tapEstimates name the source per transformer (reactance_source: :table, :analytic, :nominal).

exclude (default empty) lists transformers that never become tap states, by name or CGMES mRID. Such a changer keeps its transferred step and is reported with status = :not_estimated, reason = :excluded; its step is not calculated either. An entry that matches no transformer of the net gives a warning naming it (runse!, runse_diagnostics, the SE service).

include_machine_transformers (default false): a machine (generator step-up) transformer is not estimated. Its step is calculated after the estimation from the AVR setpoint and the machine telemetry (the method of calcMachineTrafoTapFromSE, run by runse! with update_net = true), status = :calculated, reason = :machine_transformer; without a result it stays :not_estimated with that reason. Without a Q measurement on every bus of the machine node it stays :not_estimated with reason = :q_not_measured_in_group and its transferred step; without a P measurement the scheduled P is used (note = :p_from_schedule). true estimates machine transformers like the others. Both keys act on released changers, also on one released with setTapEstimation!, also in the run of the fallback; with enabled = false every changer says :disabled and nothing is calculated.

Library callers set it for one call with with_state_estimation_config(tap_estimation = TapEstimationConfig(impedance_correction = :off)) do ... end. The keyword constructor does not validate; the configuration parser and the override validation refuse other values with the key named.

source
Sparlectra.configuration_path_from_inputs — Method
configuration_path_from_inputs(; env_var, fallback_paths) -> String

Resolve which configuration file a process should load: the environment variable first, then the first existing fallback path, then the packaged default template.

source
Sparlectra.configured_matpower_cases — Method
configured_matpower_cases(config) -> Vector{String}

Return configured cases in deterministic execution order. A non-empty runtime.cases list takes precedence over the compatible single-case runtime.case setting.

source
Sparlectra.load_sparlectra_config — Function
load_sparlectra_config(user_path; default_path, reload, cli_overrides, overrides) -> SparlectraConfig

Load the configuration from the user YAML over the packaged defaults, apply overrides, and return it WITHOUT installing it as the active configuration. Results are cached per path unless reload is set.

source
Sparlectra.model_config — Method
model_config() -> ModelConfig

The model section of the active configuration: how an imported case becomes a network (bus shunt model, tap changer model, auto profile, preallocation, nominal frequency).

source
Sparlectra.parallel_max_tasks — Method
parallel_max_tasks(cfg::ParallelRuntimeConfig) -> Int

Resolve the configured runtime.parallel.max_tasks to a concrete task count: "auto" yields Threads.nthreads(), an integer string yields that number (validation guarantees it is positive).

source
Sparlectra.refresh_sparlectra_config_file — Method
refresh_sparlectra_config_file(path; write=false, backup=true, normalize_deprecated=true, default_path=DEFAULT_SPARLECTRA_CONFIG_PATH)

Compare a user YAML configuration with the current Sparlectra template, add missing keys from the template, and optionally normalize documented deprecated aliases. Dry-run mode returns the refreshed YAML without writing. Writes are explicit and create a timestamped backup unless backup=false is requested. Form fields of options the Web UI no longer has (benchmark_enabled, benchmark_samples, benchmark_seconds, wherever they stand in the file) are removed and listed in removed_keys and warnings; the refresh does not stop for them.

source
Sparlectra.refresh_sparlectra_config_text — Method
refresh_sparlectra_config_text(text; normalize_deprecated, default_path) -> String

Rewrite a configuration YAML text against the packaged template: missing keys are added with their defaults and comments, deprecated keys are normalized, user values are kept. Used by the Web UI configuration refresh.

source
Sparlectra.set_sparlectra_config! — Method
set_sparlectra_config!(cfg) -> SparlectraConfig

Install cfg as the active configuration of the process, replacing the one every *_config() accessor returns.

source
Sparlectra.with_export_significant_digits — Method
with_export_significant_digits(f, digits::Integer)

Run f() with the case writers (exportSCF, writeCGMESFiles, writeMeasurementTable, writeMeasurementsCSV) printing every float rounded to digits significant digits, and a value below 1e-9 in magnitude as 0 (solver residuals). 0 prints the shortest round-trip form (the default outside such a block). Rounded files do not read back bit for bit, but the same values give the same bytes on every machine: the last digits a solver leaves depend on the CPU and the linear-algebra library. The setting is scoped to f and its tasks. Throws an ArgumentError for a value other than 0 or 1 to 17. Configuration key: output.export_significant_digits.

source
Sparlectra.with_sparlectra_config — Method
with_sparlectra_config(f, cfg) -> f()

Run f() with cfg installed as the active configuration and put the previous one back afterwards, also when f throws. This is how a run gets its own settings (#381): the modules read the registry (state_estimation_config(), powerflow_config(), ...) themselves, the caller installs the effective configuration for the duration of the run. The service and the Web UI do exactly that with the resolved configuration of the case (general file, case sidecar, form values). One Net, one run at a time: the registry is process-global.

f is not specialized on: every do-block call site brings its own closure type, and the closure body was inlined into a fresh specialization of this function each time (91 of them in one test group, ten seconds of compilation for a three-line body). One dynamic call is cheaper.

source
Sparlectra.with_state_estimation_config — Method
with_state_estimation_config(f; kwargs...) -> f()

Run f() with the active state-estimation settings replaced by kwargs (field names of StateEstimationConfig: max_iter, tol, flatstart, update_net, robust_mode, max_eliminations, ...) and the previous configuration restored afterwards. The one-liner for a deviating run:

se = with_state_estimation_config(max_iter = 12, update_net = false) do
  runse!(net)
end
source
Sparlectra.validate_gui_config_overrides — Method
validate_gui_config_overrides(config_overrides) -> Dict{String,Any}

Validate GUI-supplied dotted configuration keys and return the equivalent nested configuration dictionary. Only GUI_EDITABLE_CONFIG_KEYS are accepted. Invalid keys, types, enum values, and ranges throw ArgumentError before power-flow execution.

source
Sparlectra.as_bool — Method
as_bool(x)::Bool

Convert YAML booleans or boolean-like strings (true, false, yes, no, on, off) to Bool. Invalid values throw an ArgumentError.

source
Sparlectra.as_int_vector — Method
as_int_vector(x)::Vector{Int}

Convert an integer or a one-dimensional vector of integer values to Vector{Int}. Invalid values throw an ArgumentError.

source
Sparlectra.load_yaml_dict — Method
load_yaml_dict(path::AbstractString)::Dict{String,Any}

Load a simple YAML file into a Dict{String,Any}.

Only the subset used by Sparlectra examples is supported: comments beginning with #, 2-space-indented nested dictionaries, scalar key-value pairs, and one-line scalar lists. A mapping key is bare (380:, 10.5:, max_iter:) or quoted ("10.5":, '380':, the quotes stripped) and is always read as text; a dotted name (power_flow.max_iter:) is no key and throws, and a key at the top level must not contain a dot even in quotes. Invalid indentation and unsupported lines throw clear errors. Use a full YAML package for general YAML documents.

source
Sparlectra.merge_yaml_dict! — Method
merge_yaml_dict!(dst::Dict{String,Any}, src::Dict{String,Any})

Recursively merge YAML dictionaries from src into dst and return dst. Nested dictionaries are merged; non-dictionary values replace existing values.

source
Sparlectra.parse_yaml_scalar — Method
parse_yaml_scalar(raw::AbstractString)

Parse one scalar value from Sparlectra's small dependency-free YAML subset.

This parser is intended for example and benchmark configuration files. It is not a general-purpose YAML implementation. Supported scalars are booleans, null/~, integers, floating-point numbers, symbols written as :name, quoted strings, unquoted strings, and one-line scalar lists such as [100, 300, 500].

A double-quoted string resolves the two escapes the writers produce, \\ (one backslash) and \" (a quote); every other backslash stays as it is, so a hand-written "C:\data" or "\d{1,2}" reads unchanged. In a single-quoted string '' is one quote, backslashes are literal.

source
Sparlectra.yaml_quoted — Method
yaml_quoted(text) -> String

The one quoting rule of Sparlectra's YAML writers: text in double quotes with every backslash written as \\ and every quote as \", the two escapes parse_yaml_scalar resolves, so writing and reading give the same string for every value. A line break cannot be written in this line-based subset and throws an ArgumentError.

source

Internals

Sparlectra.CONFIG_VERSION_CURRENT — Constant

Current version of the configuration file format. Files declare theirs with the top-level key config_version; a file without it reads as version 0 and the alias tables below are applied stepwise, so old files keep loading while only this file knows old key names.

source
Sparlectra.ZERO_INJECTION_SIGMA — Constant
ZERO_INJECTION_SIGMA

Default sigma of a zero-injection pseudo-measurement in MVA (MW for the active, Mvar for the reactive row), the unit of the injection rows.

A passive bus injects nothing, so the row is a CONSTRAINT rather than a reading, and the sigma only says how hard it is enforced. The former 1e-6 means a weight of 1e12, and on a large network that is not "tight", it is crushing: on a 25000-bus case with 27268 such rows the estimation did not converge in 30 iterations, reported an objective of 3.8e15 per degree of freedom and losses 2069 percent above the reference. The same set with 1e-3 converges in 7 iterations to J/dof 4.97 and losses within 0.02 percent.

1e-3 still binds the bus far tighter than any real transducer (the tightest real rows in that set carry 0.01), while leaving the normal equations solvable.

It is the default of state_estimation.zero_injection_sigma_mva, the sigma the code that adds zero-injection rows reads. Change the default here.

source
Sparlectra.ApslfConfig — Type
ApslfConfig

Typed configuration for the AnalyticLoadFlow.jl-backed analytic power-series solver (ApslfSolver), used when power_flow.solver == :apslf. The series is evaluated with Padé approximants (AnalyticLoadFlow has no other evaluation), so there is no evaluation switch.

precision (power_flow.apslf.precision) is the arithmetic of the series and the Padé evaluation: :float64 (default) or :double_double (AnalyticLoadFlow 0.11). Double-double helps where a Float64 run stagnates above the tolerance (diagnosis precision_limit); without NR polish it needs order 48 or 56. The loader rejects any other value.

source
Sparlectra.ApslfStartConfig — Type
ApslfStartConfig

Typed configuration for using the analytic power-series solver as a start-value generator ahead of the rectangular Newton-Raphson solve. Deliberately has no nr_polish field: polishing is left to the downstream NR solve, so the generator always runs with nr_polish=false internally.

source
Sparlectra.BadDataConfig — Type
BadDataConfig(; substitute_sigma_factor = 3.0)

Settings of the state_estimation.bad_data block.

substitute_sigma_factor (default 3.0, at least 1): a voltage measurement outside 0.5 to 1.5 pu (0 kV and non-finite values included) on a bus the switching state energizes is a gross error. Before the WLS it is replaced by a pseudo measurement at the imported state of the bus (the SvVoltage of a CGMES import, else 1.0 pu) whose sigma is the sigma of the row times this factor (reason range_check_substituted).

Library callers set it for one call with with_state_estimation_config(bad_data = Sparlectra.BadDataConfig(substitute_sigma_factor = 5.0)) do ... end.

source
Sparlectra.CGMESImportConfig — Type
CGMESImportConfig

Options of the cgmes_import configuration block, the ENTSO-E CGMES import (see importCGMES). path accepts a folder, a ZIP, or several of both (base case plus boundary set) separated by ;.

Fields

  • path::String: delivery location(s); ;-separated for multi-part deliveries.
  • base_mva::Float64: system base, which CGMES does not define.
  • require_boundary::Bool: fail when topology references stay unresolved.
  • tap_control::Bool: start from the SSH tap positions and attach the CGMES-defined outer-loop tap controllers instead of importing the solved SvTapStep positions as fixed taps.
  • machine_control::Bool: attach outer-loop remote voltage controllers (MachineVoltageControl) for machines whose voltage RegulatingControl points at a different bus, instead of holding those machines PV at their own bus.
  • ignore_connected::Bool: diagnostic override that treats every terminal as connected, for snapshots whose SSH flags contradict their own SV state.
  • map_energy_source::Bool: map every in-service, connected EnergySource as a fixed PQ injection (p = -activePower, q = -reactivePower from the SSH, load sign convention). Off by default: the objects are then left out and counted in one import notice.
  • map_power_electronics::Bool: map every in-service, connected CGMES 3.0 PowerElectronicsConnection as an injection (p = -p, q = -q from the SSH, load sign convention), PV with an enabled voltage RegulatingControl, else PQ. Off by default: the objects are then left out and counted in one import notice.
  • shunt_control::Bool: attach a switched-bank voltage controller (ShuntVoltageControl) to every mapped LinearShuntCompensator whose controlEnabled and voltage RegulatingControl are set and regulate its own bus. Off by default: the banks stay at their SSH sections.
  • read_dynamics::Bool: read the DY profile and give the machines their DynamicData (inertia, damping, droop, governor time constant; see importCGMES). Off by default: the DY file is skipped. No calculation reads the data; the island slack choice reads the unit type.
  • equivalent_injection_as_source::Bool: import an EquivalentInjection on the SV angle reference node or on a boundary node as a voltage-regulating source at the SV voltage of its node (the one on the SV angle reference is the slack), with the short-circuit power from its r/x where the EQ states them. Off by default: the injection stays as mapped (PQ at the SSH p and q, PV with regulationStatus, slack when it holds the SV angle reference).
  • area_source::Symbol: where the area of a bus (Node._area, the partition of the multi-area state estimation) comes from. :model_authority (default): the model of each operator in a CGM (Model.modelingAuthoritySet of the EQ that defines the bus container); :sub_geographical_region and :geographical_region: the region of the substation; :none: no area. A boundary node takes the smallest area among its neighbours; the areas are numbered by name, the names go to net.area_names.
  • vset_min_pu, vset_max_pu::Float64: plausibility band for a voltage RegulatingControl.targetValue, in p.u. of the regulated bus's nominal voltage. A target outside the band is treated as a placeholder: it is ignored and the unit is held PV at the bus voltage derived from the nominal data, with a warning: message. Widen the band to accept a delivery's own values, or set vset_min_pu = 0 and a large vset_max_pu to disable the check entirely.
  • multi_slack::Bool: give every electrical island its own SV-declared angle reference (at most one per island). Required for multi-island deliveries: without it every island beyond the primary one has no reference and the island-wise power flow refuses to run. Disable only to force the legacy single-reference behavior.
  • equivalent_branch_min_z_pu::Float64: an EquivalentBranch whose impedance (|z12| and |z21|, per unit on the base of terminal 1) lies below this value builds no branch: its two buses are joined as a link, with a notice, like a closed switch. Default 1e-6; 0 switches it off.
  • start_values::Symbol: Newton-Raphson start state for CGMES runs. :flat (default) uses a synthetic flat start: the solver earns the solution itself; :sv starts from the delivery's imported SvVoltage state and force-disables the competing start-value machines for the run. On CGMES runs this key wins over power_flow.flatstart / power_flow.start_mode.flatstart; MATPOWER and DTF runs ignore it. The SV comparison artifact (sv_compare.csv) is written either way.
source
Sparlectra.DistributedSlackConfig — Type
DistributedSlackConfig

Distributed active-power slack (issue #192): the REF bus keeps the angle reference while the island's active-power imbalance is absorbed by a set of participating generators via one scalar lambda_P per island.

Fields

  • enabled::Bool: off by default, disabled reproduces the classical single-slack behavior bit-for-bit.
  • p_mode::Symbol: how raw participation weights are derived: :pg_weighted (scheduled Pg), :pmax_weighted (maxP), :headroom_weighted (max(maxP − Pg, 0)), :imported (ProSumer.participationFactor, filled from MATPOWER APF / CGMES GeneratingUnit.normalPF), :explicit (the weights table).
  • respect_p_limits::Bool: diagnostic only, WARN when a participant's corrected P leaves [minP, maxP]; no re-dispatch.
  • fallback::Symbol: :error throws when an island has no valid participant; :ref_only falls back to the classical slack for that island with a warning.
  • weights::Dict{String,Float64}: :explicit mode only, bus name (or bus index as string) → weight.
source
Sparlectra.ExternalGridConfig — Type
ExternalGridConfig

Compute the marked slack bus as a non-ideal external-grid source (issue #299): the reference voltage moves to a hidden internal bus behind the feeder impedance z = Un²/Sk'', so the connection-bus voltage reacts to loading instead of being held ideally stiff.

Fields

  • enabled::Bool: off by default, the classical ideal slack.
  • source::Symbol: where Sk''/R/X come from: :auto prefers the values a CGMES delivery declares on the slack bus's ExternalNetworkInjection and falls back to the config numbers below (MATPOWER/DTF carry no such data); :config always uses the config numbers.
  • sk_MVA::Float64: initial symmetrical short-circuit power of the feeder.
  • rx::Float64: its R/X ratio.
source
Sparlectra.LastValueConfig — Type
LastValueConfig(; enabled = false, max_age_min = 60.0, sigma_factor = 3.0)

Settings of the state_estimation.last_value block: the last valid value of a measurement stands in for a missing or invalid one in a measurement table with several timestamps (see importMeasurementTable).

enabled (default false) switches the fill-in on. max_age_min (minutes, default 60, finite and positive): a value older than this at the timestamp it would fill is not used, the gap stays. sigma_factor (default 3, finite, at least 1): the sigma of the filled value is the sigma of the original times this fixed factor, independent of the age. Both values are a proposal without a standard behind them.

Library callers set it for one call with with_state_estimation_config(last_value = Sparlectra.LastValueConfig(enabled = true)) do ... end.

source
Sparlectra.MeritLineSearchConfig — Type
MeritLineSearchConfig

Typed configuration for the optional Armijo merit-function line search used as an alternative acceptance criterion inside the rectangular Newton-Raphson autodamp backtracking loop. Disabled by default; when disabled the solver behaves exactly as before this feature was added. See Merit-Function Line Search for the theoretical background.

source
Sparlectra.MultiAreaConfig — Type
MultiAreaConfig(; mode = :off, partition = "bus_area", max_passes = 20, compare_integrated = true)

Settings of the state_estimation.multi_area block (multi-area state estimation, see runse_multi_area!).

mode (off or two_level, default off): with two_level the SE service runs the multi-area estimation after the normal one on the same final rows and writes the area tables, which the Web UI shows; runse! itself is unaffected. partition (default bus_area): the areas stored with the buses, or the path of an area list (one line per bus: bus name and area number, separated by ;, , or a tab; a header line and # comments are allowed). max_passes (positive integer, default 20): the most passes before the run stops unconverged. compare_integrated (default true): the result carries the integrated estimate on the same rows and the difference per state.

source
Sparlectra.PowerFlowPlausibilityConfig — Type
PowerFlowPlausibilityConfig

Plausibility check of a numerically converged AC power-flow solution. The check never changes the run status; it only reports.

Fields

  • vmin_warn::Float64: lowest acceptable voltage magnitude in pu at an energized bus, on every voltage level. A converged solution with a bus below it gets a warning that names the lowest bus and its voltage, in the run result (diagnostics.plausibility_warning) and in the log. A Newton solve can converge on the low-voltage branch of a heavily loaded network; this check makes such a result visible. 0 switches the check off.
source
Sparlectra.PowsyblImportConfig — Type
PowsyblImportConfig

Options of the powsybl_import configuration block (alias of the canonical section powsybl): the PowSyBl IIDM import (see docs/src/powsybl_import.md).

Fields

  • base_mva::Float64: system base in MVA.
  • hvdc_mode::Symbol: :fixed_injection (converter stations as fixed PCC injections, the rectifier drawing target_p / (1 - loss_factor / 100), the inverter delivering target_p * (1 - loss_factor / 100)) or :paired_control (not implemented for PowSyBl sources in this release, rejected with the mode named).
  • slack_ids::Vector{String}: generator ids that override the slack choice of their synchronous component; a YAML list or one string with ; between the ids.
  • multi_slack::Bool: one slack per synchronous component; false keeps only the component of the first slack and reports the others.
  • remote_regulation::Symbol: a generator whose regulated bus is not its own: :remote (default) makes it PQ and attaches an outer-loop MachineVoltageControl on the regulated bus (the same machinery as cgmes_import.machine_control; reproduces OpenLoadFlow's remote voltage control, and falls back to :hold_local where the control cannot be attached), :hold_local keeps it PV at its own bus with the target in pu of the regulated bus, :pq makes it PQ with target_q.
source
Sparlectra.SESigmaLevel — Type
SESigmaLevel(; vn_kv, p_mw = nothing, q_mvar = nothing, i_a = nothing, u_kv = nothing, rel_pct = 0.0)

One row of state_estimation.sigma_by_voltage_level: the measurement standard deviations of one voltage level in physical units. vn_kv is the nominal voltage of the level in kV (in a configuration file the key of the row), matched against the bus nominal voltage (to 1e-6 kV). p_mw (MW, P flows and injections), q_mvar (MVAr, Q flows, injections and shunt bays), i_a (A, current magnitudes) and u_kv (kV, voltage magnitudes) are the absolute sigmas; nothing leaves that measurement type on the global default. rel_pct (percent of the measured value, default 0) raises a set column to max(absolute, rel_pct / 100 * |value|).

The keyword constructor validates like the configuration parser: vn_kv and every set sigma finite and positive, at least one absolute sigma set, rel_pct finite and not negative; a violation is an ArgumentError. The State-Estimation Configuration page of the manual describes the table.

source
Sparlectra.SEStartModeConfig — Type
SEStartModeConfig(; rotate_behind_pst = false)

Settings of the state_estimation.start_mode block, the start value of the estimator next to state_estimation.flatstart.

rotate_behind_pst (default false): on the flat start a bus that the slack reaches only across phase-shifting transformers starts at the sum of their shifts on a path with the fewest shifters, a bus that a path without shifter reaches keeps the slack angle. The angles come from the same function as the power flow flat start under power_flow.start_mode.rotate_behind_pst. Off, every angle of the flat start is 0. No effect on a start from the stored state.

Library callers set it for one call with with_state_estimation_config(start_mode = Sparlectra.SEStartModeConfig(rotate_behind_pst = true)) do ... end.

source
Sparlectra.ShortCircuitConfig — Type
ShortCircuitConfig

Options of the short_circuit configuration block, the IEC 60909 balanced short-circuit evaluation (runShortCircuit!).

Fields

  • c_factor::Float64: scalar override for the IEC 60909-0 voltage factor c. 0.0 (default) selects the hardcoded Table-1 values by nominal voltage level and case (c_max/c_min); a positive value replaces the table for every bus, intended for expert/verification runs where a worked example prescribes the factor. A configurable per-voltage-level table is not configurable.
  • converter_current_factor::Float64: fault current of a converter-connected unit (PowerElectronicsConnection without maxIFault, synchronous machine on a wind or solar unit), as a multiple of its rated current ratedS/(sqrt(3)*ratedU). 0.0 (default) is off: such a unit feeds nothing and its island is flagged as a lower bound. A positive value makes it a current source of that size, flagged as a substitute; a stated maxIFault always wins. The value is a manufacturer figure to be set per case; about 1.0 to 1.5 is the usual range, as orientation only.
source
Sparlectra.StartCurrentIterationConfig — Type
StartCurrentIterationConfig

Guarded fixed-point current-injection pre-solve configuration. The stage is disabled by default and, when enabled, only prepares the initial voltage profile before the normal rectangular Newton-Raphson solve.

source
Sparlectra.TrustRegionConfig — Type
TrustRegionConfig

Typed configuration for the optional scaled-Newton trust-region step control in the rectangular Newton-Raphson solver: an alternative to autodamp that caps the Newton step norm at an adaptive radius and accepts/rejects steps by merit decrease. Disabled by default; mutually exclusive with autodamp. See Trust-Region Step Control for the theoretical background.

step_mode = :scaled (default) rescales the full Newton direction to the radius when it exceeds it, leaving pre-existing behavior byte-for-byte unchanged. step_mode = :dogleg blends the Newton direction with a steepest-descent (Cauchy) step along the dogleg path when the radius shrinks below the Newton step norm, trading some convergence speed for graceful degradation when the Newton direction becomes a poor descent direction. See Trust-Region Step Control, "Dogleg step mode".

source
Sparlectra._apply_config_aliases! — Method
_apply_config_aliases!(raw, version, context) -> raw

Rewrite a version-version configuration dictionary to the current layout by applying every alias step in order. A value is moved only when the new key is not set (an explicitly set new key wins over a stale old one).

source
Sparlectra._copy_sparlectra_with_user_keys — Method
_copy_sparlectra_with_user_keys(cfg, keys) -> SparlectraConfig

Attach the set of dotted keys the USER set explicitly. Kept out of the raw configuration dictionary on purpose: anything in there is written to effective_config.yaml, and a reload of that file would reject an unknown key.

source
Sparlectra._parse_sigma_by_voltage_level — Method
_parse_sigma_by_voltage_level(raw; source = "", lines = Dict{String,Int}()) -> Vector{SESigmaLevel}

The rows of state_estimation.sigma_by_voltage_level, validated and sorted by nominal voltage (highest first). raw is the mapping of the YAML block form (nominal voltage in kV => row of sigma columns; the key is a positive number or its text, "380" as the YAML reader returns it), a vector of SESigmaLevel, nothing, or the empty placeholder "{}" of the template (both give no rows). A key that is not a positive number is the error bad_vn_kv, two keys of the same voltage (380 and 380.0) the error duplicate_vn_kv naming both, a vn_kv column the error unknown_column. Any other text, in particular a flow mapping {p_mw: 2.0, ...}, is refused with the block form in the message, never read as a string.

For a table read from a file, source is the file and lines the line of each key below the table (_yaml_key_lines); every error then ends with the file name and the line of the offending column, row or table key.

source
Sparlectra._resolve_parallel_runtime — Method
_resolve_parallel_runtime(enabled, max_tasks, min_work_items) -> (on, cap, min_items)

Resolve per-call parallel overrides against the ACTIVE runtime.parallel configuration (nothing = take the configured value). Meant to be called ONCE by the orchestrating (serial) code of a parallel site before any task spawns; workers never touch the config globals.

source
Sparlectra.ConfigResolveError — Type
ConfigResolveError

Wraps a failure of one resolution level of resolve_config with the stable service failure reason for that level (invalid_case_file for the deprecated in-case block, invalid_case_config for the case configuration file, invalid_config_override for override validation, invalid_configuration for the general file), so every service maps failures identically without parsing messages.

source
Sparlectra._record_run_start_overrides! — Method
_record_run_start_overrides!(effective_raw, config_sources, configured, used; reason) -> Vector{String}

Write the start keys the run actually used into the effective configuration. configured is the resolved configuration handed to the import, used the one the import returned for the solve (after power_flow.flatstart and, for CGMES, cgmes_import.start_values). Every start key whose value differs gets the used value in effective_raw; its entry in config_sources keeps the configured value as configured_value, gets the source run_start_rule and reason. With the start projection off for the run, the entries of try_dc_start and try_blend_scan say that they have no effect. Returns the changed keys.

source
Sparlectra.apply_auto_profile_level — Method
apply_auto_profile_level(cfg, applied_pairs) -> (config, applied, skipped)

Applies auto-profile recommendations as their own precedence level: each pair lands only when the user did not set its key explicitly; explicitly set keys are returned in skipped so the caller can report the yield. The copy helpers resolve at call time (they live with the MATPOWER engine), so this stays the single application site without a definition-time dependency on the adapters block.

source
Sparlectra.case_config_path — Method
case_config_path(case_path) -> String

The case configuration file that belongs to one case, next to the case file. The canonical .scf.json case binds <stem>.config.yaml (case57.scf.json binds case57.config.yaml). Every other input format binds <file name>.config.yaml (case118.m binds case118.m.config.yaml), so a MATPOWER case and its SCF export in one directory keep two files; a file with the older <stem>.config.yaml name is still read for such a case when its header names the case (a Web UI run: case118.config.yaml written for case118.m was loaded for case118.scf.json and refused).

source
Sparlectra.load_case_config — Method
load_case_config(case_path) -> Dict{String,Any}

The flat dotted case-scope configuration of one case, read from its case_config_path file; empty when no such file exists. The file must open with the header keys config_version, scope: case, and case: <case file basename>; a case value naming a different file is the hard error case_config_mismatch, so a copied config cannot silently steer the wrong case. Keys outside the case scope are refused with the same wording as the in-file sparlectra.config check; a key this Sparlectra version does not know is dropped with a warning.

source
Sparlectra.resolve_config — Function
resolve_config(config_file, case_path, overrides) -> NamedTuple

The one configuration precedence of the run path, highest first: explicit API/CLI overrides, the case configuration file, sparlectra.config inside an SCF case (deprecated level, one warning naming the case configuration file as the new place), the general configuration file, packaged defaults. A key not set on one level falls through to the next; no mtime logic anywhere.

Exception, whenever a case configuration FILE exists (format independent): the case is then self-contained, so CASE-scope keys skip the general-file level and fall through from the case levels directly to the packaged defaults, and the same case-plus-config pair computes the same numbers on every installation. Machine-scope keys (output, benchmark, runtime, webui, matpower_export) still come from the general file. A case without a config file, including a bare .scf.json, keeps the full chain, and so does the deprecated in-file block alone (legacy level, legacy semantics).

A Web UI write that creates a case configuration file (a settings save, the measurement generator, the conversion of a legacy settings sidecar) writes, besides its own values, every case-scope key in which the general file differs from the packaged defaults, so the case computes as before. From then on the case no longer follows the general file for case-scope keys.

Returns the effective typed config, the effective_raw dictionary for the effective-config artifact, the merged flat and nested override chains, and the per-level dictionaries for provenance. Level errors propagate; the caller owns the failure mapping.

source
Sparlectra.write_case_config — Method
write_case_config(case_file, config) -> String

Write the case-scope keys of config (flat dotted keys) as the case configuration file of case_file (case_config_path), with the header (config_version, scope: case, case:). Keys outside the case scope are dropped with one warning naming them; an empty case scope removes an existing file instead of leaving a stale one. Returns the file path.

source