Skip to content

Testing

MarkS0485 edited this page Jun 5, 2026 · 1 revision

Testing

dotnet test GridSim.slnx

81 tests, ~3 s, fully headless — no grid data, no network, no GPU. CI runs exactly this on every push and PR (ubuntu, .NET 10), and Dependabot patch/minor bumps auto-merge only once it's green.

The validation philosophy

A simulator's tests are only as good as their reference values. GridSim's rule: physics changes ship with a reference case — a published solution, a hand calculation, or a derivable invariant. The anchors:

  1. Published solutions. The dense NR solver must reproduce the WSCC / MATPOWER IEEE 9-bus case: bus voltages, slack P ≈ 71.64 MW, losses ≈ 4.64 MW.
  2. Solver cross-validation. The sparse solver must match the dense solver to 1e-6 on every shared case — including a multi-reference case shaped like the GDA replica's per-GSP infeeds.
  3. Synthetic fixtures for ingestion. The GDA tests build a tiny synthetic LTDS dataset in a temp directory and run the full build → solve → write pipeline against it. The real archive is never needed (and never committed).

Test map

Suite Covers
PowerFlowTests dense NR vs the published IEEE 9-bus solution
SparseLuTests · NumericsTests the sparse LU kernel and sparse matrix types
SparsePowerFlowTests sparse NR vs dense, incl. the multi-reference (per-GSP infeed) case
QLimitTests generator Q-limits, PV→PQ switching
UkCaseTests the 10-zone UK case: dispatch balance, OLTC regulation, voltage band
BoundaryTests ETYS boundary flows vs limits
ContingencyTests the N-1 scan
FrequencyDynamicsTests swing equation: RoCoF, nadir, governor recovery
FrequencyTests · ReplayTests NESO CSV streaming, RoCoF upsampling, replay control
Gda/GdaBuildTests end-to-end LTDS → GridModel on synthetic data (union-find merging, per-unit referral, attachment)
Gda/CsvTests · Gda/FuelMapTests · Gda/NationalFleetTests · Gda/PercentConventionTests CSV reader, fuel classification, fleet assembly, the UKPN percent convention
VizExportTests the Unity scene export
GcScopeTests the low-latency GC scope used by the live loop

CI

.github/workflows/ci.yml — build + the full suite on every push/PR to master, doc-only changes skipped, newer pushes cancel in-flight runs. The "Build & test" check is required by branch protection, which is what the Dependabot auto-merge workflow waits on.

Clone this wiki locally