Examples Overview

Runnable examples live under examples/powerflow/, examples/others/ (also the shared suite infrastructure), examples/state_estimation/, examples/dtf/ and examples/cgmes/. Run one directly:

julia --project=. examples/<folder>/<example>.jl
julia --project=app examples/powerflow/exp_programmatic_api.jl   # examples of the service layer: the app environment

or a whole topic through its suite runner (fresh subprocess per example, summary at the end): run_powerflow_suite.jl, run_others_suite.jl, run_state_estimation_suite.jl, run_val_dtf_suite.jl, run_cgmes_suite.jl, run_short_circuit_suite.jl and run_parallel_suite.jl (parallel vs serial with identity checks). The Suite column names the runner (standalone: run directly; optional: skipped when its inputs are unavailable); the runners run in the extended test profile.

Power flow and network operation

ExampleFolderDemonstratesSuite
matpower_import.jlpowerflowMATPOWER import and solvepowerflow
matpower_import_multi_config.jlpowerflowone case under several configurationspowerflow
exp_configured_matpower_cases.jlpowerflowruntime.cases batches via run_sparlectra_casespowerflow
exp_programmatic_api.jlpowerflowthe run_sparlectra_api contractpowerflow
exp_powerflow_service.jlpowerflowlocal service run, result and artifact lookup by run IDpowerflow
exp_distributed_slack_modes.jlpowerflowsingle vs distributed slack (pg_weighted, imported APF shares)standalone
exp_external_grid_comparison.jlpowerflowideal slack, external-grid source and distributed slack on an 8-bus ringpowerflow
exp_dc_powerflow.jlpowerflowstandalone DC power flow (rundcpf!), DC-seeded AC startpowerflow
exp_condition_number.jlpowerflowJacobian condition estimate (condestJacobian, reportCondition)powerflow
exp_hvdc_b2b_pairing.jlothersHVDC pairing controller on a two-island net (theory)others
exp_hvdc_meshed_ac_tie.jlothersHVDC pair in parallel to an AC tie, island_feed rejected (theory)others
exp_parallel_islands.jlpowerflowislands on threads vs serial, bitwise-identical voltagesparallel
exp_parallel_sc_sweep.jlothersall-bus short-circuit sweep serial vs threaded, row-identicalparallel
exp_contingency_n1.jlothersfull branch N-1 on the shipped sp_case1354.m, serial vs parallel (theory)parallel
exp_contingency_events.jlotherscorrelated events (double circuits, busbars, stations, couplers, name groups) and N-2 pairs on sp_case14/sp_case60 (theory)others
exp_case_scenarios.jlothersthe scenarios block of a case file run alone (what the Web UI Scenarios button does) on a copy of sp_case60 (theory)others
exp_injection_batch.jlothersmany load scenarios of one network on sp_case188: 32 random load factors per bus and a 96-step ramp, Q limits off with the share of Q-limit violations, on CPU threads and, with CUDA and CUDSS loaded, on the GPU (theory)parallel
exp_process_batch.jlothersthe injection batch and the branch N-1 batch on the shipped sp_case1354.m on threads and in worker processes, compared bit for bit, and the GC pause status of a run (theory)parallel
exp_scf_series.jlothersthe shipped SCF time series sp_case14_day.qsts.zip: one step by hand, all 96 steps with the snapshot run, with and without the tap controller, the result files, and a few steps with the example controls (a tap control range and a bank behind the tap at priority 1) (theory)others
exp_open_terminal_line.jlothersone-sided open line: charging draw and Ferranti rise (theory)others
exp_current_iteration_start.jlpowerflowguarded current-iteration start pre-solve via config overridespowerflow
exp_diagnose_self_check.jlothersrun_fixed_reference_self_check and the diagnose.log reportothers
exp_short_circuit.jlothersrunShortCircuit! on a hand-built net, safety flag on defaulted data, converter current sourceshort_circuit
exp_short_circuit_reference.jlothersPASS/FAIL check against analytic IEC 60909-0 valuesshort_circuit
exp_short_circuit_cgmes.jlothersrunShortCircuit! on the ENTSO-E MicroGrid BE delivery (local test-set cache)short_circuit
exp_synthetic_tiled_grid_pf_perf.jlpowerflowsynthetic tiled-grid performance studypowerflow
qlimit_large_case_mode_comparison.jlpowerflowQ-limit enforcement modes on large casespowerflow
apslf_demo.jlpowerflowAPSLF as standalone, primary or start-value backendpowerflow
exp_apslf_precision.jlpowerflowAPSLF float64 against double_double on case6495rte, with the expected valuespowerflow
mc_probabilistic_powerflow.jlpowerflowMonte-Carlo load scaling on the shipped sp_case14 (N = 1000)powerflow

Transformers and controllers

Example (examples/others/)DemonstratesSuite
exp_transformer_tap_changer_model.jltap_changer_model = :ideal vs :impedance_correction on an off-nominal tapothers
exp_transformer_loss_extension.jlMATPOWER transformer-loss extension round tripothers
exp_3wt_phase_taps.jl3WT with phase_tap_side/phase_taps: OLTC-only, PST-only, combined (data model only)others
tap_control_demo_grid.jlthree controllers at once (OLTC, PST, combined), latest_control_resultothers
tap_control_schraeg_two_controllers.jlsplit combined regulation: two independent controllers on one unitothers
exp_pst_reactance_coupling.jlPST control with tap-dependent series reactance X(α) vs a static reactanceothers
exp_svc_shunt_voltage_control.jlSVC variable-shunt voltage control, in range and at_limitothers
exp_tcsc_series_reactance_control.jlTCSC series-reactance flow control (theory)others
exp_facts_limit_modes.jlFACTS limit characteristics side by side (theory)others
exp_facts_base_impedance.jlphysical base impedance after a full-UPFC run (theory)others
exp_auto_slack_selection.jlautomatic slack selection (power_flow.auto_slack / ensureSlack!)others
exp_matpower_gencost.jlMATPOWER generator costs on the shipped sp_case9, written back unchanged (also via SCF)others
exp_island_reference_priority.jlreference priority on the shipped data/scf/two_islands_prio.scf.json, in the power flow and in N-1others
exp_powsybl_iidm_import.jlPowSyBl IIDM import (read_iidm_tables) checked against the OpenLoadFlow reference (theory)others
exp_jacobian_block.jlthe 2x2 Jacobian block between two buses (jacobianBlock), with a network diagramothers
exp_tap_influence_zone.jlone tap moved by a few steps: the buses whose voltage changes beyond a thresholdothers
exp_tap_sensitivity.jlbus-voltage sensitivity to one tap from the Jacobian (dV/dtau = -J^-1 dF/dtau), with a Markdown reportothers
exp_ac_rescue_dc_fallback.jlthe power_flow.rescue ladder plus the power_flow.dc.fallback resultothers
exp_cgmes_import_analysis.jlanalyzeCGMES on an incomplete deliveryothers
exp_cgmes_infer_base_voltages.jlcgmes_import.infer_base_voltages from the SV stateothers
exp_cgmes_energy_source.jlcgmes_import.map_energy_source: EnergySource generation off and on; the same park as CGMES 3.0 PowerElectronicsConnection with cgmes_import.map_power_electronics, exported to CGMES 2.4.15 as EquivalentInjection and imported againothers
exp_cgmes_shunt_control.jlcgmes_import.shunt_control: SmallGrid banks as switched-bank regulators; a raised target switches blocksothers
exp_dynamic_data.jlDynamicData on spcase14 generators: unit type, validation error, SCF round trip; a CGMES DY profile fills it with `cgmesimport.read_dynamics`others
exp_cgmes_topology_processor.jlnode-breaker import without a TP profile (MiniGrid)others
machine_remote_voltage_control.jlremote voltage control via machine reactive power (theory)others
using_links.jlbusbar coupler as bus link, open/close behaviorothers
network_analyzer.jltopology analysis before and after removing a branchothers
export_solution.jlsolver-agnostic PFModel/PFSolution exportothers

Voltage-dependent and Q-limit control

Example (examples/powerflow/)DemonstratesSuite
example_voltage_dependent_control_rectangular.jlP(U)/Q(U) droop behavior in the rectangular solverpowerflow
example_q_limit_voltage_adjustment.jlqlimit_mode = :adjust_vset run variantspowerflow
example_qlimit_reenable_voltage_rule.jlPQ->PV release of the active-set mode on the Zeng/Chiang 14-bus casepowerflow

CGMES

ExampleDemonstratesSuite
run_cgmes_suite.jlguided walkthrough plus the sweep over every ENTSO-E/ReliCapGrid test setcgmes
cgmes/cgmes_fetch_testsets.jlone-time fetch of the ENTSO-E test-set package into the local cachestandalone
cgmes/cgmes_export_demo.jlCGMES export (writeCGMESFiles) on a small netothers (optional)
cgmes/cgmes_export_physical.jlCGMES export of a net built from line data in ohm/km and nF/km (addACLinePerKm!), with the re-importothers
cgmes/val_realgrid_remeasure.jlRealGrid measurement ladder: baseline, Q-limits, distributed slack, machine controlstandalone

DTF validation (Testnetz13 / FOR001-FOR002)

External FOR001/FOR002 datasets are not shipped; place files under data/DTF/, set SPARLECTRA_DTF_DIR to their directory, or pass --dtf-file/--for002-file.

ExampleDemonstratesSuite
run_val_dtf_suite.jlunified CLI: audit, base-case and outage validation, MATPOWER round trip (--mode, --case)val_dtf
dtf/dtf_validation_report.jlcross-case CSV/Markdown validation reportstandalone
dtf/for002_matpower_metadata_validation.jlFOR002/MATPOWER metadata fixturesstandalone

State estimation

Example (examples/state_estimation/)DemonstratesSuite
state_estimation_wls.jlbaseline WLS runstate_estimation
state_estimation_manual_measurements.jlmanual measurement setupstate_estimation
state_estimation_observability.jlobservability scenario and diagnosticsstate_estimation
state_estimation_observable_islands.jlobservable islands, estimation per island, scheduled values and measurement placement on sp_case118 and sp_case1354state_estimation
state_estimation_passive_bus_zib_comparison.jlpassive-bus / ZIB handling comparisonstate_estimation
state_estimation_zero_injection_constraint.jlzero injection as weighted rows (on) against equality constraints (constraint) on sp_case14: condition, J, dof, largest ZI residualstate_estimation
state_estimation_pmu_angles.jlPMU angle measurements and the reference-offset state αstate_estimation
usage_state_estimation_diagnostics.jldiagnostics workflowstate_estimation
state_estimation_imag_bad_data.jlImagMeas raising localizability (wii), elimination tracestate_estimation
state_estimation_shunt_estimation.jlshunt estimation as a state (case A) and as a SHDERIV pseudo-measurement (case B)state_estimation
state_estimation_links_facts.jlSE on the contracted net (links): LINKAGG, se_viewstate_estimation
state_estimation_robust.jlrobust R modification suppressing a gross errorstate_estimation
state_estimation_chain.jlmeasurement table round trip (readMeasurementTable!) and the SE-started PF (runpf_from_se!)state_estimation
state_estimation_convert_measurements.jlmigration from the measurement CSV v1: convertMeasurementsV1 on sp_case14, the same measurements and the same estimate from both filesstate_estimation
state_estimation_measurement_table.jlmeasurement table: generator and estimation on sp_case14 (name keys, noise 0 and with noise), pseudo rows for cut injection rows, bad-data elimination on the SmallGrid fixture (mRID keys)state_estimation
bench_takahashi_diagnostics.jlbenchmark: dense pinv vs Takahashi selected inverse (takahashi_min_states)(manual, not in suite)
h_matrix_observability_demo.jlmatrix-level observability/redundancy explorationstate_estimation
mc_state_estimation_study.jlMonte-Carlo WLS error statistics on the 7-bus workshop-tour network (M = 500)state_estimation