hermess.tests.test_algebraic_parity =================================== .. py:module:: hermess.tests.test_algebraic_parity .. autoapi-nested-parse:: 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 ---------- .. autoapisummary:: hermess.tests.test_algebraic_parity.FIXTURE_ROOT hermess.tests.test_algebraic_parity._COMMON Functions --------- .. autoapisummary:: hermess.tests.test_algebraic_parity.test_sp_dae_matches_eliminated_sp hermess.tests.test_algebraic_parity.test_sp_dae_private_constraints_hold hermess.tests.test_algebraic_parity.test_sp6_dae_matches_eliminated_sp6 hermess.tests.test_algebraic_parity.test_sp_dae_line_dyn_mixed_dae hermess.tests.test_algebraic_parity._sorted_eig hermess.tests.test_algebraic_parity.test_eigenvalue_analysis_line_dyn_mixed Module Contents --------------- .. py:data:: FIXTURE_ROOT .. py:data:: _COMMON .. py:function:: test_sp_dae_matches_eliminated_sp() SP_DAE (explicit algebraic stator currents) must reproduce the stock SP (eliminated currents) on identical systems, to integrator tolerance. .. py:function:: test_sp_dae_private_constraints_hold() The private stator-current constraints g = -i + 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. .. py:function:: test_sp6_dae_matches_eliminated_sp6() 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. .. py:function:: test_sp_dae_line_dyn_mixed_dae() 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. .. py:function:: _sorted_eig(sim) .. py:function:: test_eigenvalue_analysis_line_dyn_mixed() 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).