hermess.tests.test_algebraic_parity
Parity test for the device-private algebraic-equation mechanism.
Runs the stock SynchronousSubtransientSP machine (stator currents inlined as explicit expressions) and SynchronousSubtransientSP_DAE (the same currents declared as device-private algebraic variables/equations and handed to the DAE solver) on the same system, and asserts the differential-state trajectories agree to integrator tolerance.
This validates the full private-algebraic path: declaration, index allocation, finit with private unknowns, DAE assembly/solve, and the grid/output slicing.
Attributes
Functions
SP_DAE (explicit algebraic stator currents) must reproduce the stock SP |
|
The private stator-current constraints g = -i + <expr> must be satisfied |
|
Subtransient Sauer-Pai 6th-order machine with the 4-equation stator block |
|
Under line_dyn=True the network (voltages + line currents) is differential |
|
|
|
Small-signal eigenvalue analysis for the mixed DAE (line_dyn=True with |
Module Contents
- hermess.tests.test_algebraic_parity.FIXTURE_ROOT
- hermess.tests.test_algebraic_parity._COMMON
- hermess.tests.test_algebraic_parity.test_sp_dae_matches_eliminated_sp()[source]
SP_DAE (explicit algebraic stator currents) must reproduce the stock SP (eliminated currents) on identical systems, to integrator tolerance.
- hermess.tests.test_algebraic_parity.test_sp_dae_private_constraints_hold()[source]
The private stator-current constraints g = -i + <expr> must be satisfied along the SP_DAE trajectory: the recovered i_d/i_q (in y_full) equal the explicit expression evaluated on the states.
- hermess.tests.test_algebraic_parity.test_sp6_dae_matches_eliminated_sp6()[source]
Subtransient Sauer-Pai 6th-order machine with the 4-equation stator block (i_d, i_q, psi_d, psi_q) declared as device-private algebraics. Must reproduce the eliminated SynchronousSubtransientSP6 to integrator tolerance.
- hermess.tests.test_algebraic_parity.test_sp_dae_line_dyn_mixed_dae()[source]
Under line_dyn=True the network (voltages + line currents) is differential and the device-private algebraics are the only algebraic block — a mixed DAE. SP_DAE must run in this mode and reproduce the eliminated SP (which is a pure ODE there). The match is near machine precision because both integrate the same differential network states; only the linear private solve differs.
- hermess.tests.test_algebraic_parity.test_eigenvalue_analysis_line_dyn_mixed()[source]
Small-signal eigenvalue analysis for the mixed DAE (line_dyn=True with device-private algebraics). The privates are Schur-complemented out, leaving an nd = nx + nv + nl differential system. Because the eliminated ground model reduces to the same nd-dimensional system, the two spectra must coincide. Covers both SP_DAE (2 privates) and SP6_DAE (4 privates).